UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
wenv.h
1 /* wenv.h */
2 /* $Id: wenv.h,v 1.30 2004/11/29 12:03:27 vlad Exp $ */
3 
4 /*********************************************************************
5  *
6  * UNIVERS
7  * (C) ООО "ГЕОВЕРС", 2001
8  *
9  * Все права защищены * * Использование, копирование или передача регулируются законами * Российской Федерации "Об авторском праве и смежных правах", "О * правовой охране программ для электронных вычислительных машин и баз * данных" * * Encoding: ISO-8859-5 (GOST) * *********************************************************************/ #ifndef __wenv_h #define __wenv_h /************************************************************* * * Working environment of UNIVERS processing system. * *************************************************************/ #include <time.h> #include <sys/types.h> #ifndef __wenv_internal #include <ldb/wenv_stubs.h> #endif /* __wenv_internal */ /* Emergency level used in wePutMsg()/weFormatMsg() functions. */ #define EL_FATAL 0 #define EL_ERROR 1 #define EL_WARNING 2 #define EL_INFO 3 #define EL_HINT 4 #define EL_DEBUG 5 /* Environment name for data, jobs, logs and locks location */ #define WE_DATA_ENV "DATA" #define WE_JOBS_ENV "JOB" #define WE_LOGS_ENV "LOG" #define WE_LOCKS_ENV "LOCKS" #define WE_HCOPIES_ENV "HCOPIES" #define WE_REPORT_ENV "REPORT" #define WE_ARCHIVE_ENV "ARCHIVE" /** JOBS/JOB and LOGS/LOG pairs are not mistakes but SDS-5 backward compatibility features */ /** Prefix for the name of env.variable which used for job number delivering. */ #define WE_DELIVER_JOBNUM_PREFIX "DELIVER_JOBNUM_" #ifdef VERSION_NUMBER /** Version of a program is an integer number. */ #define weVersion() VERSION_NUMBER #else #define weVersion() (-1) #endif /* VERSION */ /** Maximum length for names (application, workplace, user, PEP-protocol, etc) without ending EOS. */ #define WE_NAME_LEN 99 /** Maximum length of message string (without ending EOS) */ #define WE_MSG_LEN 2047 /** The longest allowed path PATH_MAX. Please, don't use this value; try BuildFilePath() from mix/PortableDirs.h to allocate path dynamically. */ #ifndef _POSIX_SOURCE #define _POSIX_SOURCE #endif /* _POSIX_SOURCE */ #include <limits.h> #ifndef PATH_MAX #define PATH_MAX 1024 #endif /* PATH_MAX */ /** Lenght of a moment format: "YYYY/MM/DD HH:MM:SS" Date format: "YYYY/MM/DD" Time format: "HH:MM:SS" */ #define MOMENT_LEN 20 /* Language symbolic codes */ #define WE_LANG_ENGLISH "en" #define WE_LANG_RUSSIAN "ru" #define WE_LANG_CHINESE "cn" /* Name of file in weUserLoc() directory where the only string with preferred language is stored. */ #define WE_LANG_FILENAME "language" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * Initialization and self-identification features */ /** Setup packet id in case of it does not equal to default one */ void weSetProduct (int); /** The environment initialization procedure. Can abort program if its environment can't be successfully built. */ void weInitialize (); /** Assign name for the program. Name must be unique among other of the system UNIVERS. */ void weSetAppName (const char* szAppName); /** Get name of the program. */ const char* weAppName (); /** Get host name (for specifying processor/OS instance). */ const char* weHostName (); /** Get instance identifier of the running application. Use it in conjunction with weHostName. */ pid_t weAppInstance (); /** Get name of the workplace. Workplace name begins with HOSTNAME and then after separator may follow TERMINAL specification. Separator is one of chars :;,/\|!?<>(){}[] */ const char* weWorkplaceName (); /** Get name of the user. */ const char* weUserName (); /** Program identification: - running item: AppName AppInstance WorkplaceName UserName StartMoment Project - historical item: AppName WorkplaceName UserName StartMoment FinishMoment Project */ /* * Common processing environment * All paths without final slash */ /** Get path to system files: $VSPHOME */ const char* weSystemLoc (); /** Get path to user configuration: $HOME/.vsp */ const char* weUserLoc (); /** Checking for expected environment settings. If some settings are bad then warning is printed. Returns count of warnings (0 means OK). */ int weCheckStdAppEnv (); /** Pass job number to the szApplication by setting this value to env.variable strcat(WE_DELIVER_JOBNUM_PREFIX, szApplication). weJobNumber() call in the nearest exec*() call of szApplication will return delivered number. Return 0 on error and job number on success. */ int weDeliverJobNumber (const char* szApplication, int nJob); /** Constructs name of the job number delivering variable. */ void weDeliverJobNumberName (const char* szApplication, char* szVarName); /* * Actions at exit of a program. */ /** This proc is called from atexit(3) function. Do not call it directly! */ void weSystemAtExitHandler (); /** Prototype of at-exit handler. */ typedef void (*weAtExitHandlerProc)(void); /** Register given at-exit procedure. */ void weRegisterAtExitHandler (weAtExitHandlerProc proc); /** Unregister given at-exit procedure. If not found do not trouble a programmer. */ void weUnregisterAtExitHandler (weAtExitHandlerProc proc); /* * Log messages handling */ /** Put message of pointed elevel into log */ void wePutMsg (int elevel, const char* msg); /** Put formatted message of pointed elevel into log */ void weFormatMsg (int elevel, const char* format, ...); /** Prototype of message handler. Must return non-zero if wants to dispatch message to earlier registered handler. */ typedef int (*weMsgHandlerProc)(int elevel, const char* msg); /** Register handler of messages. Passed NULL cleans list of handlers. */ void weRegisterMsgHandler (weMsgHandlerProc proc); /** Message handler procedure with extended information about program. For messages of level ERROR and FATAL composes special prefix with app identification and puts them to original stderr (general message log). */ int weExtendedMsgHandlerProc (int elevel, const char* msg); /* * Time and date format * for internal representation is used POSIX struct tm, but * fields tm_wday, tm_yday, tm_isdst are not used. */ /** Returns pointer at string contains current time and date. With NULL argument returns pointer at static area. */ char* weMoment (char* place); /** Returns pointer at string contains pointed time in format "HH:MM:SS". With NULL place returns pointer at static area. With NULL tm_ptr returns current time. */ char* weFormatTime (char* place, struct tm* tm_ptr); /** Returns pointer at string contains pointed date in format "YYYY/MM/DD". With NULL argument returns pointer at static area. With NULL tm_ptr returns current date. */ char* weFormatDate (char* place, struct tm* tm_ptr); /* Parses moment string and its parts and fills fields of *tm_ptr. Returns 0 if all is OK and !0 otherwise. */ int weParseMoment (const char* szMoment, struct tm* tm_ptr); int weParseDate (const char* szDate, struct tm* tm_ptr); int weParseTime (const char* szTime, struct tm* tm_ptr); /* * User-preferred language */ /** Get preferred language string in dynamically allocated (by malloc) string. */ char* weGetPrefLanguage (); /** Set preferred language string. */ void weSetPrefLanguage (const char* szLang); /* * Miscelaneous */ /** Return level of debugging that is set by UDEBUG environment variable. (DEBUG variable is used by 'setup'). If UDEBUG is empty, 0 is returned; if UDEBUG=<number>, number is returned; if UDEBUG=<text>, -1 is returned. */ int weDebugLevel (); /** Return level of development facilities that is set by UDEVELOP environment variable. If UDEVELOP is empty, 0 is returned; if UDEVELOP=<number>, number is returned; if UDEVELOP=<text>, -1 is returned. */ int weDevelopLevel (); #ifdef __cplusplus }; #endif /* __cplusplus */ #endif /* wenv.h */
10  *
11  * Использование, копирование или передача регулируются законами
12  * Российской Федерации "Об авторском праве и смежных правах", "О * правовой охране программ для электронных вычислительных машин и баз * данных" * * Encoding: ISO-8859-5 (GOST) * *********************************************************************/ #ifndef __wenv_h #define __wenv_h /************************************************************* * * Working environment of UNIVERS processing system. * *************************************************************/ #include <time.h> #include <sys/types.h> #ifndef __wenv_internal #include <ldb/wenv_stubs.h> #endif /* __wenv_internal */ /* Emergency level used in wePutMsg()/weFormatMsg() functions. */ #define EL_FATAL 0 #define EL_ERROR 1 #define EL_WARNING 2 #define EL_INFO 3 #define EL_HINT 4 #define EL_DEBUG 5 /* Environment name for data, jobs, logs and locks location */ #define WE_DATA_ENV "DATA" #define WE_JOBS_ENV "JOB" #define WE_LOGS_ENV "LOG" #define WE_LOCKS_ENV "LOCKS" #define WE_HCOPIES_ENV "HCOPIES" #define WE_REPORT_ENV "REPORT" #define WE_ARCHIVE_ENV "ARCHIVE" /** JOBS/JOB and LOGS/LOG pairs are not mistakes but SDS-5 backward compatibility features */ /** Prefix for the name of env.variable which used for job number delivering. */ #define WE_DELIVER_JOBNUM_PREFIX "DELIVER_JOBNUM_" #ifdef VERSION_NUMBER /** Version of a program is an integer number. */ #define weVersion() VERSION_NUMBER #else #define weVersion() (-1) #endif /* VERSION */ /** Maximum length for names (application, workplace, user, PEP-protocol, etc) without ending EOS. */ #define WE_NAME_LEN 99 /** Maximum length of message string (without ending EOS) */ #define WE_MSG_LEN 2047 /** The longest allowed path PATH_MAX. Please, don't use this value; try BuildFilePath() from mix/PortableDirs.h to allocate path dynamically. */ #ifndef _POSIX_SOURCE #define _POSIX_SOURCE #endif /* _POSIX_SOURCE */ #include <limits.h> #ifndef PATH_MAX #define PATH_MAX 1024 #endif /* PATH_MAX */ /** Lenght of a moment format: "YYYY/MM/DD HH:MM:SS" Date format: "YYYY/MM/DD" Time format: "HH:MM:SS" */ #define MOMENT_LEN 20 /* Language symbolic codes */ #define WE_LANG_ENGLISH "en" #define WE_LANG_RUSSIAN "ru" #define WE_LANG_CHINESE "cn" /* Name of file in weUserLoc() directory where the only string with preferred language is stored. */ #define WE_LANG_FILENAME "language" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * Initialization and self-identification features */ /** Setup packet id in case of it does not equal to default one */ void weSetProduct (int); /** The environment initialization procedure. Can abort program if its environment can't be successfully built. */ void weInitialize (); /** Assign name for the program. Name must be unique among other of the system UNIVERS. */ void weSetAppName (const char* szAppName); /** Get name of the program. */ const char* weAppName (); /** Get host name (for specifying processor/OS instance). */ const char* weHostName (); /** Get instance identifier of the running application. Use it in conjunction with weHostName. */ pid_t weAppInstance (); /** Get name of the workplace. Workplace name begins with HOSTNAME and then after separator may follow TERMINAL specification. Separator is one of chars :;,/\|!?<>(){}[] */ const char* weWorkplaceName (); /** Get name of the user. */ const char* weUserName (); /** Program identification: - running item: AppName AppInstance WorkplaceName UserName StartMoment Project - historical item: AppName WorkplaceName UserName StartMoment FinishMoment Project */ /* * Common processing environment * All paths without final slash */ /** Get path to system files: $VSPHOME */ const char* weSystemLoc (); /** Get path to user configuration: $HOME/.vsp */ const char* weUserLoc (); /** Checking for expected environment settings. If some settings are bad then warning is printed. Returns count of warnings (0 means OK). */ int weCheckStdAppEnv (); /** Pass job number to the szApplication by setting this value to env.variable strcat(WE_DELIVER_JOBNUM_PREFIX, szApplication). weJobNumber() call in the nearest exec*() call of szApplication will return delivered number. Return 0 on error and job number on success. */ int weDeliverJobNumber (const char* szApplication, int nJob); /** Constructs name of the job number delivering variable. */ void weDeliverJobNumberName (const char* szApplication, char* szVarName); /* * Actions at exit of a program. */ /** This proc is called from atexit(3) function. Do not call it directly! */ void weSystemAtExitHandler (); /** Prototype of at-exit handler. */ typedef void (*weAtExitHandlerProc)(void); /** Register given at-exit procedure. */ void weRegisterAtExitHandler (weAtExitHandlerProc proc); /** Unregister given at-exit procedure. If not found do not trouble a programmer. */ void weUnregisterAtExitHandler (weAtExitHandlerProc proc); /* * Log messages handling */ /** Put message of pointed elevel into log */ void wePutMsg (int elevel, const char* msg); /** Put formatted message of pointed elevel into log */ void weFormatMsg (int elevel, const char* format, ...); /** Prototype of message handler. Must return non-zero if wants to dispatch message to earlier registered handler. */ typedef int (*weMsgHandlerProc)(int elevel, const char* msg); /** Register handler of messages. Passed NULL cleans list of handlers. */ void weRegisterMsgHandler (weMsgHandlerProc proc); /** Message handler procedure with extended information about program. For messages of level ERROR and FATAL composes special prefix with app identification and puts them to original stderr (general message log). */ int weExtendedMsgHandlerProc (int elevel, const char* msg); /* * Time and date format * for internal representation is used POSIX struct tm, but * fields tm_wday, tm_yday, tm_isdst are not used. */ /** Returns pointer at string contains current time and date. With NULL argument returns pointer at static area. */ char* weMoment (char* place); /** Returns pointer at string contains pointed time in format "HH:MM:SS". With NULL place returns pointer at static area. With NULL tm_ptr returns current time. */ char* weFormatTime (char* place, struct tm* tm_ptr); /** Returns pointer at string contains pointed date in format "YYYY/MM/DD". With NULL argument returns pointer at static area. With NULL tm_ptr returns current date. */ char* weFormatDate (char* place, struct tm* tm_ptr); /* Parses moment string and its parts and fills fields of *tm_ptr. Returns 0 if all is OK and !0 otherwise. */ int weParseMoment (const char* szMoment, struct tm* tm_ptr); int weParseDate (const char* szDate, struct tm* tm_ptr); int weParseTime (const char* szTime, struct tm* tm_ptr); /* * User-preferred language */ /** Get preferred language string in dynamically allocated (by malloc) string. */ char* weGetPrefLanguage (); /** Set preferred language string. */ void weSetPrefLanguage (const char* szLang); /* * Miscelaneous */ /** Return level of debugging that is set by UDEBUG environment variable. (DEBUG variable is used by 'setup'). If UDEBUG is empty, 0 is returned; if UDEBUG=<number>, number is returned; if UDEBUG=<text>, -1 is returned. */ int weDebugLevel (); /** Return level of development facilities that is set by UDEVELOP environment variable. If UDEVELOP is empty, 0 is returned; if UDEVELOP=<number>, number is returned; if UDEVELOP=<text>, -1 is returned. */ int weDevelopLevel (); #ifdef __cplusplus }; #endif /* __cplusplus */ #endif /* wenv.h */
13  * правовой охране программ для электронных вычислительных машин и баз * данных" * * Encoding: ISO-8859-5 (GOST) * *********************************************************************/ #ifndef __wenv_h #define __wenv_h /************************************************************* * * Working environment of UNIVERS processing system. * *************************************************************/ #include <time.h> #include <sys/types.h> #ifndef __wenv_internal #include <ldb/wenv_stubs.h> #endif /* __wenv_internal */ /* Emergency level used in wePutMsg()/weFormatMsg() functions. */ #define EL_FATAL 0 #define EL_ERROR 1 #define EL_WARNING 2 #define EL_INFO 3 #define EL_HINT 4 #define EL_DEBUG 5 /* Environment name for data, jobs, logs and locks location */ #define WE_DATA_ENV "DATA" #define WE_JOBS_ENV "JOB" #define WE_LOGS_ENV "LOG" #define WE_LOCKS_ENV "LOCKS" #define WE_HCOPIES_ENV "HCOPIES" #define WE_REPORT_ENV "REPORT" #define WE_ARCHIVE_ENV "ARCHIVE" /** JOBS/JOB and LOGS/LOG pairs are not mistakes but SDS-5 backward compatibility features */ /** Prefix for the name of env.variable which used for job number delivering. */ #define WE_DELIVER_JOBNUM_PREFIX "DELIVER_JOBNUM_" #ifdef VERSION_NUMBER /** Version of a program is an integer number. */ #define weVersion() VERSION_NUMBER #else #define weVersion() (-1) #endif /* VERSION */ /** Maximum length for names (application, workplace, user, PEP-protocol, etc) without ending EOS. */ #define WE_NAME_LEN 99 /** Maximum length of message string (without ending EOS) */ #define WE_MSG_LEN 2047 /** The longest allowed path PATH_MAX. Please, don't use this value; try BuildFilePath() from mix/PortableDirs.h to allocate path dynamically. */ #ifndef _POSIX_SOURCE #define _POSIX_SOURCE #endif /* _POSIX_SOURCE */ #include <limits.h> #ifndef PATH_MAX #define PATH_MAX 1024 #endif /* PATH_MAX */ /** Lenght of a moment format: "YYYY/MM/DD HH:MM:SS" Date format: "YYYY/MM/DD" Time format: "HH:MM:SS" */ #define MOMENT_LEN 20 /* Language symbolic codes */ #define WE_LANG_ENGLISH "en" #define WE_LANG_RUSSIAN "ru" #define WE_LANG_CHINESE "cn" /* Name of file in weUserLoc() directory where the only string with preferred language is stored. */ #define WE_LANG_FILENAME "language" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * Initialization and self-identification features */ /** Setup packet id in case of it does not equal to default one */ void weSetProduct (int); /** The environment initialization procedure. Can abort program if its environment can't be successfully built. */ void weInitialize (); /** Assign name for the program. Name must be unique among other of the system UNIVERS. */ void weSetAppName (const char* szAppName); /** Get name of the program. */ const char* weAppName (); /** Get host name (for specifying processor/OS instance). */ const char* weHostName (); /** Get instance identifier of the running application. Use it in conjunction with weHostName. */ pid_t weAppInstance (); /** Get name of the workplace. Workplace name begins with HOSTNAME and then after separator may follow TERMINAL specification. Separator is one of chars :;,/\|!?<>(){}[] */ const char* weWorkplaceName (); /** Get name of the user. */ const char* weUserName (); /** Program identification: - running item: AppName AppInstance WorkplaceName UserName StartMoment Project - historical item: AppName WorkplaceName UserName StartMoment FinishMoment Project */ /* * Common processing environment * All paths without final slash */ /** Get path to system files: $VSPHOME */ const char* weSystemLoc (); /** Get path to user configuration: $HOME/.vsp */ const char* weUserLoc (); /** Checking for expected environment settings. If some settings are bad then warning is printed. Returns count of warnings (0 means OK). */ int weCheckStdAppEnv (); /** Pass job number to the szApplication by setting this value to env.variable strcat(WE_DELIVER_JOBNUM_PREFIX, szApplication). weJobNumber() call in the nearest exec*() call of szApplication will return delivered number. Return 0 on error and job number on success. */ int weDeliverJobNumber (const char* szApplication, int nJob); /** Constructs name of the job number delivering variable. */ void weDeliverJobNumberName (const char* szApplication, char* szVarName); /* * Actions at exit of a program. */ /** This proc is called from atexit(3) function. Do not call it directly! */ void weSystemAtExitHandler (); /** Prototype of at-exit handler. */ typedef void (*weAtExitHandlerProc)(void); /** Register given at-exit procedure. */ void weRegisterAtExitHandler (weAtExitHandlerProc proc); /** Unregister given at-exit procedure. If not found do not trouble a programmer. */ void weUnregisterAtExitHandler (weAtExitHandlerProc proc); /* * Log messages handling */ /** Put message of pointed elevel into log */ void wePutMsg (int elevel, const char* msg); /** Put formatted message of pointed elevel into log */ void weFormatMsg (int elevel, const char* format, ...); /** Prototype of message handler. Must return non-zero if wants to dispatch message to earlier registered handler. */ typedef int (*weMsgHandlerProc)(int elevel, const char* msg); /** Register handler of messages. Passed NULL cleans list of handlers. */ void weRegisterMsgHandler (weMsgHandlerProc proc); /** Message handler procedure with extended information about program. For messages of level ERROR and FATAL composes special prefix with app identification and puts them to original stderr (general message log). */ int weExtendedMsgHandlerProc (int elevel, const char* msg); /* * Time and date format * for internal representation is used POSIX struct tm, but * fields tm_wday, tm_yday, tm_isdst are not used. */ /** Returns pointer at string contains current time and date. With NULL argument returns pointer at static area. */ char* weMoment (char* place); /** Returns pointer at string contains pointed time in format "HH:MM:SS". With NULL place returns pointer at static area. With NULL tm_ptr returns current time. */ char* weFormatTime (char* place, struct tm* tm_ptr); /** Returns pointer at string contains pointed date in format "YYYY/MM/DD". With NULL argument returns pointer at static area. With NULL tm_ptr returns current date. */ char* weFormatDate (char* place, struct tm* tm_ptr); /* Parses moment string and its parts and fills fields of *tm_ptr. Returns 0 if all is OK and !0 otherwise. */ int weParseMoment (const char* szMoment, struct tm* tm_ptr); int weParseDate (const char* szDate, struct tm* tm_ptr); int weParseTime (const char* szTime, struct tm* tm_ptr); /* * User-preferred language */ /** Get preferred language string in dynamically allocated (by malloc) string. */ char* weGetPrefLanguage (); /** Set preferred language string. */ void weSetPrefLanguage (const char* szLang); /* * Miscelaneous */ /** Return level of debugging that is set by UDEBUG environment variable. (DEBUG variable is used by 'setup'). If UDEBUG is empty, 0 is returned; if UDEBUG=<number>, number is returned; if UDEBUG=<text>, -1 is returned. */ int weDebugLevel (); /** Return level of development facilities that is set by UDEVELOP environment variable. If UDEVELOP is empty, 0 is returned; if UDEVELOP=<number>, number is returned; if UDEVELOP=<text>, -1 is returned. */ int weDevelopLevel (); #ifdef __cplusplus }; #endif /* __cplusplus */ #endif /* wenv.h */
14  * данных"
15  *
16  * Encoding: ISO-8859-5 (GOST)
17  *
18  *********************************************************************/
19 
20 #ifndef __wenv_h
21 #define __wenv_h
22 
23 
24 /*************************************************************
25  *
26  * Working environment of UNIVERS processing system.
27  *
28  *************************************************************/
29 
30 #include <time.h>
31 #include <sys/types.h>
32 
33 #ifndef __wenv_internal
34 #include <ldb/wenv_stubs.h>
35 #endif /* __wenv_internal */
36 
37 
38 /* Emergency level used in wePutMsg()/weFormatMsg() functions. */
39 #define EL_FATAL 0
40 #define EL_ERROR 1
41 #define EL_WARNING 2
42 #define EL_INFO 3
43 #define EL_HINT 4
44 #define EL_DEBUG 5
45 
46 /* Environment name for data, jobs, logs and locks location */
47 #define WE_DATA_ENV "DATA"
48 #define WE_JOBS_ENV "JOB"
49 #define WE_LOGS_ENV "LOG"
50 #define WE_LOCKS_ENV "LOCKS"
51 #define WE_HCOPIES_ENV "HCOPIES"
52 #define WE_REPORT_ENV "REPORT"
53 #define WE_ARCHIVE_ENV "ARCHIVE"
54 
60 #define WE_DELIVER_JOBNUM_PREFIX "DELIVER_JOBNUM_"
61 
62 
63 #ifdef VERSION_NUMBER
64 
65 #define weVersion() VERSION_NUMBER
66 #else
67 #define weVersion() (-1)
68 #endif /* VERSION */
69 
70 
73 #define WE_NAME_LEN 99
74 
76 #define WE_MSG_LEN 2047
77 
81 #ifndef _POSIX_SOURCE
82 #define _POSIX_SOURCE
83 #endif /* _POSIX_SOURCE */
84 #include <limits.h>
85 
86 #ifndef PATH_MAX
87 #define PATH_MAX 1024
88 #endif /* PATH_MAX */
89 
90 
94 #define MOMENT_LEN 20
95 
96 
97 /* Language symbolic codes */
98 #define WE_LANG_ENGLISH "en"
99 #define WE_LANG_RUSSIAN "ru"
100 #define WE_LANG_CHINESE "cn"
101 
102 /* Name of file in weUserLoc() directory where the only string with
103  preferred language is stored. */
104 #define WE_LANG_FILENAME "language"
105 
106 
107 
108 #ifdef __cplusplus
109 extern "C" {
110 #endif /* __cplusplus */
111 
112 
113  /*
114  * Initialization and self-identification features
115  */
116 
118  void weSetProduct (int);
119 
122  void weInitialize ();
123 
126  void weSetAppName (const char* szAppName);
127 
129  const char* weAppName ();
130 
132  const char* weHostName ();
133 
136  pid_t weAppInstance ();
137 
141  const char* weWorkplaceName ();
142 
144  const char* weUserName ();
145 
156  /*
157  * Common processing environment
158  * All paths without final slash
159  */
160 
161 
163  const char* weSystemLoc ();
164 
166  const char* weUserLoc ();
167 
171  int weCheckStdAppEnv ();
172 
178  int weDeliverJobNumber (const char* szApplication, int nJob);
179 
181  void weDeliverJobNumberName (const char* szApplication,
182  char* szVarName);
183 
184 
185  /*
186  * Actions at exit of a program.
187  */
188 
191  void weSystemAtExitHandler ();
192 
194  typedef void (*weAtExitHandlerProc)(void);
195 
197  void weRegisterAtExitHandler (weAtExitHandlerProc proc);
198 
201  void weUnregisterAtExitHandler (weAtExitHandlerProc proc);
202 
203 
204 
205  /*
206  * Log messages handling
207  */
208 
210  void wePutMsg (int elevel, const char* msg);
211 
213  void weFormatMsg (int elevel, const char* format, ...);
214 
217  typedef int (*weMsgHandlerProc)(int elevel, const char* msg);
218 
221  void weRegisterMsgHandler (weMsgHandlerProc proc);
222 
227  int weExtendedMsgHandlerProc (int elevel, const char* msg);
228 
229 
230  /*
231  * Time and date format
232  * for internal representation is used POSIX struct tm, but
233  * fields tm_wday, tm_yday, tm_isdst are not used.
234  */
235 
238  char* weMoment (char* place);
239 
243  char* weFormatTime (char* place, struct tm* tm_ptr);
244 
248  char* weFormatDate (char* place, struct tm* tm_ptr);
249 
250  /* Parses moment string and its parts and fills fields of *tm_ptr.
251  Returns 0 if all is OK and !0 otherwise. */
252  int weParseMoment (const char* szMoment, struct tm* tm_ptr);
253  int weParseDate (const char* szDate, struct tm* tm_ptr);
254  int weParseTime (const char* szTime, struct tm* tm_ptr);
255 
256 
257  /*
258  * User-preferred language
259  */
260 
263  char* weGetPrefLanguage ();
264 
266  void weSetPrefLanguage (const char* szLang);
267 
268 
269  /*
270  * Miscelaneous
271  */
272 
278  int weDebugLevel ();
279 
285  int weDevelopLevel ();
286 
287 
288 #ifdef __cplusplus
289 };
290 #endif /* __cplusplus */
291 
292 #endif /* wenv.h */