#include "flexdef.h"
+/* ANSI C does not guarantee that isascii() is defined */
+#ifndef isascii
+#define isascii(c) ((c) <= 0177)
+#endif
+
+
+
+/* declare functions that have forward references */
+
+void dataflush PROTO(());
+int otoi PROTO((Char []));
+
+
/* action_out - write the actions from the temporary file to lex.yy.c
*
* synopsis
* Copies the action file up to %% (or end-of-file) to lex.yy.c
*/
-action_out()
+void action_out()
{
char buf[MAXLINE];
/* allocate_array - allocate memory for an integer array of the given size */
-char *allocate_array( size, element_size )
+void *allocate_array( size, element_size )
int size, element_size;
{
- register char *mem;
+ register void *mem;
/* on 16-bit int machines (e.g., 80286) we might be trying to
* allocate more than a signed int can hold, and that won't
if ( element_size * size <= 0 )
flexfatal( "request for < 1 byte in allocate_array()" );
- mem = malloc( (unsigned) (element_size * size) );
+ mem = (void *) malloc( (unsigned) (element_size * size) );
if ( mem == NULL )
flexfatal( "memory allocation failed in allocate_array()" );
* v - the array to be sorted
* n - the number of elements of 'v' to be sorted */
-bubble( v, n )
+void bubble( v, n )
int v[], n;
{
* v - array to be sorted
* n - number of elements of v to be sorted
*/
-cshell( v, n, special_case_0 )
+
+void cshell( v, n, special_case_0 )
Char v[];
int n, special_case_0;
* synopsis
* dataend();
*/
-dataend()
+
+void dataend()
{
if ( datapos > 0 )
* synopsis
* dataflush();
*/
-dataflush()
+
+void dataflush()
{
putchar( '\n' );
datapos = 0;
}
+
+/* flexerror - report an error message and terminate
+ *
+ * synopsis
+ * char msg[];
+ * flexerror( msg );
+ */
+
+void flexerror( msg )
+char msg[];
+
+ {
+ fprintf( stderr, "%s: %s\n", program_name, msg );
+
+ flexend( 1 );
+ }
+
+
+/* flexfatal - report a fatal error message and terminate
+ *
+ * synopsis
+ * char msg[];
+ * flexfatal( msg );
+ */
+
+void flexfatal( msg )
+char msg[];
+
+ {
+ fprintf( stderr, "%s: fatal internal error, %s\n", program_name, msg );
+ flexend( 1 );
+ }
+
+
/* flex_gettime - return current time
*
* synopsis
* lerrif( msg, arg );
*/
-lerrif( msg, arg )
+void lerrif( msg, arg )
char msg[];
int arg;
* lerrsf( msg, arg );
*/
-lerrsf( msg, arg )
+void lerrsf( msg, arg )
char msg[], arg[];
{
}
-/* flexerror - report an error message and terminate
- *
- * synopsis
- * char msg[];
- * flexerror( msg );
- */
-
-flexerror( msg )
-char msg[];
-
- {
- fprintf( stderr, "%s: %s\n", program_name, msg );
-
- flexend( 1 );
- }
-
-
-/* flexfatal - report a fatal error message and terminate
- *
- * synopsis
- * char msg[];
- * flexfatal( msg );
- */
-
-flexfatal( msg )
-char msg[];
-
- {
- fprintf( stderr, "%s: fatal internal error, %s\n", program_name, msg );
- flexend( 1 );
- }
-
-
/* htoi - convert a hexadecimal digit string to an integer value
*
* synopsis:
/* line_directive_out - spit out a "# line" statement */
-line_directive_out( output_file_name )
+void line_directive_out( output_file_name )
FILE *output_file_name;
{
*
* generates a data statement initializing the current 2-D array to "value"
*/
-mk2data( value )
+void mk2data( value )
int value;
{
* generates a data statement initializing the current array element to
* "value"
*/
-mkdata( value )
+void mkdata( value )
int value;
{
case '\b': return ( "\\b" );
default:
- sprintf( rform, "\\%.3o", c );
+ (void) sprintf( rform, "\\%.3o", c );
return ( rform );
}
}
/* reallocate_array - increase the size of a dynamic array */
-char *reallocate_array( array, size, element_size )
-char *array;
+void *reallocate_array( array, size, element_size )
+void *array;
int size, element_size;
{
- register char *new_array;
+ register void *new_array;
/* same worry as in allocate_array(): */
if ( size * element_size <= 0 )
flexfatal( "attempt to increase array size by less than 1 byte" );
- new_array = realloc( array, (unsigned) (size * element_size ));
+ new_array =
+ (void *) realloc( (char *)array, (unsigned) (size * element_size ));
if ( new_array == NULL )
flexfatal( "attempt to increase array size failed" );
* Copies from skelfile to stdout until a line beginning with "%%" or
* EOF is found.
*/
-skelout()
+void skelout()
{
char buf[MAXLINE];
* element_n. Formats the output with spaces and carriage returns.
*/
-transition_struct_out( element_v, element_n )
+void transition_struct_out( element_v, element_n )
int element_v, element_n;
{