diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-10-09 21:45:51 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-10-09 21:45:51 -0700 |
commit | 889501071aeae561b026fc298e0442d2ef4e433f (patch) | |
tree | 21441698c9bfa98d227790c5ec5ec0b0c9fdd29a | |
parent | c318e1c4bc5dbdb1dbec46bd8962e20d5654de54 (diff) | |
download | txr-889501071aeae561b026fc298e0442d2ef4e433f.tar.gz txr-889501071aeae561b026fc298e0442d2ef4e433f.tar.bz2 txr-889501071aeae561b026fc298e0442d2ef4e433f.zip |
Ported to Cygwin.
TODO: there should be some type safety with the new wli macro
so that if it is forgotten, there will be a diagnostic.
* configure (lit_align): New configuration variable
and configuration test. Generates LIT_ALIGN in config.h.
Fixed the integer-holds-pointer test for the different output
from the nm program on Cygwin. The arrays become common symbols
marked C which do not show an offset attribute, only size:
one less column.
* filter.c (to_html_table, from_html_table): wrap wide string
literals with the wli macro. This must be done from now on for
all literals and initializes of arrays that are going to be
directly converted to type tagged val-s.
* lib.h (wli): New macro.
(auto_str, static_str, litptr, lit_noex): Handle wide literals on
platforms where they are aligned to only two bytes, such that we don't
have two bits in the pointer. We can still add our 11 bit type tag, but
then when recovering the pointer to the data, we have may have
to fix up the pointer.
* parser.l: Another portability issue here. Flex generates a scanner
which has #include <unistd.h> in the middle, after the source file's
own #includes which can introduce macros. On Cygwin, there is some
hygiene problem whereby our "noreturn" macro causes the <unistd.h>
header to generate bad syntax and fail to compile. Stupid Cygwin
and even stupider flex! The workaround is to include <unistd.h>
at the top in the flex source.
* stream.c (string_out_put_char): This is one more place where
the string literal handling hack spreads.
* txr.c (version): Wrap string in wli.
-rw-r--r-- | ChangeLog | 39 | ||||
-rwxr-xr-x | configure | 85 | ||||
-rw-r--r-- | filter.c | 516 | ||||
-rw-r--r-- | lib.h | 24 | ||||
-rw-r--r-- | parser.l | 1 | ||||
-rw-r--r-- | stream.c | 7 | ||||
-rw-r--r-- | txr.c | 2 |
7 files changed, 414 insertions, 260 deletions
@@ -1,5 +1,44 @@ 2011-10-09 Kaz Kylheku <kaz@kylheku.com> + Ported to Cygwin. + + TODO: there should be some type safety with the new wli macro + so that if it is forgotten, there will be a diagnostic. + + * configure (lit_align): New configuration variable + and configuration test. Generates LIT_ALIGN in config.h. + Fixed the integer-holds-pointer test for the different output + from the nm program on Cygwin. The arrays become common symbols + marked C which do not show an offset attribute, only size: + one less column. + + * filter.c (to_html_table, from_html_table): wrap wide string + literals with the wli macro. This must be done from now on for + all literals and initializes of arrays that are going to be + directly converted to type tagged val-s. + + * lib.h (wli): New macro. + (auto_str, static_str, litptr, lit_noex): Handle wide literals on + platforms where they are aligned to only two bytes, such that we don't + have two bits in the pointer. We can still add our 11 bit type tag, but + then when recovering the pointer to the data, we have may have + to fix up the pointer. + + * parser.l: Another portability issue here. Flex generates a scanner + which has #include <unistd.h> in the middle, after the source file's + own #includes which can introduce macros. On Cygwin, there is some + hygiene problem whereby our "noreturn" macro causes the <unistd.h> + header to generate bad syntax and fail to compile. Stupid Cygwin + and even stupider flex! The workaround is to include <unistd.h> + at the top in the flex source. + + * stream.c (string_out_put_char): This is one more place where + the string literal handling hack spreads. + + * txr.c (version): Wrap string in wli. + +2011-10-09 Kaz Kylheku <kaz@kylheku.com> + * dep.mk: Regenerated. Too easy to neglect this file. 2011-10-09 Kaz Kylheku <kaz@kylheku.com> @@ -230,6 +230,15 @@ intptr [$intptr] value can be converted to it. If this is blank, the configure script will try to auto detect it. +lit_align [$lit_align] + + Specifies alignment for wide string literals. This is guessed + from the size of the wchar_t type. If your wchar_t type is two byte wide, but + wide literals are aligned to four bytes, then you should specify this. This + will eliminate some kludges in the program. There is no easy way to check + for this withut generating and running a C program, which is unfriendly + for cross-compiling! + inline [$inline] Specifies the syntax for defining an inline function, in such @@ -620,7 +629,15 @@ char sizeof_longlong_t[sizeof (longlong_t)]; while read symbol type offset size ; do eval "size=$(( 0$size + 0 ))" - eval $(printf "%s=%d\n" "$symbol" "$size") + symbol=${symbol#_} + if [ $type == "C" ] ; then + size=$offset + fi + case "$symbol" in + sizeof* ) + eval $(printf "%s=%d\n" "$symbol" "$size") + ;; + esac done < conftest.syms rm -f conftest.syms conftest.o @@ -652,6 +669,68 @@ intptr_max_expr="((((($intptr) 1 << $((sizeof_ptr * 8 - 2))) - 1) << 1) + 1)" printf "#define INT_PTR_MAX %s\n" "$intptr_max_expr" >> config.h printf "#define INT_PTR_MIN (-INT_PTR_MAX)\n" >> config.h +# +# Alignment of wchar_t +# +# What we really want to know is the alignment of wide string literals +# like L"wide literal". +# +# We make pessimistic assumption that the size of the wchar_t type is this +# alignment. +# +# There is no easy way to get the information without running a compiled +# program. +# + +printf "Conservatively guessing the alignment of wide literals ... " + +if [ -z "$lit_align" ] ; then + cat > conftest.c <<! +#include <wchar.h> +char sizeof_wchar_t[sizeof (wchar_t)]; +! + rm -f conftest.o conftest.syms + + if ! make conftest.syms > conftest.err 2>&1 ; then + printf "failed\n\n" + + printf "Errors from compilation: \n\n" + cat conftest.err + exit 1 + fi + + sizeof_wchar_t=0 + + while read symbol type offset size ; do + eval "size=$(( 0$size + 0 ))" + symbol=${symbol#_} + if [ $type == "C" ] ; then + size=$offset + fi + case "$symbol" in + sizeof* ) + eval $(printf "%s=%d\n" "$symbol" "$size") + ;; + esac + done < conftest.syms + + rm -f conftest.syms conftest.o + + if [ $sizeof_wchar_t -eq 0 ] ; then + printf "failed\n" + exit 1 + fi + + lit_align=$sizeof_wchar_t +fi + +printf "%d\n" "$lit_align" +printf "#define LIT_ALIGN %d\n" "$lit_align" >> config.h + +# +# Inline functions +# + printf "Checking how to declare inline functions ... " if [ -z "$inline" ] ; then @@ -687,6 +766,10 @@ fi printf '"%s"\n' "$inline" printf "#define INLINE $inline\n" >> config.h +# +# Valgrind +# + if [ -n "$valgrind" ] ; then printf "Checking valgrind API availability ... " @@ -218,268 +218,268 @@ val register_filter(val sym, val table) } static struct filter_pair to_html_table[] = { - { L"<", L"<" }, - { L">", L">" }, - { L"&", L"&" }, - { L"\"", L""" }, + { wli("<"), wli("<") }, + { wli(">"), wli(">") }, + { wli("&"), wli("&") }, + { wli("\""), wli(""") }, { 0, 0 } }; static struct filter_pair from_html_table[] = { - { L""", L"\"" }, - { L"&", L"&" }, - { L"'", L"'" }, - { L"<", L"<" }, - { L">", L">" }, - { L" ", L"\x00A0" }, - { L"¡", L"\x00A1" }, - { L"¢", L"\x00A2" }, - { L"£", L"\x00A3" }, - { L"¤", L"\x00A4" }, - { L"¥", L"\x00A5" }, - { L"¦", L"\x00A6" }, - { L"§", L"\x00A7" }, - { L"¨", L"\x00A8" }, - { L"©", L"\x00A9" }, - { L"ª", L"\x00AA" }, - { L"«", L"\x00AB" }, - { L"¬", L"\x00AC" }, - { L"­", L"\x00AD" }, - { L"®", L"\x00AE" }, - { L"¯", L"\x00AF" }, - { L"°", L"\x00B0" }, - { L"±", L"\x00B1" }, - { L"²", L"\x00B2" }, - { L"³", L"\x00B3" }, - { L"´", L"\x00B4" }, - { L"µ", L"\x00B5" }, - { L"¶", L"\x00B6" }, - { L"·", L"\x00B7" }, - { L"¸", L"\x00B8" }, - { L"¹", L"\x00B9" }, - { L"º", L"\x00BA" }, - { L"»", L"\x00BB" }, - { L"¼", L"\x00BC" }, - { L"½", L"\x00BD" }, - { L"¾", L"\x00BE" }, - { L"¿", L"\x00BF" }, - { L"À", L"\x00C0" }, - { L"Á", L"\x00C1" }, - { L"Â", L"\x00C2" }, - { L"Ã", L"\x00C3" }, - { L"Ä", L"\x00C4" }, - { L"Å", L"\x00C5" }, - { L"Æ", L"\x00C6" }, - { L"Ç", L"\x00C7" }, - { L"È", L"\x00C8" }, - { L"É", L"\x00C9" }, - { L"Ê", L"\x00CA" }, - { L"Ë", L"\x00CB" }, - { L"Ì", L"\x00CC" }, - { L"Í", L"\x00CD" }, - { L"Î", L"\x00CE" }, - { L"Ï", L"\x00CF" }, - { L"Ð", L"\x00D0" }, - { L"Ñ", L"\x00D1" }, - { L"Ò", L"\x00D2" }, - { L"Ó", L"\x00D3" }, - { L"Ô", L"\x00D4" }, - { L"Õ", L"\x00D5" }, - { L"Ö", L"\x00D6" }, - { L"×", L"\x00D7" }, - { L"Ø", L"\x00D8" }, - { L"Ù", L"\x00D9" }, - { L"Ú", L"\x00DA" }, - { L"Û", L"\x00DB" }, - { L"Ü", L"\x00DC" }, - { L"Ý", L"\x00DD" }, - { L"Þ", L"\x00DE" }, - { L"ß", L"\x00DF" }, - { L"à", L"\x00E0" }, - { L"á", L"\x00E1" }, - { L"â", L"\x00E2" }, - { L"ã", L"\x00E3" }, - { L"ä", L"\x00E4" }, - { L"å", L"\x00E5" }, - { L"æ", L"\x00E6" }, - { L"ç", L"\x00E7" }, - { L"è", L"\x00E8" }, - { L"é", L"\x00E9" }, - { L"ê", L"\x00EA" }, - { L"ë", L"\x00EB" }, - { L"ì", L"\x00EC" }, - { L"í", L"\x00ED" }, - { L"î", L"\x00EE" }, - { L"ï", L"\x00EF" }, - { L"ð", L"\x00F0" }, - { L"ñ", L"\x00F1" }, - { L"ò", L"\x00F2" }, - { L"ó", L"\x00F3" }, - { L"ô", L"\x00F4" }, - { L"õ", L"\x00F5" }, - { L"ö", L"\x00F6" }, - { L"÷", L"\x00F7" }, - { L"ø", L"\x00F8" }, - { L"ù", L"\x00F9" }, - { L"ú", L"\x00FA" }, - { L"û", L"\x00FB" }, - { L"ü", L"\x00FC" }, - { L"ý", L"\x00FD" }, - { L"þ", L"\x00FE" }, - { L"ÿ", L"\x00FF" }, - { L"Œ", L"\x0152" }, - { L"œ", L"\x0153" }, - { L"Š", L"\x0160" }, - { L"š", L"\x0161" }, - { L"Ÿ", L"\x0178" }, - { L"ƒ", L"\x0192" }, - { L"ˆ", L"\x02C6" }, - { L"˜", L"\x02DC" }, - { L"Α", L"\x0391" }, - { L"Β", L"\x0392" }, - { L"Γ", L"\x0393" }, - { L"Δ", L"\x0394" }, - { L"Ε", L"\x0395" }, - { L"Ζ", L"\x0396" }, - { L"Η", L"\x0397" }, - { L"Θ", L"\x0398" }, - { L"Ι", L"\x0399" }, - { L"Κ", L"\x039A" }, - { L"Λ", L"\x039B" }, - { L"Μ", L"\x039C" }, - { L"Ν", L"\x039D" }, - { L"Ξ", L"\x039E" }, - { L"Ο", L"\x039F" }, - { L"Π", L"\x03A0" }, - { L"Ρ", L"\x03A1" }, - { L"Σ", L"\x03A3" }, - { L"Τ", L"\x03A4" }, - { L"Υ", L"\x03A5" }, - { L"Φ", L"\x03A6" }, - { L"Χ", L"\x03A7" }, - { L"Ψ", L"\x03A8" }, - { L"Ω", L"\x03A9" }, - { L"α", L"\x03B1" }, - { L"β", L"\x03B2" }, - { L"γ", L"\x03B3" }, - { L"δ", L"\x03B4" }, - { L"ε", L"\x03B5" }, - { L"ζ", L"\x03B6" }, - { L"η", L"\x03B7" }, - { L"θ", L"\x03B8" }, - { L"ι", L"\x03B9" }, - { L"κ", L"\x03BA" }, - { L"λ", L"\x03BB" }, - { L"μ", L"\x03BC" }, - { L"ν", L"\x03BD" }, - { L"ξ", L"\x03BE" }, - { L"ο", L"\x03BF" }, - { L"π", L"\x03C0" }, - { L"ρ", L"\x03C1" }, - { L"ς", L"\x03C2" }, - { L"σ", L"\x03C3" }, - { L"τ", L"\x03C4" }, - { L"υ", L"\x03C5" }, - { L"φ", L"\x03C6" }, - { L"χ", L"\x03C7" }, - { L"ψ", L"\x03C8" }, - { L"ω", L"\x03C9" }, - { L"ϑ", L"\x03D1" }, - { L"ϒ", L"\x03D2" }, - { L"ϖ", L"\x03D6" }, - { L" ", L"\x2002" }, - { L" ", L"\x2003" }, - { L" ", L"\x2009" }, - { L"‌", L"\x200C" }, - { L"‍", L"\x200D" }, - { L"‎", L"\x200E" }, - { L"‏", L"\x200F" }, - { L"–", L"\x2013" }, - { L"—", L"\x2014" }, - { L"‘", L"\x2018" }, - { L"’", L"\x2019" }, - { L"‚", L"\x201A" }, - { L"“", L"\x201C" }, - { L"”", L"\x201D" }, - { L"„", L"\x201E" }, - { L"†", L"\x2020" }, - { L"‡", L"\x2021" }, - { L"•", L"\x2022" }, - { L"…", L"\x2026" }, - { L"‰", L"\x2030" }, - { L"′", L"\x2032" }, - { L"″", L"\x2033" }, - { L"‹", L"\x2039" }, - { L"›", L"\x203A" }, - { L"‾", L"\x203E" }, - { L"⁄", L"\x2044" }, - { L"€", L"\x20AC" }, - { L"ℑ", L"\x2111" }, - { L"℘", L"\x2118" }, - { L"ℜ", L"\x211C" }, - { L"™", L"\x2122" }, - { L"ℵ", L"\x2135" }, - { L"←", L"\x2190" }, - { L"↑", L"\x2191" }, - { L"→", L"\x2192" }, - { L"↓", L"\x2193" }, - { L"↔", L"\x2194" }, - { L"↵", L"\x21B5" }, - { L"⇐", L"\x21D0" }, - { L"⇑", L"\x21D1" }, - { L"⇒", L"\x21D2" }, - { L"⇓", L"\x21D3" }, - { L"⇔", L"\x21D4" }, - { L"∀", L"\x2200" }, - { L"∂", L"\x2202" }, - { L"∃", L"\x2203" }, - { L"∅", L"\x2205" }, - { L"∇", L"\x2207" }, - { L"∈", L"\x2208" }, - { L"∉", L"\x2209" }, - { L"∋", L"\x220B" }, - { L"∏", L"\x220F" }, - { L"∑", L"\x2211" }, - { L"−", L"\x2212" }, - { L"∗", L"\x2217" }, - { L"√", L"\x221A" }, - { L"∝", L"\x221D" }, - { L"∞", L"\x221E" }, - { L"∠", L"\x2220" }, - { L"∧", L"\x2227" }, - { L"∨", L"\x2228" }, - { L"∩", L"\x2229" }, - { L"∪", L"\x222A" }, - { L"∫", L"\x222B" }, - { L"∴", L"\x2234" }, - { L"∼", L"\x223C" }, - { L"≅", L"\x2245" }, - { L"≈", L"\x2248" }, - { L"≠", L"\x2260" }, - { L"≡", L"\x2261" }, - { L"≤", L"\x2264" }, - { L"≥", L"\x2265" }, - { L"⊂", L"\x2282" }, - { L"⊃", L"\x2283" }, - { L"⊄", L"\x2284" }, - { L"⊆", L"\x2286" }, - { L"⊇", L"\x2287" }, - { L"⊕", L"\x2295" }, - { L"⊗", L"\x2297" }, - { L"⊥", L"\x22A5" }, - { L"⋅", L"\x22C5" }, - { L"⌈", L"\x2308" }, - { L"⌉", L"\x2309" }, - { L"⌊", L"\x230A" }, - { L"⌋", L"\x230B" }, - { L"⟨", L"\x2329" }, - { L"⟩", L"\x232A" }, - { L"◊", L"\x25CA" }, - { L"♠", L"\x2660" }, - { L"♣", L"\x2663" }, - { L"♥", L"\x2665" }, - { L"♦", L"\x2666" }, - { 0, 0 } + { wli("""), wli("\"") }, + { wli("&"), wli("&") }, + { wli("'"), wli("'") }, + { wli("<"), wli("<") }, + { wli(">"), wli(">") }, + { wli(" "), wli("\x00A0") }, + { wli("¡"), wli("\x00A1") }, + { wli("¢"), wli("\x00A2") }, + { wli("£"), wli("\x00A3") }, + { wli("¤"), wli("\x00A4") }, + { wli("¥"), wli("\x00A5") }, + { wli("¦"), wli("\x00A6") }, + { wli("§"), wli("\x00A7") }, + { wli("¨"), wli("\x00A8") }, + { wli("©"), wli("\x00A9") }, + { wli("ª"), wli("\x00AA") }, + { wli("«"), wli("\x00AB") }, + { wli("¬"), wli("\x00AC") }, + { wli("­"), wli("\x00AD") }, + { wli("®"), wli("\x00AE") }, + { wli("¯"), wli("\x00AF") }, + { wli("°"), wli("\x00B0") }, + { wli("±"), wli("\x00B1") }, + { wli("²"), wli("\x00B2") }, + { wli("³"), wli("\x00B3") }, + { wli("´"), wli("\x00B4") }, + { wli("µ"), wli("\x00B5") }, + { wli("¶"), wli("\x00B6") }, + { wli("·"), wli("\x00B7") }, + { wli("¸"), wli("\x00B8") }, + { wli("¹"), wli("\x00B9") }, + { wli("º"), wli("\x00BA") }, + { wli("»"), wli("\x00BB") }, + { wli("¼"), wli("\x00BC") }, + { wli("½"), wli("\x00BD") }, + { wli("¾"), wli("\x00BE") }, + { wli("¿"), wli("\x00BF") }, + { wli("À"), wli("\x00C0") }, + { wli("Á"), wli("\x00C1") }, + { wli("Â"), wli("\x00C2") }, + { wli("Ã"), wli("\x00C3") }, + { wli("Ä"), wli("\x00C4") }, + { wli("Å"), wli("\x00C5") }, + { wli("Æ"), wli("\x00C6") }, + { wli("Ç"), wli("\x00C7") }, + { wli("È"), wli("\x00C8") }, + { wli("É"), wli("\x00C9") }, + { wli("Ê"), wli("\x00CA") }, + { wli("Ë"), wli("\x00CB") }, + { wli("Ì"), wli("\x00CC") }, + { wli("Í"), wli("\x00CD") }, + { wli("Î"), wli("\x00CE") }, + { wli("Ï"), wli("\x00CF") }, + { wli("Ð"), wli("\x00D0") }, + { wli("Ñ"), wli("\x00D1") }, + { wli("Ò"), wli("\x00D2") }, + { wli("Ó"), wli("\x00D3") }, + { wli("Ô"), wli("\x00D4") }, + { wli("Õ"), wli("\x00D5") }, + { wli("Ö"), wli("\x00D6") }, + { wli("×"), wli("\x00D7") }, + { wli("Ø"), wli("\x00D8") }, + { wli("Ù"), wli("\x00D9") }, + { wli("Ú"), wli("\x00DA") }, + { wli("Û"), wli("\x00DB") }, + { wli("Ü"), wli("\x00DC") }, + { wli("Ý"), wli("\x00DD") }, + { wli("Þ"), wli("\x00DE") }, + { wli("ß"), wli("\x00DF") }, + { wli("à"), wli("\x00E0") }, + { wli("á"), wli("\x00E1") }, + { wli("â"), wli("\x00E2") }, + { wli("ã"), wli("\x00E3") }, + { wli("ä"), wli("\x00E4") }, + { wli("å"), wli("\x00E5") }, + { wli("æ"), wli("\x00E6") }, + { wli("ç"), wli("\x00E7") }, + { wli("è"), wli("\x00E8") }, + { wli("é"), wli("\x00E9") }, + { wli("ê"), wli("\x00EA") }, + { wli("ë"), wli("\x00EB") }, + { wli("ì"), wli("\x00EC") }, + { wli("í"), wli("\x00ED") }, + { wli("î"), wli("\x00EE") }, + { wli("ï"), wli("\x00EF") }, + { wli("ð"), wli("\x00F0") }, + { wli("ñ"), wli("\x00F1") }, + { wli("ò"), wli("\x00F2") }, + { wli("ó"), wli("\x00F3") }, + { wli("ô"), wli("\x00F4") }, + { wli("õ"), wli("\x00F5") }, + { wli("ö"), wli("\x00F6") }, + { wli("÷"), wli("\x00F7") }, + { wli("ø"), wli("\x00F8") }, + { wli("ù"), wli("\x00F9") }, + { wli("ú"), wli("\x00FA") }, + { wli("û"), wli("\x00FB") }, + { wli("ü"), wli("\x00FC") }, + { wli("ý"), wli("\x00FD") }, + { wli("þ"), wli("\x00FE") }, + { wli("ÿ"), wli("\x00FF") }, + { wli("Œ"), wli("\x0152") }, + { wli("œ"), wli("\x0153") }, + { wli("Š"), wli("\x0160") }, + { wli("š"), wli("\x0161") }, + { wli("Ÿ"), wli("\x0178") }, + { wli("ƒ"), wli("\x0192") }, + { wli("ˆ"), wli("\x02C6") }, + { wli("˜"), wli("\x02DC") }, + { wli("Α"), wli("\x0391") }, + { wli("Β"), wli("\x0392") }, + { wli("Γ"), wli("\x0393") }, + { wli("Δ"), wli("\x0394") }, + { wli("Ε"), wli("\x0395") }, + { wli("Ζ"), wli("\x0396") }, + { wli("Η"), wli("\x0397") }, + { wli("Θ"), wli("\x0398") }, + { wli("Ι"), wli("\x0399") }, + { wli("Κ"), wli("\x039A") }, + { wli("Λ"), wli("\x039B") }, + { wli("Μ"), wli("\x039C") }, + { wli("Ν"), wli("\x039D") }, + { wli("Ξ"), wli("\x039E") }, + { wli("Ο"), wli("\x039F") }, + { wli("Π"), wli("\x03A0") }, + { wli("Ρ"), wli("\x03A1") }, + { wli("Σ"), wli("\x03A3") }, + { wli("Τ"), wli("\x03A4") }, + { wli("Υ"), wli("\x03A5") }, + { wli("Φ"), wli("\x03A6") }, + { wli("Χ"), wli("\x03A7") }, + { wli("Ψ"), wli("\x03A8") }, + { wli("Ω"), wli("\x03A9") }, + { wli("α"), wli("\x03B1") }, + { wli("β"), wli("\x03B2") }, + { wli("γ"), wli("\x03B3") }, + { wli("δ"), wli("\x03B4") }, + { wli("ε"), wli("\x03B5") }, + { wli("ζ"), wli("\x03B6") }, + { wli("η"), wli("\x03B7") }, + { wli("θ"), wli("\x03B8") }, + { wli("ι"), wli("\x03B9") }, + { wli("κ"), wli("\x03BA") }, + { wli("λ"), wli("\x03BB") }, + { wli("μ"), wli("\x03BC") }, + { wli("ν"), wli("\x03BD") }, + { wli("ξ"), wli("\x03BE") }, + { wli("ο"), wli("\x03BF") }, + { wli("π"), wli("\x03C0") }, + { wli("ρ"), wli("\x03C1") }, + { wli("ς"), wli("\x03C2") }, + { wli("σ"), wli("\x03C3") }, + { wli("τ"), wli("\x03C4") }, + { wli("υ"), wli("\x03C5") }, + { wli("φ"), wli("\x03C6") }, + { wli("χ"), wli("\x03C7") }, + { wli("ψ"), wli("\x03C8") }, + { wli("ω"), wli("\x03C9") }, + { wli("ϑ"), wli("\x03D1") }, + { wli("ϒ"), wli("\x03D2") }, + { wli("ϖ"), wli("\x03D6") }, + { wli(" "), wli("\x2002") }, + { wli(" "), wli("\x2003") }, + { wli(" "), wli("\x2009") }, + { wli("‌"), wli("\x200C") }, + { wli("‍"), wli("\x200D") }, + { wli("‎"), wli("\x200E") }, + { wli("‏"), wli("\x200F") }, + { wli("–"), wli("\x2013") }, + { wli("—"), wli("\x2014") }, + { wli("‘"), wli("\x2018") }, + { wli("’"), wli("\x2019") }, + { wli("‚"), wli("\x201A") }, + { wli("“"), wli("\x201C") }, + { wli("”"), wli("\x201D") }, + { wli("„"), wli("\x201E") }, + { wli("†"), wli("\x2020") }, + { wli("‡"), wli("\x2021") }, + { wli("•"), wli("\x2022") }, + { wli("…"), wli("\x2026") }, + { wli("‰"), wli("\x2030") }, + { wli("′"), wli("\x2032") }, + { wli("″"), wli("\x2033") }, + { wli("‹"), wli("\x2039") }, + { wli("›"), wli("\x203A") }, + { wli("‾"), wli("\x203E") }, + { wli("⁄"), wli("\x2044") }, + { wli("€"), wli("\x20AC") }, + { wli("ℑ"), wli("\x2111") }, + { wli("℘"), wli("\x2118") }, + { wli("ℜ"), wli("\x211C") }, + { wli("™"), wli("\x2122") }, + { wli("ℵ"), wli("\x2135") }, + { wli("←"), wli("\x2190") }, + { wli("↑"), wli("\x2191") }, + { wli("→"), wli("\x2192") }, + { wli("↓"), wli("\x2193") }, + { wli("↔"), wli("\x2194") }, + { wli("↵"), wli("\x21B5") }, + { wli("⇐"), wli("\x21D0") }, + { wli("⇑"), wli("\x21D1") }, + { wli("⇒"), wli("\x21D2") }, + { wli("⇓"), wli("\x21D3") }, + { wli("⇔"), wli("\x21D4") }, + { wli("∀"), wli("\x2200") }, + { wli("∂"), wli("\x2202") }, + { wli("∃"), wli("\x2203") }, + { wli("∅"), wli("\x2205") }, + { wli("∇"), wli("\x2207") }, + { wli("∈"), wli("\x2208") }, + { wli("∉"), wli("\x2209") }, + { wli("∋"), wli("\x220B") }, + { wli("∏"), wli("\x220F") }, + { wli("∑"), wli("\x2211") }, + { wli("−"), wli("\x2212") }, + { wli("∗"), wli("\x2217") }, + { wli("√"), wli("\x221A") }, + { wli("∝"), wli("\x221D") }, + { wli("∞"), wli("\x221E") }, + { wli("∠"), wli("\x2220") }, + { wli("∧"), wli("\x2227") }, + { wli("∨"), wli("\x2228") }, + { wli("∩"), wli("\x2229") }, + { wli("∪"), wli("\x222A") }, + { wli("∫"), wli("\x222B") }, + { wli("∴"), wli("\x2234") }, + { wli("∼"), wli("\x223C") }, + { wli("≅"), wli("\x2245") }, + { wli("≈"), wli("\x2248") }, + { wli("≠"), wli("\x2260") }, + { wli("≡"), wli("\x2261") }, + { wli("≤"), wli("\x2264") }, + { wli("≥"), wli("\x2265") }, + { wli("⊂"), wli("\x2282") }, + { wli("⊃"), wli("\x2283") }, + { wli("⊄"), wli("\x2284") }, + { wli("⊆"), wli("\x2286") }, + { wli("⊇"), wli("\x2287") }, + { wli("⊕"), wli("\x2295") }, + { wli("⊗"), wli("\x2297") }, + { wli("⊥"), wli("\x22A5") }, + { wli("⋅"), wli("\x22C5") }, + { wli("⌈"), wli("\x2308") }, + { wli("⌉"), wli("\x2309") }, + { wli("⌊"), wli("\x230A") }, + { wli("⌋"), wli("\x230B") }, + { wli("⟨"), wli("\x2329") }, + { wli("⟩"), wli("\x232A") }, + { wli("◊"), wli("\x25CA") }, + { wli("♠"), wli("\x2660") }, + { wli("♣"), wli("\x2663") }, + { wli("♥"), wli("\x2665") }, + { wli("♦"), wli("\x2666") }, + { 0, 0 } }; static val html_hex_continue(val hexlist, val ch) @@ -188,19 +188,38 @@ INLINE type_t type(val obj) return tag(obj) ? (type_t) tag(obj) : obj->t.type; } +#if LIT_ALIGN < 4 +#define wli(lit) (L ## "\0" lit) +#else +#define wli(lit) (L ## lit) +#endif + INLINE val auto_str(const wchar_t *str) { +#if LIT_ALIGN < 4 + return (val) ((cnum) (str + 1) | TAG_LIT); +#else return (val) ((cnum) (str) | TAG_LIT); +#endif } INLINE val static_str(const wchar_t *str) { +#if LIT_ALIGN < 4 + return (val) ((cnum) (str + 1) | TAG_LIT); +#else return (val) ((cnum) (str) | TAG_LIT); +#endif } INLINE wchar_t *litptr(val obj) { +#if LIT_ALIGN < 4 + wchar_t *ret = (wchar_t *) ((cnum) obj & ~TAG_MASK); + return (*ret == 0) ? ret + 1 : ret; +#else return (wchar_t *) ((cnum) obj & ~TAG_MASK); +#endif } INLINE val num_fast(cnum n) @@ -213,7 +232,12 @@ INLINE val chr(wchar_t ch) return (val) (((cnum) ch << TAG_SHIFT) | TAG_CHR); } +#if LIT_ALIGN < 4 +#define lit_noex(strlit) ((obj_t *) ((cnum) (L ## "\0" L ## strlit + 1) | TAG_LIT)) +#else #define lit_noex(strlit) ((obj_t *) ((cnum) (L ## strlit) | TAG_LIT)) +#endif + #define lit(strlit) lit_noex(strlit) extern val keyword_package, system_package, user_package; @@ -35,6 +35,7 @@ #include <dirent.h> #include <wchar.h> #include <setjmp.h> +#include <unistd.h> #include "config.h" #include "lib.h" #include "y.tab.h" @@ -415,9 +415,16 @@ static val string_out_put_string(val stream, val str) static val string_out_put_char(val stream, val ch) { +#if LIT_ALIGN < 4 + wchar_t mini[3]; + mini[0] = 0; + mini[1] = c_chr(ch); + mini[2] = 0; +#else wchar_t mini[2]; mini[0] = c_chr(ch); mini[1] = 0; +#endif return string_out_put_string(stream, auto_str(mini)); } @@ -43,7 +43,7 @@ #include "utf8.h" #include "txr.h" -const wchar_t *version = L"038"; +const wchar_t *version = wli("038"); const wchar_t *progname = L"txr"; const wchar_t *spec_file = L"stdin"; val spec_file_str; |