|
|
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: Each input line contains:
13: Field name.
14: Field Length. This is zero for read only fields and negative
15: for fields where the default value is in a field.
16: This defaults to a field long enough to fill the line.
17: Default field. If the field length is 0 for read only this should be
18: the true field length. If the field length is negative
19: this is a default field, in this case this defaults
20: to the field name. Otherwise this is used as a string.
21: Verify routine. This is the name of a function which is called with
22: the field as a parm. That function should return 0
23: if the field is invalid and non 0 if it is valid.
24: The default is no verify function.
25:
26: Skip factor. If the verify routine returns -1 Skip factor fields
27: are skipped. This allows you to ask a yes or no
28: question and skip fields if the is n.
29:
30: f1, 5, xyz, ver1 ; results to f1, max len 5 default "xyz" ver1
31: ; is verify routine.
32: f2, -5, f1, ver2 ; results to f2, max len 5 default f1 ver2
33: ; is verify routine.
34: f3, 0, 17 ; f3 length 17 is displayed and is read only.
35:
36: Note comments are illegal in actual format.
37:
38: Often it is convienient to input data into arrays of fields. A line starting
39: % linesCount repeatCount
40: Says that the next lineCount fields repeat repeatCount times.
41:
42: % 2 3
43: expect, -20
44: send, -20
45:
46: Says that there are 3 expect and send fields. This generates
47: char expect[3][21];
48: char send[3][21];
49:
50: While inside a data array is is legal to use a skip factor of "group".
51: scn will replace this with the number of fields required to skip out
52: of the current group.
53:
54: In the .c file. Note the 21 is a field length of 20 and a place for
55: the zero termination.
56:
57: Then comes the input screen formatteed exactly as it should appear.
58: The beginning of each input field should be marked with a '!'. This
59: chan be changed with a -f option.
60: scn -f# xyz
61:
62: Would mark input fileds with a '#'.
63:
64: xyz_data contains the background data for the screen. It is decribed
65: by the struct backGrnd in scn.h. Each structure is a line of data
66: followed by its screen position. The array of structures ends wiht a
67: data pointer of NULL.
68:
69: xyz_locs contains the input field data for the screen. Itis described
70: by the struct loc in scn.h. It contains a pointer to the input field
71: and the row and collumn of the data.
72:
73: Driver Functions.
74:
75: setUpScreen(lines, at)
76: This initializes the screen driver and sets up a window for
77: error messages or conversational messages. setUpScreen(3, 22)
78: reserves line 22, 23 and 24 for messages.
79:
80: closeUp()
81: Shuts down the screen dirver, always call it at the end of job.
82:
83: showError(s, ...)
84: Takes the same format as printf, shows an error message and
85: waits for any key to continue.
86:
87: Query(s, ...)
88: Prints a query message waits for any key and returns that key.
89:
90: clearArea(row, col, len)
91: Clears the screen at row, col for len.
92:
93: showBak(back)
94: Displays screen background. showBak(my_data);
95:
96: clearBak(back, locs)
97: Clears the screen background and the area set aside for data.
98:
99: showDefs(back, fields)
100: Show the background and all default data. showDefs(my_data, my_locs);
101:
102: scnDriv(back, fields)
103: Show the background and get all data.
104:
105: getAll(fields)
106: Get and verify all data fields.
107:
108: getField(fields, field)
109: Get one field. getField(my_locs, myString);
110: myString must be a field name in your screen file.
111:
112: putField(fields, field)
113: Display one field. putField(my_locs, myString);
114: myString must be a field name in your screen file.
115:
116: numeric(str)
117: Returns 1 if str is numeric else 0.
118:
119: nonNull(str)
120: Returns 1 if str has some data in it else 0.
121:
122: yesNo(str)
123: Returns 1 if str is in [yYnN] else 0.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.