comparison src/fns.c @ 5510:6b3caa55668c

Remove the LOSING_BYTECODE compile-time option, it's been off since 1997. 2011-05-20 Aidan Kehoe <kehoea@parhasard.net> * config.h.in: * data.c (Faref): * fns.c (check_losing_bytecode): * fns.c (concat): * fns.c (Felt): Remove the LOSING_BYTECODE compile-time option entirely. It allowed access to the elements of a compiled function using #'aref, and has been turned off since 1997.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 20 May 2011 12:16:42 +0100
parents d3e0482c7899
children fa5fc2e3d9a6
comparison
equal deleted inserted replaced
5509:9ac0016d8fe8 5510:6b3caa55668c
834 return make_int (val); 834 return make_int (val);
835 } 835 }
836 836
837 /* Random data-structure functions */ 837 /* Random data-structure functions */
838 838
839 #ifdef LOSING_BYTECODE
840
841 /* #### Delete this shit */
842
843 /* Charcount is a misnomer here as we might be dealing with the
844 length of a vector or list, but emphasizes that we're not dealing
845 with Bytecounts in strings */
846 static Charcount
847 length_with_bytecode_hack (Lisp_Object seq)
848 {
849 if (!COMPILED_FUNCTIONP (seq))
850 return XINT (Flength (seq));
851 else
852 {
853 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (seq);
854
855 return (f->flags.interactivep ? COMPILED_INTERACTIVE :
856 f->flags.domainp ? COMPILED_DOMAIN :
857 COMPILED_DOC_STRING)
858 + 1;
859 }
860 }
861
862 #endif /* LOSING_BYTECODE */
863
864 void 839 void
865 check_losing_bytecode (const Ascbyte *function, Lisp_Object seq) 840 check_losing_bytecode (const Ascbyte *function, Lisp_Object seq)
866 { 841 {
867 if (COMPILED_FUNCTIONP (seq)) 842 if (COMPILED_FUNCTIONP (seq))
868 signal_ferror_with_frob 843 signal_ferror_with_frob
1651 Lisp_Object seq = args[argnum]; 1626 Lisp_Object seq = args[argnum];
1652 if (LISTP (seq)) 1627 if (LISTP (seq))
1653 ; 1628 ;
1654 else if (VECTORP (seq) || STRINGP (seq) || BIT_VECTORP (seq)) 1629 else if (VECTORP (seq) || STRINGP (seq) || BIT_VECTORP (seq))
1655 ; 1630 ;
1656 #ifdef LOSING_BYTECODE
1657 else if (COMPILED_FUNCTIONP (seq))
1658 /* Urk! We allow this, for "compatibility"... */
1659 ;
1660 #endif
1661 #if 0 /* removed for XEmacs 21 */ 1631 #if 0 /* removed for XEmacs 21 */
1662 else if (INTP (seq)) 1632 else if (INTP (seq))
1663 /* This is too revolting to think about but maintains 1633 /* This is too revolting to think about but maintains
1664 compatibility with FSF (and lots and lots of old code). */ 1634 compatibility with FSF (and lots and lots of old code). */
1665 args[argnum] = Fnumber_to_string (seq); 1635 args[argnum] = Fnumber_to_string (seq);
1685 with Bytecounts in strings */ 1655 with Bytecounts in strings */
1686 Charcount total_length; 1656 Charcount total_length;
1687 1657
1688 for (argnum = 0, total_length = 0; argnum < nargs; argnum++) 1658 for (argnum = 0, total_length = 0; argnum < nargs; argnum++)
1689 { 1659 {
1690 #ifdef LOSING_BYTECODE
1691 Charcount thislen = length_with_bytecode_hack (args[argnum]);
1692 #else
1693 Charcount thislen = XINT (Flength (args[argnum])); 1660 Charcount thislen = XINT (Flength (args[argnum]));
1694 #endif
1695 total_length += thislen; 1661 total_length += thislen;
1696 } 1662 }
1697 1663
1698 switch (target_type) 1664 switch (target_type)
1699 { 1665 {
1750 Ibyte *string_source_ptr = 0; 1716 Ibyte *string_source_ptr = 0;
1751 Ibyte *string_prev_result_ptr = string_result_ptr; 1717 Ibyte *string_prev_result_ptr = string_result_ptr;
1752 1718
1753 if (!CONSP (seq)) 1719 if (!CONSP (seq))
1754 { 1720 {
1755 #ifdef LOSING_BYTECODE
1756 thisleni = length_with_bytecode_hack (seq);
1757 #else
1758 thisleni = XINT (Flength (seq)); 1721 thisleni = XINT (Flength (seq));
1759 #endif
1760 } 1722 }
1761 if (STRINGP (seq)) 1723 if (STRINGP (seq))
1762 string_source_ptr = XSTRING_DATA (seq); 1724 string_source_ptr = XSTRING_DATA (seq);
1763 1725
1764 while (1) 1726 while (1)
2350 } 2312 }
2351 else if (STRINGP (sequence) || 2313 else if (STRINGP (sequence) ||
2352 VECTORP (sequence) || 2314 VECTORP (sequence) ||
2353 BIT_VECTORP (sequence)) 2315 BIT_VECTORP (sequence))
2354 return Faref (sequence, n); 2316 return Faref (sequence, n);
2355 #ifdef LOSING_BYTECODE
2356 else if (COMPILED_FUNCTIONP (sequence))
2357 {
2358 EMACS_INT idx = XINT (n);
2359 if (idx < 0)
2360 {
2361 lose:
2362 args_out_of_range (sequence, n);
2363 }
2364 /* Utter perversity */
2365 {
2366 Lisp_Compiled_Function *f = XCOMPILED_FUNCTION (sequence);
2367 switch (idx)
2368 {
2369 case COMPILED_ARGLIST:
2370 return compiled_function_arglist (f);
2371 case COMPILED_INSTRUCTIONS:
2372 return compiled_function_instructions (f);
2373 case COMPILED_CONSTANTS:
2374 return compiled_function_constants (f);
2375 case COMPILED_STACK_DEPTH:
2376 return compiled_function_stack_depth (f);
2377 case COMPILED_DOC_STRING:
2378 return compiled_function_documentation (f);
2379 case COMPILED_DOMAIN:
2380 return compiled_function_domain (f);
2381 case COMPILED_INTERACTIVE:
2382 if (f->flags.interactivep)
2383 return compiled_function_interactive (f);
2384 /* if we return nil, can't tell interactive with no args
2385 from noninteractive. */
2386 goto lose;
2387 default:
2388 goto lose;
2389 }
2390 }
2391 }
2392 #endif /* LOSING_BYTECODE */
2393 else 2317 else
2394 { 2318 {
2395 check_losing_bytecode ("elt", sequence); 2319 check_losing_bytecode ("elt", sequence);
2396 sequence = wrong_type_argument (Qsequencep, sequence); 2320 sequence = wrong_type_argument (Qsequencep, sequence);
2397 goto retry; 2321 goto retry;