Y-lib
Loadrunner libraries
vugen.h
Go to the documentation of this file.
1 
22 #ifndef _VUGEN_H_
23 #define _VUGEN_H_
24 
25 /* typedef unsigned long size_t; */
26 
27 /***** String functions *****/
32 int snprintf(char *buffer, size_t n, const char *format_string, ...);
36 int sprintf(char *buffer, const char *format_string, ...);
38 int sscanf(const char *buffer, const char *format_string, ...);
40 char *strchr(const char *string, int c);
42 int strcmp(const char *string1, const char *string2);
44 char *strdup(const char *string);
46 int stricmp(const char *string1, const char *string2);
48 size_t strlen(const char *string);
50 char *strlwr(char *string);
52 char *strncat(char *to_string, const char *from_string, size_t n);
54 int strncmp(const char *string1, const char *string2, size_t n);
56 int strnicmp(const char *string1, const char *string2, size_t num);
58 char *strncpy(char *destination, const char *source, size_t num);
60 char *strrchr(const char *string, int c);
62 char *strset(char *string1, int character);
64 size_t *strspn(const char *string, const char *skipset);
66 char *strstr(const char *string1, const char *string2);
68 char *strtok(char *string, const char *delimiters);
70 char *strupr(char *string);
72 double atof(const char *string);
74 int atoi(const char *string);
76 long atol(const char *string);
78 int itoa(int value, char *str, int radix);
80 long strtol(const char *string, char **endptr, int radix);
82 unsigned long int strtoul(const char *str, char **endptr, int base);
84 double strtod(const char *str, char **endptr);
85 
94 #define strcat(to, from) 0_DO_NOT_USE_strcat_THERE_IS_ALWAYS_A_BETTER_SOLUTION
95 
105 #define strcpy(dest, source) 0_DO_NOT_USE_strcpy_DUPLICATION_IS_NOT_REQUIRED
106 
108 /* ctype.h -- http://www.acm.uiuc.edu/webmonkeys/book/c_guide/ */
113 int isalnum(int character);
116 int isalpha(int character);
118 int iscntrl(int character);
120 int isdigit(int character);
122 int isgraph(int character);
124 int islower(int character);
126 int isprint(int character);
128 int ispunct(int character);
130 int isspace(int character);
132 int isupper(int character);
134 int isxdigit(int character);
136 int tolower(int character);
138 int toupper(int character);
140 
141 /* ctype.h -- http://www.acm.uiuc.edu/webmonkeys/book/c_guide/ */
146 void *memchr(const void *s, int c, size_t n);
149 int memcmp(const void *s1, const void *s2, size_t n);
151 void *memcpy(void *dest, const void *src, size_t n);
153 void *memmove(void *dest, const void *src, size_t n);
155 void *memset(void *buffer, int c, size_t n);
156 
157 /***** Memory Allocation Functions *****/
159 void *calloc(size_t num_elems, size_t elem_size);
161 void free(void *mem_address);
163 void *malloc(size_t num_bytes);
165 void *realloc(void *mem_address, size_t size);
167 
168 /***** Time structures and functions *****/
173 typedef long time_t;
175 
178 struct tm {
180  int tm_sec;
182  int tm_min;
184  int tm_hour;
186  int tm_mday;
188  int tm_mon;
190  int tm_year;
192  int tm_wday;
194  int tm_yday;
196  int tm_isdst;
197  #ifdef LINUX
198  int tm_gmtoff;
199  const char *tm_zone;
200  #endif
201 };
202 
204 time_t time(time_t *timeptr);
206 char *ctime(const time_t *calTime);
208 struct tm *gmtime(const time_t *calTime);
210 char *asctime(const struct tm *tmTime);
212 size_t *strftime(char *string, size_t maxlen, const char *format, const struct tm *timestruct);
214 time_t mktime(struct tm * timeptr);
216 struct tm *localtime(const time_t *timer);
218 void tzset(void);
219 
222 struct _timeb {
226  unsigned short millitm;
228  short timezone;
230  short dstflag;
231 };
232 
234 void ftime(struct _timeb *time);
236 
237 /***** File functions *****/
247 int fclose(long file_pointer);
250 int feof(long file_pointer);
252 int ferror(long file_pointer);
254 int fgetc(long file_pointer);
256 char *fgets(char *string, int maxchar, long file_pointer);
258 int fputs(const char *str, long file_pointer);
260 long fopen(const char *filename, const char *access_mode);
262 int fprintf(long file_pointer, const char *format_string, ...);
264 int fputc(int c, long file_pointer);
266 size_t fread(void *buffer, size_t size, size_t count, long file_pointer);
268 int fscanf(long file_pointer, const char *format_string, ...);
270 int fseek(long file_pointer, long offset, int origin);
272 long ftell(long file_pointer);
274 size_t fwrite(const void *buffer, size_t size, size_t count, long file_pointer);
276 void rewind(long file_pointer);
278 long tmpfile(void);
280 char *tmpnam(char *str);
282 int setvbuf(long file_pointer, char * buffer, int mode, size_t size);
283 
284 #ifndef FILENAME_MAX
285 #define FILENAME_MAX 1024
286 #endif
287 #ifndef L_tmpnam
288 #define L_tmpnam FILENAME_MAX
289 #endif
290 
292 #ifndef SEEK_SET
293 #define SEEK_SET 0
294 #endif
295 #ifndef SEEK_CUR
297 #define SEEK_CUR 1
298 #endif
299 #ifndef SEEK_END
301 #define SEEK_END 2
302 #endif
303 #define _IOFBF 0
305 #define _IOLBF 1
307 #define _IONBF 2
309 #define EOF (-1)
311 
313 /*
314  * Routines in POSIX 1003.1:2001.
315  */
320 int getw(long file_pointer);
323 int pclose(long file_pointer);
325 long popen(const char *command, const char *access_mode);
327 int putw(int word, long file_pointer);
328 
329 /***** Process Control Functions *****/
331 char *getenv(const char *varname);
333 int putenv(const char *envstring);
335 int system(const char *string);
336 
337 /***** File system functions *****/
339 int chdir(const char *path);
341 int chdrive(int drive);
343 char *getcwd(char *path, int numchars);
345 int getdrive(void);
347 int remove(const char *path);
349 int rename(const char *oldname, const char *newname);
351 int rmdir(const char *path);
353 
354 /***** locale.h functions *****/
365 #define LC_ALL 0
366 #define LC_COLLATE 1
367 #define LC_CTYPE 2
368 #define LC_MONETARY 3
369 #define LC_NUMERIC 4
370 #define LC_TIME 5
371 #define LC_MESSAGES 6
372 char *setlocale(int category, const char *locale);
374 
376 struct lconv {
382  char *grouping;
413 /*
414 The members below are not yet supported (not complying with the C standard of 1999 or later).
415  char int_n_cs_precedes;
416  char int_n_sep_by_space;
417  char int_n_sign_posn;
418  char int_p_cs_precedes;
419  char int_p_sep_by_space;
420  char int_p_sign_posn;
421 */
422 };
424 struct lconv *localeconv(void);
426 
427 /***** Mathematic Functions *****/
432 int abs(int n);
435 double fabs(double x);
437 double ceil(double x);
439 double floor(double x);
441 double fmod(double numerator, double denominator);
443 double modf(double x, double *intpart);
445 double exp(double x);
447 double sqrt(double x);
449 double pow(double base, double exponent);
451 double log(double x);
453 double log10(double x);
455 double log2(double x);
457 double sin(double x);
459 double cos(double x);
461 
463 int rand(void);
465 int srand(unsigned int seed);
466 #ifdef WINNT
467 int rand_s(unsigned int *randomValue);
469 #endif
470 
471 /***** Windows API Functions *****/
473 void sleep(DWORD dwMilliseconds);
474 /* alternative: #define sleep(msec) lr_force_think_time(msec / 1000.) */
475 
476 // doxygen info: http://www.stack.nl/~dimitri/doxygen/manual/commands.html
477 #endif /* _VUGEN_H_ */
void ftime(struct _timeb *time)
Documented at http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_lib_ref/f/ftime.html .
char * mon_thousands_sep
Separators used to delimit groups of digits to the left of the decimal point for monetary quantities...
Definition: vugen.h:390
size_t * strspn(const char *string, const char *skipset)
Documented at http://www.cplusplus.com/reference/cstring/strspn/.
int islower(int character)
Documented at http://www.cplusplus.com/reference/cctype/islower/.
double sin(double x)
Documented at http://www.cplusplus.com/reference/cmath/sin/.
int isspace(int character)
Documented at http://www.cplusplus.com/reference/cctype/isspace/.
int tm_min
minutes after the hour - [0,59]
Definition: vugen.h:182
char * asctime(const struct tm *tmTime)
Documented at http://www.cplusplus.com/reference/ctime/asctime/.
int srand(unsigned int seed)
Documented at http://www.cplusplus.com/reference/cstdlib/srand/.
long tmpfile(void)
Documented at http://www.cplusplus.com/reference/cstdio/tmpfile/.
int fscanf(long file_pointer, const char *format_string,...)
Documented at http://www.cplusplus.com/reference/cstdio/fscanf/.
double exp(double x)
Documented at http://www.cplusplus.com/reference/cmath/exp/.
char * ctime(const time_t *calTime)
Documented at http://www.cplusplus.com/reference/ctime/ctime/.
char * mon_decimal_point
Decimal-point separator used for monetary quantities.
Definition: vugen.h:388
double floor(double x)
Documented at http://www.cplusplus.com/reference/cmath/floor/.
int toupper(int character)
Documented at http://www.cplusplus.com/reference/cctype/toupper/.
char * strupr(char *string)
Documented at http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_lib_ref/s/strupr.html .
int itoa(int value, char *str, int radix)
Documented at http://www.cplusplus.com/reference/cstdlib/itoa/.
int fgetc(long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/fgetc/.
int isgraph(int character)
Documented at http://www.cplusplus.com/reference/cctype/isgraph/.
char p_sign_posn
Position of the sign for positive or zero monetary quantities.
Definition: vugen.h:410
int tm_mday
day of the month - [1,31]
Definition: vugen.h:186
char * negative_sign
Sign to be used for negative monetary quantities.
Definition: vugen.h:396
short dstflag
Nonzero if in daylight savings time.
Definition: vugen.h:230
void rewind(long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/rewind/.
double fmod(double numerator, double denominator)
Documented at http://www.cplusplus.com/reference/cmath/fmod/.
size_t * strftime(char *string, size_t maxlen, const char *format, const struct tm *timestruct)
Documented at http://www.cplusplus.com/reference/ctime/strftime/.
char * grouping
Specifies the amount of digits that form each of the groups to be separated by thousands_sep separato...
Definition: vugen.h:382
double ceil(double x)
Documented at http://www.cplusplus.com/reference/cmath/ceil/.
void * memchr(const void *s, int c, size_t n)
Documented at http://www.cplusplus.com/reference/cstring/memchr/.
char * decimal_point
Decimal-point separator used for non-monetary quantities.
Definition: vugen.h:378
size_t fread(void *buffer, size_t size, size_t count, long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/fread/.
double log2(double x)
Documented at http://www.cplusplus.com/reference/cmath/log2/.
int tm_year
years since 1900
Definition: vugen.h:190
char * mon_grouping
Specifies the amount of digits that form each of the groups to be separated by mon_thousands_sep sepa...
Definition: vugen.h:392
int iscntrl(int character)
Documented at http://www.cplusplus.com/reference/cctype/iscntrl/.
char * strdup(const char *string)
Documented at http://pubs.opengroup.org/onlinepubs/007904975/functions/strdup.html ...
char * getcwd(char *path, int numchars)
See on-line help.
void * malloc(size_t num_bytes)
Documented at http://www.cplusplus.com/reference/cstdlib/malloc/.
void * calloc(size_t num_elems, size_t elem_size)
Documented at http://www.cplusplus.com/reference/cstdlib/calloc/.
int getw(long file_pointer)
Documented at http://man7.org/linux/man-pages/man3/getw.3.html .
double strtod(const char *str, char **endptr)
Documented at http://www.cplusplus.com/reference/cstdlib/strtod/.
int getdrive(void)
See on-line help.
int feof(long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/feof/.
char * strstr(const char *string1, const char *string2)
Documented at http://www.cplusplus.com/reference/cstring/strstr/.
char int_frac_digits
Amount of fractional digits to the right of the decimal point for monetary quantities in the internat...
Definition: vugen.h:398
char * strtok(char *string, const char *delimiters)
Documented at http://www.cplusplus.com/reference/cstring/strtok/.
int fclose(long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/fclose/.
int putenv(const char *envstring)
Documented at http://www.cplusplus.com/reference/cstdlib/putenv/.
char * strrchr(const char *string, int c)
Documented at http://www.cplusplus.com/reference/cstring/strrchr/.
long fopen(const char *filename, const char *access_mode)
Documented at http://www.cplusplus.com/reference/cstdio/fopen/.
void * memcpy(void *dest, const void *src, size_t n)
Documented at http://www.cplusplus.com/reference/cstring/memcpy/.
struct tm * localtime(const time_t *timer)
Documented at http://www.cplusplus.com/reference/ctime/localtime/.
long ftell(long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/ftell/.
char * strncat(char *to_string, const char *from_string, size_t n)
Documented at http://www.cplusplus.com/reference/cstring/strncat/.
int atoi(const char *string)
Documented at http://www.cplusplus.com/reference/cstdlib/atoi/.
int strcmp(const char *string1, const char *string2)
Documented at http://www.cplusplus.com/reference/cstring/strcmp/.
char * getenv(const char *varname)
Documented at http://www.cplusplus.com/reference/cstdlib/getenv/.
char * strlwr(char *string)
Documented at http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_lib_ref/s/strlwr.html .
void * memmove(void *dest, const void *src, size_t n)
Documented at http://www.cplusplus.com/reference/cstring/memmove/.
void tzset(void)
Documented at http://www.cplusplus.com/reference/ctime/tzset/.
char n_sep_by_space
Boolean whether a space should appear between the currency symbol and negative monetary quantities...
Definition: vugen.h:408
Returned by localeconv. Documented at http://www.cplusplus.com/reference/clocale/lconv/.
Definition: vugen.h:376
double log10(double x)
Documented at http://www.cplusplus.com/reference/cmath/log10/.
char n_sign_posn
Position of the sign for negative monetary quantities.
Definition: vugen.h:412
size_t fwrite(const void *buffer, size_t size, size_t count, long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/fwrite/.
int tm_mon
months since January - [0,11]
Definition: vugen.h:188
int putw(int word, long file_pointer)
Documented at http://man7.org/linux/man-pages/man3/putw.3.html .
char * setlocale(int category, const char *locale)
Documented at http://www.cplusplus.com/reference/clocale/setlocale/.
char * fgets(char *string, int maxchar, long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/fgets/.
char * positive_sign
Sign to be used for positive or zero monetary quantities.
Definition: vugen.h:394
double cos(double x)
Documented at http://www.cplusplus.com/reference/cmath/cos/.
long popen(const char *command, const char *access_mode)
Documented at http://man7.org/linux/man-pages/man3/popen.3.html .
double fabs(double x)
Documented at http://www.cplusplus.com/reference/cmath/fabs/.
char * strset(char *string1, int character)
Documented at http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.neutrino_lib_ref/s/strset.html .
char * currency_symbol
Local currency symbol.
Definition: vugen.h:386
int isalpha(int character)
Documented at http://www.cplusplus.com/reference/cctype/isalpha/.
int abs(int n)
Documented at http://www.cplusplus.com/reference/cstdlib/abs/.
time_t mktime(struct tm *timeptr)
Documented at http://www.cplusplus.com/reference/ctime/mktime/.
long time_t
Type time_t can hold a Unix timestamp.
Definition: vugen.h:174
long strtol(const char *string, char **endptr, int radix)
Documented at http://www.cplusplus.com/reference/cstdlib/strtol/.
int fprintf(long file_pointer, const char *format_string,...)
Documented at http://www.cplusplus.com/reference/cstdio/fprintf/.
int isupper(int character)
Documented at http://www.cplusplus.com/reference/cctype/isupper/.
void sleep(DWORD dwMilliseconds)
Windows API uninterruptable sleep in LR, better to use lr_force_think_time() or lr_usleep() instead...
int sprintf(char *buffer, const char *format_string,...)
Documented at http://www.cplusplus.com/reference/cstdio/sprintf/. You should prefer snprintf over s...
char p_sep_by_space
Boolean whether the currency symbol should precede negative monetary quantities.
Definition: vugen.h:404
int sscanf(const char *buffer, const char *format_string,...)
Documented at http://www.cplusplus.com/reference/cstdio/sscanf/.
long atol(const char *string)
Documented at http://www.cplusplus.com/reference/cstdlib/atol/.
int isdigit(int character)
Documented at http://www.cplusplus.com/reference/cctype/isdigit/.
struct lconv * localeconv(void)
Documented at http://www.cplusplus.com/reference/clocale/localeconv/.
double sqrt(double x)
Documented at http://www.cplusplus.com/reference/cmath/sqrt/.
char p_cs_precedes
Boolean whether the currency symbol should precede positive or zero monetary quantities.
Definition: vugen.h:402
char * int_curr_symbol
International currency symbol. This is formed by the three-letter ISO-4217 entry code for the currenc...
Definition: vugen.h:384
void * memset(void *buffer, int c, size_t n)
Documented at http://www.cplusplus.com/reference/cstring/memset/.
Documented at http://www.cplusplus.com/reference/ctime/tm/. Values outside of valid ranges can be us...
Definition: vugen.h:178
size_t strlen(const char *string)
Documented at http://www.cplusplus.com/reference/cstring/strlen/.
int isalnum(int character)
Documented at http://www.cplusplus.com/reference/cctype/isalnum/.
void * realloc(void *mem_address, size_t size)
Documented at http://www.cplusplus.com/reference/cstdlib/realloc/.
int tm_wday
days since Sunday - [0,6] (ignored by mktime)
Definition: vugen.h:192
int strncmp(const char *string1, const char *string2, size_t n)
Documented at http://www.cplusplus.com/reference/cstring/strncmp/.
int ispunct(int character)
Documented at http://www.cplusplus.com/reference/cctype/ispunct/.
int tm_yday
days since January 1 - [0,365] (ignored by mktime)
Definition: vugen.h:194
char * thousands_sep
Separators used to delimit groups of digits to the left of the decimal point for non-monetary quantit...
Definition: vugen.h:380
int rmdir(const char *path)
See on-line help.
int rename(const char *oldname, const char *newname)
Documented at http://www.cplusplus.com/reference/cstdio/rename/.
char * strchr(const char *string, int c)
Documented at http://www.cplusplus.com/reference/cstring/strchr/.
unsigned short millitm
Milliseconds. Actual accuracy may be lower.
Definition: vugen.h:226
short timezone
Difference in minutes of the timezone from UTC.
Definition: vugen.h:228
int snprintf(char *buffer, size_t n, const char *format_string,...)
Documented at http://www.cplusplus.com/reference/cstdio/snprintf/. This function was introduced by t...
int ferror(long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/ferror/.
struct tm * gmtime(const time_t *calTime)
Documented at http://www.cplusplus.com/reference/ctime/gmtime/.
int fputs(const char *str, long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/fputs/.
int fseek(long file_pointer, long offset, int origin)
Documented at http://www.cplusplus.com/reference/cstdio/fseek/.
unsigned long int strtoul(const char *str, char **endptr, int base)
Documented at http://www.cplusplus.com/reference/cstdlib/strtoul/.
int chdir(const char *path)
Documented at http://man7.org/linux/man-pages/man2/chdir.2.html .
int rand(void)
Documented at http://www.cplusplus.com/reference/cstdlib/rand/.
int fputc(int c, long file_pointer)
Documented at http://www.cplusplus.com/reference/cstdio/fputc/.
double log(double x)
Documented at http://www.cplusplus.com/reference/cmath/log/.
int stricmp(const char *string1, const char *string2)
Documented at http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rtref/stricmp.htm .
int tm_sec
seconds after the minute - [0,61] (or [0,59] when leap seconds are not supported) ...
Definition: vugen.h:180
int isxdigit(int character)
Documented at http://www.cplusplus.com/reference/cctype/isxdigit/.
int tm_hour
hours since midnight - [0,23]
Definition: vugen.h:184
int system(const char *string)
Documented at http://www.cplusplus.com/reference/cstdlib/system/. The popen function is more useful...
int tolower(int character)
Documented at http://www.cplusplus.com/reference/cctype/tolower/.
double modf(double x, double *intpart)
Documented at http://www.cplusplus.com/reference/cmath/modf/.
int isprint(int character)
Documented at http://www.cplusplus.com/reference/cctype/isprint/.
char frac_digits
Amount of fractional digits to the right of the decimal point for monetary quantities in the local fo...
Definition: vugen.h:400
int memcmp(const void *s1, const void *s2, size_t n)
Documented at http://www.cplusplus.com/reference/cstring/memcmp/.
char * strncpy(char *destination, const char *source, size_t num)
Documented at http://www.cplusplus.com/reference/cstring/strncpy/.
int setvbuf(long file_pointer, char *buffer, int mode, size_t size)
Documented at http://www.cplusplus.com/reference/cstdio/setvbuf/.
int tm_isdst
daylight savings time flag (>0 in effect, 0 not in effect, <0 unknown)
Definition: vugen.h:196
double pow(double base, double exponent)
Documented at http://www.cplusplus.com/reference/cmath/pow/.
time_t time(time_t *timeptr)
Documented at http://www.cplusplus.com/reference/ctime/time/.
void free(void *mem_address)
Documented at http://www.cplusplus.com/reference/cstdlib/free/.
char * tmpnam(char *str)
Documented at http://www.cplusplus.com/reference/cstdio/tmpnam/.
time_t time
Time, in seconds, since the Unix Epoch, 1 January 1970 00:00:00 Coordinated Universal Time (UTC)...
Definition: vugen.h:224
int strnicmp(const char *string1, const char *string2, size_t num)
Documented at http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rtref/strnicmp.htm.
double atof(const char *string)
Documented at http://www.cplusplus.com/reference/cstdlib/atof/.
Used by ftime. Defined as _timeb (instead of timeb) just as in the on-line Help.
Definition: vugen.h:222
int pclose(long file_pointer)
Documented at http://man7.org/linux/man-pages/man3/pclose.3.html .
char n_cs_precedes
Boolean whether a space should appear between the currency symbol and positive or zero monetary quant...
Definition: vugen.h:406
int chdrive(int drive)
See on-line help.