1 /*
2  * Copyright (C) 1996 by Rob McMullen
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  *
18  *
19  * Author: Rob McMullen <rwmcm@orion.ae.utexas.edu>
20  *         http://www.ae.utexas.edu/~rwmcm
21  */
22 
23 #include <stdio.h>
24 #include <X11/Intrinsic.h>
25 #include <X11/StringDefs.h>
26 #include <Xm/PushB.h>
27 #include <Xm/MainW.h>
28 #include "SciPlot.h"
29 #include "SciPlotUtil.h"
30 
31 void
ArgProcess(Widget parent,int argc,char * argv[])32 ArgProcess(Widget parent,int argc, char *argv[])
33 {
34   int argloc;
35   FILE *fd;
36 
37   if (argc > 1) {
38     argloc = 1;
39     while (argloc <= argc) {
40       fd = fopen(argv[argloc++], "r");
41       if (fd) {
42         SciPlotReadDataFile(parent, fd);
43         fclose(fd);
44       }
45     }
46   }
47   else {
48     SciPlotReadDataFile(parent, stdin);
49   }
50 }
51 
52 int
main(int argc,char * argv[])53 main(int argc, char *argv[])
54 {
55   XtAppContext app_con;
56   Widget toplevel, mainw, dummy;
57 
58   toplevel = XtAppInitialize(&app_con, "SciPlot",
59     NULL, 0, &argc, argv, NULL, NULL, 0);
60   mainw=XmCreateMainWindow(toplevel,"dummy",NULL,0);
61   dummy=XmCreatePushButton(mainw,"dummy",NULL,0);
62 
63   XtSetMappedWhenManaged(toplevel, False);
64   XtSetMappedWhenManaged(mainw, False);
65   XtManageChild(mainw);
66   XtManageChild(dummy);
67   XtRealizeWidget(toplevel);
68 
69   ArgProcess(mainw,argc,argv);
70 
71   XtAppMainLoop(app_con);
72 
73   return 0;
74 }
75