1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
* This program is Copyright (C) 1987 by the Board of Trustees of the
* University of Illinois, and by the author Dirk Grunwald.
*/
#include "texx2.h"
#include "texx2-mark.h"
char *ProgName, *ClassName;
extern void BuildTopLevelWidget();
TeXxResourceStruct TeXxResources;
#define Offset(field) (XtOffset(TeXxResourceStruct *, field))
static XtResource resources[] = {
{"print", XtCString, XtRString, sizeof(char *),
Offset(printProgram), XtRString, "Dvi "},
{"mag", XtCString, XtRInt, sizeof(int),
Offset(userMag), XtRString, "500"},
{"paperWidth", XtCString, XtRString, sizeof(char *),
Offset(paperWidthString), XtRString, "8.5"},
{"paperHeight", XtCString, XtRString, sizeof(char *),
Offset(paperHeightString), XtRString, "11.5"},
{"smallMag", XtCString, XtRInt, sizeof(int),
Offset(smallMag), XtRString, "333"},
{"largeMag", XtCString, XtRInt, sizeof(int),
Offset(largeMag), XtRString, "500"},
{"dpi", XtCString, XtRInt, sizeof(int),
Offset(dpi), XtRString, "300"},
{"autoSize", XtCString, XtRBool, sizeof(Bool),
Offset(autoSize), XtRString, "True"}
};
static XrmOptionDescRec Options[] = {
{"-print", "*.print", XrmoptionSepArg, (caddr_t) NULL},
{"-mag", "*.mag", XrmoptionSepArg, (caddr_t) NULL},
{"-paperWidth", "*.paperWidth", XrmoptionSepArg, (caddr_t) NULL},
{"-paperHeight", "*.paperHeight", XrmoptionSepArg, (caddr_t) NULL},
{"-smallMag", "*.smallMag", XrmoptionSepArg, (caddr_t) NULL},
{"-largeMag", "*.largeMag", XrmoptionSepArg, (caddr_t) NULL},
{"-dpi", "*.dpi", XrmoptionSepArg, (caddr_t) NULL},
{"-autoSize", "*.autoSize", XrmoptionSepArg, (caddr_t) NULL}
};
int Argc;
char **Argv;
Widget TopLevelWidget;
void
main(argc,argv)
char ** argv;
int argc;
{
Argc = argc;
Argv = argv;
ClassName = "Texx2";
if( (ProgName = index(argv[0], '/')) == NULL )
ProgName = argv[0];
TopLevelWidget = XtInitialize(ProgName, ClassName,
Options, XtNumber(Options),
&Argc, Argv);
XtGetApplicationResources(TopLevelWidget,
(caddr_t) &TeXxResources,
resources, XtNumber(resources),
NULL, (Cardinal) 0);
BuildTopLevelWidget(TopLevelWidget);
XtRealizeWidget(TopLevelWidget);
if ( Argc > 1 ) {
struct stat buf;
/* set file first incase it's a relative path name */
setFileName( Argv[1] );
setDirectory( Argv[1] );
}
else {
setDirectory(".");
}
if ( Argc > 2 ) {
error(0,0,"Additional arguments ignored");
}
XtMainLoop();
}
|