/* -*-C-*-
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/findprim.c,v 9.42 1989/09/25 17:47:41 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/findprim.c,v 9.43 1990/11/21 22:38:40 jinx Rel $
Copyright (c) 1987, 1988, 1989 Massachusetts Institute of Technology
\f
/* Some utility imports and definitions. */
+#include "ansidecl.h"
#include <stdio.h>
/* For macros toupper, isalpha, etc,
#ifdef vms
/* VMS version 3 has no void. */
/* #define void */
-#define NORMAL_EXIT() return
+# define NORMAL_EXIT() return
#else
-#define NORMAL_EXIT() exit(0)
+# define NORMAL_EXIT() exit(0)
#endif
/* The 4.2 bsd vax compiler has a bug which forces the following. */
#define pseudo_void int
char *
-xmalloc (length)
- int length;
+DEFUN (xmalloc, (length),
+ int length)
{
char * result;
extern char * malloc ();
}
char *
-xrealloc (ptr, length)
- char * ptr;
- int length;
+DEFUN (xrealloc, (ptr, length),
+ char * ptr AND
+ int length)
{
char * result;
extern char * realloc ();
}
#ifdef DEBUGGING
-#define dprintf(one, two) fprintf(stderr, one, two)
+# define dprintf(one, two) fprintf(stderr, one, two)
#else
-#define dprintf(one, two)
+# define dprintf(one, two)
#endif
\f
/* Maximum number of primitives that can be handled. */
/* forward references */
-TOKEN_PROCESSOR scan ();
-boolean whitespace ();
-int compare_descriptors ();
-int read_index ();
-int strcmp_ci ();
-pseudo_void create_alternate_entry ();
-pseudo_void create_builtin_entry ();
-pseudo_void create_normal_entry ();
-void dump ();
-void grow_data_buffer ();
-void grow_token_buffer ();
-void initialize_builtin ();
-void initialize_data_buffer ();
-void initialize_default ();
-void initialize_external ();
-void initialize_token_buffer ();
-void mergesort ();
-void print_procedure ();
-void print_primitives ();
-void print_spaces ();
-void print_entry ();
-void process ();
-void process_argument ();
-void scan_to_token_start ();
-void skip_token ();
-void sort ();
-void update_from_entry ();
+TOKEN_PROCESSOR EXFUN (scan, (void));
+boolean EXFUN (whitespace, (int c));
+int EXFUN (compare_descriptors, (struct descriptor * d1, struct descriptor * d2));
+int EXFUN (read_index, (char * arg, char * identification));
+int EXFUN (strcmp_ci, (char * s1, char * s2));
+pseudo_void EXFUN (create_alternate_entry, (void));
+pseudo_void EXFUN (create_builtin_entry, (void));
+pseudo_void EXFUN (create_normal_entry, (void));
+void EXFUN (dump, (boolean check));
+void EXFUN (grow_data_buffer, (void));
+void EXFUN (grow_token_buffer, (void));
+void EXFUN (initialize_builtin, (char * arg));
+void EXFUN (initialize_data_buffer, (void));
+void EXFUN (initialize_default, (void));
+void EXFUN (initialize_external, (void));
+void EXFUN (initialize_token_buffer, (void));
+void EXFUN (mergesort, (int low, int high,
+ struct descriptor ** array,
+ struct descriptor ** temp_array));
+void EXFUN (print_procedure, (FILE * output,
+ struct descriptor * primitive_descriptor,
+ char * error_string));
+void EXFUN (print_primitives, (FILE * output, int limit));
+void EXFUN (print_spaces, (FILE * output, int how_many));
+void EXFUN (print_entry, (FILE * output, int index,
+ struct descriptor * primitive_descriptor));
+void EXFUN (process, (void));
+void EXFUN (process_argument, (char * fn));
+void EXFUN (scan_to_token_start, (void));
+void EXFUN (skip_token, (void));
+void EXFUN (sort, (void));
+void EXFUN (update_from_entry, (struct descriptor * primitive_descriptor));
\f
void
-main (argc, argv)
- int argc;
- char * argv [];
+DEFUN (main, (argc, argv),
+ int argc AND
+ char **argv)
{
name = argv[0];
}
\f
void
-process_argument (fn)
- char * fn;
+DEFUN (process_argument, (fn),
+ char * fn)
{
file_name = fn;
if ((strcmp ("-", file_name)) == 0)
/* Search for tokens and when found, create primitive entries. */
void
-process ()
+DEFUN_VOID (process)
{
TOKEN_PROCESSOR processor;
*/
TOKEN_PROCESSOR
-scan ()
+DEFUN_VOID (scan)
{
register int c;
char compare_buffer [1024];
/* Output Routines */
void
-dump (check)
- boolean check;
+DEFUN (dump, (check),
+ boolean check)
{
register int max_index;
register int count;
}
void
-print_procedure (output, primitive_descriptor, error_string)
- FILE * output;
- struct descriptor * primitive_descriptor;
- char * error_string;
+DEFUN (print_procedure, (output, primitive_descriptor, error_string),
+ FILE * output AND
+ struct descriptor * primitive_descriptor AND
+ char * error_string)
{
fprintf (output, "SCHEME_OBJECT\n");
fprintf (output, "%s ()\n", (primitive_descriptor -> c_name));
}
void
-print_primitives (output, limit)
- FILE * output;
- register int limit;
+DEFUN (print_primitives, (output, limit),
+ FILE * output AND
+ register int limit)
{
register int last;
register int count;
}
void
-print_entry (output, index, primitive_descriptor)
- FILE * output;
- int index;
- struct descriptor * primitive_descriptor;
+DEFUN (print_entry, (output, index, primitive_descriptor),
+ FILE * output AND
+ int index AND
+ struct descriptor * primitive_descriptor)
{
int index_length;
}
void
-print_spaces (output, how_many)
- FILE * output;
- register int how_many;
+DEFUN (print_spaces, (output, how_many),
+ FILE * output AND
+ register int how_many)
{
while ((--how_many) >= 0)
putc (' ', output);
int token_buffer_length;
void
-initialize_token_buffer ()
+DEFUN_VOID (initialize_token_buffer)
{
token_buffer_length = 80;
token_buffer = (xmalloc (token_buffer_length));
}
void
-grow_token_buffer ()
+DEFUN_VOID (grow_token_buffer)
{
token_buffer_length *= 2;
token_buffer = (xrealloc (token_buffer, token_buffer_length));
};
void
-copy_token (target, size, token_type)
- char ** target;
- int * size;
- register enum tokentype token_type;
+DEFUN (copy_token, (target, size, token_type),
+ char ** target AND
+ int * size AND
+ register enum tokentype token_type)
{
register int c;
TOKEN_BUFFER_DECLS ();
}
boolean
-whitespace (c)
- register int c;
+DEFUN (whitespace, (c),
+ register int c)
{
switch (c)
{
}
void
-scan_to_token_start ()
+DEFUN_VOID (scan_to_token_start)
{
register int c;
}
void
-skip_token ()
+DEFUN_VOID (skip_token)
{
register int c;
}
\f
void
-initialize_data_buffer ()
+DEFUN_VOID (initialize_data_buffer)
{
buffer_length = 0x200;
buffer_index = 0;
}
void
-grow_data_buffer ()
+DEFUN_VOID (grow_data_buffer)
{
char * old_data_buffer = ((char *) data_buffer);
buffer_length *= 2;
data_buffer =
((struct descriptor (*) [])
- (xrealloc (data_buffer, (buffer_length * (sizeof (struct descriptor))))));
+ (xrealloc (((char *) data_buffer),
+ (buffer_length * (sizeof (struct descriptor))))));
{
register struct descriptor ** scan = result_buffer;
register struct descriptor ** end = (result_buffer + buffer_index);
}
result_buffer =
((struct descriptor **)
- (xrealloc (result_buffer,
+ (xrealloc (((char *) result_buffer),
(buffer_length * (sizeof (struct descriptor *))))));
return;
}
}
\f
void
-initialize_default ()
+DEFUN_VOID (initialize_default)
{
built_in_p = FALSE;
(token_array [0]) = (& (default_token [0]));
}
void
-initialize_external ()
+DEFUN_VOID (initialize_external)
{
built_in_p = FALSE;
(token_array [0]) = (& (external_token [0]));
}
void
-initialize_builtin (arg)
- char * arg;
+DEFUN (initialize_builtin, (arg),
+ char * arg)
{
register int length;
register int index;
}
void
-update_from_entry (primitive_descriptor)
- register struct descriptor * primitive_descriptor;
+DEFUN (update_from_entry, (primitive_descriptor),
+ register struct descriptor * primitive_descriptor)
{
register int temp;
}
pseudo_void
-create_normal_entry ()
+DEFUN_VOID (create_normal_entry)
{
MAYBE_GROW_BUFFER ();
COPY_C_NAME ((* data_buffer) [buffer_index]);
}
pseudo_void
-create_alternate_entry ()
+DEFUN_VOID (create_alternate_entry)
{
MAYBE_GROW_BUFFER ();
COPY_SCHEME_NAME ((* data_buffer) [buffer_index]);
}
pseudo_void
-create_builtin_entry ()
+DEFUN_VOID (create_builtin_entry)
{
struct descriptor desc;
register int length;
}
int
-read_index (arg, identification)
- char * arg;
- char * identification;
+DEFUN (read_index, (arg, identification),
+ char * arg AND
+ char * identification)
{
int result;
/* Sorting */
void
-sort ()
+DEFUN_VOID (sort)
{
register struct descriptor ** temp_buffer;
register int count;
}
void
-mergesort (low, high, array, temp_array)
- int low;
- register int high;
- register struct descriptor ** array;
- register struct descriptor ** temp_array;
+DEFUN (mergesort, (low, high, array, temp_array),
+ int low AND
+ register int high AND
+ register struct descriptor ** array AND
+ register struct descriptor ** temp_array)
{
register int index;
register int low1;
}
int
-compare_descriptors (d1, d2)
- struct descriptor * d1;
- struct descriptor * d2;
+DEFUN (compare_descriptors, (d1, d2),
+ struct descriptor * d1 AND
+ struct descriptor * d2)
{
int value;
}
int
-strcmp_ci (s1, s2)
- register char * s1;
- register char * s2;
+DEFUN (strcmp_ci, (s1, s2),
+ register char * s1 AND
+ register char * s2)
{
int length1 = (strlen (s1));
int length2 = (strlen (s2));