Ignore:
Timestamp:
May 11, 2011, 1:26:11 AM (11 years ago)
Author:
Sam Hocevar
Message:

lisp: refactor Lisp spaces so that they are real objects, and get rid
of the unused USER_SPACE.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/lisp/lisp.h

    r560 r635  
    2121#define Cell void
    2222#define MAX_LISP_TOKEN_LEN 200
    23 enum { PERM_SPACE,
    24        TMP_SPACE,
    25        USER_SPACE,
    26        GC_SPACE };
    2723
    2824#define FIXED_TRIG_SIZE 360               // 360 degrees stored in table
     
    3329#define DEFINEDP(x) (x!=l_undefined)
    3430class bFILE;
    35 extern int current_space;
    3631extern bFILE *current_print_file;
    3732
     
    4540typedef uint32_t ltype;    // make sure structures aren't packed differently on various compiler
    4641                       // and sure that word, etc are word aligned
     42
     43class Lisp
     44{
     45public:
     46    static void Init();
     47    static void Uninit();
     48};
     49
     50struct LSpace
     51{
     52    size_t GetFree();
     53    void *Alloc(size_t size);
     54
     55    void *Mark();
     56    void Restore(void *val);
     57    void Clear();
     58
     59    static LSpace Tmp, Perm, Gc;
     60    static LSpace *Current;
     61
     62    uint8_t *m_data;
     63    uint8_t *m_free;
     64    char const *m_name;
     65    size_t m_size;
     66};
    4767
    4868struct LObject
     
    206226void perm_space();
    207227void tmp_space();
    208 void use_user_space(void *addr, long size);
    209228void *lpointer_value(void *lpointer);
    210229int32_t lnumber_value(void *lnumber);
     
    239258
    240259int end_of_program(char *s);
    241 void clear_tmp();
    242260void lisp_init();
    243261void lisp_uninit();
    244262
    245 extern uint8_t *space[4], *free_space[4];
    246 extern size_t space_size[4];
    247263void *nth(int num, void *list);
    248264int32_t lisp_atan2(int32_t dy, int32_t dx);
Note: See TracChangeset for help on using the changeset viewer.