From: Guillermo J. Rozas Date: Wed, 15 Jan 1992 17:14:12 +0000 (+0000) Subject: Protoize headers. X-Git-Tag: 20090517-FFI~9983 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=258186236485bee3cb14bd9fd93a15f1049cd927;p=mit-scheme.git Protoize headers. --- diff --git a/v7/src/microcode/cmpintmd/hppa.h b/v7/src/microcode/cmpintmd/hppa.h index 903a39362..2f6088dc6 100644 --- a/v7/src/microcode/cmpintmd/hppa.h +++ b/v7/src/microcode/cmpintmd/hppa.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/hppa.h,v 1.25 1991/10/29 22:55:11 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/hppa.h,v 1.26 1992/01/15 17:03:14 jinx Exp $ Copyright (c) 1989-1991 Massachusetts Institute of Technology @@ -88,8 +88,12 @@ typedef unsigned short format_word; instructions, an LDIL and a BLE instruction. */ -extern unsigned long hppa_extract_absolute_address (); -extern void hppa_store_absolute_address (); +extern unsigned long + EXFUN (hppa_extract_absolute_address, (unsigned long *)); + +extern void + EXFUN (hppa_store_absolute_address, + (unsigned long *, unsigned long, unsigned long)); #define EXTRACT_ABSOLUTE_ADDRESS(target, address) \ { \ @@ -260,14 +264,16 @@ DEFUN (hppa_store_absolute_address, (addr, sourcev, nullify_p), static struct pdc_cache_dump cache_info; -extern void EXFUN (flush_i_cache, (void)); -extern void EXFUN (push_d_cache_region, (PTR, unsigned long)); +extern void + EXFUN (flush_i_cache, (void)), + EXFUN (push_d_cache_region, (PTR, unsigned long)); void DEFUN_VOID (flush_i_cache) { - extern void EXFUN (cache_flush_all, - (unsigned int, struct pdc_cache_result *)); + extern void + EXFUN (cache_flush_all, (unsigned int, struct pdc_cache_result *)); + struct pdc_cache_result * cache_desc; cache_desc = ((struct pdc_cache_result *) &(cache_info.cache_format)); @@ -300,7 +306,9 @@ void DEFUN (push_d_cache_region, (start_address, block_size), PTR start_address AND unsigned long block_size) { - extern void EXFUN (cache_flush_region, (PTR, long, unsigned int)); + extern void + EXFUN (cache_flush_region, (PTR, long, unsigned int)); + struct pdc_cache_result * cache_desc; cache_desc = ((struct pdc_cache_result *) &(cache_info.cache_format)); @@ -518,9 +526,11 @@ procedures and continuations differ from closures) */ ((((SCHEME_OBJECT *) tramp) - TRAMPOLINE_BLOCK_TO_ENTRY) + \ (2 + TRAMPOLINE_ENTRY_SIZE)) -#define STORE_TRAMPOLINE_ENTRY(entry_address, index) \ +#define STORE_TRAMPOLINE_ENTRY(entry_address, index) do \ { \ - extern void cache_flush_region (); \ + extern void \ + EXFUN (cache_flush_region, (PTR, long, unsigned int)); \ + \ unsigned long *PC; \ \ PC = ((unsigned long *) (entry_address)); \ @@ -536,7 +546,7 @@ procedures and continuations differ from closures) */ (((unsigned long) (index)) << 1)); \ cache_flush_region (PC, (TRAMPOLINE_ENTRY_SIZE - 1), \ (I_CACHE | D_CACHE)); \ -} +} while (0) /* Execute cache entries. @@ -658,7 +668,8 @@ procedures and continuations differ from closures) */ #define FLUSH_I_CACHE() do \ { \ - extern void EXFUN (flush_i_cache, (void)); \ + extern void \ + EXFUN (flush_i_cache, (void)); \ \ flush_i_cache (); \ } while (0) @@ -670,7 +681,8 @@ procedures and continuations differ from closures) */ #define FLUSH_I_CACHE_REGION(address, nwords) do \ { \ - extern void EXFUN (cache_flush_region, (PTR, long, unsigned int)); \ + extern void \ + EXFUN (cache_flush_region, (PTR, long, unsigned int)); \ \ cache_flush_region (((PTR) (address)), ((long) (nwords)), \ (D_CACHE | I_CACHE)); \ @@ -683,7 +695,8 @@ procedures and continuations differ from closures) */ #define PUSH_D_CACHE_REGION(address, nwords) do \ { \ - extern void EXFUN (push_d_cache_region, (PTR, unsigned long)); \ + extern void \ + EXFUN (push_d_cache_region, (PTR, unsigned long)); \ \ push_d_cache_region (((PTR) (address)), \ ((unsigned long) (nwords))); \ @@ -763,7 +776,8 @@ void DEFUN (hppa_reset_hook, (table_length, utility_table), long table_length AND PTR * utility_table) { - extern void EXFUN (interface_initialize, (void)); + extern void + EXFUN (interface_initialize, (void)); flush_i_cache_initialize (); interface_initialize (); diff --git a/v7/src/microcode/cmpintmd/mc68k.h b/v7/src/microcode/cmpintmd/mc68k.h index 3070b3d00..1d2524000 100644 --- a/v7/src/microcode/cmpintmd/mc68k.h +++ b/v7/src/microcode/cmpintmd/mc68k.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/mc68k.h,v 1.27 1991/05/28 19:02:04 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/mc68k.h,v 1.28 1992/01/15 17:05:22 jinx Exp $ Copyright (c) 1989-1991 Massachusetts Institute of Technology @@ -88,10 +88,14 @@ procedures and continuations differ from closures) */ #define ENTRY_SKIPPED_CHECK_OFFSET 4 #define CLOSURE_SKIPPED_CHECK_OFFSET 10 -extern unsigned long hppa_extract_absolute_address (); -extern void hppa_store_absolute_address (); +/* The length of the GC recovery code that precedes an entry. + On the 68K a "jsr n(a6)" instruction. */ +#define ENTRY_PREFIX_LENGTH 4 + +/* Cache flushing. */ + #ifdef _NEXTOS extern void EXFUN (NeXT_cacheflush, (void)); @@ -260,8 +264,10 @@ DEFUN (operate_on_cache_region, It is used when interrupts are disabled, in order not to get into a loop. Note that if closure entry points were always longword-aligned, there would be no need for this nonsense. -extern void EXFUN (flush_i_cache, (void)); -extdo { \ + */ + +# define ADJUST_CLOSURE_AT_CALL(entry_point, location) \ +do { \ long magic_constant; \ \ magic_constant = (* ((long *) (((char *) (entry_point)) + 2))); \ diff --git a/v7/src/microcode/cmpintmd/vax.h b/v7/src/microcode/cmpintmd/vax.h index 6155a9b17..47a7003d7 100644 --- a/v7/src/microcode/cmpintmd/vax.h +++ b/v7/src/microcode/cmpintmd/vax.h @@ -1,6 +1,7 @@ /* -*-C-*- -$Header: /scheme/users/jinx/microcode/RCS/cmpint-hppa.h,v 1.24 1991/08/13 18:23:23 jinx Exp j@ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpintmd/vax.h,v 1.2 1992/01/15 17:07:18 jinx Exp $ + Copyright (c) 1991 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts diff --git a/v7/src/microcode/comlin.c b/v7/src/microcode/comlin.c index e69de29bb..a7481aea2 100644 --- a/v7/src/microcode/comlin.c +++ b/v7/src/microcode/comlin.c @@ -0,0 +1,332 @@ +/* -*-C-*- + +Copyright (c) 1987, 1988 Massachusetts Institute of Technology + +This material was developed by the Scheme project at the Massachusetts +Institute of Technology, Department of Electrical Engineering and +Computer Science. Permission to copy this software, to redistribute +it, and to use it for any purpose is granted, subject to the following +restrictions and understandings. + +1. Any copy made of this software must include this copyright notice +in full. + +2. Users of this software agree to make their best efforts (a) to +return to the MIT Scheme project any improvements or extensions that +they make, so that these may be included in future releases; and (b) +to inform MIT of noteworthy uses of this software. + +3. All materials developed as a consequence of the use of this +software shall duly acknowledge such use, in accordance with the usual +standards of acknowledging credit in academic research. + +4. MIT has made no warrantee or representation that the operation of +this software will be error-free, and MIT is under no obligation to +provide any services, by way of maintenance, update, or otherwise. + +5. In conjunction with products arising from the use of this material, +there shall be no use of the name of the Massachusetts Institute of +Technology nor of any adaptation thereof in any advertising, +promotional, or sales literature without prior written consent from +MIT in each case. */ + +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/comlin.c,v 1.5 1992/01/15 17:14:12 jinx Exp $ + * + * This file contains the scheme command parser. + * + */ + +#include +#ifndef toupper +#include +#endif + +#include "comlin.h" + +/* Some string utilities */ + +char * +DEFUN (remove_initial_substring, (sub, str), + register char * sub + AND register char * str) +{ + for ( ; *sub != '\0'; sub++, str++) + { + if (*sub != *str) + { + return ((char *) NULL); + } + } + return (str); +} + +boolean +DEFUN (STREQUAL, (s1, s2), + register char * s1 + AND register char * s2) +{ + for ( ; *s1 != '\0'; s1++, s2++) + { + if (toupper(*s1) != toupper(*s2)) + { + return (false); + } + } + return (*s2 == '\0'); +} + +/* Usage information */ + +void +DEFUN (print_usage_and_exit, (options, val), + struct keyword_struct * options + AND int val) +{ + register int i; + + fprintf(stderr, "usage: %s", program_name); + + if ((options[0].type_tag) == LAST_KYWRD) + { + fprintf(stderr, "\n"); + exit(val); + } + + fprintf(stderr, " [args]\n"); + fprintf(stderr, " where args are as follows:\n"); + + for (i = 0; + ((options[i].type_tag) != LAST_KYWRD); + i++) + { + switch (options[i].type_tag) + { + case BOOLEAN_KYWRD: + fprintf(stderr, " %s={true,false}\n", + options[i].keyword); + break; + + case INT_KYWRD: + case DOUBLE_KYWRD: + fprintf(stderr, " %s=%s\n", + options[i].keyword, options[i].format); + break; + + case STRING_KYWRD: + fprintf(stderr, " %s=%%s\n", + options[i].keyword); + break; + } + } + exit(val); +} + +void +DEFUN (supply, (options, j), + struct keyword_struct * options + AND int j) +{ + if (options[j].supplied_p != ((boolean *) NULL)) + { + if (*(options[j].supplied_p)) + { + fprintf(stderr, + "parse_keywords: Repeated keyword: %s\n", + options[j].keyword); + print_usage_and_exit(&options[0], 1); + } + else + { + *(options[j].supplied_p) = true; + } + } + return; +} + +char * program_name; + +/* This parser assumes that no keyword is an initial + substring of another. + */ + +void +DEFUN (parse_keywords, + (argc, argv, options, allow_others_p), + int argc + AND char **argv + AND struct keyword_struct * options + AND boolean allow_others_p) +{ + register int i, j, length; + char *argument; + + program_name = argv[0]; + argv += 1; + argc -= 1; + + /* Initialize defaults */ + + for (length = 0; + ((options[length].type_tag) != LAST_KYWRD); + length++) + { + if (options[length].supplied_p != ((boolean *) NULL)) + { + *(options[length].supplied_p) = false; + } + + switch (options[length].type_tag) + { + case BOOLEAN_KYWRD: + if (options[length].format != BFRMT) + { + fprintf(stderr, + "parse_keywords: format (%s) for boolean keyword %s\n", + options[length].format, + options[length].keyword); + exit(1); + } + break; + + case INT_KYWRD: + break; + + case DOUBLE_KYWRD: + break; + + case STRING_KYWRD: + if (options[length].format != SFRMT) + { + fprintf(stderr, + "parse_keywords: format (%s) for string keyword %s\n", + options[length].format, + options[length].keyword); + exit(1); + } + break; + + default: + fprintf(stderr, "parse_keywords: bad type %d\n", + options[length].type_tag); + exit(1); + } + } + + for (i = 0; i < argc; i++) + { + for (j = 0; j < length; j++) + { + argument = remove_initial_substring(options[j].keyword,argv[i]); + if (argument != ((char *) NULL)) + { + switch (options[j].type_tag) + { + + case BOOLEAN_KYWRD: + { + boolean value; + + if (*argument != '\0') + { + if (*argument != '=') + { + fprintf(stderr, + "parse_keywords: unrecognized parameter: %s\n", + argv[i]); + print_usage_and_exit(&options[0], 1); + } + else + { + argument = &argument[1]; + if (STREQUAL(argument,"t") || STREQUAL(argument,"true")) + { + value = true; + } + else if (STREQUAL(argument,"f") || + STREQUAL(argument,"false") || + STREQUAL(argument,"nil")) + { + value = false; + } + else + { + fprintf(stderr, + "parse_keywords: Invalid boolean value: %s\n", + argv[i]); + print_usage_and_exit(&options[0, 1]); + } + } + } + else + { + value = true; + } + supply(options, j); + *(BOOLEAN_LVALUE(options[j])) = value; + break; + } + + case INT_KYWRD: + if (*argument != '=') + { + { + fprintf(stderr, + "parse_keywords: %s: %s\n", + ((*argument == '\0') ? + "missing integer value" : + "unrecognized parameter"), + argv[i]); + print_usage_and_exit(&options[0], 1); + } + } + supply(options, j); + sscanf(&argument[1], options[j].format, INT_LVALUE(options[j])); + break; + + case DOUBLE_KYWRD: + if (*argument != '=') + { + { + fprintf(stderr, + "parse_keywords: %s: %s\n", + ((*argument == '\0') ? + "missing floating point value" : + "unrecognized parameter"), + argv[i]); + print_usage_and_exit(&options[0], 1); + } + } + supply(options, j); + sscanf(&argument[1], options[j].format, DOUBLE_LVALUE(options[j])); + break; + + case STRING_KYWRD: + if (*argument != '=') + { + { + fprintf(stderr, + "parse_keywords: %s: %s\n", + ((*argument == '\0') ? + "missing string value" : + "unrecognized parameter"), + argv[i]); + print_usage_and_exit(&options[0], 1); + } + } + supply(options, j); + *(STRING_LVALUE(options[j])) = &argument[1]; + break; + } + break; + } + } + if ((j >= length) && (!allow_others_p)) + { + fprintf(stderr, + "parse_keywords: unrecognized parameter: %s\n", + argv[i]); + print_usage_and_exit(&options[0], 1); + } + } + return; +} diff --git a/v7/src/microcode/comlin.h b/v7/src/microcode/comlin.h index 8ce543265..c5114137d 100644 --- a/v7/src/microcode/comlin.h +++ b/v7/src/microcode/comlin.h @@ -30,12 +30,17 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/comlin.h,v 1.2 1988/08/15 20:43:59 cph Rel $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/comlin.h,v 1.3 1992/01/15 17:11:26 jinx Exp $ * * This file contains definitions for the scheme command parser. * */ +#ifndef COMLIN_H_INCLUDED +#define COMLIN_H_INCLUDED + +#include "ansidecl.h" + #ifndef boolean #define boolean int #define true 1 @@ -86,5 +91,7 @@ struct keyword_struct extern char *program_name; -extern void parse_keywords(); +extern void EXFUN (parse_keywords, + (int, char **, struct keyword_struct *, boolean)); +#endif /* COMLIN_H_INCLUDED */ diff --git a/v8/src/microcode/cmpintmd/hppa.h b/v8/src/microcode/cmpintmd/hppa.h index c3f58bac0..4a5cb4cc4 100644 --- a/v8/src/microcode/cmpintmd/hppa.h +++ b/v8/src/microcode/cmpintmd/hppa.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpintmd/hppa.h,v 1.25 1991/10/29 22:55:11 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpintmd/hppa.h,v 1.26 1992/01/15 17:03:14 jinx Exp $ Copyright (c) 1989-1991 Massachusetts Institute of Technology @@ -88,8 +88,12 @@ typedef unsigned short format_word; instructions, an LDIL and a BLE instruction. */ -extern unsigned long hppa_extract_absolute_address (); -extern void hppa_store_absolute_address (); +extern unsigned long + EXFUN (hppa_extract_absolute_address, (unsigned long *)); + +extern void + EXFUN (hppa_store_absolute_address, + (unsigned long *, unsigned long, unsigned long)); #define EXTRACT_ABSOLUTE_ADDRESS(target, address) \ { \ @@ -260,14 +264,16 @@ DEFUN (hppa_store_absolute_address, (addr, sourcev, nullify_p), static struct pdc_cache_dump cache_info; -extern void EXFUN (flush_i_cache, (void)); -extern void EXFUN (push_d_cache_region, (PTR, unsigned long)); +extern void + EXFUN (flush_i_cache, (void)), + EXFUN (push_d_cache_region, (PTR, unsigned long)); void DEFUN_VOID (flush_i_cache) { - extern void EXFUN (cache_flush_all, - (unsigned int, struct pdc_cache_result *)); + extern void + EXFUN (cache_flush_all, (unsigned int, struct pdc_cache_result *)); + struct pdc_cache_result * cache_desc; cache_desc = ((struct pdc_cache_result *) &(cache_info.cache_format)); @@ -300,7 +306,9 @@ void DEFUN (push_d_cache_region, (start_address, block_size), PTR start_address AND unsigned long block_size) { - extern void EXFUN (cache_flush_region, (PTR, long, unsigned int)); + extern void + EXFUN (cache_flush_region, (PTR, long, unsigned int)); + struct pdc_cache_result * cache_desc; cache_desc = ((struct pdc_cache_result *) &(cache_info.cache_format)); @@ -518,9 +526,11 @@ procedures and continuations differ from closures) */ ((((SCHEME_OBJECT *) tramp) - TRAMPOLINE_BLOCK_TO_ENTRY) + \ (2 + TRAMPOLINE_ENTRY_SIZE)) -#define STORE_TRAMPOLINE_ENTRY(entry_address, index) \ +#define STORE_TRAMPOLINE_ENTRY(entry_address, index) do \ { \ - extern void cache_flush_region (); \ + extern void \ + EXFUN (cache_flush_region, (PTR, long, unsigned int)); \ + \ unsigned long *PC; \ \ PC = ((unsigned long *) (entry_address)); \ @@ -536,7 +546,7 @@ procedures and continuations differ from closures) */ (((unsigned long) (index)) << 1)); \ cache_flush_region (PC, (TRAMPOLINE_ENTRY_SIZE - 1), \ (I_CACHE | D_CACHE)); \ -} +} while (0) /* Execute cache entries. @@ -658,7 +668,8 @@ procedures and continuations differ from closures) */ #define FLUSH_I_CACHE() do \ { \ - extern void EXFUN (flush_i_cache, (void)); \ + extern void \ + EXFUN (flush_i_cache, (void)); \ \ flush_i_cache (); \ } while (0) @@ -670,7 +681,8 @@ procedures and continuations differ from closures) */ #define FLUSH_I_CACHE_REGION(address, nwords) do \ { \ - extern void EXFUN (cache_flush_region, (PTR, long, unsigned int)); \ + extern void \ + EXFUN (cache_flush_region, (PTR, long, unsigned int)); \ \ cache_flush_region (((PTR) (address)), ((long) (nwords)), \ (D_CACHE | I_CACHE)); \ @@ -683,7 +695,8 @@ procedures and continuations differ from closures) */ #define PUSH_D_CACHE_REGION(address, nwords) do \ { \ - extern void EXFUN (push_d_cache_region, (PTR, unsigned long)); \ + extern void \ + EXFUN (push_d_cache_region, (PTR, unsigned long)); \ \ push_d_cache_region (((PTR) (address)), \ ((unsigned long) (nwords))); \ @@ -763,7 +776,8 @@ void DEFUN (hppa_reset_hook, (table_length, utility_table), long table_length AND PTR * utility_table) { - extern void EXFUN (interface_initialize, (void)); + extern void + EXFUN (interface_initialize, (void)); flush_i_cache_initialize (); interface_initialize ();