comparison src/print.c @ 5243:808131ba4a57

Print symbols with ratio-like names and the associated ratios distinctly. src/ChangeLog addition: 2010-08-15 Aidan Kehoe <kehoea@parhasard.net> * print.c (print_symbol): Escape any symbols that look like ratios, in the same way we do symbols that look like floats or integers. Prevents confusion in the Lisp reader. * lread.c (isratio_string): Make this available even on builds without HAVE_RATIO, so we can print symbols that look like ratios with the appropriate escapes. * lisp.h: Make isratio_string available even if HAVE_RATIO is not defined. tests/ChangeLog addition: 2010-08-15 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Test that symbols with names that look like ratios are printed distinctly from the equivalent ratios.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 15 Aug 2010 13:29:10 +0100
parents 71ee43b8a74d
children 2474dce7304e 308d34e9f07d
comparison
equal deleted inserted replaced
5242:f3eca926258e 5243:808131ba4a57
2025 else 2025 else
2026 goto not_yet_confused; 2026 goto not_yet_confused;
2027 2027
2028 for (; confusing < size; confusing++) 2028 for (; confusing < size; confusing++)
2029 { 2029 {
2030 if (!isdigit (data[confusing])) 2030 if (!isdigit (data[confusing]) && '/' != data[confusing])
2031 { 2031 {
2032 confusing = 0; 2032 confusing = 0;
2033 break; 2033 break;
2034 } 2034 }
2035 } 2035 }
2037 2037
2038 if (!confusing) 2038 if (!confusing)
2039 /* #### Ugh, this is needlessly complex and slow for what we 2039 /* #### Ugh, this is needlessly complex and slow for what we
2040 need here. It might be a good idea to copy equivalent code 2040 need here. It might be a good idea to copy equivalent code
2041 from FSF. --hniksic */ 2041 from FSF. --hniksic */
2042 confusing = isfloat_string ((char *) data); 2042 confusing = isfloat_string ((char *) data)
2043 || isratio_string ((char *) data);
2043 if (confusing) 2044 if (confusing)
2044 write_ascstring (printcharfun, "\\"); 2045 write_ascstring (printcharfun, "\\");
2045 } 2046 }
2046 2047
2047 { 2048 {