mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Refactored and removed old cruft
This commit is contained in:
parent
ff49fd6796
commit
4d193a4eb3
4 changed files with 17 additions and 38 deletions
45
cyclone.h
45
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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
/* 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef CLOCKS_PER_SEC
|
||||
/* gcc doesn't define this, even though ANSI requires it in <time.h>.. */
|
||||
#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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue