unif_dtoa 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/rc
  2. test -d /netlib/fp || 9fs netlib
  3. test -d /n/hati/usr/ehg || 9fs hati
  4. echo '/* derived from /netlib/fp/dtoa.c assuming IEEE, Standard C */' > dtoa.c
  5. echo '/* kudos to dmg@research.att.com, gripes to ehg@research.att.com */' >> dtoa.c
  6. echo '#include "lib9.h"' >> dtoa.c
  7. sed 's/^#if defined.IEEE_8087. . defined.IEEE_MC68k.*!= 1/#ifndef IEEE_Arith/
  8. s/^#if defined.IEEE_8087. . defined.IEEE_MC68k.*/#ifdef IEEE_Arith/' \
  9. /netlib/fp/dtoa.c > /n/hati/usr/ehg/xxx.c
  10. # undefine __STDC__ because we can't depend on HUGE_VAL
  11. rx hati 'unifdef -UIBM -UVAX -UKR_headers -U__cplusplus -U__STDC__ -UDEBUG \
  12. -UBad_float_h -UJust_16 -UInaccurate_Divide -UROUND_BIASED \
  13. -URND_PRODQUOT -DNo_leftright -UCheck_FLT_ROUNDS -D__MATH_H__ \
  14. -DUnsigned_Shifts -DMALLOC=Malloc -DCONST=const \
  15. -DPack_32 -DIEEE_Arith xxx.c | cb -s' > xxx.c
  16. sam -d >> dtoa.c >[2] err <<!
  17. e xxx.c
  18. 1,/include "float\.h"\n/d
  19. /The following definition of Storeinc/+-;/^#endif\n/d
  20. /^#define IEEE_Arith\n/+-d
  21. /When Pack_32 is not defined/+-;/^\n/d
  22. ,s/\n\n\n+/\n\n/g
  23. ,s/\n\(/(/g
  24. ,s/\\\(/\\\n(/g
  25. ,x/IEEE_8087/ c/__LITTLE_ENDIAN/
  26. ,x/^#if / c/#ifdef /
  27. ,x g/errno/d
  28. ,x/MALLOC/ c/malloc/
  29. ,x/Long/ c/long/
  30. ,x/CONST/ c/const/
  31. w
  32. q
  33. !
  34. cat xxx.c >> dtoa.c
  35. rm xxx.c