From 4d193a4eb35b13005dc592e4211e37b2abc3f6c9 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Sat, 18 Jul 2015 21:51:53 -0400 Subject: [PATCH] Refactored and removed old cruft --- cyclone.h | 45 ++++++++++++--------------------------------- runtime-main.h | 2 +- runtime.c | 2 +- runtime.h | 6 +++--- 4 files changed, 17 insertions(+), 38 deletions(-) diff --git a/cyclone.h b/cyclone.h index 6bd65365..4db91a1e 100644 --- a/cyclone.h +++ b/cyclone.h @@ -6,8 +6,16 @@ * This file contains C types used by compiled programs. */ -#ifndef CYCLONE_H -#define CYCLONE_H +#ifndef CYCLONE_TYPES_H +#define CYCLONE_TYPES_H + +#include +#include +#include +#include +#include +#include +#include /* Debug GC flag */ #define DEBUG_GC 0 @@ -34,14 +42,6 @@ /* Define size of Lisp tags. Options are "short" or "long". */ typedef long tag_type; -#include -#include -#include -#include -#include -#include -#include - #ifndef CLOCKS_PER_SEC /* gcc doesn't define this, even though ANSI requires it in .. */ #define CLOCKS_PER_SEC 0 @@ -49,26 +49,13 @@ typedef long tag_type; #define longjmp _longjmp #endif -/* The following sparc hack is courtesy of Roger Critchlow. */ -/* It speeds up the output by more than a factor of THREE. */ -/* Do 'gcc -O -S cboyer13.c'; 'perlscript >cboyer.s'; 'gcc cboyer.s'. */ -#ifdef __GNUC__ -#ifdef sparc -#define never_returns __attribute__ ((noreturn)) -#else -#define never_returns /* __attribute__ ((noreturn)) */ -#endif -#else -#define never_returns /* __attribute__ ((noreturn)) */ -#endif - #if STACK_GROWS_DOWNWARD #define check_overflow(x,y) ((x) < (y)) #else #define check_overflow(x,y) ((x) > (y)) #endif -/* Define tag values. (I don't trust compilers to optimize enums.) */ +/* Define tag values. Could be an enum... */ #define cons_tag 0 #define symbol_tag 1 #define forward_tag 2 @@ -107,8 +94,6 @@ typedef void *object; values instead of objects (IE, pointer to a tagged object). On many machines, addresses are multiples of four, leaving the two least significant bits free - according to lisp in small pieces. - - experimenting with chars below: */ #define obj_is_char(x) ((unsigned long)(x) & (unsigned long)1) #define obj_obj2char(x) (char)((long)(x)>>1) @@ -133,10 +118,6 @@ typedef boolean_type *boolean; #define boolean_pname(x) (((boolean_type *) x)->pname) -/* #define defboolean(name,pname) \ - static boolean_type name##_boolean = {boolean_tag, #pname}; \ - static const object boolean_##name = &name##_boolean */ - /* Define symbol type. */ typedef struct {const tag_type tag; const char *pname; object plist;} symbol_type; @@ -228,8 +209,6 @@ typedef cons_type *list; #define make_cons(n,a,d) \ cons_type n; n.tag = cons_tag; n.cons_car = a; n.cons_cdr = d; -#define atom(x) ((x == NULL) || (((cons_type *) x)->tag != cons_tag)) - /* Closure types */ typedef struct {tag_type tag; function_type fn; int num_args; } closure0_type; @@ -294,4 +273,4 @@ typedef union { } common_type; -#endif /* CYCLONE_H */ +#endif /* CYCLONE_TYPES_H */ diff --git a/runtime-main.h b/runtime-main.h index 692cda27..5719576c 100644 --- a/runtime-main.h +++ b/runtime-main.h @@ -17,7 +17,7 @@ long global_heap_size = 0; static long long_arg(int argc,char **argv,char *name,long dval); static void c_entry_pt(int,closure,closure); -static void main_main(long stack_size,long heap_size,char *stack_base) never_returns; +static void main_main(long stack_size,long heap_size,char *stack_base); static void main_main (stack_size,heap_size,stack_base) long stack_size,heap_size; char *stack_base; diff --git a/runtime.c b/runtime.c index c7779d00..4ef858f9 100644 --- a/runtime.c +++ b/runtime.c @@ -1017,7 +1017,7 @@ object Cyc_integer2char(object n){ return obj_char2obj(val); } -void my_exit(closure) never_returns; +void my_exit(closure); void my_exit(env) closure env; { #if DEBUG_SHOW_DIAG printf("my_exit: heap bytes allocated=%d time=%ld ticks no_gcs=%ld no_m_gcs=%ld\n", diff --git a/runtime.h b/runtime.h index 58c36362..2cf50744 100644 --- a/runtime.h +++ b/runtime.h @@ -110,7 +110,7 @@ object Cyc_command_line_arguments(object cont); integer_type Cyc_system(object cmd); integer_type Cyc_char2integer(object chr); object Cyc_integer2char(object n); -void my_exit(closure) never_returns; +void my_exit(closure); object __halt(object obj); port_type Cyc_stdout(void); port_type Cyc_stdin(void); @@ -155,7 +155,7 @@ object equalp(object,object); object memberp(object,list); object memqp(object,list); char *transport(char *,int); -void GC(closure,object*,int) never_returns; +void GC(closure,object*,int); void Cyc_st_init(); void Cyc_st_add(char *frame); @@ -238,7 +238,7 @@ extern object gc_ans[NUM_GC_ANS]; /* argument for GC continuation closure. */ extern int gc_num_ans; extern jmp_buf jmp_main; /* Where to jump to. */ -/* Define the Lisp atoms that we need. */ +/* Define Lisp constants we need. */ extern const object boolean_t; extern const object boolean_f; extern const object quote_void;