Mercurial > hg > xemacs-beta
comparison src/lread.c @ 4923:8ee3c10d1ed5
remove old no-longer-useful kludgy compiled-fun annotations hack
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-03 Ben Wing <ben@xemacs.org>
* alloc.c (Fmake_byte_code):
* lread.c:
* lread.c (readevalloop):
* lread.c (Fread):
* lread.c (Fread_from_string):
* lread.c (read_list_conser):
* lread.c (read_list):
* lread.c (vars_of_lread):
Remove the old kludgy stuff bracketed by `#ifdef
COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY'.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 03 Feb 2010 08:50:00 -0600 |
parents | 17362f371cc2 |
children | cbe181529c34 |
comparison
equal
deleted
inserted
replaced
4922:8934492a0e97 | 4923:8ee3c10d1ed5 |
---|---|
145 problems with recursive loading. */ | 145 problems with recursive loading. */ |
146 static Lisp_Object Vload_force_doc_string_list; | 146 static Lisp_Object Vload_force_doc_string_list; |
147 | 147 |
148 /* A resizing-buffer stream used to temporarily hold data while reading */ | 148 /* A resizing-buffer stream used to temporarily hold data while reading */ |
149 static Lisp_Object Vread_buffer_stream; | 149 static Lisp_Object Vread_buffer_stream; |
150 | |
151 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY | |
152 /* The stuff throughout this file that sets the following variable is | |
153 concerned with old-style .elc files that set up compiled functions using | |
154 | |
155 (fset 'fun #[... ...]) | |
156 | |
157 Where #[... ...] is a literal compiled-function object. We want the | |
158 name of the function to get stored as the annotation, so in a clever but | |
159 nastily kludgy fashion, we hack the code that reads lists so that if it | |
160 sees a symbol `fset' as the first argument, it stores the second argument | |
161 in Vcurrent_compiled_function_annotation, and then when the third | |
162 argument gets read and a compiled-function object created by a call to | |
163 Fmake_byte_code(), the stored annotation will get snarfed up. Elsewhere, | |
164 we reset Vcurrent_compiled_function_annotation to nil so it's not still | |
165 defined in case we have a #[... ...] in other circumstances -- in that | |
166 case we use the filename (Vload_file_name_internal). | |
167 | |
168 Now it's arguable that I should simply have hacked Ffset() | |
169 appropriately. This is all moot, however, be nowadays calls that set up | |
170 compiled functions look like | |
171 | |
172 (defalias 'fun #[... ...]) | |
173 | |
174 Where Fdefalias is like Ffset but sets up load-history for the function. | |
175 Hence it's exactly the right place to hack, and it's not even messy. | |
176 | |
177 When we're sure the annotation mechanism works the new way, delete all | |
178 this old nasty code. | |
179 | |
180 --ben 2-2-10 */ | |
181 Lisp_Object Vcurrent_compiled_function_annotation; | |
182 #endif | |
183 | 150 |
184 static int load_byte_code_version; | 151 static int load_byte_code_version; |
185 | 152 |
186 /* An array describing all known built-in structure types */ | 153 /* An array describing all known built-in structure types */ |
187 static structure_type_dynarr *the_structure_type_dynarr; | 154 static structure_type_dynarr *the_structure_type_dynarr; |
1478 READCHARFUN (which can be a stream) to Lisp. --hniksic */ | 1445 READCHARFUN (which can be a stream) to Lisp. --hniksic */ |
1479 /*specbind (Qstandard_input, readcharfun);*/ | 1446 /*specbind (Qstandard_input, readcharfun);*/ |
1480 | 1447 |
1481 internal_bind_lisp_object (&Vcurrent_load_list, Qnil); | 1448 internal_bind_lisp_object (&Vcurrent_load_list, Qnil); |
1482 | 1449 |
1483 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY | |
1484 Vcurrent_compiled_function_annotation = Qnil; | |
1485 #endif | |
1486 GCPRO2 (val, sourcename); | 1450 GCPRO2 (val, sourcename); |
1487 | 1451 |
1488 LOADHIST_ATTACH (sourcename); | 1452 LOADHIST_ATTACH (sourcename); |
1489 | 1453 |
1490 while (1) | 1454 while (1) |
1646 if (EQ (stream, Qt)) | 1610 if (EQ (stream, Qt)) |
1647 stream = Qread_char; | 1611 stream = Qread_char; |
1648 | 1612 |
1649 Vread_objects = Qnil; | 1613 Vread_objects = Qnil; |
1650 | 1614 |
1651 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY | |
1652 Vcurrent_compiled_function_annotation = Qnil; | |
1653 #endif | |
1654 if (EQ (stream, Qread_char)) | 1615 if (EQ (stream, Qread_char)) |
1655 { | 1616 { |
1656 Lisp_Object val = call1 (Qread_from_minibuffer, | 1617 Lisp_Object val = call1 (Qread_from_minibuffer, |
1657 build_msg_string ("Lisp expression: ")); | 1618 build_msg_string ("Lisp expression: ")); |
1658 return Fcar (Fread_from_string (val, Qnil, Qnil)); | 1619 return Fcar (Fread_from_string (val, Qnil, Qnil)); |
1675 Bytecount startval, endval; | 1636 Bytecount startval, endval; |
1676 Lisp_Object tem; | 1637 Lisp_Object tem; |
1677 Lisp_Object lispstream = Qnil; | 1638 Lisp_Object lispstream = Qnil; |
1678 struct gcpro gcpro1; | 1639 struct gcpro gcpro1; |
1679 | 1640 |
1680 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY | |
1681 Vcurrent_compiled_function_annotation = Qnil; | |
1682 #endif | |
1683 GCPRO1 (lispstream); | 1641 GCPRO1 (lispstream); |
1684 CHECK_STRING (string); | 1642 CHECK_STRING (string); |
1685 get_string_range_byte (string, start, end, &startval, &endval, | 1643 get_string_range_byte (string, start, end, &startval, &endval, |
1686 GB_HISTORICAL_STRING_BEHAVIOR); | 1644 GB_HISTORICAL_STRING_BEHAVIOR); |
1687 lispstream = make_lisp_string_input_stream (string, startval, | 1645 lispstream = make_lisp_string_input_stream (string, startval, |
3036 } | 2994 } |
3037 read_syntax_error (". in wrong context"); | 2995 read_syntax_error (". in wrong context"); |
3038 } | 2996 } |
3039 } | 2997 } |
3040 | 2998 |
3041 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY | |
3042 if (s->length == 1 && s->allow_dotted_lists && EQ (XCAR (s->head), Qfset)) | |
3043 { | |
3044 if (CONSP (elt) && EQ (XCAR (elt), Qquote) && CONSP (XCDR (elt))) | |
3045 Vcurrent_compiled_function_annotation = XCAR (XCDR (elt)); | |
3046 else | |
3047 Vcurrent_compiled_function_annotation = elt; | |
3048 } | |
3049 #endif | |
3050 | |
3051 elt = Fcons (elt, Qnil); | 2999 elt = Fcons (elt, Qnil); |
3052 if (!NILP (s->tail)) | 3000 if (!NILP (s->tail)) |
3053 XCDR (s->tail) = elt; | 3001 XCDR (s->tail) = elt; |
3054 else | 3002 else |
3055 s->head = elt; | 3003 s->head = elt; |
3081 int allow_dotted_lists, | 3029 int allow_dotted_lists, |
3082 int check_for_doc_references) | 3030 int check_for_doc_references) |
3083 { | 3031 { |
3084 struct read_list_state s; | 3032 struct read_list_state s; |
3085 struct gcpro gcpro1, gcpro2; | 3033 struct gcpro gcpro1, gcpro2; |
3086 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY | |
3087 Lisp_Object old_compiled_function_annotation = | |
3088 Vcurrent_compiled_function_annotation; | |
3089 #endif | |
3090 | 3034 |
3091 s.head = Qnil; | 3035 s.head = Qnil; |
3092 s.tail = Qnil; | 3036 s.tail = Qnil; |
3093 s.length = 0; | 3037 s.length = 0; |
3094 s.allow_dotted_lists = allow_dotted_lists; | 3038 s.allow_dotted_lists = allow_dotted_lists; |
3095 s.terminator = terminator; | 3039 s.terminator = terminator; |
3096 GCPRO2 (s.head, s.tail); | 3040 GCPRO2 (s.head, s.tail); |
3097 | 3041 |
3098 sequence_reader (readcharfun, terminator, &s, read_list_conser); | 3042 sequence_reader (readcharfun, terminator, &s, read_list_conser); |
3099 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY | |
3100 Vcurrent_compiled_function_annotation = old_compiled_function_annotation; | |
3101 #endif | |
3102 | 3043 |
3103 if ((purify_flag || load_force_doc_strings) && check_for_doc_references) | 3044 if ((purify_flag || load_force_doc_strings) && check_for_doc_references) |
3104 { | 3045 { |
3105 /* check now for any doc string references and record them | 3046 /* check now for any doc string references and record them |
3106 for later. */ | 3047 for later. */ |
3504 staticpro (&Vload_force_doc_string_list); | 3445 staticpro (&Vload_force_doc_string_list); |
3505 | 3446 |
3506 Vload_file_name_internal = Qnil; | 3447 Vload_file_name_internal = Qnil; |
3507 staticpro (&Vload_file_name_internal); | 3448 staticpro (&Vload_file_name_internal); |
3508 | 3449 |
3509 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY | |
3510 Vcurrent_compiled_function_annotation = Qnil; | |
3511 staticpro (&Vcurrent_compiled_function_annotation); | |
3512 #endif | |
3513 | |
3514 /* So that early-early stuff will work */ | 3450 /* So that early-early stuff will work */ |
3515 Ffset (Qload, Qload_internal); | 3451 Ffset (Qload, Qload_internal); |
3516 | 3452 |
3517 #ifdef FEATUREP_SYNTAX | 3453 #ifdef FEATUREP_SYNTAX |
3518 DEFSYMBOL (Qfeaturep); | 3454 DEFSYMBOL (Qfeaturep); |