|
|
1.1 root 1: The MWC screen generator is designed to build data structures
2: describing background data and input fields form a simple input file.
3:
4: scn xyz
5:
6: Produces xyz.c with internal structures xyz_data and xyz_locs as well
7: as any defined fields. It also produces an xyz.h file with externs to
8: those defined fields and an include of scn.h.
9:
10: The input file first contains a list of all the fields in order of
11: appearence in the screen. This is terminated by a %% line.
12:
13: Each input line must contain
14: Field name A C name for the field. This will normally be built
15: in the generated .c file.
16:
17: Field Length The displayed size of the field. One will be added
18: to this for zero termination on the internal field.
19:
20: Optionaly lines may contain.
21: default string String is a C string with the starting value of the
22: field.
23:
24: default field Field is a C field name where the starting value of
25: the field may be found.
26:
27: help string String is a C string displayed at the bottom of the
28: screen before the field is entered.
29:
30: help field Field is a field name of a C string displayed at the
31: bottom of the screen before the field is entered.
32:
33: verify routine Routine is the C name of a function used to check the
34: field for validity. A return of 0 means invalid field
35: a return of non zero means value. A return of -1
36: triggers the skip factor. A return of -2 finishes the
37: screen as though ctl-z had been entered.
38:
39: skip number Number is the number of fields to skip if the verify
40: field returns -1.
41:
42: external Means the field definition for this field is elsewhere
43: and prevents scn from building one in it's .c file.
44:
45: long Means that the field is arbitrairly long, its field
46: defination will be a char *, and it will be malloc()ed
47: as needed.
48:
49: readonly Means the field is readonly.
50:
51: Examples:
52:
53: f1 5 default "xyz", verify ver1 # comment to end of line
54: f2 5 verify ver2
55: f3 5 verify yNo skip 1 \
56: help "Enter n to skip next field"
57: f4 5
58:
59: Often it is convienient to input data into arrays of fields.
60:
61: do 3
62: expect 20
63: send 20
64: done
65:
66: Says that there are 3 expect and send fields. This generates
67: char expect[3][21];
68: char send[3][21];
69:
70: While inside a do group is is legal to use a skip factor of 'group'.
71: scn will replace this with the number of fields required to skip out
72: of the current do group.
73:
74: After %% comes the input screen formatteed exactly as it should appear.
75: The beginning of each input field should be marked with a '!'. This
76: may be changed with a designator statement.
77:
78: desagnator "#"
79: Causes the field designator to be # not !. The change is for the entire
80: file.
81:
82: xyz_data contains the background data for the screen. It is decribed
83: by the struct backGrnd in scn.h. Each structure is a line of data
84: followed by its screen position. The array of structures ends with a
85: data pointer of NULL.
86:
87: xyz_locs contains the input field data for the screen. It is described
88: by the struct loc in scn.h. It contains a pointer to the input field
89: and the row and collumn of the data.
90:
91: Driver Functions.
92:
93: setUpScreen(lines, at)
94: This initializes the screen driver and sets up a window for
95: error messages or conversational messages. setUpScreen(2, 22)
96: reserves line 22 and 23 for messages.
97:
98: closeUp()
99: Shuts down the screen dirver, always call it at the end of job.
100:
101: showError(s, ...)
102: Takes the same format as printf, shows an error message and
103: waits for any key to continue.
104:
105: Query(s, ...)
106: Prints a query message waits for any key and returns that key.
107:
108: clearArea(row, col, len)
109: Clears the screen at row, col for len.
110:
111: showBak(back)
112: Displays screen background. showBak(my_data);
113:
114: clearBak(back, locs)
115: Clears the screen background and the area set aside for data.
116:
117: showDefs(back, fields)
118: Show the background and all default data. showDefs(my_data, my_locs);
119:
120: scnDriv(back, fields)
121: Show the background and get all data.
122:
123: getAll(fields)
124: Get and verify all data fields.
125:
126: getField(fields, field)
127: Get one field. getField(my_locs, myString);
128: myString must be a field name in your screen file.
129:
130: putField(fields, field)
131: Display one field. putField(my_locs, myString);
132: myString must be a field name in your screen file.
133:
134: numeric(str)
135: Returns 1 if str is numeric else 0.
136:
137: nonNull(str)
138: Returns 1 if str has some data in it else 0.
139:
140: yesNo(str)
141: Returns 1 if str is in [yYnN] else 0.
142:
143: noWhite(str)
144: Returns 1 if str contains no whitespace else 0
145:
146: noVerify(str)
147: Returns 1. This is used where no verify routine is given.
148:
149: checkEnd(str)
150: Returns -1 for a null field else 1. This is used for the
151: entry of long fields.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.