UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pep_utils.H
1 /* pep_utils.H */
2 /* $Id: pep_utils.H,v 1.5 2009/04/14 12:08:44 vlad Exp $ */
3 #ifndef __pep_utils_H
4 #define __pep_utils_H
5 
6 #include <string.h>
7 #include <stdio.h>
8 
9 #include <mix/Exceptions.h>
10 #include <csi/param.H>
11 #include <csi/CharAr.H>
12 
13 /*************************************************************
14  *
15  * PEP utility functions and classes
16  *
17  *************************************************************/
18 
19 
24 class ZString : public CharAr
25 {
26 public:
27 
28  ZString ()
29  {}
30  ZString (const ZString& zstring) : CharAr(zstring)
31  {}
32  ZString (const char* s);
33 
35  int len ();
36 
38  char* clone ();
39 
41  operator char* ()
42  { return &operator[](0); }
43 
44 };
45 
46 
51 typedef ParView* (*ParViewInit)(Protocol* protocol,
52  const char* pname,
53  Widget wParent);
54 
55 
60 struct PEP_Type
61 {
62  char *name;
64  ParViewInit create_view;
65 };
66 
67 /* Table of types */
68 #define AnyType PEP_Type
69 #define AnyAr TypesAr
70 #define AnyCmp(x,y) strcmp(x.name, y.name)
71 #define AnyFormatSpec "\n%d: name='%s' base='%s' type=%p create_view=%p"
72 #define AnyPrintList i, item.name, item.type? item.type->base_type(): "?", item.type, item.create_view
73 #include <mix/AnyAr.H>
74 
75 
82 {
83  key_t page_k;
84  key_t lock_k;
85 };
86 
87 
94 int PEP_FindProtocolSection (FILE* fp, const char* application,
95  const char* protocol);
96 
104 void PEP_ReadName (FILE* fp, CharAr& car);
105 
130 int PEP_ReadCLikeCharLiteral (FILE* fp, char eos);
131 
142 int PEP_ReadCLikeString (FILE* fp, char eos, CharAr& car);
143 
144 
155 int PEP_ReadCLikeString (const char* raw, char eos, CharAr& car);
156 
157 
169 int PEP_WriteCLikeString (FILE* fp, char eos, CharAr& car);
170 
172 Logic PEP_IsNameChar (char x);
173 
175 void PEP_SkipSpaces (FILE* fp);
176 
178 void PEP_SkipEndOfLine (FILE* fp);
179 
181 ParType* PEP_TypeByName (char* name);
182 
184 int PEP_IndexByName (const char* name);
185 
187 Logic PEP_CompatibleTypes (const ParType& pt1, const ParType& pt2);
188 
190 ParView* PEP_CreateParView (Protocol *protocol,
191  const char* pname,
192  Widget wParent);
193 
196 void PEP_ScanConfig (const char* filename,
197  const char* application,
198  const char* protocol,
199  ParDescAr& pdar);
200 
203 void PEP_AddStdProps (ParDescAr& pdar);
204 
211 char* PEP_BuildEnvName (const char* application,
212  const char* protocol);
213 
221 Logic PEP_GetCommKeys (const char* application,
222  const char* protocol,
223  PEP_CommKeys& ckeys);
224 
231 void PEP_SetCommKeys (const char* application,
232  const char* protocol,
233  PEP_CommKeys& ckeys);
234 
242 void PEP_CleanCommKeys (const char* application,
243  const char* protocol);
244 
245 /*************************************************************
246  * Support for two-range parsing functions.
247  *************************************************************/
248 #define LOW_BOUND (1<<0) /* r[0] */
249 #define HIGH_BOUND (1<<1) /* r[1] */
250 
257 int PEP_IntRange (const char* s, int r[2]);
258 
259 
260 #define AssocAr pepNamedValues
261 #define AssocItemType pepNamedValue
262 #define AssocKeyField name
263 #define AssocKeyType char*
264 #define AssocKeysCmp(key1,key2) strcmp(key1,key2)
265 #define AssocFormatSpec "name=\"%s\", value=\"%s\"\n"
266 #define AssocPrintList item.name, item.value
267 #include <mix/AssocAr.H>
268 
269 /* Format of targs is "name1=value1;name2=value2...nameN=valueN". So,
270  '=' is special name-value delimiter and ';' - value-name delimiter.
271  */
272 #define TARG_NV_DELIM '='
273 #define TARG_VN_DELIM ';'
274 
281 void PEP_ParseNameValue (const char* targ, pepNamedValues& nv,
282  const char* defname = NULL);
283 
284 
290 void PEP_Initialize ();
291 
293 void PEP_RegisterTypes ();
294 
298 void PEP_RegisterViews ();
299 
300 /* End of initialization procedures
301  *************************************************************/
302 
303 
304 #ifndef __pep_global_vars
305 
306 /*************************************************************
307  * Internal global variables of PEP runtime environment.
308  * Hidden for custom applications!!!
309  *************************************************************/
310 
312 extern TypesAr peptypes;
313 
315 extern ErrCode pepStatus;
316 
319 extern FILE *pepFpWrite, *pepFpRead;
320 
321 #endif /* __pep_global_vars */
322 
323 #endif /* pep_utils.H */
ParViewInit create_view
Definition: pep_utils.H:64
key_t lock_k
Definition: pep_utils.H:84
Definition: pep_utils.H:60
Definition: pep_utils.H:81
char * clone()
Definition: param.H:17
key_t page_k
Definition: pep_utils.H:83
Definition: pep.H:23
Definition: param.H:85
Definition: pep_utils.H:24
ParType * type
Definition: pep_utils.H:63
int len()
char * name
Definition: pep_utils.H:62