On 4/1/06, John Cowan <[EMAIL PROTECTED]> wrote: > This is a feature request for Chicken. It's hopefully very simple to > implement, and it will be extremely useful for me, but it's a fairly deep > change to the system, and it will have impact on people who don't use it. > > I'd like to have an extra slot provided with each symbol that can contain > any Chicken object. Two primitive procedures (I propose symbol-slot > and symbol-slot-set!) will provide read and write access to the slot. > This will be very useful for implementing true property lists in my Lisp > 1.5 emulator and for other purposes in my Joy interpreter. >
Attached is a patch that _appears_ to work. It's against the current darcs HEAD and will definitely break when loading extensions or interfacing with code compiled with a different chicken. Adding an extra slot to symbols would be pretty handy, and would make it easy to implement different Lisps in chicken, but I wonder how much code depends on C_SIZEOF_SYMBOL being 3.... Anyway, give the patch a try, please. cheers, felix
diff -rN old-chicken/c-backend.scm new-chicken/c-backend.scm 702c702 < [(symbol? lit) 9] ; size of symbol, and possibly a bucket --- > [(symbol? lit) 10] ; size of symbol, and possibly a bucket diff -rN old-chicken/chicken.h new-chicken/chicken.h 359c359 < #define C_SIZEOF_SYMBOL 3 --- > #define C_SIZEOF_SYMBOL 4 diff -rN old-chicken/runtime.c new-chicken/runtime.c 1907,1908c1907,1908 < p += 3; < ((C_SCHEME_BLOCK *)sym)->header = C_SYMBOL_TYPE | 2; --- > p += C_SIZEOF_SYMBOL; > ((C_SCHEME_BLOCK *)sym)->header = C_SYMBOL_TYPE | (C_SIZEOF_SYMBOL - 1); 1910a1911 > C_set_block_item(sym, 2, C_SCHEME_UNDEFINED); 1969c1970 < node->header = C_PAIR_TYPE | 2; --- > node->header = C_PAIR_TYPE | (C_SIZEOF_PAIR - 1); 2191c2192 < *(p++) = C_PAIR_TYPE | 2; --- > *(p++) = C_PAIR_TYPE | (C_SIZEOF_PAIR - 1); 2205c2206 < *(p++) = C_PAIR_TYPE | 2; --- > *(p++) = C_PAIR_TYPE | (C_SIZEOF_PAIR - 1); 7454c7455 < C_word ab[ 3 ], *a = ab, --- > C_word ab[ C_SIZEOF_SYMBOL ], *a = ab, 7457c7458 < *(a++) = C_SYMBOL_TYPE | 2; --- > *(a++) = C_SYMBOL_TYPE | (C_SIZEOF_SYMBOL - 1); 7459c7460,7461 < *a = name; --- > *(a++) = name; > *(a++) = C_SCHEME_UNDEFINED;
_______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users