43 #define isascii(c) ((c) <= 0177) 67 if ( buf[0] ==
'%' && buf[1] ==
'%' )
84 if ( element_size * size <= 0 )
85 flexfatal(
"request for < 1 byte in allocate_array()" );
87 mem = (
void *) malloc( (
unsigned) (element_size * size) );
90 flexfatal(
"memory allocation failed in allocate_array()" );
108 if ( !
isascii( (
int) *str ) || ! islower( (
int) *str ) )
129 if ( !
isascii( (
int) *str ) || ! isupper( (
int) *str ) )
156 for ( i = n; i > 1; --
i )
157 for ( j = 1; j <
i; ++j )
158 if ( v[j] > v[j + 1] )
177 return ( (
isascii( c ) && isupper( c )) ? tolower( c ) : c );
194 for ( c = str; *c; ++c )
197 copy = malloc( (
unsigned) ((c - str + 1) *
sizeof(
char )) );
200 flexfatal(
"dynamic memory failure in copy_string()" );
202 for ( c = copy; (*c++ = *str++); )
223 for ( c = str; *c; ++c )
226 copy = (
Char *) malloc( (
unsigned) ((c - str + 1) *
sizeof(
Char )) );
229 flexfatal(
"dynamic memory failure in copy_unsigned_string()" );
231 for ( c = copy; (*c++ = *str++); )
261 for ( gap = n / 2; gap > 0; gap = gap / 2 )
262 for ( i = gap; i < n; ++
i )
263 for ( j = i - gap; j >= 0; j = j - gap )
267 if ( special_case_0 )
272 else if ( v[j] != 0 && v[j] <= v[jg] )
276 else if ( v[j] <= v[jg] )
373 #include <sys/types.h> 383 time_t t, time(time_t *);
408 (void) sprintf( errmsg, msg, arg );
424 (void) sprintf( errmsg, msg, arg );
441 (void) sscanf( (
char *)
str,
"%x", &
result );
558 (void) sscanf( (
char *) array,
"%d", &val );
579 case 'a':
return (
'\a' );
580 case 'b':
return (
'\b' );
581 case 'f':
return (
'\f' );
582 case 'n':
return (
'\n' );
583 case 'r':
return (
'\r' );
584 case 't':
return (
'\t' );
585 case 'v':
return (
'\v' );
600 while (
isascii( array[sptr] ) && isdigit( array[sptr] ) )
610 esc_char =
otoi( array + 1 );
631 esc_char =
htoi( array + 2 );
656 (void) sscanf( (
char *)
str,
"%o", &
result );
674 static char rform[10];
676 if ( (c >= 0 && c < 32) || c >= 127 )
680 case '\n':
return (
"\\n" );
681 case '\t':
return (
"\\t" );
682 case '\f':
return (
"\\f" );
683 case '\r':
return (
"\\r" );
684 case '\b':
return (
"\\b" );
687 (void) sprintf( rform,
"\\%.3o", c );
712 if ( size * element_size <= 0 )
713 flexfatal(
"attempt to increase array size by less than 1 byte" );
716 (
void *) realloc( (
char *)array, (unsigned) (size * element_size ));
718 if ( new_array ==
NULL )
719 flexfatal(
"attempt to increase array size failed" );
721 return ( new_array );
739 if ( buf[0] ==
'%' && buf[1] ==
'%' )
758 printf(
"%7d, %5d,", element_v, element_n );
void flexfatal(char *msg)
int htoi(unsigned char *str)
char * readable_form(int c)
void copy(PVValueArray< T > &pvFrom, size_t fromOffset, size_t fromStride, PVValueArray< T > &pvTo, size_t toOffset, size_t toStride, size_t count)
Copy a subarray from one scalar array to another.
char * flex_gettime(void)
void line_directive_out(FILE *output_file_name)
void flexerror(char *msg)
void bubble(int v[], int n)
char * copy_string(char *str)
Char * copy_unsigned_string(Char *str)
#define TRANS_STRUCT_PRINT_LENGTH
void lerrsf(char *msg, char *arg)
void * reallocate_array(void *array, int size, int element_size)
void * allocate_array(int size, int element_size)
void cshell(Char *v, int n, int special_case_0)
void transition_struct_out(int element_v, int element_n)
void lerrif(char *msg, int arg)