diff -Naur xdvik-22.40l/CHANGES xdvik-22.40n/CHANGES --- xdvik-22.40l/CHANGES Sat Aug 31 21:46:34 2002 +++ xdvik-22.40n/CHANGES Mon Sep 16 17:49:46 2002 @@ -12,6 +12,24 @@ Only major changes are listed (mostly those visible to the user); for a more detailed list of changes, see the CVS logs. + * 22.40n: + + Fixed a few bugs in xdvi-search.el (thanks to Reiner Steib + for spotting them, and suggesting patches) + + merged in changes for libs and configure from teTeX-beta + (had been planned only for HEAD, but the situation became + too messy) - thanks to Thomas Esser for the great work in + teTeX that made this much easier ;-) + This means that --with-system-wwwlib and --with-system-t1lib + now finally work properly. + + removed K&R compatibility macros to address bugs with gcc 3.2 + on Solaris, and simplify the setup + + added progress indicator for file downloads + + * 22.40m: + Was the same as 22.40n, except that the depend.mk file had contained + references locally installed libwww headers that had made it unusable. + For that reason, 22.40m was withdrawn and replaced by 22.40n. + * 22.40l: + Fixed a memory leak (#599082, discovered and patched by Nobuyuki Tsuchimura) diff -Naur xdvik-22.40l/CVS/Entries xdvik-22.40n/CVS/Entries --- xdvik-22.40l/CVS/Entries Sat Aug 31 22:51:24 2002 +++ xdvik-22.40n/CVS/Entries Mon Sep 16 17:50:31 2002 @@ -1,17 +1,18 @@ /.indent.pro/1.1.1.1/Wed Apr 18 14:23:08 2001//Txdvik_22_40_STABLE /BUGS/1.1.1.1/Wed Apr 18 14:23:07 2001//Txdvik_22_40_STABLE -/CHANGES/1.1.6.8/Sat Aug 31 21:46:34 2002//Txdvik_22_40_STABLE /INSTALL/1.4.6.3/Tue Aug 20 22:33:23 2002//Txdvik_22_40_STABLE -/Makefile.in/1.5/Sun Jun 24 14:52:00 2001//Txdvik_22_40_STABLE +/Makefile.in/1.5.6.1/Sat Sep 14 00:24:46 2002//Txdvik_22_40_STABLE /README/1.3.8.4/Wed Aug 14 22:50:05 2002//Txdvik_22_40_STABLE /README.CVS/1.1.2.6/Sat Aug 31 17:12:11 2002//Txdvik_22_40_STABLE /README_maintainer/1.7.6.1/Sun Oct 14 12:32:03 2001//Txdvik_22_40_STABLE /TODO/1.2/Sun Jun 24 14:52:08 2001//Txdvik_22_40_STABLE -/configure/1.4.8.1/Sat Aug 24 16:09:27 2002//Txdvik_22_40_STABLE -/configure.in/1.3.8.1/Sat Aug 24 16:09:31 2002//Txdvik_22_40_STABLE +/configure/1.4.8.4/Sun Sep 15 15:14:13 2002//Txdvik_22_40_STABLE +/configure.in/1.3.8.2/Sat Sep 14 00:24:46 2002//Txdvik_22_40_STABLE /reautoconf/1.2/Sun May 13 10:54:58 2001//Txdvik_22_40_STABLE /selfautofix/1.1.1.1/Wed Apr 18 14:23:08 2001//Txdvik_22_40_STABLE -/withenable.ac/1.1.1.1/Wed Apr 18 14:23:08 2001//Txdvik_22_40_STABLE +/tetex.ac/1.1.2.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/withenable.ac/1.1.1.1.8.1/Sun Sep 15 15:14:13 2002//Txdvik_22_40_STABLE D/config//// D/libs//// D/texk//// +/CHANGES/1.1.6.11/Mon Sep 16 17:49:46 2002//Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/Makefile.in xdvik-22.40n/Makefile.in --- xdvik-22.40l/Makefile.in Sun Jun 24 14:52:00 2001 +++ xdvik-22.40n/Makefile.in Sat Sep 14 00:24:46 2002 @@ -49,59 +49,72 @@ manext = 1 mandir = @mandir@/man$(manext) infodir = @infodir@ -texmfmain = @texmfmain@ +texmf = @texmfmain@ +NCURSESDIR=libs/ncurses +ZLIBDIR=libs/zlib +LIBPNGDIR=libs/libpng +LIBT1DIR=libs/t1lib +LIBTYPE1DIR=$(LIBT1DIR)/../type1 +LIBTIFFDIR=libs/libtiff LIBWWWDIR=libs/libwww -T1DIR=libs/t1lib - -WITHHTEX=@HTEX@ -WITHT1=@T1LIB@ +LIBXPDFDIR=libs/xpdf #### End of system configuration section. #### -ALLPROGS = access afm2tfm bibtex dialog dmp dvicopy dvilj dvilj2p dvilj4 \ +ALLPROGS = access afm2tfm bibtex tcdialog dmp dvicopy dvilj dvilj2p dvilj4 \ dvilj4l dvips dvitomp dvitype etex gftodvi gftopk gftype gsftopk \ - info install-info kpsestat kpsewhich mag makeindex makeinfo mf xmf \ + install-info kpsestat kpsewhich mag makeindex makeinfo mf mfw \ mft mpost mpto newer odvicopy odvips odvitype ofm2opl omega opl2ofm \ otangle otp2ocp outocp ovf2ovp ovp2ovf oxdvi.bin patgen pdftex pfb2pfa \ pk2bm pktogf pktype pltotf pooltype ps2pk readlink tangle tex texindex \ - tftopl tie ttf2afm vftovp vptovf weave xdvi.bin + tftopl tie ttf2afm vftovp vptovf weave xdvi.bin pdfetex + +VERSION = 1.0 # Subdirectories that have makefiles ESUBDIRS = @ESUBDIRS@ texk -DSUBDIRS = @DSUBDIRS@ - -MDEFINES = bindir='$(bindir)' scriptdir='$(scriptdir)' +LIBSDIRS = @LIBSDIRS@ default: all install: all for dir in $(ESUBDIRS); do \ echo making $@ in $$dir; \ (cd $$dir && PATH=$(scriptdir):$(bindir):$(PATH) \ - $(MAKE) $(MDEFINES) $@) || exit 1; \ + $(MAKE) $@) || exit 1; \ done + $(srcdir)/selfautofix "$(bindir)" "$(texmf)/web2c" + cd $(bindir); for i in $(ALLPROGS); do test -f $$i && { echo strip $$i; strip $$i || true; }; done; true test -f $(scriptdir)/mktexlsr && \ - TEXMFMAIN=$(texmfmain) PATH=$(scriptdir):$(bindir):$(PATH) \ + TEXMFMAIN=$(texmf) PATH=$(scriptdir):$(bindir):$(PATH) \ $(scriptdir)/mktexlsr - test -f $(scriptdir)/texconfig && \ - TEXMFMAIN=$(texmfmain) PATH=$(scriptdir):$(bindir):$(PATH) \ - $(scriptdir)/texconfig init - $(srcdir)/selfautofix "$(bindir)" "$(texmfmain)/web2c" + test -f $(scriptdir)/fmtutil && \ + TEXMFMAIN=$(texmf) PATH=$(scriptdir):$(bindir):$(PATH) \ + $(scriptdir)/fmtutil --all + test -f $(scriptdir)/texlinks && \ + TEXMFMAIN=$(texmf) PATH=$(scriptdir):$(bindir):$(PATH) \ + $(scriptdir)/texlinks install-exec: for dir in $(ESUBDIRS); do \ echo making $@ in $$dir; \ (cd $$dir && PATH=$(scriptdir):$(bindir):$(PATH) \ - $(MAKE) $(MDEFINES) $@) || exit 1; \ + $(MAKE) $@) || exit 1; \ done + cd $(bindir); for i in $(ALLPROGS); do test -f $$i && { echo strip $$i; strip $$i || true; }; done; true + test -f $(scriptdir)/texlinks && \ + TEXMF=$(texmf) TEXMFMAIN=$(texmf) PATH=$(scriptdir):$(bindir):$(PATH) \ + $(scriptdir)/texlinks strip: - cd $(bindir) && strip $(ALLPROGS) >/dev/null 2>&1 || true + +check: + cd texk; TEXMF=$(texmf) TEXMFCNF=$(texmf)/web2c $(MAKE) $@ uninstall: for dir in $(ESUBDIRS); do \ echo making $@ in $$dir; \ - (cd $$dir && $(MAKE) $(MDEFINES) $@) || exit 1; \ + (cd $$dir && $(MAKE) $@) || exit 1; \ done Makefile: Makefile.in config.status @@ -111,13 +124,25 @@ all clean mostlyclean: for dir in $(ESUBDIRS); do \ echo making $@ in $$dir; \ - (if test -f $$dir/Makefile; then cd $$dir && $(MAKE) $(MDEFINES) $@; else true; fi) || exit 1; \ + (if test -f $$dir/Makefile; then cd $$dir && $(MAKE) $@; else true; fi) || exit 1; \ + done + +libsclean: + for dir in ""$(LIBSDIRS); do \ + echo making clean in $$dir; \ + (if test -f $$dir/Makefile; then cd $$dir && $(MAKE) clean; else true; fi) || exit 1; \ + done + +libsdistclean: + for dir in ""$(LIBSDIRS); do \ + echo making distclean in $$dir; \ + (if test -f $$dir/Makefile; then cd $$dir && $(MAKE) distclean; else true; fi) || exit 1; \ done distclean: clean - for dir in $(ESUBDIRS) $(DSUBDIRS) libs/t1lib; do \ + for dir in $(ESUBDIRS); do \ echo making $@ in $$dir; \ - (if test -f $$dir/Makefile; then cd $$dir && $(MAKE) $(MDEFINES) $@; else true; fi) || exit 1; \ + (if test -f $$dir/Makefile; then cd $$dir && $(MAKE) $@; else true; fi) || exit 1; \ done $(RM) Makefile *.status *.cache *.log dialogconfig.h $(RM) libs/klibtool.config texinfo/info/funs.h texinfo/info/doc.c \ @@ -130,17 +155,35 @@ tags TAGS: $(RM) TAGS - find . -type f -name '*.c' -print | xargs etags -a + find . -name '*.[ch]' -print | xargs etags --append -o TAGS + +clean mostlyclean: libsclean +distclean: libsdistclean realclean: distclean world: all install strip - +pdftex: + cd texk/web2c; $(MAKE) pdftex + test -f texk/web2c/pdftex && ls -l texk/web2c/pdftex + +$(NCURSESDIR)/lib/libncurses.a: + cd $(NCURSESDIR); $(MAKE) +$(ZLIBDIR)/libz.a: + cd $(ZLIBDIR); $(MAKE) libz.a +$(LIBPNGDIR)/libpng.a: + cd $(LIBPNGDIR); $(MAKE) libpng.a +$(LIBT1DIR)/libt1.a: + cd $(LIBT1DIR); $(MAKE) libt1.a +$(LIBTYPE1DIR)/libtype1.a: + cd $(LIBTYPE1DIR); $(MAKE) libtype1.a $(LIBWWWDIR)/libwww.a: - cd $(LIBWWWDIR) && $(MAKE) $(MDEFINES) libwww.a - -# The t1lib build process is tricky. -$(T1DIR)/lib/.libs/libt1.a: - cd $(T1DIR)/lib && $(MAKE) $(MDEFINES) + cd $(LIBWWWDIR); $(MAKE) libwww.a +$(LIBTIFFDIR)/libtiff.a: + cd $(LIBTIFFDIR); $(MAKE) libtiff.a +$(LIBXPDFDIR)/xpdf/libxpdf.a: + cd $(LIBXPDFDIR)/xpdf; $(MAKE) libxpdf.a +$(LIBXPDFDIR)/goo/libGoo.a: + cd $(LIBXPDFDIR)/goo; $(MAKE) libGoo.a # Prevent GNU make v3 from overflowing arg limit on SysV. .NOEXPORT: diff -Naur xdvik-22.40l/configure xdvik-22.40n/configure --- xdvik-22.40l/configure Sat Aug 24 16:09:27 2002 +++ xdvik-22.40n/configure Sun Sep 15 15:14:13 2002 @@ -11,46 +11,7 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: -ac_help="$ac_help - --without-texinfo do not build the texinfo package" -ac_help="$ac_help - --without-dialog do not build the dialog package" -ac_help="$ac_help - --without-t1utils do not build the t1utils package" -ac_help="$ac_help - --without-dtl do not build the dtl package" -ac_help="$ac_help - --without-dvidvi do not build the dvidvi package" -ac_help="$ac_help - --without-dviljk do not build the dviljk package" -ac_help="$ac_help - --without-dvipdfm do not build the dvipdfm package" -ac_help="$ac_help - --without-dvipsk do not build the dvipsk package" -ac_help="$ac_help - --without-gsftopk do not build the gsftopk package" -ac_help="$ac_help - --without-lacheck do not build the lacheck package" -ac_help="$ac_help - --without-makeindexk do not build the makeindexk package" -ac_help="$ac_help - --without-musixflx do not build the musixflx package" -ac_help="$ac_help - --without-odvipsk do not build the odvipsk package" -ac_help="$ac_help - --without-oxdvik do not build the oxdvik package" -ac_help="$ac_help - --without-ps2pkm do not build the ps2pkm package" -ac_help="$ac_help - --without-seetexk do not build the seetexk package" -ac_help="$ac_help - --without-tetex do not build the tetex package" -ac_help="$ac_help - --without-tex4htk do not build the tex4htk package" -ac_help="$ac_help - --without-tth do not build the tth package" -ac_help="$ac_help - --without-xdvik do not build the xdvik package" +ac_default_prefix=/usr/local/teTeX ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" @@ -93,6 +54,17 @@ ac_help="$ac_help --with-libwww-include=DIR Specify the libwww header files location." +ac_help="$ac_help + --with-libwww-config=PROG + Use PROG as libwww-config program." +ac_help="$ac_help + --with-system-t1lib use installed t1 library" +ac_help="$ac_help + --with-t1lib-libdir=DIR + Specify directory where the t1 library (libt1.a) resides." +ac_help="$ac_help + --with-t1lib-include=DIR + Specify the t1lib header files location." # Initialize some variables set by options. # The variables have the same names as the options, with @@ -630,7 +602,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:634: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:606: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -659,7 +631,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:663: checking for $ac_word" >&5 +echo "configure:635: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -690,7 +662,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:694: checking for $ac_word" >&5 +echo "configure:666: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -742,7 +714,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:746: checking for $ac_word" >&5 +echo "configure:718: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -775,7 +747,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:779: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:751: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -786,12 +758,12 @@ cat > conftest.$ac_ext << EOF -#line 790 "configure" +#line 762 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -817,12 +789,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:821: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:793: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:826: checking whether we are using GNU C" >&5 +echo "configure:798: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -831,7 +803,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -850,7 +822,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:854: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:826: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -909,7 +881,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:913: checking host system type" >&5 +echo "configure:885: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -930,7 +902,7 @@ echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:934: checking target system type" >&5 +echo "configure:906: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -948,7 +920,7 @@ echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:952: checking build system type" >&5 +echo "configure:924: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -972,7 +944,7 @@ echo $ac_n "checking whether to define additional compiler specific flags""... $ac_c" 1>&6 -echo "configure:976: checking whether to define additional compiler specific flags" >&5 +echo "configure:948: checking whether to define additional compiler specific flags" >&5 case "$target" in alpha*-dec*) if test "$CC" = "cc"; then @@ -986,6 +958,9 @@ echo "configure: warning: HP-UX's cc" 1>&2 fi ;; + *-darwin*) + : {INSTALL='/usr/bin/install -c -p'}; export INSTALL + ;; *) echo "$ac_t""no" 1>&6 ;; @@ -1010,7 +985,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1014: checking for a BSD compatible install" >&5 +echo "configure:989: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1065,7 +1040,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1069: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1044: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1092,7 +1067,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1096: checking whether ln -s works" >&5 +echo "configure:1071: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1115,7 +1090,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1119: checking how to run the C preprocessor" >&5 +echo "configure:1094: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1130,13 +1105,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1140: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1115: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1147,13 +1122,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1132: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1164,13 +1139,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1197,19 +1172,19 @@ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1201: checking for working alloca.h" >&5 +echo "configure:1176: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1230,12 +1205,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1234: checking for alloca" >&5 +echo "configure:1209: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1295,12 +1270,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1299: checking whether alloca needs Cray hooks" >&5 +echo "configure:1274: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:1329: checking for $ac_func" >&5 +echo "configure:1304: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1380,7 +1355,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1384: checking stack direction for C alloca" >&5 +echo "configure:1359: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1388,7 +1363,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1431,7 +1406,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1435: checking for $ac_word" >&5 +echo "configure:1410: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1460,135 +1435,57 @@ fi -# Check whether --with-texinfo or --without-texinfo was given. -if test "${with_texinfo+set}" = set; then - withval="$with_texinfo" - : -fi - - -# Check whether --with-dialog or --without-dialog was given. -if test "${with_dialog+set}" = set; then - withval="$with_dialog" - : -fi +: ${with_mkfmt_default=yes} +export with_mkfmt_default +: ${with_cxx_runtime_hack=yes} +export with_cxx_runtime_hack -# Check whether --with-t1utils or --without-t1utils was given. -if test "${with_t1utils+set}" = set; then - withval="$with_t1utils" - : -fi - - - - -# Check whether --with-dtl or --without-dtl was given. -if test "${with_dtl+set}" = set; then - withval="$with_dtl" - : -fi - -# Check whether --with-dvidvi or --without-dvidvi was given. -if test "${with_dvidvi+set}" = set; then - withval="$with_dvidvi" - : -fi - -# Check whether --with-dviljk or --without-dviljk was given. -if test "${with_dviljk+set}" = set; then - withval="$with_dviljk" - : -fi - -# Check whether --with-dvipdfm or --without-dvipdfm was given. -if test "${with_dvipdfm+set}" = set; then - withval="$with_dvipdfm" - : -fi - -# Check whether --with-dvipsk or --without-dvipsk was given. -if test "${with_dvipsk+set}" = set; then - withval="$with_dvipsk" - : -fi - -# Check whether --with-gsftopk or --without-gsftopk was given. -if test "${with_gsftopk+set}" = set; then - withval="$with_gsftopk" - : -fi - -# Check whether --with-lacheck or --without-lacheck was given. -if test "${with_lacheck+set}" = set; then - withval="$with_lacheck" - : -fi - -# Check whether --with-makeindexk or --without-makeindexk was given. -if test "${with_makeindexk+set}" = set; then - withval="$with_makeindexk" - : +: ${enable_multiplatform=yes} +if test "x$enable_multiplatform" = xyes \ + && test "x$bindir" = 'x${exec_prefix}/bin' +then + enable_multiplatform=yes; export enable_multiplatform + bindir="$bindir/$host"; fi +test "${enable_nls+set}" = set || { enable_nls=no; export enable_nls; } -# Check whether --with-musixflx or --without-musixflx was given. -if test "${with_musixflx+set}" = set; then - withval="$with_musixflx" - : -fi -# Check whether --with-odvipsk or --without-odvipsk was given. -if test "${with_odvipsk+set}" = set; then - withval="$with_odvipsk" - : +if test "x$prefix" = xNONE; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix=$ac_default_prefix" fi -# Check whether --with-oxdvik or --without-oxdvik was given. -if test "${with_oxdvik+set}" = set; then - withval="$with_oxdvik" - : -fi +enable_ipc=yes +case "$target" in + *nextstep3*|*NEXTSTEP*) + with_xdvik=no; with_oxdvik=no + with_nextwin=yes; with_ps=dps; with_mfw=no + export with_xdvik with_oxdvik enable_ipc with_nextwin with_ps;; +esac -# Check whether --with-ps2pkm or --without-ps2pkm was given. -if test "${with_ps2pkm+set}" = set; then - withval="$with_ps2pkm" - : -fi +: ${with_mfw=yes} +: ${with_x=yes} +export with_mfw with_x + +# for libwww, does not compile otherwise +: ${with_expat=no} +: ${with_wais=no} +: ${with_socks5=no} +: ${with_socks4=no} +: ${with_ssl=no} +: ${with_regex=no} +export with_expat with_wais with_socks5 with_socks4 with_ssl with_regex -# Check whether --with-seetexk or --without-seetexk was given. -if test "${with_seetexk+set}" = set; then - withval="$with_seetexk" - : -fi -# Check whether --with-tetex or --without-tetex was given. -if test "${with_tetex+set}" = set; then - withval="$with_tetex" - : -fi -# Check whether --with-tex4htk or --without-tex4htk was given. -if test "${with_tex4htk+set}" = set; then - withval="$with_tex4htk" - : -fi -# Check whether --with-tth or --without-tth was given. -if test "${with_tth+set}" = set; then - withval="$with_tth" - : -fi -# Check whether --with-xdvik or --without-xdvik was given. -if test "${with_xdvik+set}" = set; then - withval="$with_xdvik" - : -fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1592: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:1489: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -1607,7 +1504,7 @@ echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 -echo "configure:1611: checking for loader (symbol LD)" >&5 +echo "configure:1508: checking for loader (symbol LD)" >&5 if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1621,7 +1518,7 @@ echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 -echo "configure:1625: checking for archiver (symbol AR)" >&5 +echo "configure:1522: checking for archiver (symbol AR)" >&5 if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1635,7 +1532,7 @@ echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 -echo "configure:1639: checking for archiver options (symbol AR_OPTS)" >&5 +echo "configure:1536: checking for archiver options (symbol AR_OPTS)" >&5 if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1727,7 +1624,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1731: checking host system type" >&5 +echo "configure:1628: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1759,7 +1656,7 @@ echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 -echo "configure:1763: checking where the main texmf tree is located" >&5 +echo "configure:1660: checking where the main texmf tree is located" >&5 texmfmain= if test "x$datadir" != 'x${prefix}/share'; then # First case, datadir is defined... @@ -1949,7 +1846,7 @@ # Extract the first word of "pwd", so it can be a program name with args. set dummy pwd; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1953: checking for $ac_word" >&5 +echo "configure:1850: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BINPWD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2062,61 +1959,511 @@ fi +# Check whether --with-libwww-config or --without-libwww-config was given. +if test "${with_libwww_config+set}" = set; then + withval="$with_libwww_config" + + libwww_config=$with_libwww_config + try_system_wwwlib=yes +fi + + + + +# Check whether --with-system-t1lib or --without-system-t1lib was given. +if test "${with_system_t1lib+set}" = set; then + withval="$with_system_t1lib" + : +fi + + +# Check whether --with-t1lib_libdir or --without-t1lib_libdir was given. +if test "${with_t1lib_libdir+set}" = set; then + withval="$with_t1lib_libdir" + : +fi + + +# Check whether --with-t1lib_include or --without-t1lib_include was given. +if test "${with_t1lib_include+set}" = set; then + withval="$with_t1lib_include" + : +fi + -ESUBDIRS= -DSUBDIRS= -LIBSDEP= LIBWWWDIR=libs/libwww NCURSESDIR=libs/ncurses +LIBT1DIR=libs/t1lib +LIBTYPE1DIR=libs/type1 LIBPNGDIR=libs/libpng ZLIBDIR=libs/zlib -LIBT1DIR=libs/t1lib +LIBTIFFDIR=libs/libtiff +LIBXPDFDIR=libs/xpdf + +test "$with_x" = no && { with_xdvik=no; with_oxdvik=no; } +export with_xdvik with_oxdvik + +# we need libwww for xdvik and oxdvik +test ! -d $srcdir/$LIBWWWDIR && : ${needs_libwww=no} +test "$with_xdvik" != no && : ${needs_libwww=yes} +test "$with_oxdvik" != no && : ${needs_libwww=yes} +: ${needs_libwww=no} + +# we need libt1 for xdvik and oxdvik +test ! -d $srcdir/$LIBT1DIR && : ${needs_libt1=no} +test "$with_xdvik" != no && : ${needs_libt1=yes} +test "$with_oxdvik" != no && : ${needs_libt1=yes} +: ${needs_libt1=no} + +# we need ncurses for dialog +test ! -d $srcdir/$NCURSESDIR && : ${needs_ncurses=no} +test "$with_dialog" != no && : ${needs_ncurses=yes} +: ${needs_ncurses=no} + +# we need pnglib for pdftex and pdfetex +test ! -d $srcdir/$LIBPNGDIR && : ${needs_pnglib=no} +test "$with_pdftex" != no && : ${needs_pnglib=yes} +test "$with_pdfetex" != no && : ${needs_pnglib=yes} +: ${needs_pnglib=no} + +# we need zlib for texinfo, pdftex and pdfetex +test ! -d $srcdir/$ZLIBDIR && : ${needs_zlib=no} +test "$with_pdftex" != no && : ${needs_zlib=yes} +test "$with_pdfetex" != no && : ${needs_zlib=yes} +test "$with_texinfo" != no && : ${needs_zlib=yes} +: ${needs_zlib=no} + +# we need libtiff for pdftex and pdfetex +test ! -d $srcdir/$LIBTIFFDIR && : ${needs_libtiff=no} +test "x$with_tiff" = xno && : ${needs_libtiff=no} +test "$with_pdftex" != no && : ${needs_libtiff=yes} +test "$with_pdfetex" != no && : ${needs_libtiff=yes} +: ${needs_libtiff=no} + +# we need libxpdf for pdftex and pdfetex +test ! -d $srcdir/$LIBXPDFDIR && : ${needs_xpdf=no} +test "$with_pdftex" != no && : ${needs_xpdf=yes} +test "$with_pdfetex" != no && : ${needs_xpdf=yes} +: ${needs_xpdf=no} + +export needs_ncurses needs_pnglib needs_libtiff needs_zlib +export needs_libwww needs_xpdf +export needs_libt1 + + + +if test "$needs_libwww" = no; then + LDLIBWWW= + LIBWWWCPPFLAGS= + LIBWWWDEP= +else + OLD_LIBS=$LIBS + + LibWWW_headers="WWWLib.h WWWApp.h WWWFile.h WWWHTTP.h WWWMIME.h WWWNews.h WWWTrans.h" + LibWWW_config_h="wwwconf.h" + libwww_include_list="${libwww_include} ${libwww_dir} \ + ${libwww_dir}/include ${libwww_dir}/Library/src" + libwww_libdir_list="${libwww_library_dir} ${libwww_dir} ${libwww_dir}/lib \ + ${libwww_dir}/Library/src" + + if test $try_system_wwwlib = yes; then + test -z "$libwww_config" && libwww_config=libwww-config + + # can we find the $libwww_config program? + LIBWWW_CONFIG= + if test -f "$libwww_config"; then + LIBWWW_CONFIG=$libwww_config + else + # Extract the first word of "$libwww_config", so it can be a program name with args. +set dummy $libwww_config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2086: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_LIBWWW_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$LIBWWW_CONFIG" in + /*|[A-z]:/*) + ac_cv_path_LIBWWW_CONFIG="$LIBWWW_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_LIBWWW_CONFIG="$LIBWWW_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_path_LIBWWW_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +LIBWWW_CONFIG="$ac_cv_path_LIBWWW_CONFIG" +if test -n "$LIBWWW_CONFIG"; then + echo "$ac_t""$LIBWWW_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + + if test -n "$LIBWWW_CONFIG"; then + libwww_include_found=yes + libwww_libdir_found=yes + LDLIBWWW=`$libwww_config --libs` + + # te: I have seen xmlparse.h one directory above the directory given + # by libwww-config. Therefore, this hack: + libwww_config_cflags=`$libwww_config --cflags` + hack=`echo $libwww_config_cflags | sed 's@-I@@; s@/w3c-libwww.*@@'` + test -n "$hack" && test -f "$hack/xmlparse.h" \ + && libwww_config_cflags="$libwww_config_cflags -I$hack" + + LIBWWWCPPFLAGS="$libwww_config_cflags -DHAVE_LIBWWW -DHAVE_WWWLIB_H" + else + libwww_include_found=no + libwww_libdir_found=no + for d in $libwww_include_list; do + ok=yes + for h in $LibWWW_headers; do + if test ! -f $d/$h; then + ok=no + break + fi + done + if test $ok = yes; then + libwww_include=$d + libwww_include_found=yes + break + fi + done -if test x$HTEX = x1 ; then - if test -d $srcdir/$LIBT1DIR; then - test "$with_system_t1lib" != yes \ - && LIBSDEP="$LIBSDEP \$(T1DIR)/lib/.libs/libt1.a" - DSUBDIRS="$DSUBDIRS $LIBT1DIR" + if test $libwww_include_found = yes; then + LIBWWWCPPFLAGS="-I${libwww_include} -DHAVE_LIBWWW -DHAVE_WWWLIB_H" + else + LIBWWWCPPFLAGS="-DHAVE_LIBWWW -DHAVE_WWWLIB_H" + if test $try_system_wwwlib = yes; then + libwww_include_found=yes + for ac_hdr in $LibWWW_headers +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2162: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +libwww_include_found=no; break +fi +done + + fi + fi + + # only check for libwww.a if the includes could be found + if test $libwww_include_found = yes; then + for d in $libwww_libdir_list; do + if test -f $d/libwww.a; then + libwww_libdir=$d + libwww_libdir_found=yes + fi + done + + if test ${libwww_libdir_found} = yes; then + LDLIBWWW="-L${libwww_libdir} -lwww" + else + LDLIBWWW=-lwww + libwww_libdir_found=yes + echo $ac_n "checking for HTParse in -lwww""... $ac_c" 1>&6 +echo "configure:2217: checking for HTParse in -lwww" >&5 +ac_lib_var=`echo www'_'HTParse | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lwww $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo www | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +libwww_libdir_found=no +fi + + fi + fi + fi + fi + + if test "${libwww_include_found}" != yes || + test "${libwww_libdir_found}" != yes; then + if test $try_system_wwwlib = yes; then + echo "configure: warning: Have not found standard LIBWWW library. Shall compile my own one." 1>&2 + fi + LDLIBWWW='$(LIBWWWDIR)/libwww.a' + LIBWWWCPPFLAGS='-I$(LIBWWWDIR) -I$(LIBWWWSRCDIR) -DHAVE_LIBWWW -DHAVE_WWWLIB_H' + LIBWWWDEP='$(LIBWWWDIR)/libwww.a' + using_system_wwwlib=no + else + using_system_wwwlib=yes + LIBWWWDEP= fi + LIBS=$OLD_LIBS fi -if test x$T1LIB = x1 ; then - if test -d $srcdir/$LIBWWWDIR ; then - test "$with_system_wwwlib" != yes \ - && LIBSDEP="$LIBSDEP \$(LIBWWWDIR)/libwww.a" - DSUBDIRS="$DSUBDIRS $LIBWWWDIR" + + + + + + + +if test "$needs_libt1" = no; then + LIBT1CPPFLAGS= + LDLIBT1= + LIBT1DEP= +else + EXTRA_LIBT1_INCLUDE= + EXTRA_LIBT1_LIBDIR= + + if test "$with_system_t1lib" = yes; then + if test "x$with_t1lib_libdir" != x; then + EXTRA_LIBT1_LIBDIR="-L$with_t1lib_libdir" + fi + if test "x$with_t1lib_include" != x; then + EXTRA_LIBT1_INCLUDE="-I$with_t1lib_include" + fi fi + + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR" + CPP="$CPP $EXTRA_LIBT1_INCLUDE" + + if test "$with_system_t1lib" = yes; then + echo $ac_n "checking for T1_AddFont in -lt1""... $ac_c" 1>&6 +echo "configure:2318: checking for T1_AddFont in -lt1" >&5 +ac_lib_var=`echo t1'_'T1_AddFont | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lt1 -lz -lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + t1lib=-lt1 +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: Standard T1 library not found. Compiling my own." 1>&2 + with_system_t1lib=no +fi + + fi + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR -lt1 -lm" + if test "$with_system_t1lib" = yes; then + echo $ac_n "checking whether installed T1 lib is >= v 1.3.1 ""... $ac_c" 1>&6 +echo "configure:2364: checking whether installed T1 lib is >= v 1.3.1 " >&5 + if test "$cross_compiling" = yes; then + ac_compile_t1lib=1 + ] +else + cat > conftest.$ac_ext < +#include "t1lib.h" +#define BUFLEN 128 +int main() { + char *t1libId = T1_GetLibIdent(); + char testbuf[BUFLEN]; + char *p = testbuf; + int i; + int version_num; + /* T1_GetLibIdent() might return something like '0.8-beta2'; + convert the leading numbers to a single digit: */ + for (i = 0; i < BUFLEN; i++) { + if (t1libId[i] >= '0' && t1libId[i] <= '9') + *p++ = t1libId[i]; + else if (t1libId[i] != '.' && t1libId[i] != '_' && t1libId[i] != '-') + break; + } + version_num = strtoul(testbuf, (char **)NULL, 10); + /* xdvik needs >= 1.2.0 for parsing dvips map files. + Try to deal with version strings with 1 or more digits. */ + if (version_num >= 120 + || (version_num < 100 && version_num >= 12) + || (version_num < 10 && version_num >= 2)) + exit(0); + exit(1); +} + +EOF +if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_compile_t1lib=0 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_compile_t1lib=1 fi -if test -d $srcdir/$LIBPNGDIR; then - test "$with_system_pnglib" != yes \ - && LIBSDEP="$LIBSDEP \$(LIBPNGDIR)/libpng.a" - DSUBDIRS="$DSUBDIRS $LIBPNGDIR" +rm -fr conftest* fi -if test -d $srcdir/$ZLIBDIR; then - test "$with_system_zlib" != yes \ - && LIBSDEP="$LIBSDEP \$(ZLIBDIR)/libz.a" - DSUBDIRS="$DSUBDIRS $ZLIBDIR" + + if test $ac_compile_t1lib = 0; then + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no, will compile my own version" 1>&6 + with_system_t1lib=no + fi + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + LIBS=$OLD_LIBS + + if test "$with_system_t1lib" != yes; then + LIBT1CPPFLAGS='-I$(LIBT1DIR) -I$(LIBT1SRCDIR) -I$(LIBT1DIR)/../type1 -I$(LIBT1SRCDIR)/../type1' + LDLIBT1='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + LIBT1DEP='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + using_system_t1lib=no + else + LIBT1CPPFLAGS="$EXTRA_LIBT1_INCLUDE" + LDLIBT1="$EXTRA_LIBT1_LIBDIR -lt1" + LIBT1DEP= + using_system_t1lib=yes + fi fi -PKGS='texinfo dialog t1utils' + + + + +LIBSDEP="$LIBWWWDEP $CURSESDEP $ZLIBDEP $LIBPNGDEP $LIBTIFFDEP $LIBXPDFDEP $LIBT1DEP" + +LIBSDIRS= +test "$needs_libwww" = yes && test "$using_system_wwwlib" != yes \ + && LIBSDIRS="$LIBWWWDIR $LIBSDIRS" +test "$needs_ncurses" = yes && test "$using_system_ncurses" != yes \ + && LIBSDIRS="$NCURSESDIR $LIBSDIRS" +test "$needs_pnglib" = yes && test "$using_system_pnglib" != yes \ + && LIBSDIRS="$LIBPNGDIR $LIBSDIRS" +test "$needs_zlib" = yes && test "$using_system_zlib" != yes \ + && LIBSDIRS="$ZLIBDIR $LIBSDIRS" +test "$needs_libtiff" = yes && test "$using_system_tifflib" != yes \ + && LIBSDIRS="$LIBTIFFDIR $LIBSDIRS" +test "$needs_xpdf" = yes \ + && LIBSDIRS="$LIBXPDFDIR $LIBSDIRS" +test "$needs_libt1" = yes \ + && LIBSDIRS="$LIBT1DIR $LIBTYPE1DIR $LIBSDIRS" + +PKGS='texinfo dialog t1utils' +ESUBDIRS= for pkg in $PKGS; do - if test -d $srcdir/$pkg; then + if test -d $srcdir/utils/$pkg; then if eval "test \"`echo '$with_'${pkg}`\" != no"; then - ESUBDIRS="$ESUBDIRS $pkg" - else - DSUBDIRS="$DSUBDIRS $pkg" + ESUBDIRS="$ESUBDIRS utils/$pkg" + test -d utils || mkdir utils fi fi done @@ -2125,9 +2472,7 @@ -test -d libs || mkdir libs - -subdirs="$PKGS texk libs/t1lib libs/libwww" +subdirs="libs $ESUBDIRS texk" trap '' 1 2 15 cat > confcache <<\EOF @@ -2305,9 +2650,16 @@ s%@texmfmain@%$texmfmain%g s%@LDT1LIB@%$LDT1LIB%g s%@BINPWD@%$BINPWD%g +s%@LIBWWW_CONFIG@%$LIBWWW_CONFIG%g +s%@LDLIBWWW@%$LDLIBWWW%g +s%@LIBWWWCPPFLAGS@%$LIBWWWCPPFLAGS%g +s%@LIBWWWDEP@%$LIBWWWDEP%g +s%@LIBT1CPPFLAGS@%$LIBT1CPPFLAGS%g +s%@LDLIBT1@%$LDLIBT1%g +s%@LIBT1DEP@%$LIBT1DEP%g s%@ESUBDIRS@%$ESUBDIRS%g -s%@DSUBDIRS@%$DSUBDIRS%g s%@LIBSDEP@%$LIBSDEP%g +s%@LIBSDIRS@%$LIBSDIRS%g s%@subdirs@%$subdirs%g CEOF @@ -2483,7 +2835,7 @@ esac done - for ac_config_dir in $PKGS texk libs/t1lib libs/libwww; do + for ac_config_dir in libs $ESUBDIRS texk; do # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. diff -Naur xdvik-22.40l/configure.in xdvik-22.40n/configure.in --- xdvik-22.40l/configure.in Sat Aug 24 16:09:31 2002 +++ xdvik-22.40n/configure.in Sat Sep 14 00:24:46 2002 @@ -24,6 +24,9 @@ AC_MSG_WARN(HP-UX's cc) fi ;; + *-darwin*) + : {INSTALL='/usr/bin/install -c -p'}; export INSTALL + ;; *) AC_MSG_RESULT(no) ;; @@ -42,6 +45,7 @@ AC_FUNC_ALLOCA AC_PROG_RANLIB +sinclude(tetex.ac) sinclude(withenable.ac) sinclude(dialog/withenable.ac) sinclude(texk/withenable.ac) @@ -52,70 +56,110 @@ sinclude(libs/libwww/withenable.ac) sinclude(libs/ncurses/withenable.ac) sinclude(libs/libpng/withenable.ac) -sinclude(libs/libpng/libpng.ac) -sinclude(tetex.ac) - -ESUBDIRS= -DSUBDIRS= -LIBSDEP= +sinclude(libs/t1lib/withenable.ac) +sinclude(libs/zlib/withenable.ac) +sinclude(libs/libtiff/withenable.ac) LIBWWWDIR=libs/libwww NCURSESDIR=libs/ncurses +LIBT1DIR=libs/t1lib +LIBTYPE1DIR=libs/type1 LIBPNGDIR=libs/libpng ZLIBDIR=libs/zlib -LIBT1DIR=libs/t1lib +LIBTIFFDIR=libs/libtiff +LIBXPDFDIR=libs/xpdf -if test x$HTEX = x1 ; then - if test -d $srcdir/$LIBT1DIR; then - test "$with_system_t1lib" != yes \ - && LIBSDEP="$LIBSDEP \$(T1DIR)/lib/.libs/libt1.a" - DSUBDIRS="$DSUBDIRS $LIBT1DIR" - fi -fi +test "$with_x" = no && { with_xdvik=no; with_oxdvik=no; } +export with_xdvik with_oxdvik -if test x$T1LIB = x1 ; then - if test -d $srcdir/$LIBWWWDIR ; then - test "$with_system_wwwlib" != yes \ - && LIBSDEP="$LIBSDEP \$(LIBWWWDIR)/libwww.a" - DSUBDIRS="$DSUBDIRS $LIBWWWDIR" - fi -fi +# we need libwww for xdvik and oxdvik +test ! -d $srcdir/$LIBWWWDIR && : ${needs_libwww=no} +test "$with_xdvik" != no && : ${needs_libwww=yes} +test "$with_oxdvik" != no && : ${needs_libwww=yes} +: ${needs_libwww=no} + +# we need libt1 for xdvik and oxdvik +test ! -d $srcdir/$LIBT1DIR && : ${needs_libt1=no} +test "$with_xdvik" != no && : ${needs_libt1=yes} +test "$with_oxdvik" != no && : ${needs_libt1=yes} +: ${needs_libt1=no} + +# we need ncurses for dialog +test ! -d $srcdir/$NCURSESDIR && : ${needs_ncurses=no} +test "$with_dialog" != no && : ${needs_ncurses=yes} +: ${needs_ncurses=no} + +# we need pnglib for pdftex and pdfetex +test ! -d $srcdir/$LIBPNGDIR && : ${needs_pnglib=no} +test "$with_pdftex" != no && : ${needs_pnglib=yes} +test "$with_pdfetex" != no && : ${needs_pnglib=yes} +: ${needs_pnglib=no} + +# we need zlib for texinfo, pdftex and pdfetex +test ! -d $srcdir/$ZLIBDIR && : ${needs_zlib=no} +test "$with_pdftex" != no && : ${needs_zlib=yes} +test "$with_pdfetex" != no && : ${needs_zlib=yes} +test "$with_texinfo" != no && : ${needs_zlib=yes} +: ${needs_zlib=no} + +# we need libtiff for pdftex and pdfetex +test ! -d $srcdir/$LIBTIFFDIR && : ${needs_libtiff=no} +test "x$with_tiff" = xno && : ${needs_libtiff=no} +test "$with_pdftex" != no && : ${needs_libtiff=yes} +test "$with_pdfetex" != no && : ${needs_libtiff=yes} +: ${needs_libtiff=no} + +# we need libxpdf for pdftex and pdfetex +test ! -d $srcdir/$LIBXPDFDIR && : ${needs_xpdf=no} +test "$with_pdftex" != no && : ${needs_xpdf=yes} +test "$with_pdfetex" != no && : ${needs_xpdf=yes} +: ${needs_xpdf=no} + +export needs_ncurses needs_pnglib needs_libtiff needs_zlib +export needs_libwww needs_xpdf +export needs_libt1 -if test -d $srcdir/$NCURSESDIR; then - test "$with_system_ncurses" != yes \ - && LIBSDEP="$LIBSDEP \$(NCURSESDIR)/lib/libncurses.a" - DSUBDIRS="$DSUBDIRS $NCURSESDIR" -fi -if test -d $srcdir/$LIBPNGDIR; then - test "$with_system_pnglib" != yes \ - && LIBSDEP="$LIBSDEP \$(LIBPNGDIR)/libpng.a" - DSUBDIRS="$DSUBDIRS $LIBPNGDIR" -fi -if test -d $srcdir/$ZLIBDIR; then - test "$with_system_zlib" != yes \ - && LIBSDEP="$LIBSDEP \$(ZLIBDIR)/libz.a" - DSUBDIRS="$DSUBDIRS $ZLIBDIR" -fi +dnl We cannot use variables (e.g. $LIBPNGDIR) for sinclude, so... +sinclude(libs/libpng/libpng.ac) +sinclude(libs/zlib/zlib.ac) +sinclude(libs/libwww/libwww.ac) +sinclude(libs/ncurses/ncurses.ac) +sinclude(libs/libtiff/libtiff.ac) +sinclude(libs/xpdf/libxpdf.ac) +sinclude(libs/t1lib/t1lib.ac) + +LIBSDEP="$LIBWWWDEP $CURSESDEP $ZLIBDEP $LIBPNGDEP $LIBTIFFDEP $LIBXPDFDEP $LIBT1DEP" + +LIBSDIRS= +test "$needs_libwww" = yes && test "$using_system_wwwlib" != yes \ + && LIBSDIRS="$LIBWWWDIR $LIBSDIRS" +test "$needs_ncurses" = yes && test "$using_system_ncurses" != yes \ + && LIBSDIRS="$NCURSESDIR $LIBSDIRS" +test "$needs_pnglib" = yes && test "$using_system_pnglib" != yes \ + && LIBSDIRS="$LIBPNGDIR $LIBSDIRS" +test "$needs_zlib" = yes && test "$using_system_zlib" != yes \ + && LIBSDIRS="$ZLIBDIR $LIBSDIRS" +test "$needs_libtiff" = yes && test "$using_system_tifflib" != yes \ + && LIBSDIRS="$LIBTIFFDIR $LIBSDIRS" +test "$needs_xpdf" = yes \ + && LIBSDIRS="$LIBXPDFDIR $LIBSDIRS" +test "$needs_libt1" = yes \ + && LIBSDIRS="$LIBT1DIR $LIBTYPE1DIR $LIBSDIRS" PKGS='texinfo dialog t1utils' - +ESUBDIRS= for pkg in $PKGS; do - if test -d $srcdir/$pkg; then + if test -d $srcdir/utils/$pkg; then if eval "test \"`echo '$with_'${pkg}`\" != no"; then - ESUBDIRS="$ESUBDIRS $pkg" - else - DSUBDIRS="$DSUBDIRS $pkg" + ESUBDIRS="$ESUBDIRS utils/$pkg" + test -d utils || mkdir utils fi fi done AC_SUBST(ESUBDIRS) -AC_SUBST(DSUBDIRS) AC_SUBST(LIBSDEP) +AC_SUBST(LIBSDIRS) -dnl In the xdvik package, when building with -sourcedir option the -dnl libs dir must be made by hand. -test -d libs || mkdir libs - -AC_CONFIG_SUBDIRS($PKGS texk libs/t1lib libs/libwww) +AC_CONFIG_SUBDIRS(libs $ESUBDIRS texk) AC_OUTPUT(Makefile) diff -Naur xdvik-22.40l/libs/CVS/Entries xdvik-22.40n/libs/CVS/Entries --- xdvik-22.40l/libs/CVS/Entries Sat Aug 31 23:06:37 2002 +++ xdvik-22.40n/libs/CVS/Entries Mon Sep 16 17:45:07 2002 @@ -1,4 +1,8 @@ +/EXTRA.LIB/1.1.2.1/Sat Sep 14 00:24:46 2002//Txdvik_22_40_STABLE +/configure/1.1.2.1/Sat Sep 14 00:24:46 2002//Txdvik_22_40_STABLE +/configure.in/1.1.2.1/Sat Sep 14 00:24:46 2002//Txdvik_22_40_STABLE /psenc.diff/1.1/Sun Jun 3 23:34:05 2001//Txdvik_22_40_STABLE /t1lib.diff/1.1/Thu May 31 19:46:16 2001//Txdvik_22_40_STABLE D/libwww//// D/t1lib//// +D/type1//// diff -Naur xdvik-22.40l/libs/EXTRA.LIB xdvik-22.40n/libs/EXTRA.LIB --- xdvik-22.40l/libs/EXTRA.LIB Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/EXTRA.LIB Sat Sep 14 00:24:46 2002 @@ -0,0 +1,2 @@ +Extra libraries that are used by programs in the texk directory and +outside of it. diff -Naur xdvik-22.40l/libs/configure xdvik-22.40n/libs/configure --- xdvik-22.40l/libs/configure Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/configure Sat Sep 14 00:24:46 2002 @@ -0,0 +1,2619 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --without-mktexmf-default do not run mktexmf if MF source missing" +ac_help="$ac_help + --without-mktexpk-default do not run mktexpk if PK font missing" +ac_help="$ac_help + --without-mktextfm-default do not run mktextfm if TFM file missing" +ac_help="$ac_help + --without-mkocp-default do not run mkocp if OCP file missing" +ac_help="$ac_help + --without-mkofm-default do not run mkofm if OFM file missing" +ac_help="$ac_help + --enable-multiplatform put executables in bin/PLATFORM" +ac_help="$ac_help + --with-system-t1lib use installed t1 library" +ac_help="$ac_help + --with-t1lib-libdir=DIR + Specify directory where the t1 library (libt1.a) resides." +ac_help="$ac_help + --with-t1lib-include=DIR + Specify the t1lib header files location." +ac_help="$ac_help + --with-system-wwwlib check for installed libwww library" +ac_help="$ac_help + --with-libwww=DIR Specify path to W3C Reference Library distribution." +ac_help="$ac_help + --with-libwww-libdir=DIR + Specify directory where the libwww.a resides." +ac_help="$ac_help + --with-libwww-include=DIR + Specify the libwww header files location." +ac_help="$ac_help + --with-libwww-config=PROG + Use PROG as libwww-config program." + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=EXTRA.LIB + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in ../config $srcdir/../config; do + if test -f $ac_dir/install-sh; then + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ../config $srcdir/../config" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:591: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:620: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:651: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:703: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:736: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 747 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:778: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:783: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:811: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:870: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:891: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:909: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:943: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + # Hack for MSDOS and descendants. + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test $ac_x $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:998: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1025: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +# MS-DOS is a special case, because it sort of pretends that ln -s +# works for executables. +if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1048: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1069: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1086: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1103: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:1130: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:1142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:1163: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:1196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:1228: checking whether alloca needs Cray hooks" >&5 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1258: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:1313: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext < addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:1340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <&6 +echo "configure:1364: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1393: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test "x$USE_MAINTAINER_MODE" = xyes; then + MAINT= + else + MAINT='#M#' + fi + + + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1413: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test "x$USE_MAINTAINER_MODE" = xyes; then + MAINT= + else + MAINT='#M#' + fi + + + +echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 +echo "configure:1432: checking for loader (symbol LD)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$LD" && LD=ld +cf_cv_subst_LD=$LD +fi + +LD=${cf_cv_subst_LD} +echo "$ac_t""$LD" 1>&6 + + +echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 +echo "configure:1446: checking for archiver (symbol AR)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$AR" && AR=ar +cf_cv_subst_AR=$AR +fi + +AR=${cf_cv_subst_AR} +echo "$ac_t""$AR" 1>&6 + + +echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 +echo "configure:1460: checking for archiver options (symbol AR_OPTS)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$AR_OPTS" && AR_OPTS=rc +cf_cv_subst_AR_OPTS=$AR_OPTS +fi + +AR_OPTS=${cf_cv_subst_AR_OPTS} +echo "$ac_t""$AR_OPTS" 1>&6 + + + +# Check whether --with-mktexmf-default or --without-mktexmf-default was given. +if test "${with_mktexmf_default+set}" = set; then + withval="$with_mktexmf_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_MF_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mktexpk-default or --without-mktexpk-default was given. +if test "${with_mktexpk_default+set}" = set; then + withval="$with_mktexpk_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_PK_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mktextfm-default or --without-mktextfm-default was given. +if test "${with_mktextfm_default+set}" = set; then + withval="$with_mktextfm_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_TFM_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mkocp-default or --without-mkocp-default was given. +if test "${with_mkocp_default+set}" = set; then + withval="$with_mkocp_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_OMEGA_OCP_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mkofm-default or --without-mkofm-default was given. +if test "${with_mkofm_default+set}" = set; then + withval="$with_mkofm_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_OMEGA_OFM_BY_DEFAULT 1 +EOF + +fi + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:1552: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +# Check whether --enable-multiplatform or --disable-multiplatform was given. +if test "${enable_multiplatform+set}" = set; then + enableval="$enable_multiplatform" + if test "x$enable_multiplatform" = xyes && + test "x$bindir" = 'x${exec_prefix}/bin' +then + bindir="$bindir/$host" +fi +fi + + +echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 +echo "configure:1584: checking where the main texmf tree is located" >&5 +texmfmain= +if test "x$datadir" != 'x${prefix}/share'; then + # First case, datadir is defined... + eval p=\"$datadir\" + # Unconditionally set the directory, but... + texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` + # ... do complain if it wasn't found. + if test -d "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + echo "$ac_t""not found" 1>&6 + echo "configure: warning: No texmf tree found at $texmfmain. + If you do not have the files, you can retrieve a minimal set from + ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts + in systems/web2c. Winging it." 1>&2 + fi +else + # Second case, datadir is default... + if test "x$prefix" = "xNONE"; then + p="$ac_default_prefix" + else + eval p=\"$prefix\" + fi + for e in share/texmf lib/texmf texmf; do + if test -d "$p/$e"; then + texmfmain="$p/$e" + break + fi + done + texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` + if test -n "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + eval texmfmain="$datadir/texmf" + echo "$ac_t""not found" 1>&6 + echo "configure: warning: The main texmf tree was not found. + Specify the location of its parent directory with the --datadir option. + If you do not have the files, you can retrieve a minimal set from + ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts + in systems/web2c. Winging it by using the default location + $texmfmain." 1>&2 + fi +fi + + +# Check whether --with-system-t1lib or --without-system-t1lib was given. +if test "${with_system_t1lib+set}" = set; then + withval="$with_system_t1lib" + : +fi + + +# Check whether --with-t1lib_libdir or --without-t1lib_libdir was given. +if test "${with_t1lib_libdir+set}" = set; then + withval="$with_t1lib_libdir" + : +fi + + +# Check whether --with-t1lib_include or --without-t1lib_include was given. +if test "${with_t1lib_include+set}" = set; then + withval="$with_t1lib_include" + : +fi + + +if test "$needs_libt1" = no; then + LIBT1CPPFLAGS= + LDLIBT1= + LIBT1DEP= +else + EXTRA_LIBT1_INCLUDE= + EXTRA_LIBT1_LIBDIR= + + if test "$with_system_t1lib" = yes; then + if test "x$with_t1lib_libdir" != x; then + EXTRA_LIBT1_LIBDIR="-L$with_t1lib_libdir" + fi + if test "x$with_t1lib_include" != x; then + EXTRA_LIBT1_INCLUDE="-I$with_t1lib_include" + fi + fi + + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR" + CPP="$CPP $EXTRA_LIBT1_INCLUDE" + + if test "$with_system_t1lib" = yes; then + echo $ac_n "checking for T1_AddFont in -lt1""... $ac_c" 1>&6 +echo "configure:1677: checking for T1_AddFont in -lt1" >&5 +ac_lib_var=`echo t1'_'T1_AddFont | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lt1 -lz -lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + t1lib=-lt1 +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: Standard T1 library not found. Compiling my own." 1>&2 + with_system_t1lib=no +fi + + fi + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR -lt1 -lm" + if test "$with_system_t1lib" = yes; then + echo $ac_n "checking whether installed T1 lib is >= v 1.3.1 ""... $ac_c" 1>&6 +echo "configure:1723: checking whether installed T1 lib is >= v 1.3.1 " >&5 + if test "$cross_compiling" = yes; then + ac_compile_t1lib=1 + ] +else + cat > conftest.$ac_ext < +#include "t1lib.h" +#define BUFLEN 128 +int main() { + char *t1libId = T1_GetLibIdent(); + char testbuf[BUFLEN]; + char *p = testbuf; + int i; + int version_num; + /* T1_GetLibIdent() might return something like '0.8-beta2'; + convert the leading numbers to a single digit: */ + for (i = 0; i < BUFLEN; i++) { + if (t1libId[i] >= '0' && t1libId[i] <= '9') + *p++ = t1libId[i]; + else if (t1libId[i] != '.' && t1libId[i] != '_' && t1libId[i] != '-') + break; + } + version_num = strtoul(testbuf, (char **)NULL, 10); + /* xdvik needs >= 1.2.0 for parsing dvips map files. + Try to deal with version strings with 1 or more digits. */ + if (version_num >= 120 + || (version_num < 100 && version_num >= 12) + || (version_num < 10 && version_num >= 2)) + exit(0); + exit(1); +} + +EOF +if { (eval echo configure:1760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_compile_t1lib=0 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_compile_t1lib=1 +fi +rm -fr conftest* +fi + + if test $ac_compile_t1lib = 0; then + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no, will compile my own version" 1>&6 + with_system_t1lib=no + fi + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + LIBS=$OLD_LIBS + + if test "$with_system_t1lib" != yes; then + LIBT1CPPFLAGS='-I$(LIBT1DIR) -I$(LIBT1SRCDIR) -I$(LIBT1DIR)/../type1 -I$(LIBT1SRCDIR)/../type1' + LDLIBT1='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + LIBT1DEP='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + using_system_t1lib=no + else + LIBT1CPPFLAGS="$EXTRA_LIBT1_INCLUDE" + LDLIBT1="$EXTRA_LIBT1_LIBDIR -lt1" + LIBT1DEP= + using_system_t1lib=yes + fi +fi + + + + + +# Extract the first word of "pwd", so it can be a program name with args. +set dummy pwd; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1804: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_BINPWD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$BINPWD"; then + ac_cv_prog_BINPWD="$BINPWD" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_BINPWD="pwd" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +BINPWD="$ac_cv_prog_BINPWD" +if test -n "$BINPWD"; then + echo "$ac_t""$BINPWD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +try_system_wwwlib=no +# Check whether --with-system-wwwlib or --without-system-wwwlib was given. +if test "${with_system_wwwlib+set}" = set; then + withval="$with_system_wwwlib" + test "$withval" = "yes" && try_system_wwwlib=yes +else + try_system_wwwlib=no +fi + + +# +# Bother about W3C Reference library wich has no standard installation place... +# +# Check whether --with-libwww or --without-libwww was given. +if test "${with_libwww+set}" = set; then + withval="$with_libwww" + + try_system_wwwlib=yes + if test "${with_libwww+set}" = "set" ; + then + if test "${with_libwww}" != "no" ; + then + libwww_dir="${with_libwww}" + if test -d ${libwww_dir} ; + then + libwww_dir="`cd $libwww_dir ; $BINPWD`" + else + echo "configure: warning: ${libwww_dir} doesn't exist" 1>&2 + libwww_dir= + fi + fi + fi + + +fi + + +# Check whether --with-libwww_libdir or --without-libwww_libdir was given. +if test "${with_libwww_libdir+set}" = set; then + withval="$with_libwww_libdir" + + try_system_wwwlib=yes + if test "${with_libwww_libdir+set}" = "set" ; + then + if test "${with_libwww_libdir}" != "no" ; + then + libwww_library_dir="${with_libwww_libdir}" + if test -d ${libwww_library_dir} ; + then + libwww_library_dir="`cd $libwww_library_dir ; $BINPWD`" + else + echo "configure: warning: ${libwww_library_dir} doesn't exist" 1>&2 + libwww_library_dir= + fi + fi + fi + + +fi + + +# Check whether --with-libwww_include or --without-libwww_include was given. +if test "${with_libwww_include+set}" = set; then + withval="$with_libwww_include" + + try_system_wwwlib=yes + if test "${with_libwww_include+set}" = "set" ; + then + if test "${with_libwww_include}" != "no" ; + then + libwww_include="${with_libwww_include}" + if test -d ${libwww_include}; + then + libwww_include="`cd $libwww_include ; $BINPWD`" + else + echo "configure: warning: ${libwww_include} doesn't exist" 1>&2 + libwww_include= + fi + fi + fi + + +fi + + +# Check whether --with-libwww-config or --without-libwww-config was given. +if test "${with_libwww_config+set}" = set; then + withval="$with_libwww_config" + + libwww_config=$with_libwww_config + try_system_wwwlib=yes + + +fi + + +if test "$needs_libwww" = no; then + LDLIBWWW= + LIBWWWCPPFLAGS= + LIBWWWDEP= +else + OLD_LIBS=$LIBS + + LibWWW_headers="WWWLib.h WWWApp.h WWWFile.h WWWHTTP.h WWWMIME.h WWWNews.h WWWTrans.h" + LibWWW_config_h="wwwconf.h" + libwww_include_list="${libwww_include} ${libwww_dir} \ + ${libwww_dir}/include ${libwww_dir}/Library/src" + libwww_libdir_list="${libwww_library_dir} ${libwww_dir} ${libwww_dir}/lib \ + ${libwww_dir}/Library/src" + + if test $try_system_wwwlib = yes; then + test -z "$libwww_config" && libwww_config=libwww-config + + # can we find the $libwww_config program? + LIBWWW_CONFIG= + if test -f "$libwww_config"; then + LIBWWW_CONFIG=$libwww_config + else + # Extract the first word of "$libwww_config", so it can be a program name with args. +set dummy $libwww_config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1953: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_LIBWWW_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$LIBWWW_CONFIG" in + /*|[A-z]:/*) + ac_cv_path_LIBWWW_CONFIG="$LIBWWW_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_LIBWWW_CONFIG="$LIBWWW_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_path_LIBWWW_CONFIG="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +LIBWWW_CONFIG="$ac_cv_path_LIBWWW_CONFIG" +if test -n "$LIBWWW_CONFIG"; then + echo "$ac_t""$LIBWWW_CONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + + if test -n "$LIBWWW_CONFIG"; then + libwww_include_found=yes + libwww_libdir_found=yes + LDLIBWWW=`$libwww_config --libs` + + # te: I have seen xmlparse.h one directory above the directory given + # by libwww-config. Therefore, this hack: + libwww_config_cflags=`$libwww_config --cflags` + hack=`echo $libwww_config_cflags | sed 's@-I@@; s@/w3c-libwww.*@@'` + test -n "$hack" && test -f "$hack/xmlparse.h" \ + && libwww_config_cflags="$libwww_config_cflags -I$hack" + + LIBWWWCPPFLAGS="$libwww_config_cflags -DHAVE_LIBWWW -DHAVE_WWWLIB_H" + else + libwww_include_found=no + libwww_libdir_found=no + for d in $libwww_include_list; do + ok=yes + for h in $LibWWW_headers; do + if test ! -f $d/$h; then + ok=no + break + fi + done + if test $ok = yes; then + libwww_include=$d + libwww_include_found=yes + break + fi + done + + if test $libwww_include_found = yes; then + LIBWWWCPPFLAGS="-I${libwww_include} -DHAVE_LIBWWW -DHAVE_WWWLIB_H" + else + LIBWWWCPPFLAGS="-DHAVE_LIBWWW -DHAVE_WWWLIB_H" + if test $try_system_wwwlib = yes; then + libwww_include_found=yes + for ac_hdr in $LibWWW_headers +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2029: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2039: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +libwww_include_found=no; break +fi +done + + fi + fi + + # only check for libwww.a if the includes could be found + if test $libwww_include_found = yes; then + for d in $libwww_libdir_list; do + if test -f $d/libwww.a; then + libwww_libdir=$d + libwww_libdir_found=yes + fi + done + + if test ${libwww_libdir_found} = yes; then + LDLIBWWW="-L${libwww_libdir} -lwww" + else + LDLIBWWW=-lwww + libwww_libdir_found=yes + echo $ac_n "checking for HTParse in -lwww""... $ac_c" 1>&6 +echo "configure:2084: checking for HTParse in -lwww" >&5 +ac_lib_var=`echo www'_'HTParse | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lwww $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo www | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +libwww_libdir_found=no +fi + + fi + fi + fi + fi + + if test "${libwww_include_found}" != yes || + test "${libwww_libdir_found}" != yes; then + if test $try_system_wwwlib = yes; then + echo "configure: warning: Have not found standard LIBWWW library. Shall compile my own one." 1>&2 + fi + LDLIBWWW='$(LIBWWWDIR)/libwww.a' + LIBWWWCPPFLAGS='-I$(LIBWWWDIR) -I$(LIBWWWSRCDIR) -DHAVE_LIBWWW -DHAVE_WWWLIB_H' + LIBWWWDEP='$(LIBWWWDIR)/libwww.a' + using_system_wwwlib=no + else + using_system_wwwlib=yes + LIBWWWDEP= + fi + LIBS=$OLD_LIBS +fi + + + + + + + + + + + + + + +# The following line helps, e.g. for ncurses which properly detects the +# system's terminfo definitions if configured without explicit --prefix. +# ac_configure_args=`echo "$ac_configure_args" | sed 's@--prefix=[[^ ]]*@@'` + +subconfigures= +test "x$needs_libt1" != xno && test "$using_system_t1lib" != yes \ + && subconfigures="$subconfigures t1lib type1" +test "x$needs_libwww" != xno && test "$using_system_wwwlib" != yes \ + && subconfigures="$subconfigures libwww" +test "x$needs_ncurses" != xno && test "$using_system_ncurses" != yes \ + && subconfigures="$subconfigures ncurses" +test "x$needs_xpdf" != xno \ + && subconfigures="$subconfigures xpdf" +test "x$needs_libtiff" != xno && test "$using_system_tifflib" != yes \ + && subconfigures="$subconfigures libtiff" + +outfiles= +test "x$needs_pnglib" != xno && test "$using_system_pnglib" != yes \ + && outfiles="$outfiles libpng/Makefile" +test "x$needs_zlib" != xno && test "$using_system_zlib" != yes \ + && outfiles="$outfiles zlib/Makefile" + +subdirs="$subconfigures" + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012\015' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "$outfiles" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@LN_S@%$LN_S%g +s%@CPP@%$CPP%g +s%@ALLOCA@%$ALLOCA%g +s%@RANLIB@%$RANLIB%g +s%@MAINT@%$MAINT%g +s%@LD@%$LD%g +s%@AR@%$AR%g +s%@AR_OPTS@%$AR_OPTS%g +s%@texmfmain@%$texmfmain%g +s%@LIBT1CPPFLAGS@%$LIBT1CPPFLAGS%g +s%@LDLIBT1@%$LDLIBT1%g +s%@LIBT1DEP@%$LIBT1DEP%g +s%@BINPWD@%$BINPWD%g +s%@LIBWWW_CONFIG@%$LIBWWW_CONFIG%g +s%@LDLIBWWW@%$LDLIBWWW%g +s%@LIBWWWCPPFLAGS@%$LIBWWWCPPFLAGS%g +s%@LIBWWWDEP@%$LIBWWWDEP%g +s%@subdirs@%$subdirs%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*|[A-z]:/*) # Absolute path. + srcdir="$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + "") ;; + [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` + # Replace lines of the form ac_include foo with the contents of foo: + # first, from the ac_include lines construct a list of file names. + # From that list, we construct a second list of those files that exist. + # Then we construct lists of sed commands for including those files, + # and a sed command that removes the ac_include lines. We don't attempt + # to read non-existent files because some (buggy) versions of sed choke + # on this. Have to use sed because old (Ultrix, SunOS) awk does not support + # getline or system. (Anyway, configure scripts aren't supposed to use awk.) + # Can't use only one -e and commands {dr foo} because foo has to be last. + # Be careful, because the filename may contain /. Be careful with + # whitespace; we need to use echo. + # + # No support for the multiple-output file :-separated stuff. + # + file_substs=`sed -n \ +'/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' \ + "$ac_given_srcdir/$ac_file_in"` + # Create the sed command line ... + file_subst_cmd='sed' + for ac_inc in $file_substs; do + if test -f "$ac_given_srcdir/$ac_inc"; then + ac_mung=`echo $ac_inc | sed 's,/,%,g'` + file_subst_cmd="$file_subst_cmd -e '/^ac_include $ac_mung$/r $ac_inc'" + fi + done + file_subst_cmd="$file_subst_cmd -e '/^ac_include/d'" + # ... and fix the whitespace and escaped slashes. + file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \ +-e 's/ac_include /ac_include[ ]*/g'` + # cd into the srcdir because the files being included more or less + # must be part of the distribution. I can't find any way to do + # variable substitution in the sed commands (so the user could have, + # e.g., $top_srcdir in their ac_include line). + (cd $ac_given_srcdir && eval $file_subst_cmd $ac_file_in) \ + | sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in $subconfigures; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*|[A-z]:/*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f ./configure; then + ac_sub_configure=./configure + elif test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*|[A-z]:/*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac + case "$ac_given_INSTALL" in + "") ;; + [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + diff -Naur xdvik-22.40l/libs/configure.in xdvik-22.40n/libs/configure.in --- xdvik-22.40l/libs/configure.in Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/configure.in Sat Sep 14 00:24:46 2002 @@ -0,0 +1,51 @@ +AC_INIT(EXTRA.LIB) + +AC_CONFIG_AUX_DIR(../config) +AC_SET_MAKE +AC_PROG_CC +AC_CANONICAL_SYSTEM +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_LN_S +AC_FUNC_ALLOCA +AC_PROG_RANLIB +AM_MAINTAINER_MODE + +sinclude(../texk/kpathsea/withenable.ac) +sinclude(t1lib/withenable.ac) +sinclude(t1lib/t1lib.ac) +sinclude(libwww/withenable.ac) +sinclude(libwww/libwww.ac) +sinclude(ncurses/withenable.ac) +sinclude(ncurses/ncurses.ac) +sinclude(libtiff/withenable.ac) +sinclude(libtiff/libtiff.ac) +sinclude(libpng/withenable.ac) +sinclude(libpng/libpng.ac) +sinclude(zlib/withenable.ac) +sinclude(zlib/zlib.ac) + +# The following line helps, e.g. for ncurses which properly detects the +# system's terminfo definitions if configured without explicit --prefix. +# ac_configure_args=`echo "$ac_configure_args" | sed 's@--prefix=[[^ ]]*@@'` + +subconfigures= +test "x$needs_libt1" != xno && test "$using_system_t1lib" != yes \ + && subconfigures="$subconfigures t1lib type1" +test "x$needs_libwww" != xno && test "$using_system_wwwlib" != yes \ + && subconfigures="$subconfigures libwww" +test "x$needs_ncurses" != xno && test "$using_system_ncurses" != yes \ + && subconfigures="$subconfigures ncurses" +test "x$needs_xpdf" != xno \ + && subconfigures="$subconfigures xpdf" +test "x$needs_libtiff" != xno && test "$using_system_tifflib" != yes \ + && subconfigures="$subconfigures libtiff" + +outfiles= +test "x$needs_pnglib" != xno && test "$using_system_pnglib" != yes \ + && outfiles="$outfiles libpng/Makefile" +test "x$needs_zlib" != xno && test "$using_system_zlib" != yes \ + && outfiles="$outfiles zlib/Makefile" + +AC_CONFIG_SUBDIRS($subconfigures) +AC_OUTPUT($outfiles) diff -Naur xdvik-22.40l/libs/libwww/COPYRIGH xdvik-22.40n/libs/libwww/COPYRIGH --- xdvik-22.40l/libs/libwww/COPYRIGH Wed Apr 18 14:23:09 2001 +++ xdvik-22.40n/libs/libwww/COPYRIGH Fri Sep 13 00:23:45 2002 @@ -8,7 +8,7 @@ libwww: W3C's implementation of HTTP can be found at: http://www.w3.org/Library/ - Copyright ¨ 1995-1998 World Wide Web Consortium, + Copyright ¨ 1995-2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. diff -Naur xdvik-22.40l/libs/libwww/CVS/Entries xdvik-22.40n/libs/libwww/CVS/Entries --- xdvik-22.40l/libs/libwww/CVS/Entries Sat Aug 31 22:50:30 2002 +++ xdvik-22.40n/libs/libwww/CVS/Entries Mon Sep 16 17:45:07 2002 @@ -1,268 +1,281 @@ -/COPYRIGH/1.1.1.1/Wed Apr 18 14:23:09 2001//Txdvik_22_40_STABLE -/HTAABrow.c/1.1.1.1/Wed Apr 18 14:23:10 2001//Txdvik_22_40_STABLE -/HTAABrow.h/1.1.1.1/Wed Apr 18 14:23:10 2001//Txdvik_22_40_STABLE -/HTAAUtil.c/1.1.1.1/Wed Apr 18 14:23:10 2001//Txdvik_22_40_STABLE -/HTAAUtil.h/1.1.1.1/Wed Apr 18 14:23:10 2001//Txdvik_22_40_STABLE -/HTANSI.c/1.1.1.1/Wed Apr 18 14:23:10 2001//Txdvik_22_40_STABLE +/COPYRIGH/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAABrow.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAABrow.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAAUtil.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAAUtil.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTANSI.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE /HTANSI.h/1.1.1.1/Wed Apr 18 14:23:10 2001//Txdvik_22_40_STABLE -/HTAccess.c/1.2/Sun Jun 24 14:51:33 2001//Txdvik_22_40_STABLE -/HTAccess.h/1.1.1.1/Wed Apr 18 14:23:10 2001//Txdvik_22_40_STABLE -/HTAlert.c/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTAlert.h/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTAncMan.h/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTAnchor.c/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTAnchor.h/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTArray.c/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTArray.h/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTAssoc.c/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTAssoc.h/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTAtom.c/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTAtom.h/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTBInit.c/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTBInit.h/1.1.1.1/Wed Apr 18 14:23:11 2001//Txdvik_22_40_STABLE -/HTBTree.c/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTBTree.h/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTBind.c/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTBind.h/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTBound.c/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTBound.h/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTBufWrt.c/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTBufWrt.h/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTCache.c/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTCache.h/1.1.1.1/Wed Apr 18 14:23:12 2001//Txdvik_22_40_STABLE -/HTChannl.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTChannl.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTChunk.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTChunk.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTConLen.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTConLen.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDNS.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDNS.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDemux.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDemux.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDescpt.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDescpt.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDialog.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDialog.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDigest.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDigest.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDir.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTDir.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTEPtoCl.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTEPtoCl.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTError.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTError.h/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTEscape.c/1.2/Mon Apr 30 13:12:24 2001//Txdvik_22_40_STABLE -/HTEscape.h/1.2/Mon Apr 30 13:12:24 2001//Txdvik_22_40_STABLE -/HTEvent.c/1.1.1.1/Wed Apr 18 14:23:13 2001//Txdvik_22_40_STABLE -/HTEvent.h/1.1.1.1/Wed Apr 18 14:23:14 2001//Txdvik_22_40_STABLE -/HTEvtLst.c/1.1.1.1/Wed Apr 18 14:23:14 2001//Txdvik_22_40_STABLE -/HTEvtLst.h/1.1.1.1/Wed Apr 18 14:23:14 2001//Txdvik_22_40_STABLE -/HTFTP.c/1.1.1.1/Wed Apr 18 14:23:14 2001//Txdvik_22_40_STABLE -/HTFTP.h/1.1.1.1/Wed Apr 18 14:23:14 2001//Txdvik_22_40_STABLE -/HTFTPDir.c/1.1.1.1/Wed Apr 18 14:23:14 2001//Txdvik_22_40_STABLE -/HTFTPDir.h/1.1.1.1/Wed Apr 18 14:23:14 2001//Txdvik_22_40_STABLE -/HTFWrite.c/1.1.1.1/Wed Apr 18 14:23:14 2001//Txdvik_22_40_STABLE -/HTFWrite.h/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTFile.c/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTFile.h/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTFilter.c/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTFilter.h/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTFormat.c/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTFormat.h/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTGopher.c/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTGopher.h/1.1.1.1/Wed Apr 18 14:23:15 2001//Txdvik_22_40_STABLE -/HTGuess.c/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTGuess.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHInit.c/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHInit.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHeader.c/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHeader.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHist.c/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHist.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHome.c/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHome.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHost.c/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHost.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTHstMan.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTIOStream.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTIcons.c/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTIcons.h/1.1.1.1/Wed Apr 18 14:23:16 2001//Txdvik_22_40_STABLE -/HTInet.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTInet.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTInit.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTInit.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTLib.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTLib.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTLink.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTLink.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTList.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTList.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTLocal.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTLocal.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTLog.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTLog.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTMIME.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTMIME.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTMIMERq.c/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTMIMERq.h/1.1.1.1/Wed Apr 18 14:23:17 2001//Txdvik_22_40_STABLE -/HTMIMImp.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMIMImp.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMIMPrs.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMIMPrs.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTML.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTML.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMLGen.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMLGen.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMLPDTD.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMLPDTD.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMemLog.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMemLog.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMemory.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMemory.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMerge.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMerge.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMethod.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMethod.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMulpar.h/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMulti.c/1.1.1.1/Wed Apr 18 14:23:18 2001//Txdvik_22_40_STABLE -/HTMulti.h/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTMuxCh.c/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTMuxCh.h/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTMuxHeader.h/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTMuxTx.c/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTMuxTx.h/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTNDir.c/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTNDir.h/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTNet.c/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTNet.h/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTNetMan.h/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTNetTxt.c/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTNetTxt.h/1.1.1.1/Wed Apr 18 14:23:19 2001//Txdvik_22_40_STABLE -/HTNews.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTNews.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTNewsLs.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTNewsLs.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTNewsRq.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTNewsRq.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTPEP.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTPEP.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTParse.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTParse.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTPlain.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTPlain.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTProfil.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTProfil.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTProt.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTProt.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTProxy.c/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTProxy.h/1.1.1.1/Wed Apr 18 14:23:20 2001//Txdvik_22_40_STABLE -/HTReader.c/1.1.1.1/Wed Apr 18 14:23:21 2001//Txdvik_22_40_STABLE -/HTReader.h/1.1.1.1/Wed Apr 18 14:23:21 2001//Txdvik_22_40_STABLE -/HTReq.h/1.1.1.1/Wed Apr 18 14:23:21 2001//Txdvik_22_40_STABLE -/HTReqMan.c/1.1.1.1/Wed Apr 18 14:23:21 2001//Txdvik_22_40_STABLE -/HTReqMan.h/1.1.1.1/Wed Apr 18 14:23:21 2001//Txdvik_22_40_STABLE -/HTResMan.h/1.1.1.1/Wed Apr 18 14:23:21 2001//Txdvik_22_40_STABLE -/HTResponse.c/1.1.1.1/Wed Apr 18 14:23:21 2001//Txdvik_22_40_STABLE -/HTResponse.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTRules.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTRules.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTSChunk.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTSChunk.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTSQL.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTSQL.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTSQLLog.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTSQLLog.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTSocket.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTSocket.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTStream.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTStream.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTString.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTString.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTStruct.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTStyle.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTStyle.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTTCP.c/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTTCP.h/1.1.1.1/Wed Apr 18 14:23:22 2001//Txdvik_22_40_STABLE -/HTTChunk.c/1.1.1.1/Wed Apr 18 14:23:23 2001//Txdvik_22_40_STABLE -/HTTChunk.h/1.1.1.1/Wed Apr 18 14:23:23 2001//Txdvik_22_40_STABLE -/HTTP.c/1.1.1.1/Wed Apr 18 14:23:23 2001//Txdvik_22_40_STABLE -/HTTP.h/1.1.1.1/Wed Apr 18 14:23:23 2001//Txdvik_22_40_STABLE -/HTTPGen.c/1.1.1.1/Wed Apr 18 14:23:23 2001//Txdvik_22_40_STABLE -/HTTPGen.h/1.1.1.1/Wed Apr 18 14:23:23 2001//Txdvik_22_40_STABLE -/HTTPReq.c/1.3/Sun Jun 24 14:51:48 2001//Txdvik_22_40_STABLE -/HTTPReq.h/1.1.1.1/Wed Apr 18 14:23:24 2001//Txdvik_22_40_STABLE -/HTTPRes.c/1.1.1.1/Wed Apr 18 14:23:24 2001//Txdvik_22_40_STABLE -/HTTPRes.h/1.1.1.1/Wed Apr 18 14:23:24 2001//Txdvik_22_40_STABLE -/HTTPServ.c/1.1.1.1/Wed Apr 18 14:23:24 2001//Txdvik_22_40_STABLE -/HTTPServ.h/1.1.1.1/Wed Apr 18 14:23:24 2001//Txdvik_22_40_STABLE -/HTTPUtil.h/1.1.1.1/Wed Apr 18 14:23:24 2001//Txdvik_22_40_STABLE -/HTTeXGen.c/1.1.1.1/Wed Apr 18 14:23:24 2001//Txdvik_22_40_STABLE -/HTTeXGen.h/1.1.1.1/Wed Apr 18 14:23:24 2001//Txdvik_22_40_STABLE -/HTTee.c/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTTee.h/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTTelnet.c/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTTelnet.h/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTTimer.c/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTTimer.h/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTTrace.c/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTTrans.c/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTTrans.h/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTUTree.c/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTUTree.h/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTUU.c/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTUU.h/1.1.1.1/Wed Apr 18 14:23:25 2001//Txdvik_22_40_STABLE -/HTUser.c/1.1.1.1/Wed Apr 18 14:23:26 2001//Txdvik_22_40_STABLE -/HTUser.h/1.1.1.1/Wed Apr 18 14:23:26 2001//Txdvik_22_40_STABLE -/HTUtils.h/1.1.1.1/Wed Apr 18 14:23:26 2001//Txdvik_22_40_STABLE -/HTWAIS.c/1.1.1.1/Wed Apr 18 14:23:26 2001//Txdvik_22_40_STABLE -/HTWAIS.h/1.1.1.1/Wed Apr 18 14:23:26 2001//Txdvik_22_40_STABLE -/HTWSRC.c/1.1.1.1/Wed Apr 18 14:23:26 2001//Txdvik_22_40_STABLE -/HTWSRC.h/1.1.1.1/Wed Apr 18 14:23:26 2001//Txdvik_22_40_STABLE -/HTWWWStr.c/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTWWWStr.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTWriter.c/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTWriter.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTXML.c/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTXML.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTXParse.c/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTXParse.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTZip.c/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTZip.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HText.c/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HText.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/HTextImp.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/Makefile.in/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/SGML.c/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/SGML.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWApp.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWCache.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWCore.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWDir.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWFTP.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWFile.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWGophe.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWHTML.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWHTTP.h/1.1.1.1/Wed Apr 18 14:23:27 2001//Txdvik_22_40_STABLE -/WWWInit.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWLib.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWMIME.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWMux.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWNews.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWSQL.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWStream.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWTelnt.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWTrans.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWUtil.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWWAIS.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/WWWZip.h/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/aclocal.m4/1.1.1.1/Wed Apr 18 14:23:28 2001//Txdvik_22_40_STABLE -/configure/1.2/Sat May 12 23:21:47 2001//Txdvik_22_40_STABLE -/configure.in/1.1.1.1/Wed Apr 18 14:23:30 2001//Txdvik_22_40_STABLE -/libwww.ac/1.1.1.1/Wed Apr 18 14:23:30 2001//Txdvik_22_40_STABLE +/HTAccess.c/1.2.6.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAccess.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAlert.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAlert.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAncMan.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAnchor.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAnchor.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTArray.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTArray.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAssoc.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAssoc.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAtom.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTAtom.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBInit.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBInit.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBTree.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBTree.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBind.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBind.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBound.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBound.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBufWrt.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTBufWrt.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTCache.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTCache.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTChannl.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTChannl.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTChunk.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTChunk.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTConLen.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTConLen.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTCookie.c/1.1.2.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTCookie.h/1.1.2.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDAV.c/1.1.2.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDAV.h/1.1.2.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDNS.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDNS.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDemux.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDemux.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDescpt.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDescpt.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDialog.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDialog.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDigest.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDigest.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDir.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTDir.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTEPtoCl.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTEPtoCl.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTError.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTError.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTEscape.c/1.2.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTEscape.h/1.2.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTEvent.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTEvent.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTEvtLst.c/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTEvtLst.h/1.1.1.1.8.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTFSave.c/1.1.2.1/Fri Sep 13 00:23:45 2002//Txdvik_22_40_STABLE +/HTFSave.h/1.1.2.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFTP.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFTP.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFTPDir.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFTPDir.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFWrite.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFWrite.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFile.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFile.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFilter.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFilter.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFormat.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTFormat.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTGopher.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTGopher.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTGuess.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTGuess.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHInit.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHInit.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHash.c/1.1.2.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHash.h/1.1.2.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHeader.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHeader.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHist.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHist.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHome.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHome.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHost.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHost.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTHstMan.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTIOStream.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTIcons.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTIcons.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTInet.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTInet.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTInit.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTInit.h/1.1.1.1.8.2/Sat Sep 14 00:24:46 2002//Txdvik_22_40_STABLE +/HTLib.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTLib.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTLink.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTLink.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTList.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTList.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTLocal.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTLocal.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTLog.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTLog.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMIME.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMIME.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMIMERq.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMIMERq.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMIMImp.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMIMImp.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMIMPrs.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMIMPrs.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTML.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTML.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMLGen.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMLGen.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMLPDTD.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMLPDTD.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMemLog.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMemLog.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMemory.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMemory.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMerge.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMerge.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMethod.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMethod.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMulpar.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMulti.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMulti.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMuxCh.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMuxCh.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMuxHeader.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMuxTx.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTMuxTx.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNDir.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNDir.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNet.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNet.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNetMan.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNetTxt.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNetTxt.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNews.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNews.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNewsLs.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNewsLs.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNewsRq.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNewsRq.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNoFree.c/1.1.2.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTNoFree.h/1.1.2.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTPEP.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTPEP.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTParse.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTParse.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTPlain.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTPlain.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTProfil.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTProfil.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTProt.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTProt.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTProxy.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTProxy.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTRDF.c/1.1.2.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTRDF.h/1.1.2.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTReader.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTReader.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTReq.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTReqMan.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTReqMan.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTResMan.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTResponse.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTResponse.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTRules.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTRules.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTSChunk.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTSChunk.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTSQL.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTSQL.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTSQLLog.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTSQLLog.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTSocket.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTSocket.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTStream.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTStream.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTString.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTString.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTStruct.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTStyle.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTStyle.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTCP.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTCP.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTChunk.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTChunk.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTP.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTP.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPGen.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPGen.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPReq.c/1.3.6.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPReq.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPRes.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPRes.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPServ.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPServ.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTPUtil.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTeXGen.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTeXGen.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTee.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTee.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTelnet.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTelnet.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTimer.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTimer.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTrace.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTrans.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTTrans.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTUTree.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTUTree.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTUU.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTUU.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTUser.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTUser.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTUtils.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTWAIS.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTWAIS.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTWSRC.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTWSRC.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTWWWStr.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTWWWStr.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTWriter.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTWriter.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTXML.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTXML.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTXParse.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTXParse.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTZip.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTZip.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HText.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HText.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/HTextImp.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/Makefile.in/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/SGML.c/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/SGML.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWApp.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWCache.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWCore.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWDir.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWFTP.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWFile.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWGophe.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWHTML.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWHTTP.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWInit.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWLib.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWMIME.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWMux.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWNews.h/1.1.1.1.8.1/Fri Sep 13 00:23:46 2002//Txdvik_22_40_STABLE +/WWWSQL.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/WWWStream.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/WWWTelnt.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/WWWTrans.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/WWWUtil.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/WWWWAIS.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/WWWXML.h/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/WWWZip.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/aclocal.m4/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/configure/1.2.8.2/Mon Sep 16 17:45:27 2002//Txdvik_22_40_STABLE +/configure.in/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/libwww.ac/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE /md5.c/1.1.1.1/Wed Apr 18 14:23:30 2001//Txdvik_22_40_STABLE -/md5.h/1.1.1.1/Wed Apr 18 14:23:30 2001//Txdvik_22_40_STABLE -/withenable.ac/1.1.1.1/Wed Apr 18 14:23:30 2001//Txdvik_22_40_STABLE -/wwwconf.h.in/1.1.1.1/Wed Apr 18 14:23:30 2001//Txdvik_22_40_STABLE -/wwwsys.h/1.1.1.1/Wed Apr 18 14:23:31 2001//Txdvik_22_40_STABLE -D +/md5.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/withenable.ac/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/wwwconf.h.in/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/wwwsys.h/1.1.1.1.8.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +D/config//// diff -Naur xdvik-22.40l/libs/libwww/HTAABrow.c xdvik-22.40n/libs/libwww/HTAABrow.c --- xdvik-22.40l/libs/libwww/HTAABrow.c Wed Apr 18 14:23:10 2001 +++ xdvik-22.40n/libs/libwww/HTAABrow.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTAABrow.c,v 1.1.1.1 2001/04/18 14:23:10 stefanulrich Exp $ +** @(#) $Id: HTAABrow.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** Contains code for parsing challenges and creating credentials for ** basic authentication schemes. See also the HTAAUtil module @@ -26,6 +26,15 @@ ** Feb 96 HFN Rewritten to make it scheme independent and based on ** callback functions and an info structure ** Nov 98 JKO Added support for message digest authentication +** Jun 2000 JKO Changed the buffer size for HTUU_encode in order +** to avoid a potential SIGSEV when calling that +** function (as advised by Heiner Kallweit). +** Mar 2001 JKO When doing pipelining digest requests, the stale +** nonce reply appears only for one of such requests, +** all the following ones in the pipe will receive a +** 401. I added some code to take into account these cases +** by trying to infer if a nonce is stale. +** */ /* Portions of this code (as indicated) are derived from the Internet Draft @@ -67,6 +76,8 @@ #define BASIC_AUTH "basic" #define DIGEST_AUTH "digest" +#define DIGEST_AI "authentication-info" +#define PROXY_DIGEST_AI "proxy-authentication-info" typedef struct _HTBasic { /* Basic challenge and credentials */ char * uid; @@ -141,9 +152,8 @@ tmplate = host; } else StrAllocCopy(tmplate, "*"); - if (AUTH_TRACE) - HTTrace("Template.... Made template `%s' for file `%s'\n", - tmplate, docname ? docname : ""); + HTTRACE(AUTH_TRACE, "Template.... Made template `%s' for file `%s'\n" _ + tmplate _ docname ? docname : ""); return tmplate; } @@ -159,7 +169,12 @@ HTBasic * basic) { HTAlertCallback * cbf = HTAlert_find(HT_A_USER_PW); - if (request && cbf) { + + /* If no method for prompting the user then we might as well give up */ + if (!cbf) return HT_ERROR; + + /* Otherwise go ahead and ask the user */ + if (request) { HTAlertPar * reply = HTAlert_newReply(); int msg = basic->proxy ? HT_MSG_PROXY_UID : HT_MSG_UID; BOOL res = (*cbf)(request, HT_A_USER_PW, msg, @@ -218,7 +233,7 @@ char * cipher = NULL; int cl_len = strlen(basic->uid ? basic->uid : "") + strlen(basic->pw ? basic->pw : "") + 5; - int ci_len = 4 * (((cl_len+2)/3) + 1); + int ci_len = 5 + 4 * (cl_len/3); if ((cleartext = (char *) HT_CALLOC(1, cl_len)) == NULL) HT_OUTOFMEM("basic_credentials"); *cleartext = '\0'; @@ -236,7 +251,7 @@ if (!cookie) HT_OUTOFMEM("basic_credentials"); strcpy(cookie, "Basic "); strcat(cookie, cipher); - if (AUTH_TRACE) HTTrace("Basic Cookie `%s\'\n", cookie); + HTTRACE(AUTH_TRACE, "Basic Cookie `%s\'\n" _ cookie); /* Check whether it is proxy or normal credentials */ if (basic->proxy) @@ -332,7 +347,7 @@ ** store this information in our authentication URL Tree */ if (realm && !strcasecomp(realm, "realm") && rm) { - if (AUTH_TRACE) HTTrace("Basic Parse. Realm `%s\' found\n", rm); + HTTRACE(AUTH_TRACE, "Basic Parse. Realm `%s\' found\n" _ rm); HTRequest_setRealm(request, rm); /* @@ -340,7 +355,7 @@ */ if (proxy) { char * url = HTRequest_proxy(request); - if (AUTH_TRACE) HTTrace("Basic Parse. Proxy authentication\n"); + HTTRACE(AUTH_TRACE, "Basic Parse. Proxy authentication\n"); basic = (HTBasic *) HTAA_updateNode(proxy, BASIC_AUTH, rm, url, NULL); /* if the previous authentication failed, then try again */ @@ -384,7 +399,7 @@ } return HT_OK; } - if (AUTH_TRACE) HTTrace("Auth........ No challenges found\n"); + HTTRACE(AUTH_TRACE, "Auth........ No challenges found\n"); return HT_ERROR; } @@ -400,7 +415,12 @@ HTDigest * digest) { HTAlertCallback * cbf = HTAlert_find(HT_A_USER_PW); - if (request && cbf) { + + /* If no method for prompting the user then we might as well give up */ + if (!cbf) return HT_ERROR; + + /* Otherwise go ahead and ask the user */ + if (request) { HTAlertPar * reply = HTAlert_newReply(); int msg = digest->proxy ? HT_MSG_PROXY_UID : HT_MSG_UID; BOOL res = (*cbf)(request, HT_A_USER_PW, msg, @@ -479,29 +499,41 @@ return NO; } -/* HTDigest_refresh +/* HTDigest_updateInfo ** -------------- ** This function updates the digest with whatever new ** authentification information the server sent back. -** In theory, it should be called by an authentication after -** filter responsible for the mutual authenticati. */ -PUBLIC int HTDigest_refresh (HTRequest *request, HTResponse *response, - BOOL proxy, char *auth_info) +PUBLIC int HTDigest_updateInfo (HTRequest *request, HTResponse *response, + void * context, int status) { - char * realm = NULL; - char * value = NULL; - char * token = NULL; - - if (request && auth_info) { + HTAssocList * challenge = HTResponse_challenge(response); + const char * realm = HTRequest_realm (request); + + if (request && challenge && realm) { + BOOL proxy = 0; + char * value = NULL; + char * token = NULL; + char * auth_info = NULL; + HTDigest *digest; char *url; - const char * realm = HTRequest_realm(request); - - if (AUTH_TRACE) HTTrace("Digest Update.. " - "processing authentication-info"); + /* + ** try to find the magic string in the challenge + */ + HTTRACE(AUTH_TRACE, "Digest Update.. Processing authentication-info\n"); + if ((auth_info = HTAssocList_findObject(challenge, DIGEST_AI))) + proxy = 0; + else if ((auth_info = HTAssocList_findObject(challenge, + PROXY_DIGEST_AI))) + proxy = 1; + else { + HTTRACE(AUTH_TRACE, "Digest Update.. Didn't find any authentication-info\n"); + return HT_OK; + } + /* ** find the digest credentials */ @@ -514,11 +546,10 @@ HTRequest_anchor(request)); digest = (HTDigest *) HTAA_updateNode (proxy, DIGEST_AUTH, realm, url, NULL); + HT_FREE(url); } if (!digest) { - if (AUTH_TRACE) HTTrace("Digest Update.. " - "Error: received authentication-info " - "without having a local digest"); + HTTRACE(AUTH_TRACE, "Digest Update.. Error: received authentication-info without having a local digest\n"); return HT_ERROR; } @@ -549,6 +580,7 @@ } } } + return HT_OK; } /* @@ -622,7 +654,7 @@ HTDigest_update (&MdCtx, ":", 1); HTDigest_update (&MdCtx, pszPassword, strlen(pszPassword)); HTDigest_final (HA1, &MdCtx); - if (strcasecmp (pszAlg, "md5-sess") == 0) { + if (strcasecomp (pszAlg, "md5-sess") == 0) { HTDigest_init (&MdCtx, algorithm); HTDigest_update (&MdCtx, HA1, strlen (HA1)); HTDigest_update (&MdCtx, ":", 1); @@ -659,7 +691,7 @@ HTDigest_update (&MdCtx, pszMethod, strlen(pszMethod)); HTDigest_update (&MdCtx, ":", 1); HTDigest_update (&MdCtx, pszDigestUri, strlen(pszDigestUri)); - if (pszQop && strcasecmp (pszQop, "auth-int") == 0) { + if (pszQop && strcasecomp (pszQop, "auth-int") == 0) { HTDigest_update (&MdCtx, ":", 1); HTDigest_update (&MdCtx, HEntity, HASHHEXLEN); } @@ -717,8 +749,15 @@ if (digest->proxy) uri = HTRequest_proxy(request); - else - uri = HTAnchor_address( (HTAnchor*)HTRequest_anchor(request)); + else { + char * tmp; + /* we get the absolute URL */ + tmp = HTAnchor_address( (HTAnchor*)HTRequest_anchor(request)); + /* and then remove what makes it absolute, to be backwards + compatible */ + uri = HTParse (tmp, "", PARSE_PATH | PARSE_PUNCTUATION); + HT_FREE(tmp); + } /* increment the nonce counter */ digest->nc++; @@ -750,7 +789,7 @@ if (!cookie) HT_OUTOFMEM("digest_credentials"); strcpy(cookie, "Digest "); strcat (cookie, cleartext); - if (AUTH_TRACE) HTTrace("Digest Cookie `%s\'\n", cookie); + HTTRACE(AUTH_TRACE, "Digest Cookie `%s\'\n" _ cookie); /* Check whether it is proxy or normal credentials */ if (digest->proxy) @@ -761,6 +800,8 @@ HT_FREE(cookie); } + if (!digest->proxy) + HT_FREE(uri); HT_FREE(cleartext); return HT_OK; } @@ -812,7 +853,7 @@ prompt_digest_user(request, realm, digest) == HT_OK) || (!digest->retry && digest->uid)) { /* @@@ here we should generate a new cnonce value */ - digest->cnonce = "012345678"; + HTSACopy (&(digest->cnonce), "012345678"); digest->retry = NO; return digest_credentials(request, digest); } else { @@ -828,6 +869,27 @@ return HT_OK; } +/* +** Evaluates the existing authentication info (nonce, uid, pwd) and +** returns TRUE if we evaluate that the nonce is stale, FALSE +** otherwise. +*/ +PRIVATE BOOL nonce_is_stale (HTRequest *request, HTDigest * digest, char * old_nonce) +{ + if (!digest->uid || !digest->pw) + return FALSE; + if (!digest->nonce || !old_nonce) + return FALSE; + if (strcmp (digest->nonce, old_nonce)) + return TRUE; + /* because of a pipelining implementation bug, we don't send any good + credentials on requests following the first one in the pipeline */ + if (!HTRequest_credentials (request) && HTRequest_AAretrys (request) == 1) + return TRUE; + + return FALSE; +} + /* HTDigest_parse ** ------------- ** This function parses the contents of a "digest" challenge @@ -849,13 +911,16 @@ char * value = NULL; char * token = NULL; char * uris = NULL; + /* the value of the previous nonce in case the server has changed its + challenge */ + char * old_nonce = NULL; /* ** If valid challenge then make a template for the resource and ** store this information in our authentication URL Tree */ if (realm && !strcasecomp(realm, "realm") && rm) { - if (AUTH_TRACE) HTTrace("Digest Parse. Realm `%s\' found\n", rm); + HTTRACE(AUTH_TRACE, "Digest Parse. Realm `%s\' found\n" _ rm); HTRequest_setRealm(request, rm); /* @@ -863,7 +928,7 @@ */ if (proxy) { char * url = HTRequest_proxy(request); - if (AUTH_TRACE) HTTrace("Digest Parse. Proxy authentication\n"); + HTTRACE(AUTH_TRACE, "Digest Parse. Proxy authentication\n"); digest = (HTDigest *) HTAA_updateNode(proxy, DIGEST_AUTH, rm, url, NULL); /* if the previous authentication failed, then try again */ @@ -884,7 +949,7 @@ HT_FREE(url); } } else { - if (AUTH_TRACE) HTTrace("Digest Parse. Missing or incomplete realm\n"); + HTTRACE(AUTH_TRACE, "Digest Parse. Missing or incomplete realm\n"); return HT_ERROR; } @@ -896,6 +961,8 @@ /* it's an old digest, so we clean all in it except for the uid and the password, hoping that the server send back that data */ + old_nonce = digest->nonce; + digest->nonce = NULL; HTDigest_reset (digest); } else { /* it's a brand new digest */ @@ -927,7 +994,6 @@ /* only true if we already had a digest with uid and pw info */ if (digest->uid && digest->pw) { digest->stale = YES; - digest->retry = NO; } } } else if (!strcasecomp(token, "algorithm")) { @@ -935,17 +1001,35 @@ /* ** We only support MD5 for the moment */ - if (AUTH_TRACE) HTTrace("Digest Parse Unknown " - "algorithm `%s\'\n", value); + HTTRACE(AUTH_TRACE, "Digest Parse Unknown algorithm `%s\'\n" _ value); HTDigest_delete(digest); + if (old_nonce) + HT_FREE (old_nonce); return HT_ERROR; } else digest->algorithm = HTDaMD5; } } - - if (digest->stale) + + /* Pipelining support. If a nonce becomes stale When sending + ** several requests thru the pipeline, we may miss the stale + ** reply in the server's answer. To avoid this, we keep a copy + ** of the nonce in each request. If the nonce wasn't explicitly + ** marked stale and if it's the same that we sent, then we + ** consider that the uid/pwd pairs were false. Otherwise, we + ** assume the stole went stale before + */ + if (!digest->stale && nonce_is_stale (request, digest, old_nonce)) + digest->stale = YES; + + if (old_nonce) + HT_FREE (old_nonce); + + if (digest->stale) { + digest->stale = NO; + digest->retry = NO; return HT_OK; + } else if (digest->uid || digest->pw) { /* ** For some reason there was no stale nonce header and the @@ -978,7 +1062,7 @@ if (proxy) { /* we ignore the domain */ char * location = HTRequest_proxy(request); - if (AUTH_TRACE) HTTrace("Digest Parse Proxy authentication\n"); + HTTRACE(AUTH_TRACE, "Digest Parse Proxy authentication\n"); HTAA_updateNode(proxy, DIGEST_AUTH, rm, location, digest); } else { char * url = HTAnchor_address((HTAnchor *) HTRequest_anchor(request)); @@ -998,7 +1082,7 @@ full_url = HTParse (domain_url, base_url, PARSE_ALL); digest->references++; if (proxy) { - if (AUTH_TRACE) HTTrace("Digest Parse Proxy authentication\n"); + HTTRACE(AUTH_TRACE, "Digest Parse Proxy authentication\n"); HTAA_updateNode(proxy, DIGEST_AUTH, rm, full_url, digest); } else { char * tmplate = make_template(full_url); @@ -1008,24 +1092,9 @@ HT_FREE (full_url); } HT_FREE (base_url); - HT_FREE (uris); } return HT_OK; } - if (AUTH_TRACE) HTTrace("Auth........ No challenges found\n"); + HTTRACE(AUTH_TRACE, "Auth........ No challenges found\n"); return HT_ERROR; } - - - - - - - - - - - - - - diff -Naur xdvik-22.40l/libs/libwww/HTAABrow.h xdvik-22.40n/libs/libwww/HTAABrow.h --- xdvik-22.40l/libs/libwww/HTAABrow.h Wed Apr 18 14:23:10 2001 +++ xdvik-22.40n/libs/libwww/HTAABrow.h Fri Sep 13 00:23:45 2002 @@ -55,11 +55,9 @@ extern HTNetBefore HTDigest_generate; extern HTNetAfter HTDigest_parse; +extern HTNetAfter HTDigest_updateInfo; extern HTUTree_gc HTDigest_delete; -extern int HTDigest_refresh (HTRequest *request, - HTResponse *response, - BOOL proxy, - char *auth_info); + /* */ @@ -70,7 +68,7 @@ - @(#) $Id: HTAABrow.h,v 1.1.1.1 2001/04/18 14:23:10 stefanulrich Exp $ + @(#) $Id: HTAABrow.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTAAUtil.c xdvik-22.40n/libs/libwww/HTAAUtil.c --- xdvik-22.40l/libs/libwww/HTAAUtil.c Wed Apr 18 14:23:10 2001 +++ xdvik-22.40n/libs/libwww/HTAAUtil.c Fri Sep 13 00:23:45 2002 @@ -4,7 +4,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTAAUtil.c,v 1.1.1.1 2001/04/18 14:23:10 stefanulrich Exp $ +** @(#) $Id: HTAAUtil.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** The authentication information is stored in a list of authentication ** data bases, each uniquely identified by a hostname and a port number. @@ -21,10 +21,13 @@ ** AL Ari Luotonen luotonen@dxcern.cern.ch ** MD Mark Donszelmann duns@vxdeop.cern.ch ** HFN Henrik Frystyk -** +** JK Jose Kahan jose@w3.org +** ** HISTORY: ** 8 Nov 93 MD (VMS only) Added case insensitive comparison ** in HTAA_templateCaseMatch +** 26 Jan 98 JK Augmented the HTAA module interface with a function +** for processing the auth-info headers (update) */ /* Library include files */ @@ -41,6 +44,7 @@ char * scheme; HTNetBefore * before; HTNetAfter * after; + HTNetAfter * update; HTUTree_gc * gc; }; @@ -74,13 +78,14 @@ while ((pres = (HTAAModule *) HTList_nextObject(cur))) if (!strcasecomp(pres->scheme, scheme)) return pres; } else - if (AUTH_TRACE) HTTrace("Auth Engine. Bad argument\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. Bad argument\n"); return NULL; } PUBLIC HTAAModule * HTAA_newModule (const char * scheme, HTNetBefore * before, HTNetAfter * after, + HTNetAfter * update, HTUTree_gc * gc) { if (scheme) { @@ -93,17 +98,18 @@ StrAllocCopy(pres->scheme, scheme); pres->before = before; pres->after = after; + pres->update = update; pres->gc = gc; /* Add the new AA Module to the list */ HTList_addObject(HTSchemes, (void *) pres); - if (AUTH_TRACE) HTTrace("Auth Engine. Created module %p\n", pres); + HTTRACE(AUTH_TRACE, "Auth Engine. Created module %p\n" _ pres); } else { - if (AUTH_TRACE) HTTrace("Auth Engine. Found module %p\n", pres); + HTTRACE(AUTH_TRACE, "Auth Engine. Found module %p\n" _ pres); } return pres; } else { - if (AUTH_TRACE) HTTrace("Auth Engine. Bad argument\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. Bad argument\n"); return NULL; } } @@ -112,11 +118,10 @@ { if (scheme) { HTAAModule * pres = find_module(scheme); - if (AUTH_TRACE) - HTTrace("Auth Engine. did %sfind %s\n", pres ? "" : "NOT ",scheme); + HTTRACE(AUTH_TRACE, "Auth Engine. did %sfind %s\n" _ pres ? "" : "NOT " _ scheme); return pres; } else { - if (AUTH_TRACE) HTTrace("Auth Engine. Bad augument\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. Bad augument\n"); } return NULL; } @@ -127,7 +132,7 @@ HTAAModule * pres = find_module(scheme); if (pres) { HTList_removeObject(HTSchemes, pres); - if (AUTH_TRACE) HTTrace("Auth Engine. deleted %p\n", pres); + HTTRACE(AUTH_TRACE, "Auth Engine. deleted %p\n" _ pres); delete_module(pres); return YES; } @@ -167,7 +172,7 @@ HT_OUTOFMEM("HTAAElement_new"); StrAllocCopy(me->scheme, scheme); me->context = context; - if (AUTH_TRACE) HTTrace("Auth Engine. Created element %p\n", me); + HTTRACE(AUTH_TRACE, "Auth Engine. Created element %p\n" _ me); return me; } return NULL; @@ -211,7 +216,7 @@ if (module && module->gc && me->context) (*module->gc)(me->context); - if (AUTH_TRACE) HTTrace("Auth Engine. Deleted element %p\n", me); + HTTRACE(AUTH_TRACE, "Auth Engine. Deleted element %p\n" _ me); HT_FREE(me->scheme); HT_FREE(me); return YES; @@ -237,10 +242,10 @@ { HTUTree * tree; if (!url) { - if (AUTH_TRACE) HTTrace("Auth Engine. Bad argument\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. Bad argument\n"); return NULL; } - if (AUTH_TRACE) HTTrace("Auth Engine. Looking up `%s'\n", url); + HTTRACE(AUTH_TRACE, "Auth Engine. Looking up `%s'\n" _ url); /* Find an existing URL Tree for this URL (if any) */ { @@ -254,7 +259,7 @@ tree = HTUTree_find(proxy_access ? AA_PROXY_TREE : AA_TREE, host,port); HT_FREE(host); if (!tree) { - if (AUTH_TRACE) HTTrace("Auth Engine. No information\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. No information\n"); return NULL; } } @@ -281,14 +286,14 @@ HTUTree * tree = NULL; HTAAModule * module = NULL; if (!scheme || !url) { - if (AUTH_TRACE) HTTrace("Auth Engine. Bad argument\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. Bad argument\n"); return NULL; } - if (AUTH_TRACE) HTTrace("Auth Engine. Adding info for `%s'\n", url); + HTTRACE(AUTH_TRACE, "Auth Engine. Adding info for `%s'\n" _ url); /* Find the AA module with this name */ if ((module = HTAA_findModule(scheme)) == NULL) { - if (AUTH_TRACE) HTTrace("Auth Engine. Module `%s\' not registered\n", + HTTRACE(AUTH_TRACE, "Auth Engine. Module `%s\' not registered\n" _ scheme ? scheme : ""); return NULL; } @@ -306,7 +311,7 @@ host, port, HTAA_deleteElement); HT_FREE(host); if (!tree) { - if (AUTH_TRACE) HTTrace("Auth Engine. Can't create tree\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. Can't create tree\n"); return NULL; } } @@ -316,7 +321,8 @@ char * path = HTParse(url, "", PARSE_PATH | PARSE_PUNCTUATION); HTAAElement * element = NULL; BOOL status; - if ((element = (HTAAElement *) HTUTree_findNode(tree, realm, path))) + if ((element = (HTAAElement *) HTUTree_findNode(tree, realm, path)) + && element->scheme && !strcasecomp (element->scheme, scheme)) status = HTAA_updateElement(element, scheme, context); else { /* create the new element */ @@ -339,14 +345,14 @@ HTUTree * tree = NULL; HTAAModule * module = NULL; if (!scheme || !url) { - if (AUTH_TRACE) HTTrace("Auth Engine. Bad argument\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. Bad argument\n"); return NO; } - if (AUTH_TRACE) HTTrace("Auth Engine. Deleting info for `%s'\n", url); + HTTRACE(AUTH_TRACE, "Auth Engine. Deleting info for `%s'\n" _ url); /* Find the AA module with this name */ if ((module = HTAA_findModule(scheme)) == NULL) { - if (AUTH_TRACE) HTTrace("Auth Engine. Module `%s\' not registered\n", + HTTRACE(AUTH_TRACE, "Auth Engine. Module `%s\' not registered\n" _ scheme ? scheme : ""); return NO; } @@ -364,7 +370,7 @@ host, port, HTAA_deleteElement); HT_FREE(host); if (!tree) { - if (AUTH_TRACE) HTTrace("Auth Engine. Can't create tree\n"); + HTTRACE(AUTH_TRACE, "Auth Engine. Can't create tree\n"); return NO; } } @@ -400,7 +406,7 @@ if (element) { HTAAModule * module = HTAA_findModule(element->scheme); if (module) { - if (AUTH_TRACE) HTTrace("Auth Engine. Found BEFORE filter %p\n", + HTTRACE(AUTH_TRACE, "Auth Engine. Found BEFORE filter %p\n" _ module->before); return (*module->before)(request, element->context, mode); } @@ -418,7 +424,7 @@ { const char * scheme = HTResponse_scheme(response); HTAAModule * module = NULL; - if (AUTH_TRACE) HTTrace("Auth Engine. After filter status %d\n", status); + HTTRACE(AUTH_TRACE, "Auth Engine. After filter status %d\n" _ status); /* ** If we don't have a scheme then the server has made an error. We ** try to make up for it by creating our own "noop" realm and use basic. @@ -428,8 +434,7 @@ scheme = "basic"; } if ((module = HTAA_findModule(scheme)) != NULL) { - if (AUTH_TRACE) - HTTrace("Auth Engine. Found AFTER filter %p\n", module->after); + HTTRACE(AUTH_TRACE, "Auth Engine. Found AFTER filter %p\n" _ module->after); HTRequest_deleteCredentialsAll(request); HTRequest_addAARetry (request); return (*module->after)(request, response, NULL, status); @@ -437,6 +442,39 @@ return HT_ERROR; } +/* HTAA_UpdateFilter +** ----------------- +** Call the Update filter that knows how to handle this scheme. +** Return YES or whatever callback returns +*/ +PUBLIC int HTAA_updateFilter (HTRequest * request, HTResponse * response, + void * param, int status) +{ + const char * scheme = HTResponse_scheme(response); + HTAAModule * module = NULL; + HTTRACE(AUTH_TRACE, "Auth Engine. Update filter status %d\n" _ status); + /* + ** If we don't have a scheme then the server has made an error. We + ** try to make up for it by creating our own "noop" realm and use basic. + */ + if (!scheme) { + HTResponse_addChallenge(response, "basic", "realm LIBWWW-UNKNOWN"); + scheme = "basic"; + } + if ((module = HTAA_findModule(scheme)) != NULL) { + /* we don't call this module systematically, as it could hamper + the execution of Basic authentication requests for nothing */ + if (module->update) { + HTTRACE(AUTH_TRACE, "Auth Engine. Found Update filter %p\n" _ module->update); + HTRequest_deleteCredentialsAll(request); + return (*module->update)(request, response, NULL, status); + } + return HT_OK; + } + return HT_ERROR; +} + + /* HTAA_proxybeforeFilter ** ---------------------- ** Make a lookup in the proxy URL tree to find any context for this node, @@ -460,9 +498,8 @@ if (element) { HTAAModule * module = HTAA_findModule(element->scheme); if (module) { - if (AUTH_TRACE) - HTTrace("Auth Engine. Found Proxy BEFORE filter %p with context %p\n", - module->before, element->context); + HTTRACE(AUTH_TRACE, "Auth Engine. Found Proxy BEFORE filter %p with context %p\n" _ + module->before _ element->context); return (*module->before)(request, element->context, HT_NO_PROXY_ACCESS); } } diff -Naur xdvik-22.40l/libs/libwww/HTAAUtil.h xdvik-22.40n/libs/libwww/HTAAUtil.h --- xdvik-22.40l/libs/libwww/HTAAUtil.h Wed Apr 18 14:23:10 2001 +++ xdvik-22.40n/libs/libwww/HTAAUtil.h Fri Sep 13 00:23:45 2002 @@ -112,6 +112,7 @@ extern HTAAModule * HTAA_newModule (const char * scheme, HTNetBefore * before, HTNetAfter * after, + HTNetAfter * update, HTUTree_gc * gc); /* @@ -210,6 +211,16 @@ /* ( + Update Filter +) + +Call the UPDATE filter that knows how to handle this scheme. +*/ + +HTNetAfter HTAA_updateFilter; + +/* +( Proxy Authentication Filter ) @@ -235,6 +246,6 @@ - @(#) $Id: HTAAUtil.h,v 1.1.1.1 2001/04/18 14:23:10 stefanulrich Exp $ + @(#) $Id: HTAAUtil.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTANSI.c xdvik-22.40n/libs/libwww/HTANSI.c --- xdvik-22.40l/libs/libwww/HTANSI.c Wed Apr 18 14:23:10 2001 +++ xdvik-22.40n/libs/libwww/HTANSI.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTANSI.c,v 1.1.1.1 2001/04/18 14:23:10 stefanulrich Exp $ +** @(#) $Id: HTANSI.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** History: ** HFN: writtem @@ -82,17 +82,17 @@ while (fp) { if ((me->b_read = fread(me->data, 1, FILE_BUFFER_SIZE, fp)) == 0){ if (ferror(fp)) { - if (PROT_TRACE) HTTrace("ANSI read... READ ERROR\n"); + HTTRACE(PROT_TRACE, "ANSI read... READ ERROR\n"); } else { HTAlertCallback *cbf = HTAlert_find(HT_PROG_DONE); - if (PROT_TRACE) HTTrace("ANSI read... Finished loading file %p\n", fp); + HTTRACE(PROT_TRACE, "ANSI read... Finished loading file %p\n" _ fp); if (cbf) (*cbf)(net->request, HT_PROG_DONE, HT_MSG_NULL,NULL,NULL,NULL); return HT_CLOSED; } } /* Remember how much we have read from the input socket */ - HTTraceData(me->data, me->b_read, "HTANSIReader_read me->data:"); + HTTRACEDATA(me->data, me->b_read, "HTANSIReader_read me->data:"); me->write = me->data; me->read = me->data + me->b_read; @@ -109,24 +109,23 @@ if ((status = (*net->readStream->isa->put_block) (net->readStream, me->data, me->b_read)) != HT_OK) { if (status == HT_WOULD_BLOCK) { - if (PROT_TRACE) HTTrace("ANSI read... Target WOULD BLOCK\n"); + HTTRACE(PROT_TRACE, "ANSI read... Target WOULD BLOCK\n"); return HT_WOULD_BLOCK; } else if (status == HT_PAUSE) { - if (PROT_TRACE) HTTrace("ANSI read... Target PAUSED\n"); + HTTRACE(PROT_TRACE, "ANSI read... Target PAUSED\n"); return HT_PAUSE; } else if (status > 0) { /* Stream specific return code */ - if (PROT_TRACE) - HTTrace("ANSI read... Target returns %d\n", status); + HTTRACE(PROT_TRACE, "ANSI read... Target returns %d\n" _ status); me->write = me->data + me->b_read; return status; } else { /* We have a real error */ - if (PROT_TRACE) HTTrace("ANSI read... Target ERROR\n"); + HTTRACE(PROT_TRACE, "ANSI read... Target ERROR\n"); return status; } } me->write = me->data + me->b_read; } - if (PROT_TRACE) HTTrace("ANSI read... File descriptor is NULL...\n"); + HTTRACE(PROT_TRACE, "ANSI read... File descriptor is NULL...\n"); return HT_ERROR; } @@ -138,14 +137,14 @@ */ PRIVATE int HTANSIReader_close (HTInputStream * me) { - if (PROT_TRACE) HTTrace("ANSI read... FREEING...\n"); + HTTRACE(PROT_TRACE, "ANSI read... FREEING...\n"); HT_FREE(me); return HT_OK; } PRIVATE int HTANSIReader_consumed (HTInputStream * me, size_t bytes) { - if (PROT_TRACE) HTTrace("ANSI read... consumed %d bytes\n", bytes); + HTTRACE(PROT_TRACE, "ANSI read... consumed %d bytes\n" _ bytes); return HT_OK; } @@ -194,7 +193,7 @@ PRIVATE int HTANSIWriter_abort (HTOutputStream * me, HTList * e) { - if (PROT_TRACE) HTTrace("ANSI write.. ABORTING...\n"); + HTTRACE(PROT_TRACE, "ANSI write.. ABORTING...\n"); return HT_ERROR; } @@ -226,7 +225,7 @@ */ PRIVATE int HTANSIWriter_close (HTOutputStream * me) { - if (PROT_TRACE) HTTrace("ANSI write.. FREEING...\n"); + HTTRACE(PROT_TRACE, "ANSI write.. FREEING...\n"); HT_FREE(me); return HT_OK; } diff -Naur xdvik-22.40l/libs/libwww/HTAccess.c xdvik-22.40n/libs/libwww/HTAccess.c --- xdvik-22.40l/libs/libwww/HTAccess.c Sun Jun 24 14:51:33 2001 +++ xdvik-22.40n/libs/libwww/HTAccess.c Fri Sep 13 00:23:45 2002 @@ -3,13 +3,14 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTAccess.c,v 1.2 2001/06/24 14:51:33 stefanulrich Exp $ +** @(#) $Id: HTAccess.c,v 1.2.6.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** Authors ** TBL Tim Berners-Lee timbl@w3.org ** JFG Jean-Francois Groff jfg@dxcern.cern.ch ** DD Denis DeLaRoca (310) 825-4580 ** HFN Henrik Frystyk, frystyk@w3.org +** JK Jose Kahan, kahan@w3.org ** History ** 8 Jun 92 Telnet hopping prohibited as telnet is not secure TBL ** 26 Jun 92 When over DECnet, suppressed FTP, Gopher and News. JFG @@ -22,6 +23,8 @@ ** 09 May 94 logfile renamed to HTlogfile to avoid clash with WAIS ** 8 Jul 94 Insulate HT_FREE(); ** Sep 95 Rewritten, HFN +** 21 Jun 00 Added a Cache-Control: no-cache when doing PUT, as some +** proxies do cache PUT requests, JK */ /* Library include files */ @@ -66,12 +69,14 @@ */ PRIVATE BOOL launch_request (HTRequest * request, BOOL recursive) { +#ifdef HTDEBUG if (PROT_TRACE) { HTParentAnchor *anchor = HTRequest_anchor(request); char * full_address = HTAnchor_address((HTAnchor *) anchor); - HTTrace("HTAccess.... Accessing document %s\n", full_address); + HTTRACE(PROT_TRACE, "HTAccess.... Accessing document %s\n" _ full_address); HT_FREE(full_address); } +#endif /* HTDEBUG */ return HTLoad(request, recursive); } @@ -581,7 +586,7 @@ PRIVATE int HTEntity_callback (HTRequest * request, HTStream * target) { HTParentAnchor * entity = HTRequest_entityAnchor(request); - if (WWWTRACE) HTTrace("Posting Data from callback function\n"); + HTTRACE(APP_TRACE, "Posting Data from callback function\n"); if (!request || !entity || !target) return HT_ERROR; { BOOL chunking = NO; @@ -589,7 +594,7 @@ char * document = (char *) HTAnchor_document(entity); int len = HTAnchor_length(entity); if (!document) { - if (PROT_TRACE) HTTrace("Posting Data No document\n"); + HTTRACE(PROT_TRACE, "Posting Data No document\n"); return HT_ERROR; } @@ -605,8 +610,7 @@ len = strlen(document); /* Naive! */ chunking = YES; } else { - if (PROT_TRACE) - HTTrace("Posting Data Must know the length of document %p\n", + HTTRACE(PROT_TRACE, "Posting Data Must know the length of document %p\n" _ document); return HT_ERROR; } @@ -615,23 +619,23 @@ /* Send the data down the pipe */ status = (*target->isa->put_block)(target, document, len); if (status == HT_WOULD_BLOCK) { - if (PROT_TRACE)HTTrace("Posting Data Target WOULD BLOCK\n"); + HTTRACE(PROT_TRACE, "Posting Data Target WOULD BLOCK\n"); return HT_WOULD_BLOCK; } else if (status == HT_PAUSE) { - if (PROT_TRACE) HTTrace("Posting Data Target PAUSED\n"); + HTTRACE(PROT_TRACE, "Posting Data Target PAUSED\n"); return HT_PAUSE; } else if (chunking && status == HT_OK) { - if (PROT_TRACE) HTTrace("Posting Data Target is SAVED using chunked\n"); + HTTRACE(PROT_TRACE, "Posting Data Target is SAVED using chunked\n"); return (*target->isa->put_block)(target, "", 0); } else if (status == HT_LOADED || status == HT_OK) { - if (PROT_TRACE) HTTrace("Posting Data Target is SAVED\n"); + HTTRACE(PROT_TRACE, "Posting Data Target is SAVED\n"); (*target->isa->flush)(target); return HT_LOADED; } else if (status > 0) { /* Stream specific return code */ - if (PROT_TRACE) HTTrace("Posting Data. Target returns %d\n", status); + HTTRACE(PROT_TRACE, "Posting Data. Target returns %d\n" _ status); return status; } else { /* we have a real error */ - if (PROT_TRACE) HTTrace("Posting Data Target ERROR %d\n", status); + HTTRACE(PROT_TRACE, "Posting Data Target ERROR %d\n" _ status); return status; } } @@ -805,7 +809,7 @@ break; default: - if (APP_TRACE) HTTrace("Precondition %d not understood\n", precons); + HTTRACE(APP_TRACE, "Precondition %d not understood\n" _ precons); } @@ -822,7 +826,7 @@ HTMethod method) { if (!(method & (METHOD_PUT | METHOD_POST))) { - if (APP_TRACE) HTTrace("Posting..... Bad method\n"); + HTTRACE(APP_TRACE, "Posting..... Bad method\n"); return NO; } @@ -1120,9 +1124,8 @@ void * param, int status) { HTPutContext * me = (HTPutContext *) param; - if (APP_TRACE) - HTTrace("Save Filter. Using context %p with state %c\n", - me, me->state+0x30); + HTTRACE(APP_TRACE, "Save Filter. Using context %p with state %c\n" _ + me _ me->state+0x30); /* ** Just ignore authentication in the hope that some other filter will @@ -1130,7 +1133,7 @@ */ if (status == HT_NO_ACCESS || status == HT_NO_PROXY_ACCESS || status == HT_REAUTH || status == HT_PROXY_REAUTH) { - if (APP_TRACE) HTTrace("Save Filter. Waiting for authentication\n"); + HTTRACE(APP_TRACE, "Save Filter. Waiting for authentication\n"); return HT_OK; } @@ -1169,7 +1172,7 @@ me->state = HT_ABORT_SAVE; } #else - if (APP_TRACE) HTTrace("Save Filter. Destination hae moved!\n"); + HTTRACE(APP_TRACE, "Save Filter. Destination hae moved!\n"); me->destination = redirection; #endif } @@ -1233,9 +1236,15 @@ return HT_ERROR; } else { - HTAnchor_setDocument(me->source, me->placeholder); - HTChunk_delete(me->document); - HT_FREE(me); +#if 0 + /* @@ JK 28/03/2000: invalidated this code as we're doing this exact + treatment later on. In addition, it was a source of + dangling pointer error */ + /* @@ JK: Added it again, because it's now working! */ +#endif + HTAnchor_setDocument(me->source, me->placeholder); + HTChunk_delete(me->document); + HT_FREE(me); } return HT_OK; } @@ -1327,6 +1336,15 @@ HTRequest_setReloadMode(request, HT_CACHE_FLUSH_MEM); /* + ** Some proxy servers don't clean up their cache + ** when receiving a PUT, specially if this PUT is + ** redirected. We remove this problem by adding + ** an explicit Cache-Control: no-cache header to + ** all PUT requests. + */ + HTRequest_addCacheControl(request, "no-cache", ""); + + /* ** Now we load the source document into a chunk. We specify that ** we want the document ASIS from the source location. */ @@ -1335,7 +1353,7 @@ HTRequest_setOutputFormat(request, WWW_SOURCE); context->document = HTLoadAnchorToChunk((HTAnchor*)source,request); if (context->document == NULL) { - if (APP_TRACE) HTTrace("Put Document No source\n"); + HTTRACE(APP_TRACE, "Put Document No source\n"); HT_FREE(context); return NO; } @@ -1362,7 +1380,7 @@ HTRequest * src_req; HTList * cur; if (!src_anchor || !main_dest) { - if (WWWTRACE) HTTrace("Copy........ BAD ARGUMENT\n"); + HTTRACE(APP_TRACE, "Copy........ BAD ARGUMENT\n"); return NO; } @@ -1384,8 +1402,7 @@ HTAnchor *main_anchor = HTLink_destination(main_link); HTMethod method = HTLink_method(main_link); if (!main_link || method==METHOD_INVALID) { - if (WWWTRACE) - HTTrace("Copy Anchor. No destination found or unspecified method\n"); + HTTRACE(APP_TRACE, "Copy Anchor. No destination found or unspecified method\n"); HTRequest_delete(src_req); return NO; } @@ -1406,8 +1423,7 @@ HTMethod method = HTLink_method(pres); HTRequest *dest_req; if (!dest || method==METHOD_INVALID) { - if (WWWTRACE) - HTTrace("Copy Anchor. Bad anchor setup %p\n", + HTTRACE(APP_TRACE, "Copy Anchor. Bad anchor setup %p\n" _ dest); return NO; } @@ -1468,8 +1484,7 @@ HTAnchor * dest_anchor = HTLink_destination(link); HTMethod method = HTLink_method(link); if (!link || method==METHOD_INVALID || !callback) { - if (WWWTRACE) - HTTrace("Upload...... No destination found or unspecified method\n"); + HTTRACE(APP_TRACE, "Upload...... No destination found or unspecified method\n"); return NO; } request->GenMask |= HT_G_DATE; /* Send date header */ @@ -1491,7 +1506,7 @@ */ PUBLIC int HTUpload_callback (HTRequest * request, HTStream * target) { - if (WWWTRACE) HTTrace("Uploading... from callback function\n"); + HTTRACE(APP_TRACE, "Uploading... from callback function\n"); if (!request || !request->source_anchor || !target) return HT_ERROR; { int status; @@ -1506,17 +1521,16 @@ if (status == HT_OK) return (*target->isa->flush)(target); if (status == HT_WOULD_BLOCK) { - if (PROT_TRACE)HTTrace("POST Anchor. Target WOULD BLOCK\n"); + HTTRACE(PROT_TRACE, "POST Anchor. Target WOULD BLOCK\n"); return HT_WOULD_BLOCK; } else if (status == HT_PAUSE) { - if (PROT_TRACE) HTTrace("POST Anchor. Target PAUSED\n"); + HTTRACE(PROT_TRACE, "POST Anchor. Target PAUSED\n"); return HT_PAUSE; } else if (status > 0) { /* Stream specific return code */ - if (PROT_TRACE) - HTTrace("POST Anchor. Target returns %d\n", status); + HTTRACE(PROT_TRACE, "POST Anchor. Target returns %d\n" _ status); return status; } else { /* we have a real error */ - if (PROT_TRACE) HTTrace("POST Anchor. Target ERROR\n"); + HTTRACE(PROT_TRACE, "POST Anchor. Target ERROR\n"); return status; } } @@ -1769,12 +1783,14 @@ PRIVATE BOOL launch_server (HTRequest * request, BOOL recursive) { +#ifdef HTDEBUG if (PROT_TRACE) { HTParentAnchor *anchor = HTRequest_anchor(request); char * full_address = HTAnchor_address((HTAnchor *) anchor); - HTTrace("HTAccess.... Serving %s\n", full_address); + HTTRACE(PROT_TRACE, "HTAccess.... Serving %s\n" _ full_address); HT_FREE(full_address); } +#endif /* HTDEBUG */ return HTServe(request, recursive); } diff -Naur xdvik-22.40l/libs/libwww/HTAccess.h xdvik-22.40n/libs/libwww/HTAccess.h --- xdvik-22.40l/libs/libwww/HTAccess.h Wed Apr 18 14:23:10 2001 +++ xdvik-22.40n/libs/libwww/HTAccess.h Fri Sep 13 00:23:45 2002 @@ -930,6 +930,6 @@ - @(#) $Id: HTAccess.h,v 1.1.1.1 2001/04/18 14:23:10 stefanulrich Exp $ + @(#) $Id: HTAccess.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTAlert.c xdvik-22.40n/libs/libwww/HTAlert.c --- xdvik-22.40l/libs/libwww/HTAlert.c Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAlert.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTAlert.c,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ +** @(#) $Id: HTAlert.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** REPLACE THIS MODULE with a GUI version in a GUI environment! ** @@ -61,8 +61,7 @@ PUBLIC BOOL HTAlertCall_add (HTList * list, HTAlertCallback * cbf, HTAlertOpcode opcode) { - if (CORE_TRACE) - HTTrace("Alert Call.. Add Alert Handler %p\n", (void *) cbf); + HTTRACE(CORE_TRACE, "Alert Call.. Add Alert Handler %p\n" _ (void *) cbf); if (list && cbf) { HTAlert *me; if ((me = (HTAlert *) HT_CALLOC(1, sizeof(HTAlert))) == NULL) @@ -80,8 +79,7 @@ */ PUBLIC BOOL HTAlertCall_delete (HTList * list, HTAlertCallback *cbf) { - if (CORE_TRACE) - HTTrace("Alert Call.. Delete Alert Handler %p\n", (void *) cbf); + HTTRACE(CORE_TRACE, "Alert Call.. Delete Alert Handler %p\n" _ (void *) cbf); if (list && cbf) { HTList *cur = list; HTAlert *pres; @@ -102,8 +100,7 @@ */ PUBLIC BOOL HTAlertCall_deleteOpcode (HTList * list, HTAlertOpcode opcode) { - if (CORE_TRACE) - HTTrace("Alert Call.. Delete all handlers with opcode %d\n", opcode); + HTTRACE(CORE_TRACE, "Alert Call.. Delete all handlers with opcode %d\n" _ opcode); if (list) { HTList * cur = list; HTAlert * pres; @@ -125,8 +122,7 @@ */ PUBLIC BOOL HTAlertCall_deleteAll (HTList * list) { - if (CORE_TRACE) - HTTrace("Alert Call.. Delete All callback functions\n"); + HTTRACE(CORE_TRACE, "Alert Call.. Delete All callback functions\n"); if (list) { HTList *cur = list; HTAlert *pres; @@ -152,8 +148,7 @@ if (pres->opcode & opcode) return pres->cbf; } - if (CORE_TRACE) - HTTrace("Alert Call.. No entry found for opcode %d\n",opcode); + HTTRACE(CORE_TRACE, "Alert Call.. No entry found for opcode %d\n" _ opcode); } return NULL; } diff -Naur xdvik-22.40l/libs/libwww/HTAlert.h xdvik-22.40n/libs/libwww/HTAlert.h --- xdvik-22.40l/libs/libwww/HTAlert.h Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAlert.h Fri Sep 13 00:23:45 2002 @@ -16,24 +16,23 @@ /* -The Alert class defines a set of methods to be used by libwww to be used -for passing prompts and message to a user. In order to maintain the Library -core application independent and natural language independent, libwww does -not know how to communicate with a user. Note here that a user -is a somewhat abstract notion for  something that can receive a message -or prompt from the Library. This can for example be a person, but is may -also be handled automatically by a robot or a client receiving a response -from a HTTP server. +The Alert class defines a set of methods to be used by libwww for passing +prompts and message to the application. In order to maintain libwww application +independent and natural language independent, it does not know how to communicate +with a user. Note here that a user is a somewhat abstract notion +for  something that can receive a message or prompt from libwww. A +user can for example be a person, but is may also be handled +automatically by a robot or a client receiving a response from a HTTP server. Libwww has a set of opcodes that classifies the nature of the message, for example that it is a question that must be confirmed in order to continue a request or simply a progress notification. The application can register -a method for any number of the defined opcodes - in case the Library has -a message for an opcode that does not have a method associated, the message -is ignored. You can also globally disable any message send from the Library. +a callback for any number of the defined opcodes - in case libwww has a message +for an opcode that does not have a method associated, the message is ignored. +You can also globally disable any message send from libwww. Note: The library core does not define any message or dialog -methods - they are all considered part of the application. The library comes +methods - they are all considered part of the application. However, it comes with a default set of methods which can be initiated using the function HTAlertInit() in HTInit module @@ -57,7 +56,12 @@ can pass a set of input parameters and the callee can return a set of outptu parameters. Also note that all the *_PROG_* opcodes are a subset of HT_A_PROGRESS. This means that you easily can register a -callback for all progress reports. +callback for all progress reports. + +The callback handler for progress notifications SHOULD NOT be used +to interrupt the ongoing message as it is not guaranteed to be in a state +to do so. Instead you should use the event handlers +or the timers for this. */ typedef enum _HTAlertOpcode { @@ -93,12 +97,13 @@ If you don't expect any return values then reply can be NULL. The return value of the callback function can be used to indicate confirmation on a prompt (Yes or No). -( - String Messages -) +. + User Prompts and Questions +. This is an enumerated list of messages that can be converted into a string -table etc. +table etc. See the HTDialog module for +default initialization of these strings. */ typedef enum _HTAlertMsg { @@ -122,33 +127,10 @@ HT_MSG_REDIRECTION, HT_MSG_PROXY, HT_MSG_CACHE_LOCK, + HT_MSG_ACCEPT_COOKIE, HT_MSG_ELEMENTS /* This MUST be the last element */ } HTAlertMsg; -#define HT_MSG_ENGLISH_INITIALIZER \ - "Please enter username:", \ - "Please enter username for proxy authentication:", \ - "Please enter username for this FTP server:", \ - "Password:", \ - "Please give name of file to save in:", \ - "Plase enter account:", \ - "You might not be allowed to use this method here, continue?", \ - "Location has moved, continue?", \ - "A new set of rules is requested to be added to your setup - continue?", \ - "This file already exists - replace existing file?", \ - "Authentication failed - retry?", \ - "Proxy authentication failed - retry?", \ - "This method has already been performed - repeat operation?", \ - "This document is very big - continue operation?", \ - "The source document for this operation has moved - continue operation \ -with new location?", \ - "The destination document for this operation has moved - continue \ -operation with new location?", \ - "A redirection may change the behavior of this method - proceed anyway?", \ - "An automatic request for changing proxy has been encountered - continue?", \ - "The persistent cache is already in use by another user. If this is not \ -the case then you can manually delete this lock and restart." - /* . Enable or Disable Messages @@ -335,6 +317,6 @@ - @(#) $Id: HTAlert.h,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ + @(#) $Id: HTAlert.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTAncMan.h xdvik-22.40n/libs/libwww/HTAncMan.h --- xdvik-22.40l/libs/libwww/HTAncMan.h Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAncMan.h Fri Sep 13 00:23:45 2002 @@ -140,7 +140,7 @@ -@(#) $Id: HTAncMan.h,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ +@(#) $Id: HTAncMan.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTAnchor.c xdvik-22.40n/libs/libwww/HTAnchor.c --- xdvik-22.40l/libs/libwww/HTAnchor.c Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAnchor.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTAnchor.c,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ +** @(#) $Id: HTAnchor.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** An anchor represents a region of a hypertext document which is ** linked to another anchor in the same or a different document. @@ -25,8 +25,8 @@ #include "HTWWWStr.h" #include "HTAncMan.h" /* Implemented here */ -#define HASH_SIZE 599 /* Arbitrary prime. Memory/speed tradeoff */ -#define CHILD_HASH_SIZE 97 /* Often smaller than hash of parents */ +#define PARENT_HASH_SIZE HT_XL_HASH_SIZE +#define CHILD_HASH_SIZE HT_L_HASH_SIZE PRIVATE HTList **adult_table=0; /* Point to table of lists of all parents */ @@ -80,7 +80,7 @@ HTChildAnchor * child = NULL; HTList * kids = NULL; if (!parent) { - if (ANCH_TRACE) HTTrace("Child Anchor Bad argument\n"); + HTTRACE(ANCH_TRACE, "Child Anchor Bad argument\n"); return NULL; } @@ -109,9 +109,8 @@ HTList * cur = kids; while ((child = (HTChildAnchor *) HTList_nextObject(cur))) { if (child->tag && !strcmp(child->tag, tag)) { - if (ANCH_TRACE) - HTTrace("Child Anchor %p of parent %p with name `%s' already exists.\n", - (void *) child, (void *) parent, tag); + HTTRACE(ANCH_TRACE, "Child Anchor %p of parent %p with name `%s' already exists.\n" _ + (void *) child _ (void *) parent _ tag); return child; } } @@ -122,9 +121,8 @@ HTList_addObject(kids, (void *) child); child->parent = parent; if (tag) StrAllocCopy(child->tag, tag); - if (ANCH_TRACE) - HTTrace("Child Anchor New Anchor %p named `%s' is child of %p\n", - (void *) child, tag ? tag : (const char *) "", (void *)parent); + HTTRACE(ANCH_TRACE, "Child Anchor New Anchor %p named `%s' is child of %p\n" _ + (void *) child _ tag ? tag : (const char *) "" _ (void *)parent); return child; } @@ -164,9 +162,9 @@ /* Select list from hash table */ for(p=newaddr, hash=0; *p; p++) - hash = (int) ((hash * 3 + (*(unsigned char*)p)) % HASH_SIZE); + hash = (int) ((hash * 3 + (*(unsigned char*)p)) % PARENT_HASH_SIZE); if (!adult_table) { - if ((adult_table = (HTList* *) HT_CALLOC(HASH_SIZE, sizeof(HTList*))) == NULL) + if ((adult_table = (HTList* *) HT_CALLOC(PARENT_HASH_SIZE, sizeof(HTList*))) == NULL) HT_OUTOFMEM("HTAnchor_findAddress"); } if (!adult_table[hash]) adult_table[hash] = HTList_new(); @@ -176,9 +174,8 @@ grownups = adults; while ((foundAnchor = (HTParentAnchor *) HTList_nextObject(grownups))){ if (!strcmp(foundAnchor->address, newaddr)) { - if (ANCH_TRACE) - HTTrace("Find Parent. %p with address `%s' already exists.\n", - (void*) foundAnchor, newaddr); + HTTRACE(ANCH_TRACE, "Find Parent. %p with address `%s' already exists.\n" _ + (void*) foundAnchor _ newaddr); HT_FREE(newaddr); /* We already have it */ return (HTAnchor *) foundAnchor; } @@ -188,7 +185,7 @@ foundAnchor = HTParentAnchor_new(); foundAnchor->address = newaddr; /* Remember our copy */ HTList_addObject (adults, foundAnchor); - if (ANCH_TRACE) HTTrace("Find Parent. %p with hash %d and address `%s' created\n", (void*)foundAnchor, hash, newaddr); + HTTRACE(ANCH_TRACE, "Find Parent. %p with hash %d and address `%s' created\n" _ (void*)foundAnchor _ hash _ newaddr); return (HTAnchor *) foundAnchor; } } @@ -350,12 +347,11 @@ { HTParentAnchor * parent = NULL; if (!me) { - if (ANCH_TRACE) HTTrace("AnchorDelete No anchor found\n"); + HTTRACE(ANCH_TRACE, "AnchorDelete No anchor found\n"); return NULL; } parent = me->parent; - if (ANCH_TRACE) - HTTrace("AnchorDelete Remove parent %p and children\n", parent); + HTTRACE(ANCH_TRACE, "AnchorDelete Remove parent %p and children\n" _ parent); /* Delete children */ if (parent->children) { @@ -397,7 +393,7 @@ HTList *cur; if (!adult_table) return NO; - for (cnt=0; cntdocument) { - if (ANCH_TRACE) HTTrace("Anchor...... Not deleted\n"); + HTTRACE(ANCH_TRACE, "Anchor...... Not deleted\n"); return NO; } @@ -513,6 +509,38 @@ } } + /* 2001/03/06: Bug fix by Serge Adda + HTAnchor_delete wasn't removing the reference to the deleted + anchor. This caused a bug whenever requesting another anchor + for the same URL. + */ + if (adult_table) { + int hash; + const char *p; + HTList * adults; + HTList * grownups; + HTList * last; + HTParentAnchor * foundAnchor; + + /* Select list from hash table */ + for(p=me->address, hash=0; *p; p++) + hash = (int) ((hash * 3 + (*(unsigned char*)p)) % + PARENT_HASH_SIZE); + adults = adult_table[hash]; + + /* Search list for anchor */ + grownups = adults; + last = grownups; + while ((foundAnchor = (HTParentAnchor *) + HTList_nextObject(grownups))){ + if (!strcmp(foundAnchor->address, me->address)) { + HTList_quickRemoveElement (grownups, last); + break; + } + last = grownups; + } + } + /* Now kill myself */ delete_parent(me); return YES; /* Parent deleted */ @@ -555,18 +583,17 @@ if (!adult_table) return NULL; /* Allocate an array for the anchors */ - if (!growby) growby = HASH_SIZE; + if (growby <= 0) growby = PARENT_HASH_SIZE; array = HTArray_new(growby); /* Traverse anchor structure */ - for (cnt=0; cntphysical, physical); @@ -695,18 +721,23 @@ PUBLIC BOOL HTAnchor_update (HTParentAnchor * me, HTResponse * response) { if (me && response) { + HTCachable cachable = HTResponse_isCachable(response); - if (HTResponse_isCachable(response) == HT_CACHE_ETAG) { + if (cachable == HT_CACHE_ETAG) { char * etag = HTResponse_etag(response); - if (ANCH_TRACE) HTTrace("HTAnchor.... Updating etag for %p\n", me); + HTTRACE(ANCH_TRACE, "HTAnchor.... Updating etag for %p\n" _ me); if (etag) { HTAnchor_setEtag(me, etag); return YES; } - } else if (HTResponse_isCachable(response) == HT_CACHE_ALL) { + + } else if (cachable == HT_CACHE_NOT_MODIFIED) { + HTTRACE(ANCH_TRACE, "HTAnchor.... Information is up to date for %p\n" _ me); + return YES; + + } else if (cachable == HT_CACHE_ALL) { char * etag = HTResponse_etag(response); - if (ANCH_TRACE) - HTTrace("HTAnchor.... Updating metainformation for %p\n", me); + HTTRACE(ANCH_TRACE, "HTAnchor.... Updating metainformation for %p\n" _ me); /* ** The content length and type is already parsed at this point @@ -724,6 +755,7 @@ /* ** Inherit all the unparsed headers - we may need them later! */ + if (me->headers) HTAssocList_delete(me->headers); me->headers = HTResponse_handOverHeader(response); /* @@ -732,6 +764,13 @@ */ HTResponse_isCached(response, YES); + /* + ** Set the datestamp of when the anchor was updated if we didn't + ** get any in the response + */ + if (!HTAssocList_findObject(me->headers, "date")) + HTAnchor_setDate(me, time(NULL)); + return YES; } } @@ -1302,7 +1341,9 @@ PUBLIC void HTAnchor_setEtag (HTParentAnchor * me, const char * etag) { - if (me && etag && me->etag != etag) StrAllocCopy(me->etag, etag); + /* JK: add a new etag if it doesn't exist or if the value has changed */ + if (me && etag && ((me->etag == NULL) || strcmp (me->etag, etag))) + StrAllocCopy(me->etag, etag); } PUBLIC BOOL HTAnchor_isEtagWeak (HTParentAnchor * me) @@ -1333,16 +1374,7 @@ PUBLIC void HTAnchor_setHeaderParsed (HTParentAnchor * me) { if (me) { - - /* - ** If the server did not send a date then use the current time - */ - if (me->date < 0) me->date = time(NULL); - - /* - ** If we don't get a Last-Modified header then set it to date - */ - if (ANCH_TRACE) HTTrace("HTAnchor.... Anchor is parsed\n"); + HTTRACE(ANCH_TRACE, "HTAnchor.... Anchor is parsed\n"); me->header_parsed = YES; } } @@ -1357,7 +1389,7 @@ */ PUBLIC void HTAnchor_clearHeader (HTParentAnchor * me) { - if (ANCH_TRACE) HTTrace("HTAnchor.... Clear all header information\n"); + HTTRACE(ANCH_TRACE, "HTAnchor.... Clear all header information\n"); me->allow = METHOD_INVALID; if (me->content_encoding) { HTList_delete(me->content_encoding); @@ -1400,7 +1432,4 @@ /* Delete any original headers */ if (me->headers) HTAssocList_delete(me->headers); me->headers = NULL; - - /* Anchor is cleared */ - me->header_parsed = NO; } diff -Naur xdvik-22.40l/libs/libwww/HTAnchor.h xdvik-22.40n/libs/libwww/HTAnchor.h --- xdvik-22.40l/libs/libwww/HTAnchor.h Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAnchor.h Fri Sep 13 00:23:45 2002 @@ -25,6 +25,21 @@ It would actually be most useful if we had persistent anchors so that an application could build up a higher knowledge about the Web topology. +.When to Escape and Unescape Addresses. + + +The URI escape policy in libwww is that all URIs created as +anchors must already have been escaped. The reason for this is that if +URIs are not escaped then the URI parser is not guaranteed to work as +expected. Imagine, for example, that you have a ":" in a +host name, then you could get something like this: +http://my:host:8000/ instead of http://my%3Ahost:8000/. + + +Libwww provides support for escaping and unescaping +URIs using this set of APIs. + + This module is implemented by HTAnchor.c, and it is a part of the W3C Sample Code Library. @@ -678,6 +693,6 @@ - @(#) $Id: HTAnchor.h,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ + @(#) $Id: HTAnchor.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTArray.c xdvik-22.40n/libs/libwww/HTArray.c --- xdvik-22.40l/libs/libwww/HTArray.c Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTArray.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTArray.c,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ +** @(#) $Id: HTArray.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** history: Sep 95 HFN Written after looking at Hancock Tower */ diff -Naur xdvik-22.40l/libs/libwww/HTArray.h xdvik-22.40n/libs/libwww/HTArray.h --- xdvik-22.40l/libs/libwww/HTArray.h Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTArray.h Fri Sep 13 00:23:45 2002 @@ -97,10 +97,10 @@ */ -#define HTArray_firstObject(me, data) \ - ((me) && ((data)=(me)->data) ? *(data)++ : NULL) -#define HTArray_nextObject(me, data) \ - ((me) && (data) ? *(data)++ : NULL) +#define HTArray_firstObject(me, dp) \ + ((me) && ((dp)=(me)->data) ? *(dp)++ : NULL) +#define HTArray_nextObject(me, dp) \ + ((me) && (dp) ? *(dp)++ : NULL) /* @@ -154,7 +154,7 @@ -@(#) $Id: HTArray.h,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ +@(#) $Id: HTArray.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTAssoc.c xdvik-22.40n/libs/libwww/HTAssoc.c --- xdvik-22.40l/libs/libwww/HTAssoc.c Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAssoc.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTAssoc.c,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ +** @(#) $Id: HTAssoc.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** NAMES NOT CASE SENSITIVE, AND ONLY COMMON LENGTH ** IS CHECKED (allows abbreviations; well, length is @@ -58,8 +58,7 @@ if (value) StrAllocCopy(assoc->value, value); return HTList_addObject(list, (void *) assoc); } else { - if (WWWTRACE) - HTTrace("HTAssoc_add: ERROR: assoc list NULL!!\n"); + HTTRACE(UTIL_TRACE, "HTAssoc_add: ERROR: assoc list NULL!!\n"); } return NO; } @@ -97,6 +96,46 @@ return NULL; } +PUBLIC char * HTAssocList_findObjectExact (HTAssocList * list, const char * name) +{ + if (list && name) { + HTAssocList * cur = list; + HTAssoc * assoc; + while ((assoc = (HTAssoc *) HTList_nextObject(cur))) { + if (!strcasecomp(assoc->name, name)) + return assoc->value; + } + } + return NULL; +} + +PUBLIC char * HTAssocList_findObjectCaseSensitive (HTAssocList * list, const char * name) +{ + if (list && name) { + HTAssocList * cur = list; + HTAssoc * assoc; + int len = strlen(name); + while ((assoc = (HTAssoc *) HTList_nextObject(cur))) { + if (!strncmp(assoc->name, name, len)) + return assoc->value; + } + } + return NULL; +} + +PUBLIC char * HTAssocList_findObjectCaseSensitiveExact (HTAssocList * list, const char * name) +{ + if (list && name) { + HTAssocList * cur = list; + HTAssoc * assoc; + while ((assoc = (HTAssoc *) HTAssocList_nextObject(cur))) { + if (!strcmp(HTAssoc_name(assoc), name)) + return HTAssoc_value(assoc); + } + } + return NULL; +} + /* ** Searches the whole list and removes all elements with this name */ @@ -112,6 +151,7 @@ HTList_removeObject(list, assoc); HT_FREE(assoc); found = YES; + cur = list; } } } diff -Naur xdvik-22.40l/libs/libwww/HTAssoc.h xdvik-22.40n/libs/libwww/HTAssoc.h --- xdvik-22.40l/libs/libwww/HTAssoc.h Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAssoc.h Fri Sep 13 00:23:45 2002 @@ -1,6 +1,5 @@ /* - W3C Sample Code Library libwww Association Pairs @@ -19,7 +18,7 @@ This Assoctiation List class is closely related to the HTList Class as it simply is a list of a specific list element containing a characters based name/value pair. Lookups from -association list are not case-sensitive. +association list can be case sensitive and or prefix based. This module is implemented by HTAssoc.c, and it is a part of the W3C Sample Code @@ -39,55 +38,113 @@ } HTAssoc; /* -( +. Creation and Deletetion Methods -) +. These methods create and deletes and association list */ + extern HTAssocList * HTAssocList_new (void); extern BOOL HTAssocList_delete (HTAssocList * alist); /* -( +. Add an Element to a List -) +. We have two methods for adding new elements - you can either add unconditionally or replace any existing element with the same name but a new value. -A new list element is added to the beginning of the list so that it is the -first element just after the head element. +In replacing an element, the search is case insensitive +prefix match! A new list element is added to the beginning of the +list so that it is the first element just after the head element. */ -extern BOOL HTAssocList_addObject (HTAssocList * alist, - const char * name, const char * value); -extern BOOL HTAssocList_replaceObject (HTAssocList * list, - const char * name, const char * value); +extern BOOL HTAssocList_addObject ( + HTAssocList * alist, + const char * name, + const char * value); + +extern BOOL HTAssocList_replaceObject ( + HTAssocList * list, + const char * name, + const char * value); /* -( +. Remove an Element from a List +. + +Remove the element with the given name from the list. Search is +case insensitive prefix match! +*/ + +extern BOOL HTAssocList_removeObject ( + HTAssocList * list, + const char * name); + +/* +. + Search for Element in a list +. + +We have a small set of methods for searching a specific element within a +list. +( + Case Insensitive, Prefix Match ) -Remove the element with the given name from the list. +In many situations, the values of associations are case insensitive - use +this method to search the list using case insensitive comparison. Also, you +can search for matching prefixes and not the whole string, for example +"foo" matches "football" */ -extern BOOL HTAssocList_removeObject (HTAssocList * list, const char * name); + +extern char * HTAssocList_findObject ( + HTAssocList * alist, + const char * name); /* ( - Search for Elements in a list + Case Insensitive, Exact Match ) -We have a small set of methods for searching a specific element within a -list. +In case you want case insensitive, exact match */ -extern char * HTAssocList_findObject (HTAssocList * alist, const char * name); + +extern char * HTAssocList_findObjectExact ( + HTAssocList * alist, + const char * name); /* ( - Get Name and Values + Case Sensitive, Prefix Match +) + +In case you want case sensitive, prefix match +*/ + +extern char * HTAssocList_findObjectCaseSensitive ( + HTAssocList * list, + const char * name); + +/* +( + Case Sensitive, Exact Match ) +And finally if you want case sensitive, exact match +*/ + +extern char * HTAssocList_findObjectCaseSensitiveExact ( + HTAssocList * list, + const char * name); + +/* +. + Get Name and Values +. + Use this to get the name and value of a assoc object */ @@ -95,9 +152,9 @@ #define HTAssoc_value(me) ((me) ? (me)->value : NULL) /* -( +. Traverse list -) +. Fast macro to traverse the list. Call it first with copy of list header: it returns the first object and increments the passed list pointer. Call @@ -116,6 +173,6 @@ - @(#) $Id: HTAssoc.h,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ + @(#) $Id: HTAssoc.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTAtom.c xdvik-22.40n/libs/libwww/HTAtom.c --- xdvik-22.40l/libs/libwww/HTAtom.c Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAtom.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTAtom.c,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ +** @(#) $Id: HTAtom.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** Atoms are names which are given representative pointer values ** so that they can be stored more efficiently, and comparisons @@ -23,9 +23,7 @@ #include "HTList.h" #include "HTAtom.h" -#define HASH_SIZE 599 /* Tunable */ - -PRIVATE HTAtom * hash_table[HASH_SIZE]; +PRIVATE HTAtom * hash_table[HT_XL_HASH_SIZE]; PRIVATE BOOL initialised = NO; /* @@ -43,22 +41,21 @@ /* First time around, clear hash table */ if (!initialised) { - memset((void *) hash_table, '\0', sizeof(HTAtom *) * HASH_SIZE); + memset((void *) hash_table, '\0', sizeof(HTAtom *) * HT_XL_HASH_SIZE); initialised = YES; } /* Generate hash function */ for (p=string, hash=0; *p; p++) { - hash = (hash * 3 + tolower(*p)) % HASH_SIZE; + hash = (hash * 3 + TOLOWER(*p)) % HT_XL_HASH_SIZE; } /* Search for the string in the list */ for (a=hash_table[hash]; a; a=a->next) { if (0==strcmp(a->name, string)) { - /* if (WWWTRACE) HTTrace( - "HTAtom: Old atom %p for `%s'\n", a, string); */ + /* HTTRACE(UTIL_TRACE, "HTAtom: Old atom %p for `%s'\n" _ a _ string); */ return a; /* Found: return it */ } } @@ -72,7 +69,7 @@ strcpy(a->name, string); a->next = hash_table[hash]; /* Put onto the head of list */ hash_table[hash] = a; -/* if (WWWTRACE) HTTrace("HTAtom: New atom %p for `%s'\n", a, string); */ +/* HTTRACE(UTIL_TRACE, "HTAtom: New atom %p for `%s'\n" _ a _ string); */ return a; } @@ -93,14 +90,14 @@ /* First time around, clear hash table */ if (!initialised) { - memset((void *) hash_table, '\0', sizeof(HTAtom *) * HASH_SIZE); + memset((void *) hash_table, '\0', sizeof(HTAtom *) * HT_XL_HASH_SIZE); initialised = YES; } /* Generate hash function */ for(p=string, hash=0; *p; p++) { - hash = (hash * 3 + tolower(*p)) % HASH_SIZE; + hash = (hash * 3 + TOLOWER(*p)) % HT_XL_HASH_SIZE; } /* Search for the string in the list @@ -134,7 +131,7 @@ HTAtom *cur; HTAtom *next; - for (i=0; inext) { if (mime_match(cur->name, templ)) HTList_addObject(matches, (void*)cur); diff -Naur xdvik-22.40l/libs/libwww/HTAtom.h xdvik-22.40n/libs/libwww/HTAtom.h --- xdvik-22.40l/libs/libwww/HTAtom.h Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTAtom.h Fri Sep 13 00:23:45 2002 @@ -18,8 +18,8 @@ The Atom Class defines strings which are given representative pointer values so that they can be stored more efficiently, and comparisons -for equality done more efficiently. The list of atoms are stored -in a has table, so when asking for a new atom you might infact get back an +for equality done more efficiently. The list of atoms is stored +in a hash table, so when asking for a new atom you might in fact get back an existing one. Note: There are a whole bunch of @@ -96,6 +96,6 @@ - @(#) $Id: HTAtom.h,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ + @(#) $Id: HTAtom.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTBInit.c xdvik-22.40n/libs/libwww/HTBInit.c --- xdvik-22.40l/libs/libwww/HTBInit.c Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTBInit.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTBInit.c,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ +** @(#) $Id: HTBInit.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** Define a basic set of suffixes and presentations */ @@ -98,6 +98,7 @@ HTBind_add("ps", "application/postscript", NULL, "8bit", NULL, 0.8); HTBind_add("qt", "video/quicktime", NULL, "binary", NULL, 1.0); /* QuickTime */ HTBind_add("ras", "image/cmu-raster", NULL, "binary", NULL, 1.0); + HTBind_add("rdf", "text/rdf", NULL, "binary", NULL, 1.0); /* rdf */ HTBind_add("rgb", "image/x-rgb", NULL, "binary", NULL, 1.0); HTBind_add("roff", "application/x-troff", NULL, "7bit", NULL, 0.5); HTBind_add("rtf", "text/rtf", NULL, "7bit", NULL, 1.0); /* RTF */ @@ -130,7 +131,6 @@ HTBind_add("zip", "application/zip", NULL, "binary", NULL, 1.0); /* PKZIP */ HTBind_add("Z", NULL, "compress", "binary", NULL, 1.0); /* Compressed data */ - HTBind_add("Z", NULL, "x-compress", "binary", NULL, 1.0); /* Compressed data */ HTBind_add("gz", NULL, "gzip", "binary", NULL, 1.0); /* Gnu Compressed data */ HTBind_add("*.*", "www/unknown", NULL, "binary", NULL, 0.1); /* Unknown suffix */ diff -Naur xdvik-22.40l/libs/libwww/HTBInit.h xdvik-22.40n/libs/libwww/HTBInit.h --- xdvik-22.40l/libs/libwww/HTBInit.h Wed Apr 18 14:23:11 2001 +++ xdvik-22.40n/libs/libwww/HTBInit.h Fri Sep 13 00:23:45 2002 @@ -60,6 +60,6 @@ - @(#) $Id: HTBInit.h,v 1.1.1.1 2001/04/18 14:23:11 stefanulrich Exp $ + @(#) $Id: HTBInit.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTBTree.c xdvik-22.40n/libs/libwww/HTBTree.c --- xdvik-22.40l/libs/libwww/HTBTree.c Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTBTree.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTBTree.c,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ +** @(#) $Id: HTBTree.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** Authors: ** Arthur Secret @@ -567,7 +567,7 @@ HTBTree * tree; HTBTElement * next_element; - tree = HTBTree_new((HTComparer)strcasecmp); + tree = HTBTree_new((HTComparer)strcasecomp); HTBTree_add(tree,"hypertext"); HTBTree_add(tree,"Addressing"); HTBTree_add(tree,"X11"); diff -Naur xdvik-22.40l/libs/libwww/HTBTree.h xdvik-22.40n/libs/libwww/HTBTree.h --- xdvik-22.40l/libs/libwww/HTBTree.h Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTBTree.h Fri Sep 13 00:23:45 2002 @@ -105,7 +105,7 @@ -@(#) $Id: HTBTree.h,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ +@(#) $Id: HTBTree.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTBind.c xdvik-22.40n/libs/libwww/HTBind.c --- xdvik-22.40l/libs/libwww/HTBind.c Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTBind.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995 ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTBind.c,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ +** @(#) $Id: HTBind.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This module sets up the binding between a file Bind and a media ** type, language, encoding etc. In a client application the Binds @@ -48,8 +48,6 @@ double quality; } HTBind; -#define HASH_SIZE 101 /* Arbitrary prime. Memory/speed tradeoff */ - /* Suffix registration */ PRIVATE BOOL HTCaseSen = YES; /* Are suffixes case sensitive */ PRIVATE char *HTDelimiters = NULL; /* Set of suffixes */ @@ -67,7 +65,7 @@ PUBLIC BOOL HTBind_init (void) { if (!HTBindings) { - if (!(HTBindings = (HTList **) HT_CALLOC(HASH_SIZE, sizeof(HTList *)))) + if (!(HTBindings = (HTList **) HT_CALLOC(HT_L_HASH_SIZE, sizeof(HTList *)))) HT_OUTOFMEM("HTBind_init"); } StrAllocCopy(HTDelimiters, DEFAULT_SUFFIXES); @@ -90,7 +88,7 @@ HTList *cur; if (!HTBindings) return NO; - for (cnt=0; cnttype = HTAtom_for(HTChunk_data(chunk)); - HTChunk_clear(chunk); + HTChunk_truncate(chunk,0); } if (encoding) { HTChunk_puts(chunk, encoding); @@ -236,7 +236,7 @@ for (; *ptr; ptr++) *ptr = TOLOWER(*ptr); suff->encoding = HTAtom_for(HTChunk_data(chunk)); - HTChunk_clear(chunk); + HTChunk_truncate(chunk,0); } if (transfer) { HTChunk_puts(chunk, transfer); @@ -244,7 +244,7 @@ for (; *ptr; ptr++) *ptr = TOLOWER(*ptr); suff->transfer = HTAtom_for(HTChunk_data(chunk)); - HTChunk_clear(chunk); + HTChunk_truncate(chunk,0); } if (language) { HTChunk_puts(chunk, language); @@ -252,7 +252,7 @@ for (; *ptr; ptr++) *ptr = TOLOWER(*ptr); suff->language = HTAtom_for(HTChunk_data(chunk)); - HTChunk_clear(chunk); + HTChunk_truncate(chunk,0); } HTChunk_delete(chunk); suff->quality = value; @@ -282,8 +282,9 @@ HTFormat format = HTAnchor_format(anchor); HTList * encoding = HTAnchor_encoding(anchor); HTList * language = HTAnchor_language(anchor); + if (!HTBindings) HTBind_init(); if (anchor) { - for (cnt=0; cntsuffix, suffix)) || !strcasecomp(suff->suffix, suffix)) { - if (BIND_TRACE) HTTrace("Found!\n"); + HTTRACE(BIND_TRACE, "Found!\n"); if (suff->type && format) *format = suff->type; if (suff->encoding && enc) *enc = suff->encoding; if (suff->transfer && cte) *cte = suff->transfer; @@ -474,8 +476,7 @@ } } if (!suff) { /* We don't have this suffix - use default */ - if (BIND_TRACE) - HTTrace("Not found - use default for \'*.*\'\n"); + HTTRACE(BIND_TRACE, "Not found - use default for \'*.*\'\n"); if (format) *format = unknown_suffix.type; if (enc) *enc = unknown_suffix.encoding; if (cte) *cte = unknown_suffix.transfer; @@ -485,21 +486,19 @@ } /* while we still have suffixes */ } if (!sufcnt) { /* No suffix so use default value */ - if (BIND_TRACE) - HTTrace("Get Binding. No suffix found - using default '%s\'\n", filename); + HTTRACE(BIND_TRACE, "Get Binding. No suffix found - using default '%s\'\n" _ filename); if (format) *format = no_suffix.type; if (enc) *enc = no_suffix.encoding; if (cte) *cte = no_suffix.transfer; if (lang) *lang = no_suffix.language; *quality = no_suffix.quality; } - if (BIND_TRACE) - HTTrace("Get Binding. Result for '%s\' is: type='%s\', encoding='%s\', cte='%s\', language='%s\' with quality %.2f\n", - filename, - (format && *format) ? HTAtom_name(*format) : "unknown", - (enc && *enc) ? HTAtom_name(*enc) : "unknown", - (cte && *cte) ? HTAtom_name(*cte) : "unknown", - (lang && *lang) ? HTAtom_name(*lang) : "unknown", + HTTRACE(BIND_TRACE, "Get Binding. Result for '%s\' is: type='%s\', encoding='%s\', cte='%s\', language='%s\' with quality %.2f\n" _ + filename _ + (format && *format) ? HTAtom_name(*format) : "unknown" _ + (enc && *enc) ? HTAtom_name(*enc) : "unknown" _ + (cte && *cte) ? HTAtom_name(*cte) : "unknown" _ + (lang && *lang) ? HTAtom_name(*lang) : "unknown" _ *quality); HT_FREE(file); return YES; diff -Naur xdvik-22.40l/libs/libwww/HTBind.h xdvik-22.40n/libs/libwww/HTBind.h --- xdvik-22.40l/libs/libwww/HTBind.h Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTBind.h Fri Sep 13 00:23:45 2002 @@ -16,15 +16,34 @@ /* -This module sets up the binding between a file suffix and a media type, language, -encoding etc. In a client application the suffixes are used in protocols -that does not directly support media types etc., like FTP, and in server -applications they are used to make the bindings between the server and the -local file store that the server can serve to the rest of the world (well -almost). The HTFormat module holds this information -against the accept headers received in a request and uses if for format -negotiation. All the binding management can all be replace by a database -interface. +The preferences that we described in section +Request Preferences did not mention +what libwww should do if it doesn't know the data format of a document. In +many protocols this information is provided by the remote server. Typical +examples are MIME like protocols where the metainformation such as the +Content-Type and the Content-Language is provided together +with the document. However, applications often have access to the local file +system using file URLs which in general do not keep any or at least +very little information of the file type. It is therefore required to have +some kind of binding between the file system and the preferences registered +in the Library which provides this mateinformation about the object. + +Often files in a file system is classified by some sort of a suffix, for +example, GIF files are often ending in .gif, text files +in .txt etc. This binding is not static and it is therefore required +to have a dynamic binding just like the preferences themselves. An example +of the latter is HTML files which on most Unix systems end in .html +whereas they on many MS-DOS based systems end in .htm. + +This module provides a generic binding mechanism between a file and its +representation internally in libwww. It is not limited to simple file suffix +classification but can also be used in more advanced environments using data +bases etc. However, at this point we are interested in how we can register +bindings between file suffixes and for example content types, content languages +etc. The Bind manager is born with a certain knowledge about the set of +delimiters but more can be added to provide the functionality desired. + +All the binding management could of course be replaced by a database interface. This module is implemented by HTBind.c, and it is a part of the W3C Sample Code @@ -203,6 +222,6 @@ - @(#) $Id: HTBind.h,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ + @(#) $Id: HTBind.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTBound.c xdvik-22.40n/libs/libwww/HTBound.c --- xdvik-22.40l/libs/libwww/HTBound.c Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTBound.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTBound.c,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ +** @(#) $Id: HTBound.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This stream parses a MIME multipart stream and builds a set of new ** streams via the stream stack each time we encounter a boundary start. @@ -21,7 +21,7 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWCore.h" -#include "WWWStream.h" +#include "HTMerge.h" #include "HTReqMan.h" #include "HTBound.h" /* Implemented here */ @@ -45,9 +45,6 @@ /* ------------------------------------------------------------------------- */ -/* -** Searches for FTP line until buffer fills up or a CRLF or LF is found -*/ PRIVATE int HTBoundary_put_block (HTStream * me, const char * b, int l) { const char *start = b; @@ -59,8 +56,7 @@ if (me->dash == 2) { while (l>0 && *me->bpos && *me->bpos==*b) l--, me->bpos++, b++; if (!*me->bpos) { - if (STREAM_TRACE && !*me->bpos) - HTTrace("Boundary.... `%s\' found\n", me->boundary); + HTTRACE(STREAM_TRACE, "Boundary.... `%s\' found\n" _ me->boundary); me->bpos = me->boundary; me->body = YES; me->state = EOL_DOT; @@ -82,7 +78,7 @@ int status = PUTBLOCK(start, end-start); if (status != HT_OK) return status; } - if (STREAM_TRACE) HTTrace("Boundary.... Ending\n"); + HTTRACE(STREAM_TRACE, "Boundary.... Ending\n"); start = b; me->dash = 0; me->state = EOL_BEGIN; @@ -147,7 +143,7 @@ if ((status = (*me->target->isa->_free)(me->target)) == HT_WOULD_BLOCK) return HT_WOULD_BLOCK; } - if (PROT_TRACE) HTTrace("Boundary.... FREEING....\n"); + HTTRACE(PROT_TRACE, "Boundary.... FREEING....\n"); HT_FREE(me->boundary); HT_FREE(me); return status; @@ -157,7 +153,7 @@ { int status = HT_ERROR; if (me->target) status = (*me->target->isa->abort)(me->target, e); - if (PROT_TRACE) HTTrace("Boundary.... ABORTING...\n"); + HTTRACE(PROT_TRACE, "Boundary.... ABORTING...\n"); HT_FREE(me->boundary); HT_FREE(me); return status; @@ -198,11 +194,10 @@ me->state = EOL_FLF; StrAllocCopy(me->boundary, boundary); /* Local copy */ me->bpos = me->boundary; - if (STREAM_TRACE) - HTTrace("Boundary.... Stream created with boundary '%s\'\n", me->boundary); + HTTRACE(STREAM_TRACE, "Boundary.... Stream created with boundary '%s\'\n" _ me->boundary); return me; } else { - if (STREAM_TRACE) HTTrace("Boundary.... UNKNOWN boundary!\n"); + HTTRACE(STREAM_TRACE, "Boundary.... UNKNOWN boundary!\n"); return HTErrorStream(); } } diff -Naur xdvik-22.40l/libs/libwww/HTBound.h xdvik-22.40n/libs/libwww/HTBound.h --- xdvik-22.40l/libs/libwww/HTBound.h Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTBound.h Fri Sep 13 00:23:45 2002 @@ -41,7 +41,7 @@ -@(#) $Id: HTBound.h,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ +@(#) $Id: HTBound.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTBufWrt.c xdvik-22.40n/libs/libwww/HTBufWrt.c --- xdvik-22.40l/libs/libwww/HTBufWrt.c Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTBufWrt.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTBufWrt.c,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ +** @(#) $Id: HTBufWrt.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** A buffered output stream. This stream lets you write characters to a ** stream without causing a write every time. The data is first written @@ -59,9 +59,9 @@ PRIVATE int FlushEvent (HTTimer * timer, void * param, HTEventType type) { HTOutputStream * me = (HTOutputStream *) param; - if (timer != me->timer) - HTDebugBreak(__FILE__, __LINE__, "Buffer Writer timer %p not in sync\n", timer); - if (PROT_TRACE) HTTrace("Buffer...... Timeout flushing %p with timer %p\n", me, timer); + if (me->timer && timer != me->timer) + HTDEBUGBREAK("Buffer Writer timer %p not in sync\n" _ timer); + HTTRACE(PROT_TRACE, "Buffer...... Timeout flushing %p with timer %p\n" _ me _ timer); /* ** We ignore the return code here which we shouldn't!!! @@ -71,6 +71,7 @@ /* ** Delete the timer */ + HTTimer_delete(me->timer); me->timer = NULL; return HT_OK; } @@ -95,7 +96,7 @@ */ if (!delay) { int status; - if (STREAM_TRACE) HTTrace("Buffer...... Flushing %p\n", me); + HTTRACE(STREAM_TRACE, "Buffer...... Flushing %p\n" _ me); if ((status = HTBufferWriter_flush(me)) && me->timer) { HTTimer_delete(me->timer); me->timer = NULL; @@ -114,16 +115,14 @@ net = HTHost_getWriteNet(me->host); me->timer = HTTimer_new(NULL, FlushEvent, me, delay, YES, NO); HTHost_unregister(me->host, net, HTEvent_WRITE); - if (STREAM_TRACE) HTTrace("Buffer...... Waiting %dms on %p\n", delay, me); + HTTRACE(STREAM_TRACE, "Buffer...... Waiting %dms on %p\n" _ delay _ me); } else { if (HTTimer_hasTimerExpired(me->timer)) { - if (STREAM_TRACE) - HTTrace("Buffer...... Dispatching old timer %p\n", me->timer); + HTTRACE(STREAM_TRACE, "Buffer...... Dispatching old timer %p\n" _ me->timer); HTTimer_dispatch(me->timer); me->timer = NULL; } else { - if (STREAM_TRACE) - HTTrace("Buffer...... Waiting on unexpired timer %p\n", me->timer); + HTTRACE(STREAM_TRACE, "Buffer...... Waiting on unexpired timer %p\n" _ me->timer); } } return HT_OK; @@ -139,7 +138,7 @@ if (me) { me->allocated += (addthis - addthis%me->growby + (me->growby*me->expo)); me->expo *= 2; - if (STREAM_TRACE) HTTrace("Buffer...... Increasing buffer to %d bytes\n", me->allocated); + HTTRACE(STREAM_TRACE, "Buffer...... Increasing buffer to %d bytes\n" _ me->allocated); if (me->data) { int size = me->read-me->data; if ((me->data = (char *) HT_REALLOC(me->data, me->allocated)) == NULL) @@ -157,12 +156,12 @@ PRIVATE int HTBufferWriter_abort (HTOutputStream * me, HTList * e) { - if (STREAM_TRACE) HTTrace("Buffer...... ABORTING...\n"); - if (me->target) (*me->target->isa->abort)(me->target, e); + HTTRACE(STREAM_TRACE, "Buffer...... ABORTING...\n"); if (me->timer) { HTTimer_delete(me->timer); me->timer = NULL; } + if (me->target) (*me->target->isa->abort)(me->target, e); return HT_ERROR; } @@ -238,6 +237,10 @@ PRIVATE int HTBufferWriter_close (HTOutputStream * me) { if (me) { + if (me->timer) { + HTTimer_delete(me->timer); + me->timer = NULL; + } if (me->target) (*me->target->isa->close)(me->target); HT_FREE(me->data); HT_FREE(me); @@ -257,8 +260,8 @@ HTBufferWriter_close }; -PUBLIC HTOutputStream * HTBufferWriter_new (HTHost * host, HTChannel * ch, - void * param, int bufsize) +PRIVATE HTOutputStream * buffer_new (HTHost * host, HTChannel * ch, + void * param, int bufsize) { if (host && ch) { HTOutputStream * me = HTChannel_output(ch); @@ -276,11 +279,9 @@ int status = getsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (void *) &tcpbufsize, &size); if (status == -1) { - if (STREAM_TRACE) - HTTrace("Socket...... Could not get TCP send buffer size for socket %d\n", sockfd); + HTTRACE(STREAM_TRACE, "Socket...... Could not get TCP send buffer size for socket %d\n" _ sockfd); } else { - if (STREAM_TRACE) - HTTrace("Socket...... TCP send buffer size is %d for socket %d\n", tcpbufsize, sockfd); + HTTRACE(STREAM_TRACE, "Socket...... TCP send buffer size is %d for socket %d\n" _ tcpbufsize _ sockfd); } } #endif @@ -293,9 +294,37 @@ me->allocated = bufsize; me->growby = bufsize; me->expo = 1; - me->target = HTWriter_new(host, ch, param, 0); me->host = host; return me; + } + } + return NULL; +} + +PUBLIC HTOutputStream * HTBufferWriter_new (HTHost * host, + HTChannel * ch, + void * param, + int bufsize) +{ + HTOutputStream * me = buffer_new(host, ch, param, bufsize); + if (me) { + me->target = HTWriter_new(host, ch, param, 0); + return me; + } + return NULL; +} + +PUBLIC HTOutputStream * HTBufferConverter_new (HTHost * host, + HTChannel * ch, + void * param, + int bufsize, + HTOutputStream * target) +{ + if (target) { + HTOutputStream * me = buffer_new(host, ch, param, bufsize); + if (me) { + me->target = target; + return me; } } return NULL; diff -Naur xdvik-22.40l/libs/libwww/HTBufWrt.h xdvik-22.40n/libs/libwww/HTBufWrt.h --- xdvik-22.40l/libs/libwww/HTBufWrt.h Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTBufWrt.h Fri Sep 13 00:23:45 2002 @@ -66,6 +66,14 @@ extern HTOutput_new HTBufferWriter_new; /* +. + Buffered Write Converter Stream +. +*/ + +extern HTOutputConverter_new HTBufferConverter_new; + +/* */ #endif @@ -74,6 +82,6 @@ - @(#) $Id: HTBufWrt.h,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ + @(#) $Id: HTBufWrt.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTCache.c xdvik-22.40n/libs/libwww/HTCache.c --- xdvik-22.40l/libs/libwww/HTCache.c Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTCache.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTCache.c,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ +** @(#) $Id: HTCache.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This modules manages the cache ** @@ -28,7 +28,7 @@ #define HT_CACHE_INDEX ".index" #define HT_CACHE_LOCK ".lock" #define HT_CACHE_META ".meta" -#define HT_CACHE_ETAG "@w3c@" +#define HT_CACHE_EMPTY_ETAG "@w3c@" /* Default heuristics cache expirations - thanks to Jeff Mogul for good comments! */ #define NO_LM_EXPIRATION 24*3600 /* 24 hours */ @@ -44,7 +44,6 @@ #define WARN_HEURISTICS 24*3600 /* When to issue a warning */ -#define HASH_SIZE 599 #define DUMP_FREQUENCY 10 /* Dump index every x loads */ #define MEGA 0x100000L @@ -113,7 +112,8 @@ /* Cache parameters */ PRIVATE BOOL HTCacheEnable = NO; /* Disabled by default */ PRIVATE BOOL HTCacheInitialized = NO; -PRIVATE char * HTCacheRoot = NULL; /* Destination for cache */ +PRIVATE BOOL HTCacheProtected = YES; +PRIVATE char * HTCacheRoot = NULL; /* Local Destination for cache */ PRIVATE HTExpiresMode HTExpMode = HT_EXPIRES_IGNORE; PRIVATE HTDisconnectedMode DisconnectedMode = HT_DISCONNECT_NONE; @@ -132,7 +132,9 @@ PRIVATE int new_entries = 0; /* Number of new entries */ -PRIVATE HTNetAfter HTCacheCheckFilter; +PRIVATE HTNetBefore HTCacheFilter; +PRIVATE HTNetAfter HTCacheUpdateFilter; +PRIVATE HTNetAfter HTCacheCheckFilter; /* ------------------------------------------------------------------------- */ /* CACHE GARBAGE COLLECTOR */ @@ -151,7 +153,7 @@ PRIVATE BOOL HTCacheGarbage (void) { long old_size = HTCacheContentSize; - if (CACHE_TRACE) HTTrace("Cache....... Garbage collecting\n"); + HTTRACE(CACHE_TRACE, "Cache....... Garbage collecting\n"); if (CacheTable) { time_t cur_time = time(NULL); HTList * cur; @@ -173,8 +175,8 @@ ** the size and also the pain it took to get the document in the first ** case. It could also include max_stale. */ - if (CACHE_TRACE) HTTrace("Cache....... Collecting Stale entries\n"); - for (cnt=0; cntresponse_time; time_t current_age = pres->corrected_initial_age + resident_time; - if (pres->freshness_lifetime < current_age) { - HTCache_remove(pres); + /* 2000-08-08 Jens Meggers: HTCache_remove doesn't + remove a cache entry if it's locked. To avoid + an endless loop, we check the return value of + HTCache_remove before skipping the entry. */ + if ((pres->freshness_lifetime < current_age) + && HTCache_remove(pres)) { cur = old_cur; } else { old_cur = cur; @@ -198,19 +204,24 @@ ** dead lock ourselves. We start from the bottom up by taking ** all the documents with 0 hits, 1 hits, 2 hits, etc. */ - if (CACHE_TRACE) HTTrace("Cache....... Collecting least used entries\n"); + HTTRACE(CACHE_TRACE, "Cache....... Collecting least used entries\n"); hits = 0; while (startGC()) { BOOL removed = NO; - if (CACHE_TRACE) - HTTrace("Cache....... Collecting entries with %d hits\n",hits); - for (cnt=0; cntsize > HTCacheMaxEntrySize || pres->hits <= hits) { - HTCache_remove(pres); + /* 2000-08-08 Jens Meggers: HTCache_remove doesn't + remove a cache entry if it's locked. To avoid + going into an endless loop, we check the return + value of HTCache_remove before marking the + object as removed. */ + if ((pres->size > HTCacheMaxEntrySize + || pres->hits <= hits) + && HTCache_remove(pres)) { cur = old_cur; removed = YES; } else { @@ -223,9 +234,8 @@ if (!removed) break; hits++; } - if (CACHE_TRACE) - HTTrace("Cache....... Size reduced from %ld to %ld\n", - old_size, HTCacheContentSize); + HTTRACE(CACHE_TRACE, "Cache....... Size reduced from %ld to %ld\n" _ + old_size _ HTCacheContentSize); /* ** Dump the new content to the index file */ @@ -278,7 +288,7 @@ if (cache_root && CacheTable) { char * index = cache_index_name(cache_root); FILE * fp = NULL; - if (CACHE_TRACE) HTTrace("Cache Index. Writing index `%s\'\n", index); + HTTRACE(CACHE_TRACE, "Cache Index. Writing index `%s\'\n" _ index); /* ** Open the file for writing. Note - we don't take a backup! @@ -286,8 +296,7 @@ */ if (!index) return NO; if ((fp = fopen(index, "wb")) == NULL) { - if (CACHE_TRACE) - HTTrace("Cache Index. Can't open `%s\' for writing\n", index); + HTTRACE(CACHE_TRACE, "Cache Index. Can't open `%s\' for writing\n" _ index); HT_FREE(index); return NO; } @@ -299,14 +308,14 @@ { HTList * cur; int cnt; - for (cnt=0; cnturl, pres->cachename, - pres->etag ? pres->etag : HT_CACHE_ETAG, + pres->etag ? pres->etag : HT_CACHE_EMPTY_ETAG, (long) (pres->lm), (long) (pres->expires), pres->size, @@ -317,8 +326,7 @@ (long) (pres->response_time), (long) (pres->corrected_initial_age), pres->must_revalidate+0x30) < 0) { - if (CACHE_TRACE) - HTTrace("Cache Index. Error writing cache index\n"); + HTTRACE(CACHE_TRACE, "Cache Index. Error writing cache index\n"); return NO; } } @@ -355,7 +363,7 @@ char * etag = HTNextField(&line); StrAllocCopy(cache->url, url); StrAllocCopy(cache->cachename, cachename); - if (strcmp(etag, HT_CACHE_ETAG)) StrAllocCopy(cache->etag, etag); + if (strcmp(etag, HT_CACHE_EMPTY_ETAG)) StrAllocCopy(cache->etag, etag); } #ifdef HAVE_LONG_TIME_T /* @@ -378,7 +386,7 @@ &cache->response_time, &cache->corrected_initial_age, &validate) < 0) { - if (CACHE_TRACE) HTTrace("Cache Index. Error reading cache index\n"); + HTTRACE(CACHE_TRACE, "Cache Index. Error reading cache index\n"); return NO; } cache->range = range-0x30; @@ -401,11 +409,11 @@ ** entry. Also check that the hash is still within bounds */ if (!CacheTable) { - if ((CacheTable = (HTList **) HT_CALLOC(HASH_SIZE, + if ((CacheTable = (HTList **) HT_CALLOC(HT_XL_HASH_SIZE, sizeof(HTList *))) == NULL) HT_OUTOFMEM("HTCache_parseLine"); } - if (cache->hash >= 0 && cache->hash < HASH_SIZE) { + if (cache->hash >= 0 && cache->hash < HT_XL_HASH_SIZE) { int hash = cache->hash; if (!CacheTable[hash]) CacheTable[hash] = HTList_new(); HTList_addObject(CacheTable[hash], (void *) cache); @@ -490,7 +498,7 @@ { if (me) { int status = HTCacheIndex_flush(me); - if (APP_TRACE) HTTrace("Cache Index. FREEING....\n"); + HTTRACE(APP_TRACE, "Cache Index. FREEING....\n"); HTChunk_delete(me->buffer); HT_FREE(me); return status; @@ -502,7 +510,7 @@ { if (me) { int status = HT_ERROR; - if (APP_TRACE) HTTrace("Cache Index. ABORTING...\n"); + HTTRACE(APP_TRACE, "Cache Index. ABORTING...\n"); HTChunk_delete(me->buffer); HT_FREE(me); return status; @@ -547,7 +555,7 @@ if (cache_root && CacheTable == NULL) { BOOL wasInteractive; char * file = cache_index_name(cache_root); - char * index = HTParse(file, "cache:", PARSE_ALL); + char * index = HTLocalToWWW(file, "cache:"); HTAnchor * anchor = HTAnchor_findAddress(index); HTRequest * request = HTRequest_new(); HTRequest_setPreemptive(request, YES); @@ -584,22 +592,25 @@ BOOL create = NO; if (!cache_root) return NO; StrAllocCopy(loc, cache_root); /* Get our own copy */ +#ifdef WWW_MSWINDOWS + cur = *(loc+1) == ':' ? loc+3 : loc+1; +#else cur = loc+1; - while ((cur = strchr(cur, '/'))) { +#endif + while ((cur = strchr(cur, DIR_SEPARATOR_CHAR))) { *cur = '\0'; if (create || HT_STAT(loc, &stat_info) == -1) { create = YES; /* To avoid doing stat()s in vain */ - if (CACHE_TRACE) HTTrace("Cache....... Creating dir `%s\'\n", loc); + HTTRACE(CACHE_TRACE, "Cache....... Creating dir `%s\'\n" _ loc); if (MKDIR(loc, 0777) < 0) { - if (CACHE_TRACE) HTTrace("Cache....... can't create\n"); + HTTRACE(CACHE_TRACE, "Cache....... can't create\n"); HT_FREE(loc); return NO; } } else { - if (CACHE_TRACE) - HTTrace("Cache....... dir `%s\' already exists\n", loc); + HTTRACE(CACHE_TRACE, "Cache....... dir `%s\' already exists\n" _ loc); } - *cur++ = '/'; + *cur++ = DIR_SEPARATOR_CHAR; } HT_FREE(loc); return YES; @@ -612,32 +623,34 @@ PRIVATE BOOL HTCacheMode_setRoot (const char * cache_root) { if (cache_root) { - StrAllocCopy(HTCacheRoot, cache_root); - if (*(HTCacheRoot+strlen(HTCacheRoot)-1) != '/') - StrAllocCat(HTCacheRoot, "/"); + if ((HTCacheRoot = HTWWWToLocal(cache_root, "file:", NULL)) == NULL) + return NO; + if (*(HTCacheRoot+strlen(HTCacheRoot)-1) != DIR_SEPARATOR_CHAR) + StrAllocCat(HTCacheRoot, DIR_SEPARATOR_STR); } else { /* ** If no cache root has been indicated then look for a suitable ** location. */ - char * cr = (char *) getenv("TMPDIR"); -#if 0 - /* - ** Windows screws this up pretty bad :-( - */ + char * addr = NULL; + char * cr = (char *) getenv("WWW_CACHE"); if (!cr) cr = (char *) getenv("TMP"); if (!cr) cr = (char *) getenv("TEMP"); -#endif if (!cr) cr = HT_CACHE_LOC; - StrAllocCopy(HTCacheRoot, cr); - if (*(HTCacheRoot+strlen(HTCacheRoot)-1) != '/') - StrAllocCat(HTCacheRoot, "/"); - StrAllocCat(HTCacheRoot, HT_CACHE_ROOT); - if (*(HTCacheRoot+strlen(HTCacheRoot)-1) != '/') - StrAllocCat(HTCacheRoot, "/"); + addr = HTLocalToWWW(cr, NULL); + if (*(addr+strlen(addr)-1) != DIR_SEPARATOR_CHAR) + StrAllocCat(addr, DIR_SEPARATOR_STR); + StrAllocCat(addr, HT_CACHE_ROOT); + if (*(addr+strlen(addr)-1) != DIR_SEPARATOR_CHAR) + StrAllocCat(addr, DIR_SEPARATOR_STR); + if ((HTCacheRoot = HTWWWToLocal(addr, "file:", NULL)) == NULL) { + HT_FREE(addr); + return NO; + } + HT_FREE(addr); } if (create_cache_root(HTCacheRoot) == NO) return NO; - if (CACHE_TRACE) HTTrace("Cache Root.. Root set to `%s\'\n", HTCacheRoot); + HTTRACE(CACHE_TRACE, "Cache Root.. Local root set to `%s\'\n" _ HTCacheRoot); return YES; } @@ -645,9 +658,9 @@ ** Return the value of the cache root. The cache root can only be ** set through the HTCacheInit() function */ -PUBLIC const char * HTCacheMode_getRoot (void) +PUBLIC char * HTCacheMode_getRoot (void) { - return HTCacheRoot; + return HTLocalToWWW(HTCacheRoot, NULL); } /* @@ -667,7 +680,7 @@ strcat(location, HT_CACHE_LOCK); if ((fp = fopen(location, "r")) != NULL) { HTAlertCallback *cbf = HTAlert_find(HT_A_CONFIRM); - HTTrace("Cache....... In `%s\' is already in use\n", root); + HTTRACE(CACHE_TRACE, "Cache....... In `%s\' is already in use\n" _ root); fclose(fp); if (cbf) { BOOL result = (*cbf)(NULL, HT_A_CONFIRM, @@ -684,7 +697,7 @@ } } if ((fp = fopen(location, "w")) == NULL) { - HTTrace("Cache....... Can't open `%s\' for writing\n", location); + HTTRACE(CACHE_TRACE, "Cache....... Can't open `%s\' for writing\n" _ location); HT_FREE(location); return NO; } @@ -752,6 +765,13 @@ HTCacheIndex_read(HTCacheRoot); /* + ** Register the cache before and after filters + */ + HTNet_addBefore(HTCacheFilter, "http://*", NULL, HT_FILTER_MIDDLE); + HTNet_addAfter(HTCacheUpdateFilter, "http://*", NULL, + HT_NOT_MODIFIED, HT_FILTER_MIDDLE); + + /* ** Register the cache AFTER filter for checking whether ** we should invalidate the cached entry */ @@ -781,8 +801,14 @@ HTCacheIndex_write(HTCacheRoot); /* - ** Set a lock on the cache so that multiple users - ** don't step on each other. + ** Unregister the cache before and after filters + */ + HTNet_deleteBefore(HTCacheFilter); + HTNet_deleteAfter(HTCacheUpdateFilter); + HTNet_deleteAfter(HTCacheCheckFilter); + + /* + ** Remove the global cache lock. */ HTCache_deleteSingleUserLock(HTCacheRoot); @@ -816,6 +842,16 @@ return HTCacheEnable; } +PUBLIC void HTCacheMode_setProtected (BOOL mode) +{ + HTCacheProtected = mode; +} + +PUBLIC BOOL HTCacheMode_protected (void) +{ + return HTCacheProtected; +} + /* ** We can set the cache to operate in disconnected mode in which we only ** return (valid) responses from the cache. Disconnected mode does not @@ -870,9 +906,8 @@ HTCacheFolderSize = HTCacheTotalSize/HT_CACHE_FOLDER_PCT; HTCacheGCBuffer = HTCacheTotalSize/HT_CACHE_GC_PCT; if (new_size < old_size) HTCacheGarbage(); - if (CACHE_TRACE) - HTTrace("Cache....... Total cache size: %ld with %ld bytes for metainformation and folders and at least %ld bytes free after every gc\n", - HTCacheTotalSize, HTCacheFolderSize, HTCacheGCBuffer); + HTTRACE(CACHE_TRACE, "Cache....... Total cache size: %ld with %ld bytes for metainformation and folders and at least %ld bytes free after every gc\n" _ + HTCacheTotalSize _ HTCacheFolderSize _ HTCacheGCBuffer); return YES; } @@ -892,11 +927,10 @@ long old_size = HTCacheMaxEntrySize; HTCacheMaxEntrySize = new_size; if (new_size < old_size) HTCacheGarbage(); - if (CACHE_TRACE) - HTTrace("Cache...... Max entry cache size is %ld\n", HTCacheMaxEntrySize); + HTTRACE(CACHE_TRACE, "Cache...... Max entry cache size is %ld\n" _ HTCacheMaxEntrySize); return YES; } - if (CACHE_TRACE) HTTrace("Cache...... Max entry cache size is unchanged\n"); + HTTRACE(CACHE_TRACE, "Cache...... Max entry cache size is unchanged\n"); return NO; } @@ -905,6 +939,19 @@ return HTCacheMaxEntrySize / MEGA; } +/* +** Set the default expiration time. In seconds. +*/ +PUBLIC void HTCacheMode_setDefaultExpiration (const int exp_time) +{ + DefaultExpiration = exp_time; +} + +PUBLIC int HTCacheMode_DefaultExpiration (void) +{ + return DefaultExpiration; +} + /* ------------------------------------------------------------------------- */ /* CACHE OBJECT */ /* ------------------------------------------------------------------------- */ @@ -920,7 +967,7 @@ PRIVATE BOOL delete_object (HTList * list, HTCache * me) { - if (CACHE_TRACE) HTTrace("Cache....... delete %p from list %p\n",me, list); + HTTRACE(CACHE_TRACE, "Cache....... delete %p from list %p\n" _ me _ list); HTList_removeObject(list, (void *) me); HTCacheContentSize -= me->size; free_object(me); @@ -950,14 +997,13 @@ */ sprintf(path, "%s%d", HTCacheRoot, me->hash); if (HT_STAT(path, &stat_info) == -1) { - if (CACHE_TRACE) HTTrace("Cache....... Create dir `%s\'\n", path); + HTTRACE(CACHE_TRACE, "Cache....... Create dir `%s\'\n" _ path); if (MKDIR(path, 0777) < 0) { - if (CACHE_TRACE) HTTrace("Cache....... Can't create...\n"); + HTTRACE(CACHE_TRACE, "Cache....... Can't create...\n"); status = NO; } } else { - if (CACHE_TRACE) - HTTrace("Cache....... Directory `%s\' already exists\n", path); + HTTRACE(CACHE_TRACE, "Cache....... Directory `%s\' already exists\n" _ path); } /* @@ -1035,12 +1081,8 @@ } me->freshness_lifetime = HTMAX(0, freshness_lifetime); } - if (CACHE_TRACE) { - HTTrace("Cache....... Received Age %d, corrected %d, freshness lifetime %d\n", - HTAnchor_age(anchor), - me->corrected_initial_age, - me->freshness_lifetime); - } + HTTRACE(CACHE_TRACE, "Cache....... Received Age %d, corrected %d, freshness lifetime %d\n" _ + HTAnchor_age(anchor) _ me->corrected_initial_age _ me->freshness_lifetime); return YES; } return NO; @@ -1057,7 +1099,7 @@ int hash = 0; char * url = NULL; if (!request || !response || !anchor) { - if (CORE_TRACE) HTTrace("Cache....... Bad argument\n"); + HTTRACE(CORE_TRACE, "Cache....... Bad argument\n"); return NULL; } @@ -1065,9 +1107,9 @@ if ((url = HTAnchor_address((HTAnchor *) anchor))) { char * ptr; for (ptr=url; *ptr; ptr++) - hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HASH_SIZE); + hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HT_XL_HASH_SIZE); if (!CacheTable) { - if ((CacheTable = (HTList **) HT_CALLOC(HASH_SIZE, + if ((CacheTable = (HTList **) HT_CALLOC(HT_XL_HASH_SIZE, sizeof(HTList *))) == NULL) HT_OUTOFMEM("HTCache_new"); } @@ -1099,7 +1141,7 @@ if (HTCache_hasLock(pres)) { if (HTCache_breakLock(pres, request) == NO) { - if (CACHE_TRACE) HTTrace("Cache....... Entry %p already in use\n"); + HTTRACE(CACHE_TRACE, "Cache....... Entry %p already in use\n"); return pres; } } @@ -1133,7 +1175,7 @@ /* Get a new cache entry */ if ((cache = HTCache_new(request, response, anchor)) == NULL) { - if (CACHE_TRACE) HTTrace("Cache....... Can't get a cache object\n"); + HTTRACE(CACHE_TRACE, "Cache....... Can't get a cache object\n"); return NULL; } @@ -1147,6 +1189,187 @@ } /* +** Cache Validation BEFORE Filter +** ------------------------------ +** Check the cache mode to see if we can use an already loaded version +** of this document. If so and our copy is valid then we don't have +** to go out and get it unless we are forced to +** We only check the cache in caseof a GET request. Otherwise, we go +** directly to the source. +*/ +PRIVATE int HTCacheFilter (HTRequest * request, void * param, int mode) +{ + HTParentAnchor * anchor = HTRequest_anchor(request); + char * default_name = HTRequest_defaultPutName (request); + HTCache * cache = NULL; + HTReload reload = HTRequest_reloadMode(request); + HTMethod method = HTRequest_method(request); + HTDisconnectedMode disconnect = HTCacheMode_disconnected(); + BOOL validate = NO; + + /* + ** If the cache is disabled all together then it won't help looking, huh? + */ + if (!HTCacheMode_enabled()) return HT_OK; + HTTRACE(CACHE_TRACE, "Cachefilter. Checking persistent cache\n"); + + /* + ** Now check the cache... + */ + if (method != METHOD_GET) { + HTTRACE(CACHE_TRACE, "Cachefilter. We only check GET methods\n"); + } else if (reload == HT_CACHE_FLUSH) { + /* + ** If the mode if "Force Reload" then don't even bother to check the + ** cache - we flush everything we know abut this document anyway. + ** Add the appropriate request headers. We use both the "pragma" + ** and the "cache-control" headers in order to be + ** backwards compatible with HTTP/1.0 + */ + validate = YES; + HTRequest_addGnHd(request, HT_G_PRAGMA_NO_CACHE); + HTRequest_addCacheControl(request, "no-cache", ""); + + /* + ** We also flush the information in the anchor as we don't want to + ** inherit any "old" values + */ + HTAnchor_clearHeader(anchor); + + } else { + /* + ** Check the persistent cache manager. If we have a cache hit then + ** continue to see if the reload mode requires us to do a validation + ** check. This filter assumes that we can get the cached version + ** through one of our protocol modules (for example the file module) + */ + cache = HTCache_find(anchor, default_name); + if (cache) { + HTReload cache_mode = HTCache_isFresh(cache, request); + if (cache_mode == HT_CACHE_ERROR) cache = NULL; + reload = HTMAX(reload, cache_mode); + HTRequest_setReloadMode(request, reload); + + /* + ** Now check the mode and add the right headers for the validation + ** If we are to validate a cache entry then we get a lock + ** on it so that not other requests can steal it. + */ + if (reload == HT_CACHE_RANGE_VALIDATE) { + /* + ** If we were asked to range validate the cached object then + ** use the etag or the last modified for cache validation + */ + validate = YES; + HTCache_getLock(cache, request); + HTRequest_addRqHd(request, HT_C_IF_RANGE); + } else if (reload == HT_CACHE_END_VALIDATE) { + /* + ** If we were asked to end-to-end validate the cached object + ** then use a max-age=0 cache control directive + */ + validate = YES; + HTCache_getLock(cache, request); + HTRequest_addCacheControl(request, "max-age", "0"); + } else if (reload == HT_CACHE_VALIDATE) { + /* + ** If we were asked to validate the cached object then + ** use the etag or the last modified for cache validation + ** We use both If-None-Match or If-Modified-Since. + */ + validate = YES; + HTCache_getLock(cache, request); + HTRequest_addRqHd(request, HT_C_IF_NONE_MATCH | HT_C_IMS); + } else if (cache) { + /* + ** The entity does not require any validation at all. We + ** can just go ahead and get it from the cache. In case we + ** have a fresh subpart of the entity, then we issue a + ** conditional GET request with the range set by the cache + ** manager. Issuing the conditional range request is + ** equivalent to a validation as we have to go out on the + ** net. This may have an effect if running in disconnected + ** mode. We disable all BEFORE filters as they don't make + ** sense while loading the cache entry. + */ + { + char * name = HTCache_name(cache); + HTAnchor_setPhysical(anchor, name); + HTCache_addHit(cache); + HT_FREE(name); + } + } + } + } + + /* + ** If we are in disconnected mode and we are to validate an entry + ** then check whether what mode of disconnected mode we're in. If + ** we are to use our own cache then return a "504 Gateway Timeout" + */ + if ((!cache || validate) && disconnect != HT_DISCONNECT_NONE) { + if (disconnect == HT_DISCONNECT_EXTERNAL) + HTRequest_addCacheControl(request, "only-if-cached", ""); + else { + HTRequest_addError(request, ERR_FATAL, NO, + HTERR_GATE_TIMEOUT, "Disconnected Cache Mode", + 0, "HTCacheFilter"); + return HT_ERROR; + } + } + return HT_OK; +} + +/* +** Cache Update AFTER filter +** ------------------------- +** On our way out we catch the metainformation and stores it in +** our persistent store. If we have a cache validation (a 304 +** response then we use the new metainformation and merges it with +** the existing information already captured in the cache. +*/ +PRIVATE int HTCacheUpdateFilter (HTRequest * request, HTResponse * response, + void * param, int status) +{ + HTParentAnchor * anchor = HTRequest_anchor(request); + char * default_name = HTRequest_defaultPutName(request); + HTCache * cache = HTCache_find(anchor, default_name); + if (cache) { + + /* + ** It may in fact be that the information in the 304 response + ** told us that we can't cache the entity anymore. If this is the + ** case then flush it now. Otherwise prepare for a cache read + */ + HTTRACE(CACHE_TRACE, "Cache....... Merging metainformation\n"); + if (HTResponse_isCachable(response) == HT_NO_CACHE) { + HTCache_remove(cache); + } else { + char * name = HTCache_name(cache); + HTAnchor_setPhysical(anchor, name); + HTCache_addHit(cache); + HT_FREE(name); + HTCache_updateMeta(cache, request, response); + } + + /* + ** Start request directly from the cache. As with the redirection filter + ** we reuse the same request object which means that we must + ** keep this around until the cache load request has terminated + ** In the case of a + */ + HTLoad(request, YES); + return HT_ERROR; + } else { + + /* If entry doesn't already exist then create a new entry */ + HTCache_touch(request, response, anchor); + + } + return HT_OK; +} + +/* ** Cache Check AFTER filter ** ------------------------ ** Add an entry for a resource that has just been created so that we can @@ -1165,13 +1388,30 @@ HTCache_touch(request, response, anchor); } else { HTParentAnchor * anchor = HTRequest_anchor(request); - HTCache * cache = HTCache_find(anchor); + char * default_name = HTRequest_defaultPutName(request); + HTCache * cache = HTCache_find(anchor, default_name); if (cache) { - if (status == 204) + /* + ** If we receive a 204 and the method is unsafe then we have + ** to delete the cache body but not the header information + */ + /* + ** @@ JK: see how to add all the methods here (201, etc.) when + ** it's a PUT + */ + if (status == 204) { HTCache_updateMeta(cache, request, response); - else + cache->size = 0; + cache->range = YES; + /* @@ JK: update the cache meta data on disk */ + HTCache_writeMeta (cache, request, response); + /* @@ JK: and we remove the file name as it's obsolete + now */ + REMOVE(cache->cachename); + } else HTCache_remove(cache); - } + } + /* @@ this operation will clear the cache->size and cache_range */ HTCache_touch(request, response, anchor); } } @@ -1200,7 +1440,7 @@ ** Now add the new size to the total cache size. If the new size is ** bigger than the legal cache size then start the gc. */ - if (CACHE_TRACE) HTTrace("Cache....... Total size %ld\n", HTCacheContentSize); + HTTRACE(CACHE_TRACE, "Cache....... Total size %ld\n" _ HTCacheContentSize); if (startGC()) HTCacheGarbage(); return YES; } @@ -1215,18 +1455,25 @@ ** Returns: file name If OK (must be freed by caller) ** NULL If no cache object found */ -PUBLIC HTCache * HTCache_find (HTParentAnchor * anchor) +PUBLIC HTCache * HTCache_find (HTParentAnchor * anchor, char * default_name) { HTList * list = NULL; HTCache * pres = NULL; /* Find a hash entry for this URL */ if (HTCacheMode_enabled() && anchor && CacheTable) { - char * url = HTAnchor_address((HTAnchor *) anchor); + char * url = NULL; int hash = 0; - char * ptr = url; + char * ptr; + + if (default_name) + StrAllocCopy (url, default_name); + else + url = HTAnchor_address((HTAnchor *) anchor); + ptr = url; + for (; *ptr; ptr++) - hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HASH_SIZE); + hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HT_XL_HASH_SIZE); if (!CacheTable[hash]) { HT_FREE(url); return NULL; @@ -1238,8 +1485,8 @@ HTList * cur = list; while ((pres = (HTCache *) HTList_nextObject(cur))) { if (!strcmp(pres->url, url)) { - if (CACHE_TRACE) HTTrace("Cache....... Found %p hits %d\n", - pres, pres->hits); + HTTRACE(CACHE_TRACE, "Cache....... Found %p hits %d\n" _ + pres _ pres->hits); break; } } @@ -1274,7 +1521,7 @@ int cnt; /* Delete the rest */ - for (cnt=0; cntisa->put_block)(target, buffer, status); + if (status == HT_LOADED) { (*target->isa->flush)(target); return YES; } if (status < 0) { - if (PROT_TRACE) HTTrace("Cache....... Target ERROR %d\n", status); + HTTRACE(PROT_TRACE, "Cache....... Target ERROR %d\n" _ status); break; } } @@ -1464,14 +1711,13 @@ FILE * fp; char * name = HTCache_metaLocation(cache); if (!name) { - if (CACHE_TRACE) HTTrace("Cache....... Invalid meta name\n", name); + HTTRACE(CACHE_TRACE, "Cache....... Invalid meta name\n" _ name); HTCache_remove(cache); return NO; } - if (CACHE_TRACE) HTTrace("Cache....... Looking for `%s\'\n", name); + HTTRACE(CACHE_TRACE, "Cache....... Looking for `%s\'\n" _ name); if ((fp = fopen(name, "rb")) == NULL) { - if (CACHE_TRACE) - HTTrace("Cache....... Can't open `%s\' for reading\n", name); + HTTRACE(CACHE_TRACE, "Cache....... Can't open `%s\' for reading\n" _ name); HTCache_remove(cache); HT_FREE(name); } else { @@ -1483,6 +1729,11 @@ HTResponse_setCachable(HTRequest_response(request), HT_CACHE_ALL); status = meta_read(fp, request, target); (*target->isa->_free)(target); + /* JK: Moved the delete outside of meta_read, because it was being + deleted multiple times. + Delete the response headers. In principle, they are + already available in the anchor */ + HTRequest_setResponse(request, NULL); fclose(fp); HT_FREE(name); return status; @@ -1521,6 +1772,23 @@ return NO; } +PUBLIC BOOL HTCache_resetMeta (HTCache * cache, HTRequest * request, + HTResponse * response) +{ + /* what a problem... we update the cache with the wrong data + from the response... after the redirection */ + HTCache_updateMeta (cache, request, response); + cache->size = 0; + cache->range = YES; + /* @@ JK: update the cache meta data on disk */ + HTCache_writeMeta (cache, request, response); + /* @@ JK: and we remove the file name as it's obsolete + now */ + REMOVE(cache->cachename); + + return YES; +} + /* ** Remove from disk. You must explicitly remove a lock ** before this operation can succeed @@ -1550,7 +1818,7 @@ int cnt; /* Delete the rest */ - for (cnt=0; cntsize == 0) + return HT_CACHE_FLUSH; +#endif /* ** If we only have a part of this request then make a range request ** using the If-Range condition GET request @@ -1601,7 +1878,7 @@ if (cache->range) { char buf[20]; sprintf(buf, "%ld-", cache->size); - if (CACHE_TRACE) HTTrace("Cache....... Asking for range `%s\'\n", buf); + HTTRACE(CACHE_TRACE, "Cache....... Asking for range `%s\'\n" _ buf); HTRequest_addRange(request, "bytes", buf); HTRequest_addRqHd(request, HT_C_RANGE); return HT_CACHE_RANGE_VALIDATE; @@ -1639,12 +1916,12 @@ ** given in the request cache control header is followed. */ if (max_age >= 0 && current_age > max_age) { - if (CACHE_TRACE) HTTrace("Cache....... Max-age validation\n"); + HTTRACE(CACHE_TRACE, "Cache....... Max-age validation\n"); return HT_CACHE_VALIDATE; } if (min_fresh >= 0 && cache->freshness_lifetime < current_age + min_fresh) { - if (CACHE_TRACE) HTTrace("Cache....... Min-fresh validation\n"); + HTTRACE(CACHE_TRACE, "Cache....... Min-fresh validation\n"); return HT_CACHE_VALIDATE; } @@ -1664,7 +1941,7 @@ PUBLIC BOOL HTCache_getLock (HTCache * cache, HTRequest * request) { if (cache && request) { - if (CACHE_TRACE) HTTrace("Cache....... Locking cache entry %p\n", cache); + HTTRACE(CACHE_TRACE, "Cache....... Locking cache entry %p\n" _ cache); cache->lock = request; return YES; } @@ -1674,7 +1951,7 @@ PUBLIC BOOL HTCache_releaseLock (HTCache * cache) { if (cache) { - if (CACHE_TRACE) HTTrace("Cache....... Unlocking cache entry %p\n", cache); + HTTRACE(CACHE_TRACE, "Cache....... Unlocking cache entry %p\n" _ cache); cache->lock = NULL; return YES; } @@ -1690,8 +1967,7 @@ { if (cache && cache->lock) { if (cache->lock == request) { - if (CACHE_TRACE) - HTTrace("Cache....... Breaking lock on entry %p\n", cache); + HTTRACE(CACHE_TRACE, "Cache....... Breaking lock on entry %p\n" _ cache); cache->lock = NULL; return YES; } @@ -1710,7 +1986,7 @@ { if (cache) { char * local = cache->cachename; - char * url = HTParse(local, "cache:", PARSE_ALL); + char * url = HTLocalToWWW(local, "cache:"); return url; } return NULL; @@ -1729,8 +2005,8 @@ { if (cache) { cache->hits++; - if (CACHE_TRACE) HTTrace("Cache....... Hits for %p is %d\n", - cache, cache->hits); + HTTRACE(CACHE_TRACE, "Cache....... Hits for %p is %d\n" _ + cache _ cache->hits); return YES; } return NO; @@ -1799,7 +2075,7 @@ PRIVATE int HTCache_abort (HTStream * me, HTList * e) { - if (CACHE_TRACE) HTTrace("Cache....... ABORTING\n"); + HTTRACE(CACHE_TRACE, "Cache....... ABORTING\n"); free_stream(me, YES); return HT_ERROR; } @@ -1849,7 +2125,13 @@ /* If cache is not enabled then exit now */ if (!HTCacheEnable || !HTCacheInitialized) { - if (CACHE_TRACE) HTTrace("Cache....... Not enabled\n"); + HTTRACE(CACHE_TRACE, "Cache....... Not enabled\n"); + return NULL; + } + + /* don't cache protected documents */ + if (HTRequest_credentials (request) && !HTCacheProtected) { + HTTRACE(CACHE_TRACE, "Cache....... won't cache protected objects\n"); return NULL; } @@ -1858,20 +2140,20 @@ ** to be too big. */ if (HTAnchor_length(anchor) > HTCacheMaxEntrySize) { - if (CACHE_TRACE) HTTrace("Cache....... Entry is too big - won't cache\n"); + HTTRACE(CACHE_TRACE, "Cache....... Entry is too big - won't cache\n"); return NULL; } /* Get a new cache entry */ if ((cache = HTCache_new(request, response, anchor)) == NULL) { - if (CACHE_TRACE) HTTrace("Cache....... Can't get a cache object\n"); + HTTRACE(CACHE_TRACE, "Cache....... Can't get a cache object\n"); return NULL; } /* Test that the cached object is not locked */ if (HTCache_hasLock(cache)) { if (HTCache_breakLock(cache, request) == NO) { - if (CACHE_TRACE) HTTrace("Cache....... Entry already in use\n"); + HTTRACE(CACHE_TRACE, "Cache....... Entry already in use\n"); return NULL; } } @@ -1882,14 +2164,12 @@ ** existed then it will be overridden with the new data. */ if ((fp = fopen(cache->cachename, append ? "ab" : "wb")) == NULL) { - if (CACHE_TRACE) - HTTrace("Cache....... Can't open `%s\' for writing\n", cache->cachename); + HTTRACE(CACHE_TRACE, "Cache....... Can't open `%s\' for writing\n" _ cache->cachename); HTCache_delete(cache); return NULL; } else { - if (CACHE_TRACE) - HTTrace("Cache....... %s file `%s\'\n", - append ? "Append to" : "Creating", cache->cachename); + HTTRACE(CACHE_TRACE, "Cache....... %s file `%s\'\n" _ + append ? "Append to" : "Creating" _ cache->cachename); } /* Set up the stream */ @@ -1931,6 +2211,32 @@ /* ------------------------------------------------------------------------- */ /* +** This function copies the headers associated with a cached +** object to closes the connection and frees memory. +** Returns YES on OK, else NO +*/ +PRIVATE void HTCache_copyHeaders (HTRequest * req) +{ + HTParentAnchor * anchor; + char * url; + + anchor = HTRequest_anchor (req); + url = HTAnchor_physical(anchor); + if (url && !strncmp (url, "cache:", sizeof ("cache:") - 1 )) + { + /* + HTMIME_anchor2response (req); + */ + + /* set up a "dummy" stack just for copying the MIME type. + We need this to remove any dependencies between the MIME + and CACHE minilibs */ + HTStreamStack(WWW_MIME_COPYHEADERS, WWW_DEBUG, + HTBlackHole(), req, NO); + } +} + +/* ** This function closes the connection and frees memory. ** Returns YES on OK, else NO */ @@ -1961,6 +2267,12 @@ HT_FREE(cache->local); HT_FREE(cache); } + + /* if the object was cached, we copy the pertinent HTTP headers + from the anchor object (where they are stored) to the + response object */ + if (status == HT_NOT_MODIFIED) + HTCache_copyHeaders (req); HTNet_delete(net, status); return YES; } @@ -1987,7 +2299,7 @@ ** This is actually state CACHE_BEGIN, but it can't be in the state ** machine as we need the structure first. */ - if (PROT_TRACE) HTTrace("Load Cache.. Looking for `%s\'\n", + HTTRACE(PROT_TRACE, "Load Cache.. Looking for `%s\'\n" _ HTAnchor_physical(anchor)); if ((cache = (cache_info *) HT_CALLOC(1, sizeof(cache_info))) == NULL) HT_OUTOFMEM("HTLoadCACHE"); @@ -2004,8 +2316,8 @@ { cache_info * cache = (cache_info *) param; if (timer != cache->timer) - HTDebugBreak(__FILE__, __LINE__, "File timer %p not in sync\n", timer); - if (PROT_TRACE) HTTrace("HTLoadCache. Continuing %p with timer %p\n", cache, timer); + HTDEBUGBREAK("File timer %p not in sync\n" _ timer); + HTTRACE(PROT_TRACE, "HTLoadCache. Continuing %p with timer %p\n" _ cache _ timer); /* ** Delete the timer @@ -2048,8 +2360,7 @@ case CL_BEGIN: if (HTLib_secure()) { - if (PROT_TRACE) - HTTrace("Load Cache.. No access to local file system\n"); + HTTRACE(PROT_TRACE, "Load Cache.. No access to local file system\n"); cache->state = CL_ERROR; break; } @@ -2065,18 +2376,19 @@ */ { HTHost * host = NULL; - if ((host = HTHost_new(cache->local, 0)) == NULL) return HT_ERROR; + if ((host = HTHost_new("cache", 0)) == NULL) return HT_ERROR; HTNet_setHost(net, host); - if (HTHost_addNet(host, net) == HT_PENDING) - if (PROT_TRACE) HTTrace("HTLoadCache. Pending...\n"); + if (HTHost_addNet(host, net) == HT_PENDING) { + HTTRACE(PROT_TRACE, "HTLoadCache. Pending...\n"); + return HT_OK; + } } cache->state = CL_NEED_BODY; break; case CL_NEED_BODY: if (HT_STAT(cache->local, &cache->stat_info) == -1) { - if (PROT_TRACE) - HTTrace("Load Cache.. Not found `%s\'\n", cache->local); + HTTRACE(PROT_TRACE, "Load Cache.. Not found `%s\'\n" _ cache->local); HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTLoadCache"); cache->state = CL_ERROR; @@ -2095,7 +2407,7 @@ break; case CL_NEED_OPEN_FILE: - status = HTFileOpen(net, cache->local, HT_FT_RDONLY); + status = HTFileOpen(net, cache->local, HT_FB_RDONLY); if (status == HT_OK) { /* ** Create the stream pipe FROM the channel to the application. @@ -2125,10 +2437,10 @@ if (HTEvent_isCallbacksRegistered()) { if (!HTRequest_preemptive(request)) { if (!HTNet_preemptive(net)) { - if (PROT_TRACE) HTTrace("HTLoadCache. Returning\n"); + HTTRACE(PROT_TRACE, "HTLoadCache. Returning\n"); HTHost_register(HTNet_host(net), net, HTEvent_READ); } else if (!cache->timer) { - if (PROT_TRACE) HTTrace("HTLoadCache. Returning\n"); + HTTRACE(PROT_TRACE, "HTLoadCache. Returning\n"); cache->timer = HTTimer_new(NULL, ReturnEvent, cache, 1, YES, NO); } return HT_OK; diff -Naur xdvik-22.40l/libs/libwww/HTCache.h xdvik-22.40n/libs/libwww/HTCache.h --- xdvik-22.40l/libs/libwww/HTCache.h Wed Apr 18 14:23:12 2001 +++ xdvik-22.40n/libs/libwww/HTCache.h Fri Sep 13 00:23:45 2002 @@ -35,15 +35,28 @@ Initialize and Terminate the Persistent Cache . -If `cache_root' is NULL then use HT_CACHE_ROOT -which by default is set to "/tmp/w3c-lib". The -cache_root location does not have to exist, it will be created -automatically if not. An empty string will make '/' as cache root. The size -is the total size in MBytes - the default size is 20M. The cache can not -be less than 5M. We can only enable the cache if we are in -secure mode where we can not access the local -file system. This is for example the case if using an application as -a telnet shell. +The cache_root is the URI of the location of the persistent +cache. An example is "file:/tmp/w3c-lib". If +cache_root is NULL then determine a cache root +using the following algorithm: + + o + Look for any environment variables (if supported) in the following order: + WWW_CACHE, TMP, and TEMP. If none + are set then then fall back on "/tmp". + o + Append the folder name "w3c-cache" to the root identified above + + +The cache_root location does not have to exist, it will be created +automatically if not. An empty string will make '/' the cache root. + +The size is the total size in MBytes - the default size is 20M. The cache +can not be less than 5M. + +We can only enable the cache if we are in secure +mode where we can not access the local file system. This is for example +the case if using an application as a telnet shell. */ extern BOOL HTCacheInit (const char * cache_root, int size); @@ -61,7 +74,7 @@ Cache Mode Parameters . -The persistent cache has a set of overall parameters  that you can adust +The persistent cache has a set of overall parameters that you can adjust ( Enable and Disable the Cache ) @@ -75,15 +88,25 @@ extern BOOL HTCacheMode_enabled (void); /* + +The cache can be setup to whether cache password protected documents thru the +protected flag. By default this flag is turned off. +*/ + +extern void HTCacheMode_setProtected (BOOL mode); +extern BOOL HTCacheMode_protected (void); + +/* ( What is the current Cache Root? ) Return the value of the cache root. The cache root can only be set through -the HTCacheInit() function +the HTCacheInit() function. The string returned MUST be freed +by the caller */ -extern const char * HTCacheMode_getRoot (void); +extern char * HTCacheMode_getRoot (void); /* ( @@ -105,11 +128,10 @@ Max Size of a Single Cache Entry ) -It is also possible to control the max size of a single cache entry so -that the cache doesn't get filled with a very few, very large cached -entries. The default max size for a single cached entry is 3M. The -value indicated must be in Mbytes, for example, a vaue of 3 would mean -3 MBytes. +It is also possible to control the max size of a single cache entry so that +the cache doesn't get filled with a very few, very large cached entries. +The default max size for a single cached entry is 3M. The value indicated +must be in Mbytes, for example, a vaue of 3 would mean 3 MBytes. */ extern BOOL HTCacheMode_setMaxCacheEntrySize (int size); @@ -117,6 +139,19 @@ /* ( + Default expiration time of cache entries +) + +If a response does not arrive with an expiration time and does not +explicitly forbid its being cached, use the default expiration time. The +time is given in seconds (e.g., 3,600 is one hour). +*/ + +extern void HTCacheMode_setDefaultExpiration (const int exp_time); +extern int HTCacheMode_DefaultExpiration (void); + +/* +( How do we handle Expiration of Cached Objects? ) @@ -143,13 +178,22 @@ ) The cache can be set to handle disconnected operation where it does not use -the network to validate entries and do not attempt to load new versions. +the network to validate entries and do not attempt to load new documents. All requests that can not be fulfilled by the cache will be returned with a "504 Gateway Timeout" response. There are two modes of how -the cache can operate in disconnected mode: it can use diconnected mode on -its own persistent cache or it can forward the disconnected request to a -proxy cache, for example. The latter mode only really makes sense when you -are using a proxy, of course. +the cache can operate in disconnected mode: + + + No network activity at all + + Here is uses its own persistent cache + + Forward all disconnected requests to a proxy cache + + Here it uses the HTTP/1.1 cache-control to indicate that the proxy should + operate in disconnected mode. This mode only really makes sense when you + are using a proxy, of course. + */ typedef enum _HTDisconnectedMode { @@ -243,6 +287,14 @@ HTResponse * response); /* + +Clear a cache entry +*/ + +extern BOOL HTCache_resetMeta (HTCache * cache, HTRequest * request, + HTResponse * response); + +/* ( Check Cached Entry ) @@ -315,7 +367,7 @@ this. */ -extern HTCache * HTCache_find (HTParentAnchor * anchor); +extern HTCache * HTCache_find (HTParentAnchor * anchor, char * default_name); /* ( @@ -383,6 +435,6 @@ - @(#) $Id: HTCache.h,v 1.1.1.1 2001/04/18 14:23:12 stefanulrich Exp $ + @(#) $Id: HTCache.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTChannl.c xdvik-22.40n/libs/libwww/HTChannl.c --- xdvik-22.40l/libs/libwww/HTChannl.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTChannl.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTChannl.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTChannl.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** ** HISTORY: @@ -23,8 +23,7 @@ #include "HTChannl.h" /* Implemented here */ -#define HASH_SIZE 67 -#define HASH(s) ((s) % HASH_SIZE) +#define HASH(s) ((s) % (HT_M_HASH_SIZE)) struct _HTInputStream { const HTInputStreamClass * isa; @@ -131,19 +130,16 @@ /* Close the socket */ if (ch->sockfd != INVSOC) { - HTEvent_unregister(ch->sockfd, HTEvent_ALL); NETCLOSE(ch->sockfd); HTNet_decreaseSocket(); - if (PROT_TRACE) - HTTrace("Channel..... Deleted %p, socket %d\n", ch,ch->sockfd); + HTTRACE(PROT_TRACE, "Channel..... Deleted %p, socket %d\n" _ ch _ ch->sockfd); ch->sockfd = INVSOC; } /* Close the file */ if (ch->fp) { fclose(ch->fp); - if (PROT_TRACE) - HTTrace("Channel..... Deleted %p, file %p\n", ch, ch->fp); + HTTRACE(PROT_TRACE, "Channel..... Deleted %p, file %p\n" _ ch _ ch->fp); ch->fp = NULL; } HT_FREE(ch); @@ -163,9 +159,9 @@ HTList * list = NULL; HTChannel * ch = NULL; int hash = sockfd < 0 ? 0 : HASH(sockfd); - if (PROT_TRACE) HTTrace("Channel..... Hash value is %d\n", hash); + HTTRACE(PROT_TRACE, "Channel..... Hash value is %d\n" _ hash); if (!channels) { - if (!(channels = (HTList **) HT_CALLOC(HASH_SIZE,sizeof(HTList*)))) + if (!(channels = (HTList **) HT_CALLOC(HT_M_HASH_SIZE,sizeof(HTList*)))) HT_OUTOFMEM("HTChannel_new"); } if (!channels[hash]) channels[hash] = HTList_new(); @@ -194,7 +190,7 @@ } #endif /* HT_MUX */ - if (PROT_TRACE) HTTrace("Channel..... Added %p to list %p\n", ch,list); + HTTRACE(PROT_TRACE, "Channel..... Added %p to list %p\n" _ ch _ list); return ch; } @@ -225,28 +221,16 @@ PUBLIC BOOL HTChannel_delete (HTChannel * channel, int status) { if (channel) { - if (PROT_TRACE) HTTrace("Channel..... Delete %p with semaphore %d\n", - channel, channel->semaphore); + HTTRACE(PROT_TRACE, "Channel..... Delete %p with semaphore %d, status %d\n" _ + channel _ channel->semaphore _ status); /* ** We call the free methods on both the input stream and the output ** stream so that we can free up the stream pipes. However, note that ** this doesn't mean that we close the input stream and output stream ** them selves - only the generic streams */ - if (status != HT_IGNORE) { - if (channel->input) { - if (status==HT_INTERRUPTED || status==HT_TIMEOUT) - (*channel->input->isa->abort)(channel->input, NULL); - else - (*channel->input->isa->_free)(channel->input); - } - if (channel->output) { - if (status==HT_INTERRUPTED || status==HT_TIMEOUT) - (*channel->output->isa->abort)(channel->output, NULL); - else - (*channel->output->isa->_free)(channel->output); - } - } + HTChannel_deleteInput(channel, status); + HTChannel_deleteOutput(channel, status); /* ** Check whether this channel is used by other objects or we can @@ -276,7 +260,7 @@ if (channels) { HTList * cur; int cnt; - for (cnt=0; cntsockfd : INVSOC; } -PUBLIC BOOL HTChannel_setSocket (HTChannel * channel, SOCKET socket) +PUBLIC BOOL HTChannel_setSocket (HTChannel * channel, SOCKET sockfd) { if (channel) { - channel->sockfd = socket; - return YES; + + /* + ** As we use the socket number as the hash entry then we have to + ** update the hash table as well. + */ + int old_hash = HASH(channel->sockfd); + int new_hash = sockfd < 0 ? 0 : HASH(sockfd); + HTList * list = channels[old_hash]; + if (list) HTList_removeObject(list, channel); + if (!channels[new_hash]) channels[new_hash] = HTList_new(); + list = channels[new_hash]; + HTList_addObject(list, channel); + + channel->sockfd = sockfd; + return YES; } return NO; } @@ -348,9 +371,8 @@ { if (channel) { channel->semaphore++; - if (PROT_TRACE) - HTTrace("Channel..... Semaphore increased to %d for channel %p\n", - channel->semaphore, channel); + HTTRACE(PROT_TRACE, "Channel..... Semaphore increased to %d for channel %p\n" _ + channel->semaphore _ channel); #ifdef HT_MUX HTMuxChannel * muxch = HTMuxChannel_find(me); HTProtocol * protocol = HTNet_protocol(net); @@ -368,9 +390,8 @@ if (channel) { channel->semaphore--; if (channel->semaphore <= 0) channel->semaphore = 0; - if (PROT_TRACE) - HTTrace("Channel..... Semaphore decreased to %d for channel %p\n", - channel->semaphore, channel); + HTTRACE(PROT_TRACE, "Channel..... Semaphore decreased to %d for channel %p\n" _ + channel->semaphore _ channel); } } @@ -382,9 +403,8 @@ if (channel) { channel->semaphore = semaphore; if (channel->semaphore <= 0) channel->semaphore = 0; - if (PROT_TRACE) - HTTrace("Channel..... Semaphore set to %d for channel %p\n", - channel->semaphore, channel); + HTTRACE(PROT_TRACE, "Channel..... Semaphore set to %d for channel %p\n" _ + channel->semaphore _ channel); } } @@ -406,6 +426,21 @@ return ch ? ch->input : NULL; } +PUBLIC BOOL HTChannel_deleteInput (HTChannel * channel, int status) +{ + if (channel && channel->input && status != HT_IGNORE) { + HTTRACE(PROT_TRACE, + "Channel..... Delete input stream %p from channel %p\n" _ + channel->input _ channel); + if (status==HT_INTERRUPTED || status==HT_TIMEOUT) + (*channel->input->isa->abort)(channel->input, NULL); + else + (*channel->input->isa->_free)(channel->input); + return YES; + } + return NO; +} + /* ** Create the output stream and bind it to the channel ** Please read the description in the HTIOStream module on the parameters @@ -422,6 +457,21 @@ PUBLIC HTOutputStream * HTChannel_output (HTChannel * ch) { return ch ? ch->output : NULL; +} + +PUBLIC BOOL HTChannel_deleteOutput (HTChannel * channel, int status) +{ + if (channel && channel->output && status != HT_IGNORE) { + HTTRACE(PROT_TRACE, + "Channel..... Delete input stream %p from channel %p\n" _ + channel->input _ channel); + if (status==HT_INTERRUPTED || status==HT_TIMEOUT) + (*channel->output->isa->abort)(channel->output, NULL); + else + (*channel->output->isa->_free)(channel->output); + return YES; + } + return NO; } PUBLIC HTInputStream * HTChannel_getChannelIStream (HTChannel * ch) diff -Naur xdvik-22.40l/libs/libwww/HTChannl.h xdvik-22.40n/libs/libwww/HTChannl.h --- xdvik-22.40l/libs/libwww/HTChannl.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTChannl.h Fri Sep 13 00:23:45 2002 @@ -69,6 +69,7 @@ extern BOOL HTChannel_delete (HTChannel * channel, int status); extern BOOL HTChannel_deleteAll (void); +extern BOOL HTChannel_safeDeleteAll (void); /* ( @@ -139,9 +140,11 @@ extern BOOL HTChannel_setInput (HTChannel * ch, HTInputStream * input); extern HTInputStream * HTChannel_input (HTChannel * ch); +extern BOOL HTChannel_deleteInput (HTChannel * channel, int status); extern BOOL HTChannel_setOutput (HTChannel * ch, HTOutputStream * output); extern HTOutputStream * HTChannel_output (HTChannel * ch); +extern BOOL HTChannel_deleteOutput (HTChannel * channel, int status); extern HTInputStream * HTChannel_getChannelIStream (HTChannel * ch); extern HTOutputStream * HTChannel_getChannelOStream (HTChannel * ch); @@ -155,6 +158,6 @@ - @(#) $Id: HTChannl.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ + @(#) $Id: HTChannl.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTChunk.c xdvik-22.40n/libs/libwww/HTChunk.c --- xdvik-22.40l/libs/libwww/HTChunk.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTChunk.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTChunk.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTChunk.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** history: AL, HF 28 Apr 94, Now chunk->data is filled by '\0' so ** that the string is terminated at any time. That makes @@ -17,6 +17,15 @@ #include "HTUtils.h" #include "HTChunk.h" /* Implemented here */ +struct _HTChunk { + int size; /* In bytes */ + int growby; /* Allocation unit in bytes */ + int allocated; /* Current size of *data */ + char * data; /* Pointer to malloced area or 0 */ +}; + +/* --------------------------------------------------------------------------*/ + /* Create a chunk with a certain allocation unit ** -------------- */ @@ -55,6 +64,44 @@ } } +PUBLIC char * HTChunk_data (HTChunk * ch) +{ + return ch ? ch->data : NULL; +} + +PUBLIC int HTChunk_size (HTChunk * ch) +{ + return ch ? ch->size : -1; +} + +PUBLIC BOOL HTChunk_truncate (HTChunk * ch, int length) +{ + if (ch && length >= 0 && length < ch->size) { + memset(ch->data+length, '\0', ch->size-length); + ch->size = length; + return YES; + } + return NO; +} + +/* Set the "size" of the Chunk's data +** ----------------------------------- +** The actual allocated length must be at least 1 byte longer to hold the +** mandatory null terminator. +*/ +PUBLIC BOOL HTChunk_setSize (HTChunk * ch, int length) +{ + if (ch && length >= 0) { + if (length < ch->size) + memset(ch->data+length, '\0', ch->size-length); + else if (length >= ch->allocated) + HTChunk_ensure(ch, length - ch->size); + ch->size = length; + return YES; + } + return NO; +} + /* Create a chunk from an allocated string ** --------------------------------------- */ @@ -70,6 +117,22 @@ return ch; } +/* Create a chunk from an allocated buffer +** --------------------------------------- +*/ +PUBLIC HTChunk * HTChunk_fromBuffer (char * buf, int buflen, int size, int grow) +{ + HTChunk * ch; + ch = HTChunk_new(grow); + if (buf) { + ch->data = buf; + ch->size = ch->allocated = buflen; + if (size < buflen) + HTChunk_setSize(ch, size); /* This ensures the end is 0-filled */ + } + return ch; +} + /* Free a chunk but keep the data ** ------------------------------ */ @@ -136,23 +199,27 @@ } } +PUBLIC void HTChunk_terminate (HTChunk * ch) +{ + HTChunk_putc(ch, '\0'); +} /* Ensure a certain size ** --------------------- */ PUBLIC void HTChunk_ensure (HTChunk * ch, int len) { - if (ch && len) { + if (ch && len > 0) { int needed = ch->size+len; if (needed >= ch->allocated) { ch->allocated = needed - needed%ch->growby + ch->growby; if (ch->data) { if ((ch->data = (char *) HT_REALLOC(ch->data, ch->allocated)) == NULL) - HT_OUTOFMEM("HTChunk_putb"); + HT_OUTOFMEM("HTChunk_ensure"); memset((void *) (ch->data + ch->size), '\0', ch->allocated-ch->size); } else { if ((ch->data = (char *) HT_CALLOC(1, ch->allocated)) == NULL) - HT_OUTOFMEM("ch->data "); + HT_OUTOFMEM("HTChunk_ensure"); } } } diff -Naur xdvik-22.40l/libs/libwww/HTChunk.h xdvik-22.40n/libs/libwww/HTChunk.h --- xdvik-22.40l/libs/libwww/HTChunk.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTChunk.h Fri Sep 13 00:23:45 2002 @@ -1,6 +1,6 @@ /* - + W3C Sample Code Library libwww Chunk Class @@ -16,10 +16,10 @@ /* -The Chunk Class  defines a way to automatically handle dynamic strings -and other data types. You create a chunk with an initial size and it will -then automatically grow to accomodate added data to the chunk. It is a general -utility module. It is garanteed that the array is '\0' terminated +The Chunk Class defines a way to automatically handle dynamic strings and +other data types. You create a chunk with an initial size and it will then +automatically grow to accommodate added data to the chunk. It is a general +utility module. It is guaranteed that the array is '\0' terminated at all times (and hence is a valid C type string). The method HTChunkTerminate can be used to explicitly add a terminating '\0' and then to include this character in @@ -37,23 +37,6 @@ #ifndef HTCHUNK_H #define HTCHUNK_H - -/* -. - The Chunk Class -. - -This structure should not be referenced outside this module! We only keep -it here to maintain high performance. Don't use it directly! -*/ - -typedef struct { - int size; /* In bytes */ - int growby; /* Allocation unit in bytes */ - int allocated; /* Current size of *data */ - char * data; /* Pointer to malloced area or 0 */ -} HTChunk; - /* . Create new chunk @@ -64,7 +47,8 @@ vs. memory */ -#define HTChunkCreate(growby) HTChunk_new(growby) +typedef struct _HTChunk HTChunk; + extern HTChunk * HTChunk_new (int growby); /* @@ -72,10 +56,9 @@ Free a chunk . -Free a chunk created by HTChunkCreatefrom memory +Free a chunk created by HTChunk_newfrom memory */ -#define HTChunkFree(ch) HTChunk_delete(ch) extern void HTChunk_delete (HTChunk * ch); /* @@ -85,10 +68,12 @@ Keep the chunk in memory but clear all data kept inside. This can be used if you know that you can reuse the allocated memory instead of allocating -new memory. +new memory. This zeros out all the allocated data (even data past the +indicated size) and sets the size of the chunk to 0. If you have not used +any bytes past the indicated size, it is more efficient to truncate the +chunk to 0 instead. */ -#define HTChunkClear(ch) HTChunk_clear(ch) extern void HTChunk_clear (HTChunk * ch); /* @@ -96,13 +81,14 @@ Ensure a Chunk has a Certain Amount of Free Space . -Make sure that a chunk has a certain size. If this is not the case then the -chunk is expanded. Nothing is done if the current size if bigger than the -size requested. +Make sure that a chunk has enough memory allocated to grow by the +indicated extra size. If this is not the case, then the chunk is expanded +(in multiples of the chunk's "growby" size). Nothing is done if the +current size plus the requested extra space fits within the chunk's +currently allocated memory. */ -#define HTChunkEnsure(ch, s) HTChunk_ensure(ch, s) -extern void HTChunk_ensure (HTChunk * ch, int s); +extern void HTChunk_ensure (HTChunk * ch, int extra_size); /* . @@ -112,7 +98,6 @@ Add the character and increment the size of the chunk by one character */ -#define HTChunkPutc(ch, c) HTChunk_putc(ch, c) extern void HTChunk_putc (HTChunk * ch, char c); /* @@ -124,7 +109,6 @@ (without the trailing zero) */ -#define HTChunkPuts(ch, str) HTChunk_puts(ch, str) extern void HTChunk_puts (HTChunk * ch, const char *str); /* @@ -140,6 +124,44 @@ /* . + Return Pointer to Data +. + +This define converts a chunk to a normal char pointer so that it can be parsed +to any ANSI C string function. +*/ + +extern char * HTChunk_data (HTChunk * ch); + +/* +. + Return Current Size +. + +Returns the current size of the chunk +*/ + +extern int HTChunk_size (HTChunk * ch); + +/* +. + Setting the Size of a Chunk +. + +If you want to cut off a piece of a chunk or extend it to make room +for some direct buffer manipulation, then you can use one of these +functions. Both of these calls set the size of the chunk to be +size, but the truncate call only allows you to make the +string shorter. If the string is made shorter, the formerly-used bytes +are cleared, so truncating a chunk to 0 is analogous to clearing it, +but slightly more efficient. +*/ + +extern BOOL HTChunk_truncate (HTChunk * ch, int size); +extern BOOL HTChunk_setSize (HTChunk * ch, int size); + +/* +. Zero Terminate a chunk . @@ -149,45 +171,56 @@ increment the size counter with one corresponding to the zero. */ -#define HTChunkTerminate(ch) HTChunk_terminate(ch) -#define HTChunk_terminate(ch) HTChunk_putc((ch), '\0') +extern void HTChunk_terminate (HTChunk * ch); /* . - Return Pointer to Data + CString Conversions . -This define converts a chunk to a normal char pointer so that it can be parsed -to any ANSI C string function. +A Chunk may be built from an allocated string. The chunk assumes control +of the passed string, eliminating the need for additional allocations and +string copies. +When you take control of the CString from a chunk, the chunk is destroyed. */ -#define HTChunkData(me) ((me) ? (me)->data : NULL) -#define HTChunk_data(me) ((me) ? (me)->data : NULL) +extern HTChunk * HTChunk_fromCString (char * str, int grow); +extern char * HTChunk_toCString (HTChunk * ch); /* . - CString conversions + Creating a Chunk from an allocated buffer . -A Chunk may be build from an allocated string. The chunk assumes control -of the passes string, elminating the need for additional allocations and -string copies. -Once a string is built, the chunk may be destroyed and the string kept around. +A Chunk may be built from an allocted buffer. You must specify how much +memory is allocated in the buffer (buflen) and what the size the new +Chunk should be (size). All memory between size and buflen is zeroed. +Note that is is legal to specify a size equal to the buflen if you don't +expect the Chunk to be null terminated. The chunk takes control of the +memory, and will free it when the Chunk is destroyed. Note that in order +to avoid conflicts, the buffer's memory should be allocated using +libwww's dedicated functions. */ -extern HTChunk * HTChunk_fromCString (char * str, int grow); -extern char * HTChunk_toCString (HTChunk * ch); +extern HTChunk * HTChunk_fromBuffer (char * buf, int buflen, int size, int grow); /* . - Return Current Size + Old Interface Names . -Returns the current size of the chunk +Don't use these in new applications */ -#define HTChunkSize(me) ((me) ? (me)->size : -1) -#define HTChunk_size(me) ((me) ? (me)->size : -1) +#define HTChunkCreate(growby) HTChunk_new(growby) +#define HTChunkFree(ch) HTChunk_delete(ch) +#define HTChunkClear(ch) HTChunk_clear(ch) +#define HTChunkEnsure(ch, s) HTChunk_ensure((ch), (s)) +#define HTChunkPutc(ch, c) HTChunk_putc((ch), (c)) +#define HTChunkPuts(ch, str) HTChunk_puts((ch), (str)) +#define HTChunkTerminate(ch) HTChunk_terminate(ch) +#define HTChunkData(ch) HTChunk_data(ch) +#define HTChunkSize(ch) HTChunk_size(ch) /* */ @@ -198,6 +231,6 @@ - @(#) $Id: HTChunk.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ + @(#) $Id: HTChunk.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTConLen.c xdvik-22.40n/libs/libwww/HTConLen.c --- xdvik-22.40l/libs/libwww/HTConLen.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTConLen.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTConLen.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTConLen.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This stream counts the number of bytes in a stream until it reaches ** max number of bytes it can occupy. If this happens then it gives up. @@ -115,8 +115,7 @@ PRIVATE BOOL alloc_new (HTStream * me, int size) { if (me->conlen >= me->max_size) { - if (STREAM_TRACE) - HTTrace("Buffer...... size %d reached, going transparent\n", + HTTRACE(STREAM_TRACE, "Buffer...... size %d reached, going transparent\n" _ me->max_size); return NO; } else if (size) { @@ -124,8 +123,7 @@ me->tmp_max = size; if ((me->tmp_buf = (char *) HT_MALLOC(size)) == NULL) HT_OUTOFMEM("buf_put_char"); - if (STREAM_TRACE) - HTTrace("Buffer...... created with len %d\n", size); + HTTRACE(STREAM_TRACE, "Buffer...... created with len %d\n" _ size); return YES; } return NO; @@ -151,7 +149,7 @@ } /* If we are not a pipe then do no more buffering */ - if (!(me->mode & HT_BM_PIPE)) me->state = HT_BS_TRANSPARENT; + if ((me->mode & HT_BM_PIPE)) me->state = HT_BS_TRANSPARENT; } return (*me->target->isa->flush)(me->target); } @@ -207,7 +205,7 @@ } else if (me->mode & HT_BM_DELAY) { /* Buffer ran full and we pause */ me->state = HT_BS_PAUSE; - if (STREAM_TRACE) HTTrace("Buffer....... Paused\n"); + HTTRACE(STREAM_TRACE, "Buffer....... Paused\n"); return HT_PAUSE; } else { /* Buffer ran full and we flush and go transparent */ @@ -245,7 +243,7 @@ ** then we don't free it. */ if (me->mode & HT_BM_PIPE && me->state != HT_BS_TRANSPARENT) { - if (STREAM_TRACE) HTTrace("PipeBuffer Waiting to be flushed\n"); + HTTRACE(STREAM_TRACE, "PipeBuffer Waiting to be flushed\n"); return HT_OK; } @@ -255,8 +253,7 @@ */ if (me->mode & HT_BM_COUNT && me->request) { HTParentAnchor * anchor = HTRequest_anchor(me->request); - if (STREAM_TRACE) - HTTrace("Buffer........ Calculated content-length: %d\n", me->conlen); + HTTRACE(STREAM_TRACE, "Buffer........ Calculated content-length: %d\n" _ me->conlen); HTAnchor_setLength(anchor, me->conlen); } @@ -280,7 +277,7 @@ if (me->target) (*me->target->isa->abort)(me->target,e); free_buf_all(me); HT_FREE(me); - if (PROT_TRACE) HTTrace("Buffer...... ABORTING...\n"); + HTTRACE(PROT_TRACE, "Buffer...... ABORTING...\n"); return HT_ERROR; } @@ -306,7 +303,7 @@ me->request = request; me->max_size = (max_size > 0) ? max_size : HT_MAX_SIZE; me->mode = HT_BM_PLAIN; - if (STREAM_TRACE) HTTrace("Buffer...... Created with size %d\n", me->max_size); + HTTRACE(STREAM_TRACE, "Buffer...... Created with size %d\n" _ me->max_size); return me; } diff -Naur xdvik-22.40l/libs/libwww/HTConLen.h xdvik-22.40n/libs/libwww/HTConLen.h --- xdvik-22.40l/libs/libwww/HTConLen.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTConLen.h Fri Sep 13 00:23:45 2002 @@ -105,6 +105,6 @@ - @(#) $Id: HTConLen.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ + @(#) $Id: HTConLen.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTCookie.c xdvik-22.40n/libs/libwww/HTCookie.c --- xdvik-22.40l/libs/libwww/HTCookie.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTCookie.c Fri Sep 13 00:23:45 2002 @@ -0,0 +1,458 @@ +/* +** SIMPLE HTTP COOKIE FILTER HANDLER +** +** (c) COPYRIGHT MIT 1999. +** Please first read the full copyright statement in the file COPYRIGH. +** @(#) $Id: HTCookie.c,v 1.1.2.1 2002/09/13 00:23:45 stefanulrich Exp $ +** +** Written based on Jim Raven's code sent to the list +** +** History: +** JR: Sent code to the list +** HFN: Made a libwww module +** +*/ + +/* Library include files */ +#include "wwwsys.h" +#include "WWWUtil.h" +#include "WWWCore.h" +#include "WWWHTTP.h" +#include "WWWMIME.h" +#include "HTCookie.h" /* Implemented here */ + +/* Interface to persistent cookie jar */ +PRIVATE HTCookieSetCallback * SetCookie = NULL; +PRIVATE void * SetCookieContext = NULL; + +PRIVATE HTCookieFindCallback * FindCookie = NULL; +PRIVATE void * FindCookieContext = NULL; + +/* Are cookies enabled */ +PRIVATE BOOL baking_cookies = NO; + +/* Our cookies */ +struct _HTCookie { + char * name; + char * value; + char * domain; + char * path; + time_t expiration; + BOOL secure; +}; + +/* Hold all cookies found for a single request */ +typedef struct _HTCookieHolder { + HTRequest * request; + HTList * cookies; +} HTCookieHolder; + +/* List of current cookie holders */ +PRIVATE HTList * cookie_holder = NULL; + +/* What should we do with cookies? */ +PRIVATE HTCookieMode CookieMode = HT_COOKIE_PROMPT | HT_COOKIE_ACCEPT | HT_COOKIE_SEND; + +/* ------------------------------------------------------------------------- */ + +PRIVATE HTCookie * HTCookie_new (void) +{ + HTCookie * me = NULL; + if ((me = (HTCookie *) HT_CALLOC(1, sizeof(HTCookie))) == NULL) + HT_OUTOFMEM("HTCookie_new"); + return me; +} + +PRIVATE BOOL HTCookie_delete (HTCookie * me) +{ + if (me) { + HT_FREE(me->name); + HT_FREE(me->value); + HT_FREE(me->domain); + HT_FREE(me->path); + HT_FREE(me); + return YES; + } + return NO; +} + +PUBLIC BOOL HTCookie_setName (HTCookie * me, const char * name) +{ + if (me && name) { + me->name = StrAllocCopy(me->name, name); + return YES; + } + return NO; +} + +PUBLIC char * HTCookie_name (HTCookie * me) +{ + return me ? me->name : NULL; +} + +PUBLIC BOOL HTCookie_setValue (HTCookie * me, const char * value) +{ + if (me && value) { + me->value = StrAllocCopy(me->value, value); + return YES; + } + return NO; +} + +PUBLIC char * HTCookie_value (HTCookie * me) +{ + return me ? me->value : NULL; +} + +PUBLIC BOOL HTCookie_setDomain (HTCookie * me, const char * domain) +{ + if (me && domain) { + me->domain = StrAllocCopy(me->domain, domain); + return YES; + } + return NO; +} + +PUBLIC char * HTCookie_domain (HTCookie * me) +{ + return me ? me->domain : NULL; +} + +PUBLIC BOOL HTCookie_setPath (HTCookie * me, const char * path) +{ + if (me && path) { + me->path = StrAllocCopy(me->path, path); + return YES; + } + return NO; +} + +PUBLIC char * HTCookie_path (HTCookie * me) +{ + return me ? me->path : NULL; +} + +PUBLIC time_t HTCookie_setExpiration (HTCookie * me, time_t expiration) +{ + if (me) { + me->expiration = expiration; + return YES; + } + return NO; +} + +PUBLIC time_t HTCookie_expiration (HTCookie * me) +{ + return me ? me->expiration : -1; +} + +PUBLIC time_t HTCookie_setSecure (HTCookie * me, BOOL secure) +{ + if (me) { + me->secure = secure; + return YES; + } + return NO; +} + +PUBLIC BOOL HTCookie_isSecure (HTCookie * me) +{ + return me ? me->secure : NO; +} + +/* ------------------------------------------------------------------------- */ + +PRIVATE BOOL HTCookieHolder_addCookie (HTRequest * request, HTCookie * cookie) +{ + if (request && cookie) { + HTList * cur = cookie_holder; + HTCookieHolder * pres = NULL; + + /* Make sure that we have a cookie holder list */ + if (!cookie_holder) cookie_holder = HTList_new(); + + /* See if we already have a cookie holder for this request */ + while ((pres = (HTCookieHolder *) HTList_nextObject(cur))) { + if (pres->request == request) break; + } + + /* If found then use existing cookie holder, otherwise create new one */ + if (!pres) { + if ((pres = (HTCookieHolder *) HT_CALLOC(1, sizeof(HTCookieHolder))) == NULL) + HT_OUTOFMEM("HTCookieHolder_newCookie"); + pres->request = request; + pres->cookies = HTList_new(); + + /* Add to cookie holder list */ + HTList_addObject(cookie_holder, pres); + } + + /* Now add the cookie */ + HTList_addObject(pres->cookies, cookie); + + return YES; + } + return NO; +} + +PRIVATE HTCookieHolder * HTCookieHolder_find (HTRequest * request) +{ + if (request) { + HTList * cur = cookie_holder; + HTCookieHolder * pres = NULL; + while ((pres = (HTCookieHolder *) HTList_nextObject(cur))) { + if (pres->request == request) return pres; + } + } + return NULL; +} + +PRIVATE BOOL HTCookieHolder_delete (HTCookieHolder * me) +{ + if (me) { + if (me->cookies) { + HTList * cookies = me->cookies; + HTCookie * cookie; + while ((cookie = (HTCookie *) HTList_nextObject(cookies))) + HTCookie_delete(cookie); + HTList_delete(me->cookies); + } + HTList_removeObject(cookie_holder, me); + HT_FREE(me); + return YES; + } + return NO; +} + +PRIVATE BOOL HTCookieHolder_deleteAll (void) +{ + if (cookie_holder) { + HTList * cur = cookie_holder; + HTCookieHolder * pres = NULL; + while ((pres = (HTCookieHolder *) HTList_nextObject(cur))) { + HTCookieHolder_delete(pres); + } + HTList_delete(cookie_holder); + cookie_holder = NULL; + return YES; + } + return NO; +} + +/* ------------------------------------------------------------------------- */ + +/* +** MIME header parser for the Set-Cookie header field. We parse the cookies +** and create HTCookie objects and store them in the cookie holder so that +** the cookie after filter can deal with them accordingly. +*/ +PRIVATE int HTCookie_parseSetCookie (HTRequest * request, HTResponse * response, + char * token, char * value) + +{ + char * cookie_name = HTNextField(&value); + char * cookie_value = HTNextField(&value); + if (cookie_name && *cookie_name && cookie_value) { + HTCookie * cookie = HTCookie_new(); + char * param_pair; + + HTCookie_setName(cookie, cookie_name); + HTCookie_setValue(cookie, cookie_value); + + /* Add the cookie to our holder */ + HTCookieHolder_addCookie(request, cookie); + + /* Parse cookie parameters */ + while ((param_pair = HTNextParam(&value))) { + char * tok = HTNextField(¶m_pair); + char * val = param_pair; + if (tok) { + if (!strcasecomp(tok, "expires") && val && *val) { + HTTRACE(STREAM_TRACE, "Cookie...... Expires `%s\'\n" _ val); + HTCookie_setExpiration(cookie, HTParseTime(val, NULL, YES)); + } else if (!strcasecomp(tok, "domain") && val && *val) { + HTTRACE(STREAM_TRACE, "Cookie...... Domain `%s\'\n" _ val); + HTCookie_setDomain(cookie, val); + } else if (!strcasecomp(tok, "path") && val && *val) { + HTTRACE(STREAM_TRACE, "Cookie...... Path `%s\'\n" _ val); + HTCookie_setPath(cookie, val); + } else if (!strcasecomp(tok, "secure")) { + HTTRACE(STREAM_TRACE, "Cookie...... Secure `%s\'\n" _ val); + HTCookie_setSecure(cookie, YES); + } else + HTTRACE(STREAM_TRACE, "Cookie...... Unknown `%s\' with value `%s\'\n" _ + tok _ val ? val : ""); + } + } + } + return HT_OK; +} + +/* +** Check whether the application provides us with a cookie or more. +*/ +PRIVATE int HTCookie_beforeFilter (HTRequest * request, void * param, int mode) +{ + if ((CookieMode & HT_COOKIE_SEND) && FindCookie) { + HTAssocList * cookies = (*FindCookie)(request, FindCookieContext); + if (cookies) { + HTChunk * cookie_header = HTChunk_new(64); + HTAssocList * cur = cookies; + HTAssoc * pres; + BOOL first=YES; + while ((pres = (HTAssoc *) HTAssocList_nextObject(cur))) { + if (!first) HTChunk_putc(cookie_header, ';'); + HTChunk_puts(cookie_header, HTAssoc_name(pres)); + HTChunk_putc(cookie_header, '='); + HTChunk_puts(cookie_header, HTAssoc_value(pres)); + first = NO; + } + HTRequest_addExtraHeader(request, "Cookie", HTChunk_data(cookie_header)); + HTChunk_delete(cookie_header); + + /* Also delete the association list */ + HTAssocList_delete(cookies); + } + } + return HT_OK; +} + +/* +** Check the response to see if we got a cookie or more. +** If so then figure out what to do with it (prompt user, store, etc.) +*/ +PRIVATE int HTCookie_afterFilter (HTRequest * request, HTResponse * response, + void * param, int status) +{ + if ((CookieMode & HT_COOKIE_ACCEPT) && SetCookie) { + HTCookieHolder * holder = HTCookieHolder_find(request); + if (holder) { + HTList * cookies = holder->cookies; + HTCookie * pres; + while ((pres = (HTCookie *) HTAssocList_nextObject(cookies))) { + + /* Should we check to see if hosts match? */ + if (CookieMode & (HT_COOKIE_SAME_HOST|HT_COOKIE_SAME_DOMAIN)) { + char * cookie_host = HTCookie_domain(pres); + if (cookie_host) { + int res; + char * addr = HTAnchor_address((HTAnchor *) HTRequest_anchor(request)); + char * host = HTParse(addr, "", PARSE_HOST); + + if (CookieMode & HT_COOKIE_SAME_DOMAIN) + res = tailcasecomp(cookie_host, host); + else + res = strcasecomp(cookie_host, host); + + if (res != 0) { + HTTRACE(APP_TRACE, "Cookie...... Host `%s\' doesn't match what is sent in cookie `%s\'\n" _ host _ cookie_host); + HT_FREE(addr); + continue; + } + HT_FREE(addr); + } + } + + /* Should we prompt the user? */ + if (CookieMode & HT_COOKIE_PROMPT) { + HTAlertCallback * prompt = HTAlert_find(HT_A_CONFIRM); + if (prompt) { + if ((*prompt)(request, HT_A_CONFIRM, HT_MSG_ACCEPT_COOKIE, + NULL, NULL, NULL) != YES) + continue; + } else + continue; + } + + /* Call the application with our new cookie */ + (*SetCookie)(request, pres, SetCookieContext); + } + + /* Delete cookie holder */ + HTCookieHolder_delete(holder); + } + } + return HT_OK; +} + +/* ------------------------------------------------------------------------- */ + +/* +** Start and stop the cookie engine +*/ +PUBLIC BOOL HTCookie_init (void) +{ + if (!baking_cookies) { + + /* Register the SetCookie header parser */ + HTHeader_addParser("Set-Cookie", NO, HTCookie_parseSetCookie); + + /* Register the cookie before and after filters */ + HTNet_addBefore(HTCookie_beforeFilter, "http://*", NULL, HT_FILTER_MIDDLE); + HTNet_addAfter(HTCookie_afterFilter, "http://*", NULL, HT_ALL, HT_FILTER_MIDDLE); + + baking_cookies = YES; + return YES; + } + return NO; +} + +PUBLIC BOOL HTCookie_terminate (void) +{ + /* Unregister Set-Cookie header parser */ + HTHeader_deleteParser("Set-Cookie"); + + /* Unregister the cookie before and after filters */ + HTNet_deleteBefore(HTCookie_beforeFilter); + HTNet_deleteAfter(HTCookie_afterFilter); + + /* Delete all pending cookies */ + HTCookieHolder_deleteAll(); + + baking_cookies = NO; + return YES; +} + +PUBLIC BOOL HTCookie_setCookieMode (HTCookieMode mode) +{ + CookieMode = mode; + return YES; +} + +PUBLIC HTCookieMode HTCookie_cookieMode (void) +{ + return CookieMode; +} + +/* +** Callbacks can be used by the application to set and retrieve cookies +** from a persistent cookie jar as libwww doesn't provide a persistent +** storage for this kind of thing and they probably should be secured +** anyway. +*/ +PUBLIC BOOL HTCookie_setCallbacks (HTCookieSetCallback * setCookie, + void * setCookieContext, + HTCookieFindCallback * findCookie, + void * findCookieContext) +{ + if (setCookie && findCookie) { + HTTRACE(APP_TRACE, "Cookie...... Registering cookie callbacks\n"); + SetCookie = setCookie; + SetCookieContext = setCookieContext; + + FindCookie = findCookie; + FindCookieContext = findCookieContext; + return YES; + } + return NO; +} + +PUBLIC BOOL HTCookie_deleteCallbacks (void) +{ + HTTRACE(APP_TRACE, "Cookie...... Unregistering cookie callbacks\n"); + SetCookie = NULL; + SetCookieContext = NULL; + FindCookie = NULL; + FindCookieContext = NULL; + return YES; +} diff -Naur xdvik-22.40l/libs/libwww/HTCookie.h xdvik-22.40n/libs/libwww/HTCookie.h --- xdvik-22.40l/libs/libwww/HTCookie.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTCookie.h Fri Sep 13 00:23:45 2002 @@ -0,0 +1,180 @@ +/* + + W3C Sample Code Library libwww Simple Cookie Handler + + +! + Simple Cookie Handler +! +*/ + +/* +** (c) COPYRIGHT MIT 1999. +** Please first read the full copyright statement in the file COPYRIGH. +*/ + +/* + +This module provides a simple +HTTP Cookie +handling mechanism. It really also is an excersize in showing how libwww +can be extended with something like cookies in a modular manner. An important +thing to note about this implementation is that it does not provide +storage for cookies - this is left to the application as normally cookies +have to be kept under lock. + +This module is implemented by HTCookie.c, and it +is a part of the W3C Sample Code +Library. +*/ + +#ifndef HTCOOKIE_H +#define HTCOOKIE_H +#include "WWWLib.h" + +/* +. + Initiate and Terminate Cookie Handling +. + +In order to start handling cookies, you need to initiate the module. Likewise, +when you are done, you must terminate the module in order to clean up memory +etc. Note that this cookie handler doesn't provide storage room for cookies +- the application MUST do that by registering cookie +callbacks. Initiation does three things: + + o + Register a MIME header parser to parse the Set-Cookie + header field + o + Register a BEFORE filter to see if a cookie should + be added to the request (uses the "set" callback) + o + Register an AFTER filter to handle new cookies (uses + the "find" callback) + +*/ + +extern BOOL HTCookie_init (void); +extern BOOL HTCookie_terminate (void); + +/* +. + The Cookie Class +. + +The cookie class is used to handle cookies in libwww and to hand them off +to the application. The creation and deletion of cookie object is handled +by this cookie module - the application is handed a cookie and can access +the elements using the following methods: +*/ + +typedef struct _HTCookie HTCookie; + +/* +( + Cookie Name +) +*/ + +extern BOOL HTCookie_setName (HTCookie * me, const char * name); +extern char * HTCookie_name (HTCookie * me); + +/* +( + Cookie Value +) +*/ + +extern BOOL HTCookie_setValue (HTCookie * me, const char * value); +extern char * HTCookie_value (HTCookie * me); + +/* +( + Cookie Domain +) +*/ + +extern BOOL HTCookie_setDomain (HTCookie * me, const char * domain); +extern char * HTCookie_domain (HTCookie * me); + +/* +( + Cookie Path +) +*/ + +extern BOOL HTCookie_setPath (HTCookie * me, const char * path); +extern char * HTCookie_path (HTCookie * me); + +/* +( + Cookie Expiration +) +*/ + +extern time_t HTCookie_setExpiration (HTCookie * me, time_t expiration); +extern time_t HTCookie_expiration (HTCookie * me); + +/* +( + Is Cookie Secure? +) +*/ + +extern time_t HTCookie_setSecure (HTCookie * me, BOOL secure); +extern BOOL HTCookie_isSecure (HTCookie * me); + +/* +. + Cookie Callbacks +. + +The cookie callbacks are called before the request is shipped over the wire +to see if any cookies should be included and after the response has been +recieved if a new cookie is found in a response and before. Cookie callbacks +can be registered with a context that is sent along with the callback when +called. +*/ + +typedef BOOL HTCookieSetCallback (HTRequest * request, HTCookie * cookie, void * param); +typedef HTAssocList * HTCookieFindCallback (HTRequest * request, void * param); + +extern BOOL HTCookie_setCallbacks (HTCookieSetCallback * setCookie, + void * setCookieContext, + HTCookieFindCallback * findCookie, + void * findCookieContext); +extern BOOL HTCookie_deleteCallbacks (void); + +/* +. + Cookie Handling Mode +. + +The application can decide how cookies are to be handled - should they be +ignored, should the user be asked, etc. +*/ + +typedef enum _HTCookieMode { + HT_COOKIE_ACCEPT = 0x1, /* Accept cookies */ + HT_COOKIE_SEND = 0x2, /* Send cookies when fit */ + HT_COOKIE_SAME_HOST = 0x4, /* Don't accept cookies for other hosts */ + HT_COOKIE_SAME_DOMAIN = 0x8, /* Don't accept cookies for other domains */ + HT_COOKIE_PROMPT = 0x10 /* Prompt before accepting cookies */ +} HTCookieMode; + +extern BOOL HTCookie_setCookieMode (HTCookieMode mode); +extern HTCookieMode HTCookie_cookieMode (void); + +/* +*/ + +#endif /* HTCOOKIE_H */ + +/* + + + + @(#) $Id: HTCookie.h,v 1.1.2.1 2002/09/13 00:23:45 stefanulrich Exp $ + +*/ diff -Naur xdvik-22.40l/libs/libwww/HTDAV.c xdvik-22.40n/libs/libwww/HTDAV.c --- xdvik-22.40l/libs/libwww/HTDAV.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTDAV.c Fri Sep 13 00:23:45 2002 @@ -0,0 +1,1208 @@ +/* +** WebDAV MANAGER +** +** (c) COPYRIGHT MIT 1995. +** Please first read the full copyright statement in the file COPYRIGH. +** +** Authors +** MKP Manuele Kirsch Pinheiro, Manuele.Kirsch_Pinheiro@inrialpes.fr +** manuele@inf.ufrgs.br +** +** History +** 15 Fev 02 Writen +** 15 Mar 02 Changed - All methods will use entity callback and not the +** message body functions. This modification was demanded by +** Jose Kahan. +** 30 May 02 Changed - wwwsys.h becames the first include file +** +** $Log: HTDAV.c,v $ +** Revision 1.1.2.1 2002/09/13 00:23:45 stefanulrich +** - updated libwww to status of teTeX beta-20020911, but with some additional +** fixes to compiler warnings and bug #434836. Still needs testing of configure +** options for compiling with system-wide libwwww. +** - re-enabled the nifty downloading messages (kind of saying goodbye to libwww ;-) +** +** Revision 1.3 2002/05/30 18:08:56 kirschpi +** Minor changes concerning windows plataform (as STDIN_FILENO reference at +** myext.c and myext2.c) and concerning code readability. +** +** Revision 1.2 2002/05/29 16:09:13 kirschpi +** +** Fixes for windows plataform concerning WebDAV and Extension +** methods. In HTMethod and HTRequest, functions defined for +** the Extension Methods are now defined always, but return +** fail values when HT_EXT is not defined. In addition, the +** files "Library/src/WWWDAV.html" and "Library/src/windows/wwwdav.files" +** have been added. These files and modifications were needed +** to produce the correct "*.def" files, for windows plataform. +** +** Revision 1.1 2002/03/21 14:16:27 kirschpi +** Missing files +** Manuele Kirsch +** +** +** $Id: HTDAV.c,v 1.1.2.1 2002/09/13 00:23:45 stefanulrich Exp $ +*/ + + +/* Library include files */ +#include "wwwsys.h" +#include "WWWLib.h" +#include "WWWInit.h" +#include "WWWUtil.h" +#include "WWWStream.h" +#include "HTDAV.h" /* implemented here */ + +#ifdef HT_DAV + +struct _HTStream { + const HTStreamClass * isa; + HTStream * target; + HTRequest * request; + int version; + BOOL endHeader; + BOOL transparent; +}; + + +/* --------------------------------------------------------------------------*/ +/* WebDAV REQUEST HEADERS */ +/* --------------------------------------------------------------------------*/ + +/* Headers defined in WebDAV - RC2518 +** If: state list _ may be a tagged or a non-tag list of state tokens and Etags +** Depth: how depth the method should be executed. Values are: 0,1,infinity +** Destination: destination URI for COPY and MOVE methods +** Overwrite: should the method overwrite any existant resource? Values: T or F +** LockToken: lock identification (used only in UNLOCK method) +** Timeout: lock timeout. Values: Second-nnn,Infinite or Extend file (RFC2068) +*/ +struct _HTDAVHeaders { + char * If; + char * Depth; + char * Destination; + char * LockToken; + char * Timeout; + char Overwrite; +}; + + +/* +** Creates a new HTDAVHeaders struct +*/ +PUBLIC HTDAVHeaders * HTDAVHeaders_new (void) { + HTDAVHeaders *me; + + if ( (me = (HTDAVHeaders *) HT_CALLOC (1,sizeof(HTDAVHeaders))) == NULL) + HT_OUTOFMEM ("HTDAVHeaders_new"); + + /* set everything to an empty value */ + me->If = NULL; + me->Depth = NULL; + me->Destination = NULL; + me->LockToken = NULL; + me->Timeout = NULL; + me->Overwrite = ' '; + + HTTRACE (PROT_TRACE,"HTDAV.... HTDAVHeaders object created\n"); + + return me; +} + + +/* +** Deletes a HTDAVHeaders object +*/ +PUBLIC BOOL HTDAVHeaders_delete (HTDAVHeaders *me) { + if (me) { + if (me->If) HT_FREE (me->If); + if (me->Depth) HT_FREE (me->Depth); + if (me->Destination) HT_FREE (me->Destination); + if (me->LockToken) HT_FREE (me->LockToken); + if (me->Timeout) HT_FREE (me->Timeout); + HT_FREE (me); + + HTTRACE (PROT_TRACE,"HTDAV.... HTDAVHeaders object removed\n"); + + return YES; + } + return NO; +} + + +/* +** Set the If header - see section 9.4 of RFC2518 +*/ +PUBLIC BOOL HTDAV_setIfHeader (HTDAVHeaders *me, const char *If) { + if (me && If && *If) { + HTTRACE (PROT_TRACE,"HTDAV.... If Header set\n"); + StrAllocCopy (me->If,If); + return YES; + } + return NO; +} + +/* +** Removes the "If" header. +*/ +PUBLIC BOOL HTDAV_deleteIfHeader (HTDAVHeaders * me) { + if (me && me->If) { + HT_FREE(me->If); + me->If = NULL; + return YES; + } + return NO; +} + +/* +** Return the "If" header, NULL if this header is not set. +** The caller should FREE the returned string +*/ +PUBLIC char * HTDAV_ifHeader (HTDAVHeaders *me) { + char *copy = NULL; + if (me && me->If) { + StrAllocCopy (copy,me->If); + } + return copy; +} + + +/* +** Set the Depth header - see section 9.2 of RFC2518 +*/ +PUBLIC BOOL HTDAV_setDepthHeader (HTDAVHeaders *me, const char *Depth) { + if (me && Depth && *Depth) { + HTTRACE (PROT_TRACE,"HTDAV.... Depth Header set\n"); + StrAllocCopy (me->Depth,Depth); + return YES; + } + return NO; +} + + +/* +** Removes the "Depth" header. +*/ +PUBLIC BOOL HTDAV_deleteDepthHeader (HTDAVHeaders * me) { + if (me && me->Depth) { + HT_FREE (me->Depth); + me->Depth = NULL; + return YES; + } + return NO; +} + + +/* +** Return the "Depth" header, NULL if this header is not set. +** The caller should FREE the returned string +*/ +PUBLIC char * HTDAV_DepthHeader (HTDAVHeaders *me) { + char *copy = NULL; + if (me && me->Depth) { + StrAllocCopy (copy,me->Depth); + } + return copy; +} + + +/* +** Set the LockToken header - see section 9.5 of RFC2518 +*/ +PUBLIC BOOL HTDAV_setLockTokenHeader (HTDAVHeaders *me, const char *LockToken) { + if (me && LockToken && *LockToken) { + HTTRACE (PROT_TRACE,"HTDAV.... Lock-Token Header set\n"); + StrAllocCopy (me->LockToken,LockToken); + return YES; + } + return NO; +} + + +/* +** Removes the "LockToken" header. +*/ +PUBLIC BOOL HTDAV_deleteLockTokenHeader (HTDAVHeaders * me) { + if (me && me->LockToken) { + HT_FREE (me->LockToken); + me->LockToken = NULL; + return YES; + } + return NO; +} + + +/* +** Return the "LockToken" header, NULL if this header is not set. +** The caller should FREE the returned string +*/ +PUBLIC char * HTDAV_LockTokenHeader (HTDAVHeaders *me) { + char *copy = NULL; + if (me && me->LockToken) { + StrAllocCopy (copy,me->LockToken); + } + return copy; +} + + +/* +** Set the Destination header - see section 9.3 of RFC2518 +*/ +PUBLIC BOOL HTDAV_setDestinationHeader (HTDAVHeaders *me, const char *Destination) { + if (me && Destination && *Destination) { + HTTRACE (PROT_TRACE,"HTDAV.... Destination Header set\n"); + StrAllocCopy (me->Destination,Destination); + return YES; + } + return NO; +} + + +/* +** Removes the "Destination" header. +*/ +PUBLIC BOOL HTDAV_deleteDestinationHeader (HTDAVHeaders * me) { + if (me && me->Destination) { + HT_FREE (me->Destination); + me->Destination = NULL; + return YES; + } + return NO; +} + + +/* +** Return the "Destination" header, NULL if this header is not set. +** The caller should FREE the returned string +*/ +PUBLIC char * HTDAV_DestinationHeader (HTDAVHeaders *me) { + char *copy = NULL; + if (me && me->Destination) { + StrAllocCopy (copy,me->Destination); + } + return copy; +} + + + +/* +** Set the Timeout header - see section 9.8 of RFC2518 +*/ +PUBLIC BOOL HTDAV_setTimeoutHeader (HTDAVHeaders *me, const char *Timeout) { + if (me && Timeout && *Timeout) { + HTTRACE (PROT_TRACE,"HTDAV.... Timeout Header set\n"); + StrAllocCopy (me->Timeout,Timeout); + return YES; + } + return NO; +} + + +/* +** Removes the "Timeout" header. +*/ +PUBLIC BOOL HTDAV_deleteTimeoutHeader (HTDAVHeaders * me) { + if (me && me->Timeout) { + HT_FREE (me->Timeout); + me->Timeout = NULL; + return YES; + } + return NO; +} + + +/* +** Return the "Timeout" header, NULL if this header is not set. +** The caller should FREE the returned string +*/ +PUBLIC char * HTDAV_TimeoutHeader (HTDAVHeaders *me) { + char *copy = NULL; + if (me && me->Timeout) { + StrAllocCopy (copy,me->Timeout); + } + return copy; +} + + +/* +** Set the Overwrite header - see section 9.6 of RFC2518 +*/ +PUBLIC BOOL HTDAV_setOverwriteHeader (HTDAVHeaders *me, BOOL Overwrite) { + if (me) { + HTTRACE (PROT_TRACE,"HTDAV.... Overwrite Header set\n"); + me->Overwrite = (Overwrite)?'T':'F'; + return YES; + } + return NO; +} + +/* +** Removes the "Overwirte" header. +*/ +PUBLIC BOOL HTDAV_deleteOverwriteHeader (HTDAVHeaders * me) { + if (me) { + me->Overwrite = ' '; + return YES; + } + return NO; +} + + +/* +** Returns the "Overwrite" header. If it is not set, returns the +** default value (YES == TRUE) +*/ +PUBLIC BOOL HTDAV_OverwriteHeader (HTDAVHeaders * me) { + if (me) { + return (me->Overwrite==' ' || me->Overwrite=='T')?YES:NO; + } + return YES; +} + + + +/* --------------------------------------------------------------------------*/ +/* ENTITY CALLBACK */ +/* --------------------------------------------------------------------------*/ + + +/* +** Entity Callback - IDEM HTAccess.c +*/ +PRIVATE int HTEntity_callback (HTRequest * request, HTStream * target) +{ + HTParentAnchor * entity = HTRequest_entityAnchor(request); + HTTRACE(APP_TRACE, "Posting Data from callback function\n"); + if (!request || !entity || !target) return HT_ERROR; + { + BOOL chunking = NO; + int status; + char * document = (char *) HTAnchor_document(entity); + int len = HTAnchor_length(entity); + if (!document) { + HTTRACE(PROT_TRACE, "Posting Data No document\n"); + return HT_ERROR; + } + + /* + ** If the length is unknown (-1) then see if the document is a text + ** type and in that case take the strlen. If not then we don't know + ** how much data we can write and must stop + */ + if (len < 0) { + HTFormat actual = HTAnchor_format(entity); + HTFormat tmplate = HTAtom_for("text/*"); + if (HTMIMEMatch(tmplate, actual)) { + len = strlen(document); /* Naive! */ + chunking = YES; + } else { + HTTRACE(PROT_TRACE, "Posting Data Must know the length of document %p\n" _ + document); + return HT_ERROR; + } + } + + /* Send the data down the pipe */ + status = (*target->isa->put_block)(target, document, len); + if (status == HT_WOULD_BLOCK) { + HTTRACE(PROT_TRACE, "Posting Data Target WOULD BLOCK\n"); + return HT_WOULD_BLOCK; + } else if (status == HT_PAUSE) { + HTTRACE(PROT_TRACE, "Posting Data Target PAUSED\n"); + return HT_PAUSE; + } else if (chunking && status == HT_OK) { + HTTRACE(PROT_TRACE, "Posting Data Target is SAVED using chunked\n"); + return (*target->isa->put_block)(target, "", 0); + } else if (status == HT_LOADED || status == HT_OK) { + HTTRACE(PROT_TRACE, "Posting Data Target is SAVED\n"); + (*target->isa->flush)(target); + return HT_LOADED; + } else if (status > 0) { /* Stream specific return code */ + HTTRACE(PROT_TRACE, "Posting Data. Target returns %d\n" _ status); + return status; + } else { /* we have a real error */ + HTTRACE(PROT_TRACE, "Posting Data Target ERROR %d\n" _ status); + return status; + } + } +} + + + +/* --------------------------------------------------------------------------*/ +/* LOCK REQUESTS */ +/* --------------------------------------------------------------------------*/ + + +/* +** LOCK REQUESTS +** +** LOCK requests may create a lock specified by "lockinfo" XML element +** on the Request URI. LOCK request should have a XML request entity body, +** which contains "owner" XML element, or the request should be a lock +** refresh request. +** Headers: +** If header is mandatory for lock refresh request +** Depth header may be "0" or "infinity" (default: infinity) +** Timeout header may be used +*/ + +PUBLIC BOOL HTLOCKDocumentAnchor (HTRequest * request, + HTAnchor * dst, + HTParentAnchor * xmlbody, + HTDAVHeaders * headers) { + + if (request && dst) { + /* set method and request-URI */ + HTRequest_setMethod (request,METHOD_LOCK); + HTRequest_setAnchor (request,dst); + HTTRACE (PROT_TRACE,"HTDAV.... Method set to LOCK\n"); + + /* set headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Seting default Headers \n"); + HTRequest_addCacheControl (request,"no-cache",""); + HTRequest_addEnHd (request,HT_E_CONTENT_ENCODING); + HTRequest_addEnHd (request,HT_E_CONTENT_LENGTH); + HTRequest_addGnHd (request,HT_G_PRAGMA_NO_CACHE); + + if (headers) { /* WebDAV specific headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Setting WebDAV headers \n"); + if (headers->If) + HTRequest_addExtraHeader (request,"If",headers->If); + + if (headers->Depth) { /* Depth: 0 or infinity only */ + if (!strcasecomp(headers->Depth,"0") || + !strcasecomp(headers->Depth,"infinity")) + HTRequest_addExtraHeader (request,"Depth",headers->Depth); + } + + if (headers->Timeout) + HTRequest_addExtraHeader (request,"Timeout",headers->Timeout); + } + + /* set body - if there is no body, we expect that is a lock refresh */ + if (xmlbody) { + HTTRACE (PROT_TRACE,"HTDAV.... Setting Entity Body \n"); + HTRequest_setEntityAnchor (request,xmlbody); + HTRequest_setPostCallback(request, HTEntity_callback); + } + + return HTLoad (request,NO); + } + return NO; +} + + +/* +** LOCK the URI indicated by HTAnchor *dst using the informations +** in xmlbody string. +*/ +PUBLIC BOOL HTLOCKAnchor (HTRequest * request, + HTAnchor * dst, + char * xmlbody, + HTDAVHeaders * headers) { + + if (request && dst) { + HTParentAnchor * src = NULL; + if (xmlbody) { + src = HTTmpAnchor(NULL); + HTAnchor_setDocument(src, xmlbody); + HTAnchor_setFormat(src, HTAtom_for ("text/xml")); + HTAnchor_setLength(src, strlen(xmlbody)); + } + return (HTLOCKDocumentAnchor (request,dst,src,headers)); + } + return NO; +} + + +/* +** LOCK the resource indicated by an absolute URI, using the informations +** in xmlbody string. +*/ +PUBLIC BOOL HTLOCKAbsolute (HTRequest * request, + const char * uri, + char * xmlbody, + HTDAVHeaders * headers){ + if (request && uri && *uri) { + HTAnchor *dst = HTAnchor_findAddress (uri); + HTParentAnchor *src = NULL; + + if (xmlbody) { + src = HTTmpAnchor(NULL); + HTAnchor_setDocument(src, xmlbody); + HTAnchor_setFormat(src, HTAtom_for ("text/xml")); + HTAnchor_setLength(src, strlen(xmlbody)); + } + + return (HTLOCKDocumentAnchor (request,dst,src,headers)); + } + return NO; +} + + +/* +** LOCK the resource indicated by a relative URI, which is made +** absolute by using the base anchor. +*/ +PUBLIC BOOL HTLOCKRelative (HTRequest * request, + const char * relative, + HTParentAnchor * base, + char * xmlbody, + HTDAVHeaders * headers){ + BOOL status = NO; + if (request && relative && base) { + char * base_uri = HTAnchor_address ((HTAnchor *)base); + char * full_uri = HTParse(relative,base_uri,PARSE_ACCESS|PARSE_HOST| \ + PARSE_PATH|PARSE_PUNCTUATION); + + status = HTLOCKAbsolute (request,full_uri,xmlbody,headers); + HT_FREE (full_uri); + HT_FREE (base_uri); + } + return status; +} + + +/* --------------------------------------------------------------------------*/ +/* UNLOCK REQUESTS */ +/* --------------------------------------------------------------------------*/ + +/* +** UNLOCK REQUEST +** +** UNLOCK request removes the lock identified by Lock-Token header from +** the Request-URI. +** Headers: +** Lock-Token header must be present +*/ +PUBLIC BOOL HTUNLOCKAnchor (HTRequest * request, + HTAnchor * dst, + HTDAVHeaders * headers) { + if (request && dst) { + /* set method and request-uri */ + HTRequest_setMethod (request,METHOD_UNLOCK); + HTRequest_setAnchor (request,dst); + HTTRACE (PROT_TRACE,"HTDAV.... Method set to UNLOCK\n"); + + /* set headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Setting default Headers \n"); + HTRequest_addCacheControl (request, "no-cache",""); + HTRequest_addEnHd (request,HT_E_CONTENT_ENCODING); + HTRequest_addEnHd (request,HT_E_CONTENT_LENGTH); + HTRequest_addGnHd (request,HT_G_PRAGMA_NO_CACHE); + + if (headers && headers->LockToken) { + HTTRACE (PROT_TRACE,"HTDAV.... Seting Lock-Token \n"); + if (headers->LockToken == NULL) { + HTTRACE (PROT_TRACE,"HTDAV.... FAILED Lock-Token is NULL\n"); + return NO; + } + HTRequest_addExtraHeader (request,"Lock-Token",headers->LockToken); + + return HTLoad (request,NO); + } + } + return NO; +} + + +/* +** UNLOCK the resource indicated by an absolute URI, using the lock tocken +** defined in HTDAVHeaders * headers parameter. +*/ +PUBLIC BOOL HTUNLOCKAbsolute (HTRequest * request, + const char * uri, + HTDAVHeaders * headers) { + + if (request && uri && *uri) { + HTAnchor *dst = HTAnchor_findAddress (uri); + return HTUNLOCKAnchor (request,dst,headers); + } + return NO; +} + + +/* +** UNLOCK the resource indicated by a relative URI, which is made +** absolute by using the base anchor. +*/ +PUBLIC BOOL HTUNLOCKRelative (HTRequest * request, + const char * relative, + HTParentAnchor * base, + HTDAVHeaders * headers) { + BOOL status = NO; + if (request && relative && base) { + char * base_uri = HTAnchor_address ((HTAnchor *)base); + char * full_uri = HTParse (relative,base_uri,PARSE_ACCESS|PARSE_HOST| \ + PARSE_PATH|PARSE_PUNCTUATION); + + status = HTUNLOCKAbsolute (request,full_uri,headers); + HT_FREE (full_uri); + HT_FREE (base_uri); + } + return status; +} + + +/* --------------------------------------------------------------------------*/ +/* PROPFIND REQUESTS */ +/* --------------------------------------------------------------------------*/ + + +/* +** PROPFIND Requests +** PROPFIND requests returns properties defined for the resource. +** The request may contain xml message body with a "propfind" element, +** which may include an "allprop" element (to get all properties), a +** "propname" element (the name of all properties defined), and a "prop" +** element containing the desired properties. +** Headers: +** Depth header may be "0", "1" or "infinity". +*/ +PUBLIC BOOL HTPROPFINDDocumentAnchor (HTRequest * request, + HTAnchor * dst, + HTParentAnchor * xmlbody, + HTDAVHeaders * headers) { + + if (request && dst) { + /* set method and request-URI */ + HTRequest_setMethod (request,METHOD_PROPFIND); + HTRequest_setAnchor (request,dst); + HTTRACE (PROT_TRACE,"HTDAV.... Method set to PROPFIND\n"); + + /* set headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Seting default Headers \n"); + HTRequest_addCacheControl (request,"no-cache",""); + HTRequest_addGnHd (request,HT_G_PRAGMA_NO_CACHE); + + if (headers) { /* WebDAV specific headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Setting WebDAV headers \n"); + if (headers->Depth) /* only Depth header may be used */ + if (!strcasecomp(headers->Depth,"0") || /* values 0, 1 */ + !strcasecomp(headers->Depth,"1") || /* or infinity */ + !strcasecomp(headers->Depth,"infinity")) + HTRequest_addExtraHeader(request,"Depth",headers->Depth); + } + + /* set body - if there is a body */ + if (xmlbody) { + HTTRACE (PROT_TRACE,"HTDAV.... Setting WebDAV Entity Request Body \n"); + HTRequest_setEntityAnchor (request,xmlbody); + HTRequest_setPostCallback (request, HTEntity_callback); + } + + return HTLoad (request,NO); + } + + return NO; +} + + + +PUBLIC BOOL HTPROPFINDAnchor (HTRequest * request, + HTAnchor * dst, + const char * xmlbody, + HTDAVHeaders * headers) { + if (request && dst) { + HTParentAnchor * body = NULL; + if (xmlbody) { + body = HTTmpAnchor(NULL); + HTAnchor_setDocument(body, (void *)xmlbody); + HTAnchor_setFormat(body, HTAtom_for ("text/xml")); + HTAnchor_setLength(body, strlen(xmlbody)); + } + return HTPROPFINDDocumentAnchor (request,dst,body,headers); + } + + return NO; +} + + +/* +** This PROPFIND request returns the properties of the resource +** indicated by the absolute URI (parameter uri). +*/ +PUBLIC BOOL HTPROPFINDAbsolute (HTRequest * request, + const char * uri, + const char * xmlbody, + HTDAVHeaders * headers) { + if (request && uri && *uri) { + HTAnchor *dst = HTAnchor_findAddress (uri); + return HTPROPFINDAnchor (request,dst,xmlbody,headers); + } + return NO; +} + + +/* +** This PROPFIND request returns the properties of the resource +** indicated by a relative URI, which is made absolute by using +** the base anchor. +*/ +PUBLIC BOOL HTPROPFINDRelative (HTRequest * request, + const char * relative, + HTParentAnchor * base, + const char * xmlbody, + HTDAVHeaders * headers) { + BOOL status = NO; + if (request && relative && base) { + char * base_uri = HTAnchor_address ((HTAnchor *)base); + char * full_uri = HTParse(relative,base_uri,PARSE_ACCESS|PARSE_HOST| \ + PARSE_PATH|PARSE_PUNCTUATION); + + status = HTPROPFINDAbsolute (request,full_uri,xmlbody,headers); + HT_FREE (full_uri); + HT_FREE (base_uri); + } + return status; +} + + + +/* --------------------------------------------------------------------------*/ +/* PROPPATCH REQUESTS */ +/* --------------------------------------------------------------------------*/ + + +/* +** PROPPATCH Requests +** PROPPATCH requests sets/removes the properties values for the resource. +** The request must contain a xml message body with a "propertyupdate" element, +** which may include an "set" element (to set the properties value) or +** a "remove" element (to remove the properties). +** Headers: (the RFC is not very clair about it) +** If header, indicating a state token for the resource. +*/ +PUBLIC BOOL HTPROPPATCHDocumentAnchor (HTRequest * request, + HTAnchor * dst, + HTParentAnchor * xmlbody, + HTDAVHeaders * headers) { + + if (request && dst && xmlbody) { + + /* set method and request-URI */ + HTRequest_setMethod (request,METHOD_PROPPATCH); + HTRequest_setAnchor (request,dst); + HTTRACE (PROT_TRACE,"HTDAV.... Method set to PROPPATCH\n"); + + /* set headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Seting default Headers \n"); + HTRequest_addCacheControl (request,"no-cache",""); + HTRequest_addGnHd (request,HT_G_PRAGMA_NO_CACHE); + + if (headers) { /* WebDAV specific headers*/ + HTTRACE (PROT_TRACE,"HTDAV.... Setting WebDAV headers \n"); + if (headers->If) + HTRequest_addExtraHeader (request,"If",headers->If); + } + + /* set body - mandatory! */ + HTTRACE (PROT_TRACE,"HTDAV.... Setting Entity Body \n"); + HTRequest_setEntityAnchor (request,xmlbody); + HTRequest_setPostCallback (request, HTEntity_callback); + + return HTLoad (request,NO); + } + return NO; + +} + + + +PUBLIC BOOL HTPROPPATCHAnchor (HTRequest * request, + HTAnchor * dst, + const char * xmlbody, + HTDAVHeaders * headers) { + if (request && dst && xmlbody) { + HTParentAnchor * body = HTTmpAnchor(NULL); + HTAnchor_setDocument (body, (void *)xmlbody); + HTAnchor_setFormat (body, HTAtom_for ("text/xml")); + HTAnchor_setLength (body, strlen(xmlbody)); + + return HTPROPPATCHDocumentAnchor (request,dst,body,headers); + } + return NO; +} + + +/* +** This PROPPATCH request set or removes properties from the resource +** indicated by the absolute URI (parameter uri). +*/ +PUBLIC BOOL HTPROPPATCHAbsolute (HTRequest * request, + const char * uri, + const char * xmlbody, + HTDAVHeaders * headers) { + if (request && uri && *uri && xmlbody && *xmlbody) { + HTAnchor *dst = HTAnchor_findAddress (uri); + return HTPROPPATCHAnchor (request,dst,xmlbody,headers); + } + return NO; +} + + +/* +** This PROPPATCH request sets/removes the properties from the resource +** indicated by a relative URI, which is made absolute by using +** the base anchor. +*/ +PUBLIC BOOL HTPROPPATCHRelative (HTRequest * request, + const char * relative, + HTParentAnchor * base, + const char * xmlbody, + HTDAVHeaders * headers) { + BOOL status = NO; + if (request && relative && base && xmlbody && *xmlbody) { + char * base_uri = HTAnchor_address ((HTAnchor *)base); + char * full_uri = HTParse (relative,base_uri,PARSE_ACCESS|PARSE_HOST| \ + PARSE_PATH|PARSE_PUNCTUATION); + + status = HTPROPPATCHAbsolute (request,full_uri,xmlbody,headers); + HT_FREE (full_uri); + HT_FREE (base_uri); + } + return status; +} + + +/* --------------------------------------------------------------------------*/ +/* MKCOL REQUESTS */ +/* --------------------------------------------------------------------------*/ + + +/* +** MKCOL Requests +** MKCOL requests creates a collection. The resource indicated by HTAnchor * +** dst parameter must not be a "non-null" resource, but all it ancestors +** must exist. +** Headers: +** If header may be used. +*/ +PUBLIC BOOL HTMKCOLAnchor (HTRequest * request, + HTAnchor * dst, + HTDAVHeaders * headers) { + if (request && dst) { + /* set method and request-URI */ + HTRequest_setMethod (request,METHOD_MKCOL); + HTRequest_setAnchor (request,dst); + HTTRACE (PROT_TRACE,"HTDAV.... Method set to MKCOL\n"); + + /* set headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Seting default Headers \n"); + HTRequest_addCacheControl (request,"no-cache",""); + HTRequest_addGnHd (request,HT_G_PRAGMA_NO_CACHE); + + if (headers) { /* WebDAV specific headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Setting WebDAV headers \n"); + if (headers->If) /* only IF header may be used */ + HTRequest_addExtraHeader (request,"If",headers->If); + } + + return HTLoad (request,NO); + } + + return NO; +} + + + +/* +** This MKCOL request tries to create the resource +** indicated by the absolute URI (parameter uri). +*/ +PUBLIC BOOL HTMKCOLAbsolute (HTRequest * request, + const char * uri, + HTDAVHeaders * headers) { + if (request && uri && *uri) { + HTAnchor *dst = HTAnchor_findAddress (uri); + return HTMKCOLAnchor (request,dst,headers); + } + return NO; +} + + +/* +** This MKCOL request tries to create the resource indicated +** by a relative URI, which is made absolute by using the +** base anchor. +*/ +PUBLIC BOOL HTMKCOLRelative (HTRequest * request, + const char * relative, + HTParentAnchor * base, + HTDAVHeaders * headers) { + BOOL status = NO; + if (request && relative && base) { + char * base_uri = HTAnchor_address ((HTAnchor *)base); + char * full_uri = HTParse (relative,base_uri,PARSE_ACCESS|PARSE_HOST| \ + PARSE_PATH|PARSE_PUNCTUATION); + + status = HTMKCOLAbsolute (request,full_uri,headers); + HT_FREE (full_uri); + HT_FREE (base_uri); + } + return status; +} + + + +/* --------------------------------------------------------------------------*/ +/* COPY REQUESTS */ +/* --------------------------------------------------------------------------*/ + + +/* +** COPY Requests +** COPY requests copies the Request-URI resource (indicated by the parameter +** HTAnchor *src) to the resource indicated by the Destination header (it must +** be set in HTDAVHeaders object - so, this object must NOT be NULL). +** A xml message body may also be set, with the propertybehavior xml element, +** which indicates what should be the server behavior when copying the resouce +** properties. +** Headers: +** Destination header is mandatory! +** If header may be used. +** Depth header may be "0" or "infinity" +** Overwrite header may be used +*/ +PUBLIC BOOL HTCOPYDocumentAnchor (HTRequest * request, + HTAnchor * src, + HTParentAnchor * xmlbody, + HTDAVHeaders * headers) { + + if (request && src && headers) { + + /* set method and request-URI */ + HTRequest_setMethod (request,METHOD_COPY); + HTRequest_setAnchor (request,src); + HTTRACE (PROT_TRACE,"HTDAV.... Method set to COPY\n"); + + /* set headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Seting default Headers \n"); + HTRequest_addCacheControl (request,"no-cache",""); + HTRequest_addGnHd (request,HT_G_PRAGMA_NO_CACHE); + + /* WebDAV specific headers - Destination is mandatory! */ + if (headers->Destination && *headers->Destination) { + HTTRACE (PROT_TRACE,"HTDAV.... Setting WebDAV headers \n"); + HTRequest_addExtraHeader (request,"Destination",headers->Destination); + + if (headers->If) /* If header may be used */ + HTRequest_addExtraHeader (request,"If",headers->If); + + if (headers->Overwrite != ' ') { + char over[] = { headers->Overwrite, '\0' }; + HTRequest_addExtraHeader (request,"Overwirte", over ); + } + + if (headers->Depth) { + if (!strcasecomp (headers->Depth,"0") || + !strcasecomp (headers->Depth,"infinity")) + HTRequest_addExtraHeader (request,"Depth",headers->Depth); + } + } + else return NO; + + /* set body - if there is a body */ + if (xmlbody) { + HTTRACE (PROT_TRACE,"HTDAV.... Setting Entity Body \n"); + HTRequest_setEntityAnchor (request,xmlbody); + HTRequest_setPostCallback (request, HTEntity_callback); + } + return HTLoad (request,NO); + } + + return NO; +} + + + +PUBLIC BOOL HTCOPYAnchor (HTRequest * request, + HTAnchor * src, + const char * xmlbody, + HTDAVHeaders * headers) { + + if (request && src && headers) { + HTParentAnchor * body = NULL; + if (xmlbody) { + body = HTTmpAnchor(NULL); + HTAnchor_setDocument (body, (void *)xmlbody); + HTAnchor_setFormat (body, HTAtom_for ("text/xml")); + HTAnchor_setLength (body, strlen(xmlbody)); + } + return HTCOPYDocumentAnchor (request,src,body,headers); + } + return NO; +} + + +/* +** This COPY request copies the resource indicated by an absolute URI +** (parameter uri) to the URI in Destination header. +*/ +PUBLIC BOOL HTCOPYAbsolute (HTRequest * request, + const char * uri, + const char * xmlbody, + HTDAVHeaders * headers) { + if (request && uri && *uri && headers) { + HTAnchor *src = HTAnchor_findAddress (uri); + return HTCOPYAnchor (request,src,xmlbody,headers); + } + return NO; +} + + +/* +** This COPY request copies the resource indicated by a relative URI, +** which is made absolute by using the base anchor. +*/ +PUBLIC BOOL HTCOPYRelative (HTRequest * request, + const char * relative, + HTParentAnchor * base, + const char * xmlbody, + HTDAVHeaders * headers) { + BOOL status = NO; + if (request && relative && base && headers) { + char * base_uri = HTAnchor_address ((HTAnchor *)base); + char * full_uri = HTParse (relative,base_uri,PARSE_ACCESS|PARSE_HOST| \ + PARSE_PATH|PARSE_PUNCTUATION); + + status = HTCOPYAbsolute (request,full_uri,xmlbody,headers); + HT_FREE (full_uri); + HT_FREE (base_uri); + } + return status; +} + + + +/* --------------------------------------------------------------------------*/ +/* MOVE REQUESTS */ +/* --------------------------------------------------------------------------*/ + + +/* +** MOVE Requests +** MOVE requests moves the Request-URI resource (indicated by the parameter +** HTAnchor *src) to the resource indicated by the Destination header (it must +** be set in HTDAVHeaders object - so, this object must NOT be NULL). +** A xml message body may also be set, with the propertybehavior xml element, +** which indicates what should be the server behavior when copying the resouce +** properties. +** Headers: +** Destination header is mandatory! +** If header may be used. +** Depth header may be "0" or "infinity" (for collections, it MUST be "infinity") +** Overwrite header may be used +*/ +PUBLIC BOOL HTMOVEDocumentAnchor (HTRequest * request, + HTAnchor * src, + HTParentAnchor * xmlbody, + HTDAVHeaders * headers) { + + if (request && src && headers) { + + /* set method and request-URI */ + HTRequest_setMethod (request,METHOD_MOVE); + HTRequest_setAnchor (request,src); + HTTRACE (PROT_TRACE,"HTDAV.... Method set to MOVE\n"); + + /* set headers */ + HTTRACE (PROT_TRACE,"HTDAV.... Seting default Headers \n"); + HTRequest_addCacheControl (request,"no-cache",""); + HTRequest_addGnHd (request,HT_G_PRAGMA_NO_CACHE); + + /* WebDAV specific headers - Destination is mandatory! */ + if (headers->Destination && *headers->Destination) { + HTTRACE (PROT_TRACE,"HTDAV.... Setting WebDAV headers \n"); + HTRequest_addExtraHeader (request,"Destination",headers->Destination); + + if (headers->If) /* If header may be used */ + HTRequest_addExtraHeader (request,"If",headers->If); + + if (headers->Overwrite != ' ') { + char over[] = { headers->Overwrite, '\0' }; + HTRequest_addExtraHeader (request,"Overwirte", over ); + } + + if (headers->Depth) { + if (!strcasecomp (headers->Depth,"0") || + !strcasecomp (headers->Depth,"infinity")) + HTRequest_addExtraHeader(request,"Depth",headers->Depth); + } + } + else return NO; + + /* set body - if there is a body */ + if (xmlbody) { + HTTRACE (PROT_TRACE,"HTDAV.... Setting Entity Body \n"); + HTRequest_setEntityAnchor (request,xmlbody); + HTRequest_setPostCallback (request,HTEntity_callback); + } + return HTLoad (request,NO); + } + + return NO; +} + + + +PUBLIC BOOL HTMOVEAnchor (HTRequest * request, + HTAnchor * src, + const char * xmlbody, + HTDAVHeaders * headers) { + + if (request && src && headers) { + HTParentAnchor * body = NULL; + if (xmlbody) { + body = HTTmpAnchor (NULL); + HTAnchor_setDocument(body, (void *) xmlbody); + HTAnchor_setFormat (body, HTAtom_for ("text/xml")); + HTAnchor_setLength (body, strlen(xmlbody)); + } + return HTMOVEDocumentAnchor (request,src,body,headers); + } + return NO; +} + + +/* +** This MOVE request moves the resource indicated by an absolute URI +** (parameter uri) to the URI in Destination header. +*/ +PUBLIC BOOL HTMOVEAbsolute (HTRequest * request, + const char * uri, + const char * xmlbody, + HTDAVHeaders * headers) { + if (request && uri && *uri && headers) { + HTAnchor *src = HTAnchor_findAddress (uri); + return HTMOVEAnchor (request,src,xmlbody,headers); + } + return NO; +} + + +/* +** This MOVE request moves the resource indicated by a relative URI, +** which is made absolute by using the base anchor. +*/ +PUBLIC BOOL HTMOVERelative (HTRequest * request, + const char * relative, + HTParentAnchor * base, + const char * xmlbody, + HTDAVHeaders * headers) { + BOOL status = NO; + if (request && relative && base && headers) { + char * base_uri = HTAnchor_address ((HTAnchor *)base); + char * full_uri = HTParse (relative,base_uri,PARSE_ACCESS|PARSE_HOST| \ + PARSE_PATH|PARSE_PUNCTUATION); + + status = HTMOVEAbsolute (request,full_uri,xmlbody,headers); + HT_FREE (full_uri); + HT_FREE (base_uri); + } + return status; +} + + +#endif /* HT_DAV */ diff -Naur xdvik-22.40l/libs/libwww/HTDAV.h xdvik-22.40n/libs/libwww/HTDAV.h --- xdvik-22.40l/libs/libwww/HTDAV.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTDAV.h Fri Sep 13 00:23:45 2002 @@ -0,0 +1,386 @@ +/* + + W3C Sample Code Library libwww WebDAV Access Methods + + + +! +W3C Sample Code Library libwww WebDAV Access Methods +! +*/ + +/* +** (c) COPYRIGHT MIT 1995. +** Please first read the full copyright statement in the file COPYRIGH. +*/ + +/* + + +This module contains methods for accessing URIs using WebDAV methods. It +also contains functions for headers definition. + + +This module is implemented by HTDAV.c and it is a +part of the W3C Sample +CodeLibrary. +*/ + +#ifndef HTDAV_H +#define HTDAV_H + +#ifdef HT_DAV + +/* + +. +WebDAV HEADERS +. + + +WebDAV extension protocol defines new headers to be used in its requests. +See RFC2518 for details. +*/ + +typedef struct _HTDAVHeaders HTDAVHeaders; + +extern HTDAVHeaders * HTDAVHeaders_new (void); +extern BOOL HTDAVHeaders_delete (HTDAVHeaders *me); + +/* + +( +If Header +) + + +Manipulates the "If" header, which describes a series of state lists. The +caller must assure that the parameter "If" is well-formed. Below, you can see +a small description of If header format. See section 9.4 of RFC2518 for details. + + +If = "If" ":" ( 1*NOTAGGED | 1*TAGGED ) + + +NOTAGGED = LIST + + +TAGGED = CODED-URL 1*LIST + + +LIST = "(" 1*( ["Not"] (STATE-TOKEN | "[" ENTITY-TAG "]" ) ) ")" + + +STATE-TOKEN = CODED-URL + + +CODED-URL = "<" AbsoluteURI "> + + +Note: The caller should free the strings returned by +HTDAV_ifHeader method. +*/ + +extern BOOL HTDAV_setIfHeader (HTDAVHeaders *me, const char *If); +extern BOOL HTDAV_deleteIfHeader (HTDAVHeaders * me); +extern char * HTDAV_ifHeader (HTDAVHeaders *me); + +/* + +( +Depth Header +) + + +Manipulates the "Depth" header. Depth header is used with methods executed +on resource which could have internal members (Collections) to indicate +whether the method should be applied to the resource children. + + +The caller must assure that the parameter "Depth" is "0", "1" or +"infinity", and that its value can be applied in the used resquest method +(for example, LOCK method does not support Depth value 1). + + +Note: The caller should free the string returned by +HTDAV_DepthHeader method. +*/ + +extern BOOL HTDAV_setDepthHeader (HTDAVHeaders *me, const char *Depth); +extern BOOL HTDAV_deleteDepthHeader (HTDAVHeaders * me); +extern char * HTDAV_DepthHeader (HTDAVHeaders *me); + +/* + +( +Lock-Tocken header +) + + +Manipulates the "LockToken" header. It is used in UNLOCK method to +identify the lock to be removed. The caller must assure that the parameter is +a state token well-formed ( +RFC2518 section 9.5). + + +Note: The caller should free the string returned by +HTDAV_LockTokenHeader method. +*/ + +extern BOOL HTDAV_setLockTokenHeader (HTDAVHeaders *me, const char *LockToken); +extern BOOL HTDAV_deleteLockTokenHeader (HTDAVHeaders * me); +extern char * HTDAV_LockTokenHeader (HTDAVHeaders *me); + +/* + +( +Destination Header +) + + +Manipulates the "Destination" header. It is used in COPY and MOVE methods +to identify a destination resource. The caller must assure that the parameter +is an absolute URI. + + +Note: The caller should free the string returned by +HTDAV_DestinationHeader method. +*/ + +extern BOOL HTDAV_setDestinationHeader (HTDAVHeaders *me, const char *Destination); +extern BOOL HTDAV_deleteDestinationHeader (HTDAVHeaders * me); +extern char * HTDAV_DestinationHeader (HTDAVHeaders *me); + +/* + +( +Timeout Header +) + + +Manipulates the "Timeout" header. It is used in LOCK requests to indicate +the desired timeout value for the requested lock. However, according to the +RFC2518, the server is not +required to honor this value. + + +The caller must assure that the parameter follows the specification in the +section 9.8 of RFC 2518: + + +Timeout = "Timeout" ":" 1#TIMETYPE + + +TIMETYPE = ( "Second-" VAL | "Infinite" | OTHER ) + + +VAL = 1*digit + + +OTHER = "Extend" Field ; +RFC2068 - section 4.2 + + +Note: The caller should free the string returned by +HTDAV_TimeoutHeader method. +*/ + +extern BOOL HTDAV_setTimeoutHeader (HTDAVHeaders *me, const char *Timeout); +extern BOOL HTDAV_deleteTimeoutHeader (HTDAVHeaders * me); +extern char * HTDAV_TimeoutHeader (HTDAVHeaders *me); + +/* + +( +Overwrite Header +) + + +Manipulates the "Overwrite" header. It is used in COPY and MOVE methods to +specify whether the server should overwrite a destination resource. +*/ + +extern BOOL HTDAV_setOverwriteHeader (HTDAVHeaders *me, BOOL Overwrite); +extern BOOL HTDAV_deleteOverwriteHeader (HTDAVHeaders * me); +extern BOOL HTDAV_OverwriteHeader (HTDAVHeaders * me); + +/* + +. +WebDAV REQUESTS +. + + +WebDAV extension protocol defines new methods: LOCK, UNLOCK, MOVE, COPY, +MKCOL, PROPFIND, PROPPATCH (See +RFC2518 for details). + +( +LOCK Requests +) + + +A LOCK request create or refresh a lock over the destiny URI. If it wants +to create a new lock, the request should have a XML body (parameter +"xmlbody"), but if it is a refresh request, this body may be NULL and the +header "If" should be set in HTDAVHeaders object. +*/ + +extern BOOL HTLOCKDocumentAnchor(HTRequest * request, HTAnchor * dst, + HTParentAnchor *xmlbody, HTDAVHeaders *headers); +extern BOOL HTLOCKAnchor (HTRequest * request,HTAnchor * dst, + char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTLOCKAbsolute (HTRequest * request, const char * uri, + char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTLOCKRelative (HTRequest * request, const char * relative, + HTParentAnchor * base, char * xmlbody, + HTDAVHeaders * headers); + +/* + +( +UNLOCK Requests +) + + +An UNLOCK request removes a lock from the destiny URI. The request must +contain the Lock-Token header set in HTDAVHeaders object (so, the +HTDAVHeaders * headers parameter can't be NULL). +*/ + +extern BOOL HTUNLOCKAnchor (HTRequest * request, HTAnchor * dst, + HTDAVHeaders * headers); +extern BOOL HTUNLOCKAbsolute (HTRequest * request, const char * uri, + HTDAVHeaders * headers); +extern BOOL HTUNLOCKRelative (HTRequest * request, const char * relative, + HTParentAnchor * base, HTDAVHeaders * headers); + +/* + +( +PROPFIND Requests +) + + +PROPFIND requests returns properties defined for the resource. The request +may contain xml entity body with a "propfind" element, which may include an +"allprop" element (to get all properties), a "propname" element (the name of +all properties defined), and a "prop" element containing the desired +properties. +*/ + +extern BOOL HTPROPFINDAnchor (HTRequest * request, HTAnchor * dst, + const char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTPROPFINDDocumentAnchor (HTRequest * request, HTAnchor * dst, + HTParentAnchor * xmlbody, HTDAVHeaders * headers); +extern BOOL HTPROPFINDAbsolute (HTRequest * request, const char * uri, + const char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTPROPFINDRelative (HTRequest * request, const char * relative, + HTParentAnchor * base, const char * xmlbody, + HTDAVHeaders * headers); + +/* + +( +PROPPATCH Requests +) + + +PROPPATCH requests sets or removes properties defined for the resource. +The request MUST contain xml message body (parameter xmlbody) with a +"propertyupdate" element, which may include a "set" element (to set the +properties) or a "remove" element (to remove the properties). +*/ + +extern BOOL HTPROPPATCHAnchor (HTRequest * request, HTAnchor * dst, + const char * xmlbody,HTDAVHeaders * headers); +extern BOOL HTPROPPATCHDocumentAnchor (HTRequest * request,HTAnchor * dst, + HTParentAnchor * xmlbody,HTDAVHeaders * headers); +extern BOOL HTPROPPATCHAbsolute (HTRequest * request, const char * uri, + const char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTPROPPATCHRelative (HTRequest * request, const char * relative, + HTParentAnchor * base, const char * xmlbody, + HTDAVHeaders * headers); + +/* + +( +MKCOL Requests +) + + +MKCOL requests are used to create Collections. The resource indicated by +the Request-URI (parameters HTAnchor *dst or char *absolute/relative) MUST +not exist, but all the resource's ancestros MUST exist. +*/ + +extern BOOL HTMKCOLAnchor (HTRequest * request, HTAnchor * dst, + HTDAVHeaders * headers); +extern BOOL HTMKCOLAbsolute (HTRequest * request, const char * uri, + HTDAVHeaders * headers); +extern BOOL HTMKCOLRelative (HTRequest * request, const char * relative, + HTParentAnchor * base, HTDAVHeaders * headers); + +/* + +( +COPY Requests +) + + +COPY requests copies the Request-URI (parameters HTAnchor *src or char +*absolute/relative) to the resource indicated in Destinarion header. The +HTDAVHeaders *headers parameter MUST be a non-null object and it MUST have +the Destination header set. Other headers may also be used, like Depth (0 or +infinity), If and Overwrite headers. +*/ + +extern BOOL HTCOPYAnchor (HTRequest * request, HTAnchor * src, + const char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTCOPYDocumentAnchor (HTRequest * request, HTAnchor * src, + HTParentAnchor * xmlbody, HTDAVHeaders * headers); +extern BOOL HTCOPYAbsolute (HTRequest * request, const char * uri, + const char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTCOPYRelative (HTRequest * request, const char * relative, + HTParentAnchor * base, const char * xmlbody, + HTDAVHeaders * headers); + +/* + +( +MOVE Requests +) + + +MOVE requests moves the Request-URI (parameters HTAnchor *src or char +*absolute/relative) to the resource indicated in Destinarion header. The +HTDAVHeaders *headers parameter MUST be a non-null object and it MUST have +the Destination header set. Other headers may also be used, like Depth ("0" +or "infinity" - if the resource is a Collection, Depth must only be +"infinity"), If and Overwrite headers. +*/ + +extern BOOL HTMOVEAnchor (HTRequest * request, HTAnchor * src, + const char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTMOVEDocumentAnchor (HTRequest * request, HTAnchor * src, + HTParentAnchor * xmlbody, HTDAVHeaders * headers); +extern BOOL HTMOVEAbsolute (HTRequest * request, const char * uri, + const char * xmlbody, HTDAVHeaders * headers); +extern BOOL HTMOVERelative (HTRequest * request, const char * relative, + HTParentAnchor * base, const char * xmlbody, + HTDAVHeaders * headers); + +#endif /* HT_DAV */ +#endif /* HTDAV_H */ + +/* + + + + + $Id: HTDAV.h,v 1.1.2.1 2002/09/13 00:23:45 stefanulrich Exp $ + + + + +*/ diff -Naur xdvik-22.40l/libs/libwww/HTDNS.c xdvik-22.40n/libs/libwww/HTDNS.c --- xdvik-22.40l/libs/libwww/HTDNS.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDNS.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTDNS.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTDNS.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This object manages a cache of hosts we have looked up vis DNS. ** The object contains the necessary parts from hostent. For Internet host @@ -24,7 +24,6 @@ #include "HTDNS.h" /* Implemented here */ #define DNS_TIMEOUT 1800L /* Default DNS timeout is 30 mn */ -#define HASH_SIZE 67 /* Type definitions and global variables etc. local to this module */ struct _HTdns { @@ -55,8 +54,7 @@ PRIVATE BOOL delete_object (HTList * list, HTdns * me) { - if (PROT_TRACE) - HTTrace("DNS Delete.. object %p from list %p\n", me, list); + HTTRACE(PROT_TRACE, "DNS Delete.. object %p from list %p\n" _ me _ list); HTList_removeObject(list, (void *) me); free_object(me); return YES; @@ -114,9 +112,8 @@ if ((me->weight = (double *) HT_CALLOC(me->homes, sizeof(double))) == NULL) HT_OUTOFMEM("HTDNS_add"); me->addrlength = element->h_length; - if (PROT_TRACE) - HTTrace("DNS Add..... `%s\' with %d home(s) to %p\n", - host, *homes, list); + HTTRACE(PROT_TRACE, "DNS Add..... `%s\' with %d home(s) to %p\n" _ + host _ *homes _ list); HTList_addObject(list, (void *) me); return me; } @@ -154,14 +151,12 @@ } else { *(dns->weight+cnt) = *(dns->weight+cnt) * passive; } - if (PROT_TRACE) - HTTrace("DNS Weigths. Home %d has weight %4.2f\n", cnt, + HTTRACE(PROT_TRACE, "DNS weight.. Home %d has weight %4.2f\n" _ cnt _ *(dns->weight+cnt)); } return YES; } - if (PROT_TRACE) - HTTrace("DNS Weigths. Object %p not found'\n", dns); + HTTRACE(PROT_TRACE, "DNS weight.. Object %p not found'\n" _ dns); return NO; } @@ -176,7 +171,7 @@ const char *ptr; if (!host || !CacheTable) return NO; for(ptr=host; *ptr; ptr++) - hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HASH_SIZE); + hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HT_M_HASH_SIZE); if ((list = CacheTable[hash])) { /* We have the list, find the entry */ HTdns *pres; while ((pres = (HTdns *) HTList_nextObject(list))) { @@ -198,7 +193,7 @@ int cnt; HTList *cur; if (!CacheTable) return NO; - for (cnt=0; cnthostname, hostname)) { if (time(NULL) > pres->ntime + DNSTimeout) { - if (PROT_TRACE) - HTTrace("HostByName.. Refreshing cache\n"); + HTTRACE(PROT_TRACE, "HostByName.. Refreshing cache\n"); delete_object(list, pres); pres = NULL; } @@ -270,7 +263,7 @@ homes = pres->homes; if (pres->homes > 1) { int cnt = 0; - double best_weight = 1e30; /* Pretty good */ + double best_weight = 1e30; /* Pretty bad */ while (cnt < pres->homes) { if (*(pres->weight+cnt) < best_weight) { best_weight = *(pres->weight+cnt); @@ -289,9 +282,26 @@ int thd_errno; char buffer[HOSTENT_MAX]; struct hostent result; /* For gethostbyname_r */ +#endif +#ifdef HAVE_GETHOSTBYNAME_R_3 + struct hostent_data hdata; +#endif + if (cbf) (*cbf)(request, HT_PROG_DNS, HT_MSG_NULL,NULL,hostname,NULL); +#ifdef HAVE_GETHOSTBYNAME_R_5 hostelement = gethostbyname_r(hostname, &result, buffer, HOSTENT_MAX, &thd_errno); +#elif defined(HAVE_GETHOSTBYNAME_R_6) + gethostbyname_r(hostname, &result, buffer, + HOSTENT_MAX, &hostelement, &thd_errno); + +#elif defined(HAVE_GETHOSTBYNAME_R_3) + if (gethostbyname_r(hostname, &result, &hdata) == 0) { + hostelement = &result; + } + else { + hostelement = NULL; + } #else if (cbf) (*cbf)(request, HT_PROG_DNS, HT_MSG_NULL,NULL,hostname,NULL); hostelement = gethostbyname(hostname); @@ -325,6 +335,9 @@ char buffer[HOSTENT_MAX]; struct hostent result; /* For gethostbyaddr_r */ #endif +#ifdef HAVE_GETHOSTBYADDR_R_5 + struct hostent_data hdata; +#endif #ifdef DECNET /* Decnet ain't got no damn name server 8#OO */ return NULL; @@ -333,19 +346,29 @@ return NULL; iaddr = &(((struct sockaddr_in *)&addr)->sin_addr); -#ifdef HT_REENTRANT +#ifdef HAVE_GETHOSTBYADDR_R_7 phost = gethostbyaddr_r((char *) iaddr, sizeof(struct in_addr), AF_INET, &result, buffer, HOSTENT_MAX, &thd_errno); +#elif defined(HAVE_GETHOSTBYADDR_R_8) + gethostbyaddr_r((char *) iaddr, sizeof(struct in_addr), AF_INET, + &result, buffer, HOSTENT_MAX, &phost, &thd_errno); +#elif defined(HAVE_GETHOSTBYADDR_R_5) + if(gethostbyaddr_r((char *) iaddr, sizeof(struct in_addr), AF_INET, + &result, &hdata)==0) { + phost=&result; + } + else { + phost = NULL; + } #else phost = gethostbyaddr((char *) iaddr, sizeof(struct in_addr), AF_INET); #endif if (!phost) { - if (PROT_TRACE) - HTTrace("TCP......... Can't find internet node name for peer!!\n"); + HTTRACE(PROT_TRACE, "TCP......... Can't find internet node name for peer!!\n"); return NULL; } StrAllocCopy(name, phost->h_name); - if (PROT_TRACE) HTTrace("TCP......... Peer name is `%s'\n", name); + HTTRACE(PROT_TRACE, "TCP......... Peer name is `%s'\n" _ name); return name; #endif /* not DECNET */ diff -Naur xdvik-22.40l/libs/libwww/HTDNS.h xdvik-22.40n/libs/libwww/HTDNS.h --- xdvik-22.40l/libs/libwww/HTDNS.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDNS.h Fri Sep 13 00:23:45 2002 @@ -31,8 +31,7 @@ TTL This module is implemented by HTDNS.c, and it is a -part of the W3C Sample Code -Library. +part of the W3C Sample Code Library. */ #ifndef HTDNS_H @@ -48,7 +47,12 @@ DNS Cache Expiration Time . -When to remove an entry in the cache. The default value is 12h. +When to remove an entry in the DNS cache. We maintain our own DNS cache as +we keep track of the connect time, pick the fastet host on multi-homed hosts +etc. However we DO NOT HONOR DNS TTL Records which is the +reason for why the expiration must be faily short (the default value is 30 +mins), so that it doesn't collide with the DNS mechanism for timing out DNS +records befoew swapping IP addresses around. */ extern void HTDNS_setTimeout (time_t timeout); @@ -85,9 +89,8 @@ Delete ALL DNS objects ) -This function is called from -HTLibTerminate. It can be called at any point in time if the DNS cache -is going to be flushed. +This function is called from HTLibTerminate. It +can be called at any point in time if the DNS cache is going to be flushed. */ extern BOOL HTDNS_deleteAll (void); @@ -144,6 +147,6 @@ - @(#) $Id: HTDNS.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ + @(#) $Id: HTDNS.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTDemux.c xdvik-22.40n/libs/libwww/HTDemux.c --- xdvik-22.40l/libs/libwww/HTDemux.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDemux.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTDemux.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTDemux.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This stream parses MUX headers. ** @@ -65,7 +65,7 @@ } length = HTMIN(len, me->next); sid = MUX_GET_SID(header[0]); - if (MUX_TRACE) HTTrace("Demux stream Header: %x, sid %d, length %d\n", header[0], length, sid); + HTTRACE(MUX_TRACE, "Demux stream Header: %x, sid %d, length %d\n" _ header[0] _ length _ sid); /* ** If this is a control message then handle it here diff -Naur xdvik-22.40l/libs/libwww/HTDemux.h xdvik-22.40n/libs/libwww/HTDemux.h --- xdvik-22.40l/libs/libwww/HTDemux.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDemux.h Fri Sep 13 00:23:45 2002 @@ -50,6 +50,6 @@ - @(#) $Id: HTDemux.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ + @(#) $Id: HTDemux.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTDescpt.c xdvik-22.40n/libs/libwww/HTDescpt.c --- xdvik-22.40l/libs/libwww/HTDescpt.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDescpt.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTDescpt.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTDescpt.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** Authors: ** AL Ari Luotonen @@ -47,13 +47,11 @@ sprintf(name, "%s/%s", dirname, HTDescriptionFile); fp = fopen(name, "r"); if (!fp) { - if (PROT_TRACE) - HTTrace("DirBrowse... No description file %s\n", name); + HTTRACE(PROT_TRACE, "DirBrowse... No description file %s\n" _ name); HT_FREE(name); return NULL; } else { - if (WWWTRACE) - HTTrace("DirBrowse... Description file found %s\n", name); + HTTRACE(PROT_TRACE, "DirBrowse... Description file found %s\n" _ name); } list = HTList_new(); @@ -89,8 +87,7 @@ HT_OUTOFMEM("HTDirReadDescriptions"); sprintf(stuff, "%s %s", t, d); HTList_addObject(list, (void*)stuff); - if (PROT_TRACE) - HTTrace("Description. %s\n", stuff); + HTTRACE(PROT_TRACE, "Description. %s\n" _ stuff); } } fclose(fp); @@ -128,9 +125,8 @@ HT_FREE(ret); /* from previous call */ - if (PROT_TRACE) - HTTrace("HTPeekTitle. called, dirname=%s filename=%s\n", - dirname ? dirname : "-null-", + HTTRACE(PROT_TRACE, "HTPeekTitle. called, dirname=%s filename=%s\n" _ + dirname ? dirname : "-null-" _ filename ? filename : "-null-"); if (!dirname || !filename) return NULL; @@ -141,8 +137,7 @@ fp = fopen(name, "r"); if (!fp) { - if (PROT_TRACE) - HTTrace("HTPeekTitle. fopen failed\n"); + HTTRACE(PROT_TRACE, "HTPeekTitle. fopen failed\n"); goto cleanup; } @@ -181,9 +176,8 @@ } cleanup: - if (PROT_TRACE) - HTTrace("HTPeekTitle. returning %c%s%c\n", - ret ? '"' : '-', ret ? ret : "null", ret ? '"' : '-'); + HTTRACE(PROT_TRACE, "HTPeekTitle. returning %c%s%c\n" _ + ret ? '"' : '-' _ ret ? ret : "null" _ ret ? '"' : '-'); HT_FREE(name); return ret; } diff -Naur xdvik-22.40l/libs/libwww/HTDescpt.h xdvik-22.40n/libs/libwww/HTDescpt.h --- xdvik-22.40l/libs/libwww/HTDescpt.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDescpt.h Fri Sep 13 00:23:45 2002 @@ -130,7 +130,7 @@ -@(#) $Id: HTDescpt.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +@(#) $Id: HTDescpt.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTDialog.c xdvik-22.40n/libs/libwww/HTDialog.c --- xdvik-22.40l/libs/libwww/HTDialog.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDialog.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTDialog.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTDialog.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This module provides a default implementation of the application part ** of the Message and Dialog part or the Library. You do not have to do @@ -253,7 +253,7 @@ { char * msg = HTDialog_progressMessage(request, op, msgnum, dfault, input); if (msg) { - HTTrace("%s\n", msg); + HTPrint("%s\n", msg); HT_FREE(msg); } return YES; @@ -264,13 +264,10 @@ HTAlertPar * reply) { char response[4]; /* One more for terminating NULL -- AL */ - HTTrace("%s", HTDialogs[msgnum]); - if (input) HTTrace(" (%s)", (char *) input); - HTTrace(" (y/n) "); -#ifndef NO_STDIO - if (fgets(response, 4, stdin)) /* get reply, max 3 chars */ -#endif - { + HTPrint("%s", HTDialogs[msgnum]); + if (input) HTPrint(" (%s)", (char *) input); + HTPrint(" (y/n) "); + if (fgets(response, 4, stdin)) { /* get reply, max 3 chars */ char *ptr = response; while (*ptr) { if (*ptr == '\n') { @@ -292,11 +289,10 @@ int msgnum, const char * dfault, void * input, HTAlertPar * reply) { - HTTrace("%s ", HTDialogs[msgnum]); - if (input) HTTrace(" (%s) ", (char *) input); - if (dfault) HTTrace("(RETURN for [%s]) ", (char *) dfault); + HTPrint("%s ", HTDialogs[msgnum]); + if (input) HTPrint(" (%s) ", (char *) input); + if (dfault) HTPrint("(RETURN for [%s]) ", (char *) dfault); if (reply && msgnum>=0) { -#ifndef NO_STDIO char buffer[200]; if (!fgets(buffer, 200, stdin)) return NO; buffer[strlen(buffer)-1] = '\0'; /* Overwrite newline */ @@ -307,7 +303,6 @@ else return NO; return YES; -#endif } return NO; } @@ -331,7 +326,7 @@ */ char buffer[100]; memset(buffer, '\0', 100); - HTTrace("%s ", HTDialogs[msgnum]); + HTPrint("%s ", HTDialogs[msgnum]); if (!fgets(buffer, 99, stdin)) return NO; buffer[strlen(buffer)-1] = '\0'; /* Overwrite newline */ if (*buffer) { @@ -370,7 +365,7 @@ { char * msg = HTDialog_errorMessage(request, op, msgnum, dfault, input); if (msg) { - HTTrace("%s\n", msg); + HTPrint("%s\n", msg); HT_FREE(msg); } return YES; diff -Naur xdvik-22.40l/libs/libwww/HTDialog.h xdvik-22.40n/libs/libwww/HTDialog.h --- xdvik-22.40l/libs/libwww/HTDialog.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDialog.h Fri Sep 13 00:23:45 2002 @@ -1,6 +1,6 @@ /* - W3C Sample Code Library libwww messages and dialogs + W3C Sample Code Library libwww Messages and Dialogs ! @@ -26,15 +26,152 @@ Library. */ -#ifndef HTMSG_H -#define HTMSG_H +#ifndef HTDIALOG_H +#define HTDIALOG_H #include "WWWLib.h" /* . - English Error Messages and Progress Notifications + Default English Error Messages and Progress Notifications . +The following functions provide a default set of error messages and prompts +in plain English. You can of course change this as you like. +( + Default English User Prompts and Questions +) + +This list corresponds to the enumeration list defined in the +HTAlert module +*/ + +#define HT_MSG_ENGLISH_INITIALIZER \ + "Please enter username:", \ + "Please enter username for proxy authentication:", \ + "Please enter username for this FTP server:", \ + "Password:", \ + "Please give name of file to save in:", \ + "Plase enter account:", \ + "You might not be allowed to use this method here, continue?", \ + "Location has moved, continue?", \ + "A new set of rules is requested to be added to your setup - continue?", \ + "This file already exists - replace existing file?", \ + "Authentication failed - retry?", \ + "Proxy authentication failed - retry?", \ + "This method has already been performed - repeat operation?", \ + "This document is very big - continue operation?", \ + "The source document for this operation has moved - continue operation \ +with new location?", \ + "The destination document for this operation has moved - continue \ +operation with new location?", \ + "A redirection may change the behavior of this method - proceed anyway?", \ + "An automatic request for changing proxy has been encountered - continue?", \ + "The persistent cache is already in use by another user. If this is not \ +the case then you can manually delete this lock and restart.", \ + "The server has sent you a cookie - accept?" + +/* +( + Default English Messages and Progress Notifications +) + +This list corresponds to the enumeration list defined in the +HTError module +*/ + +/* CODE ERROR MESSAGE ERROR URL */ +#define HTERR_ENGLISH_INITIALIZER \ + { 100, "Continue", "information" }, \ + { 101, "Switching Protocols", "information" }, \ + { 200, "OK", "success" }, \ + { 201, "Created", "success" }, \ + { 202, "Accepted", "success" }, \ + { 203, "Non-authoritative Information", "success" }, \ + { 204, "Document Updated", "success" }, \ + { 205, "Reset Content", "success" }, \ + { 206, "Partial Content", "success" }, \ + { 207, "Partial Update OK", "success" }, \ + { 300, "Multiple Choices", "redirection" }, \ + { 301, "Moved Permanently", "redirection" }, \ + { 302, "Found", "redirection" }, \ + { 303, "See Other", "redirection" }, \ + { 304, "Not Modified", "redirection" }, \ + { 305, "Use Proxy", "redirection" }, \ + { 306, "Proxy Redirect", "redirection" }, \ + { 307, "Temporary Redirect", "redirection" }, \ + { 400, "Bad Request", "client_error" }, \ + { 401, "Unauthorized", "client_error" }, \ + { 402, "Payment Required", "client_error" }, \ + { 403, "Forbidden", "client_error" }, \ + { 404, "Not Found", "client_error" }, \ + { 405, "Method Not Allowed", "client_error" }, \ + { 406, "Not Acceptable", "client_error" }, \ + { 407, "Proxy Authentication Required", "client_error" }, \ + { 408, "Request Timeout", "client_error" }, \ + { 409, "Conflict", "client_error" }, \ + { 410, "Gone", "client_error" }, \ + { 411, "Length Required", "client_error" }, \ + { 412, "Precondition Failed", "client_error" }, \ + { 413, "Request Entity Too Large", "client_error" }, \ + { 414, "Request-URI Too Large", "client_error" }, \ + { 415, "Unsupported Media Type", "client_error" }, \ + { 416, "Range Not Satisfiable", "client_error" }, \ + { 417, "Expectation Failed", "client_error" }, \ + { 418, "Reauthentication Required", "client_error" }, \ + { 419, "Proxy Reauthentication Reuired", "client_error" }, \ + { 500, "Internal Server Error", "server_error" }, \ + { 501, "Not Implemented", "server_error" }, \ + { 502, "Bad Gateway", "server_error" }, \ + { 503, "Service Unavailable", "server_error" }, \ + { 504, "Gateway Timeout", "server_error" }, \ + { 505, "HTTP Version not supported", "server_error" }, \ + { 506, "Partial update Not Implemented", "server_error" }, \ + \ + /* Cache Warnings */ \ + { 10, "Response is Stale", "cache" }, \ + { 11, "Revalidation Failed", "cache" }, \ + { 12, "Disconnected Opeartion", "cache" }, \ + { 13, "Heuristic Expiration", "cache" }, \ + { 14, "Transformation Applied", "cache" }, \ + { 99, "Cache warning", "cache" }, \ + \ + /* Non-HTTP Error codes and warnings */ \ + { 0, "Can't locate remote host", "internal" }, \ + { 0, "No host name found", "internal" }, \ + { 0, "No file name found or file not accessible", "internal" }, \ + { 0, "FTP server replies", "internal" }, \ + { 0, "FTP server doesn't reply", "internal" }, \ + { 0, "FTP login failure", "internal" }, \ + { 0, "Server timed out", "internal" }, \ + { 0, "Gopher-server replies", "internal" }, \ + { 0, "Data transfer interrupted", "internal" }, \ + { 0, "Connection establishment interrupted", "internal" }, \ + { 0, "CSO-server replies", "internal" }, \ + { 0, "This is probably a HTTP server 0.9 or less","internal" }, \ + { 0, "Bad, Incomplete, or Unknown Response", "internal" }, \ + { 0, "Unknown access authentication scheme", "internal" }, \ + { 0, "News-server replies", "internal" }, \ + { 0, "Trying `ftp://' instead of `file://'", "internal" }, \ + { 0, "Too many redirections", "internal" }, \ + { 0, "Method not suited for automatic redirection","internal" }, \ + { 0, "Premature End Of File", "internal" }, \ + { 0, "Response from WAIS Server too Large - Extra lines \ +ignored","internal"}, \ + { 0, "WAIS-server doesn't return any data", "internal" }, \ + { 0, "Can't connect to WAIS-server", "internal" }, \ + { 0, "operation failed", "internal" }, \ + { 0, "Wrong or unknown access scheme", "internal" }, \ + { 0, "Access scheme not allowed in this context", "internal" }, \ + { 0, "When you are connected, you can log in", "internal" }, \ + { 0, "This version has expired and will be automatically reloaded", "internal" }, \ + { 0, "Loading new rules must be explicitly acknowledged", "internal" }, \ + { 0, "Automatic proxy redirection must be explicitly acknowledged", "internal" } + +/* +( + Generate a Default Error Message +) + This function provides an unformatted English string containing the possibly nested status message that explains the result of a request. This is essentially "flattening out" the information provided in the request @@ -46,6 +183,9 @@ void * input); /* +( + Generate a Default Progress Notification Message +) This function provides a string containin an English progress message that the application can present to the user if desired. The string must be freed @@ -169,12 +309,12 @@ /* */ -#endif /* HTHOME_H */ +#endif /* HTDIALOG_H */ /* - @(#) $Id: HTDialog.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ + @(#) $Id: HTDialog.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTDigest.c xdvik-22.40n/libs/libwww/HTDigest.c --- xdvik-22.40l/libs/libwww/HTDigest.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDigest.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT W3C/INRIA 1998. ** Please first read the full copyright statement in the file COPYRIGHT. -** @(#) $Id: HTDigest.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTDigest.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** Contains a generic interface to the message digest algorithms, ** inspired from the RSA-Euro toolkit. For the moment, it only @@ -40,27 +40,35 @@ PUBLIC BOOL HTDigest_update (HTDigestContext *context, char *input, unsigned int inputLen) { - switch (context->algorithm) { - case HTDaMD5: - MD5Update (&context->context.md5, (unsigned char *) input, - inputLen); - break; - default: - return NO; - break; - } + if (context) { + switch (context->algorithm) { + case HTDaMD5: + MD5Update (&context->context.md5, (unsigned char *) input, + inputLen); + break; + default: + return NO; + break; + } + return YES; + } + return NO; } PUBLIC BOOL HTDigest_final (unsigned char *digest, HTDigestContext *context) { - switch (context->algorithm) { - case HTDaMD5: - MD5Final (digest, &context->context.md5); - break; - default: - return NO; - break; + if (context) { + switch (context->algorithm) { + case HTDaMD5: + MD5Final (digest, &context->context.md5); + break; + default: + return NO; + break; + } + return YES; } + return NO; } diff -Naur xdvik-22.40l/libs/libwww/HTDigest.h xdvik-22.40n/libs/libwww/HTDigest.h --- xdvik-22.40l/libs/libwww/HTDigest.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDigest.h Fri Sep 13 00:23:45 2002 @@ -23,7 +23,7 @@ used during message digest authentication. AUTHORS: - JKO Jose Kahan jose@w3.org + JK Jose Kahan jose@w3.org HISTORY: Dec 98 JK Created the module from scratch @@ -82,7 +82,7 @@ - @(#) $Id: HTDigest.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ + @(#) $Id: HTDigest.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTDir.c xdvik-22.40n/libs/libwww/HTDir.c --- xdvik-22.40l/libs/libwww/HTDir.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDir.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTDir.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTDir.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This is unix-specific code in general ** The module is intended for use in HTFile.c and HTFTP.c where @@ -23,6 +23,7 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWCore.h" +#include "WWWFile.h" #include "WWWHTML.h" #include "HTIcons.h" #include "HTDescpt.h" @@ -302,8 +303,9 @@ } *tp = '\0'; PUTS(dir->lnbuf); + END(HTML_PRE); START(HTML_HR); - PUTC('\n'); + START(HTML_PRE); return YES; } return NO; @@ -378,8 +380,7 @@ StrAllocCopy(dir->base, ++ptr); StrAllocCat(dir->base, "/"); } - if (PROT_TRACE) - HTTrace("HTDir_new... base is `%s\'\n", dir->base ? dir->base : ""); + HTTRACE(PROT_TRACE, "HTDir_new... base is `%s\'\n" _ dir->base ? dir->base : ""); HT_FREE(addr); HT_FREE(path); } @@ -480,7 +481,7 @@ if (!dir) return NO; if (dir->key != HT_DK_NONE) { HTArray *array = dir->array; - void **data; + void **data = NULL; HTDirNode *node; HTDir_headLine(dir); HTArray_sort(array, (dir->key==HT_DK_CINS ? DirCaseSort : DirSort)); @@ -497,7 +498,9 @@ /* Put out the end of the HTML stuff */ { HTStructured *target = dir->target; + END(HTML_PRE); START(HTML_HR); + START(HTML_PRE); if (!dir->size) PUTS("Empty directory"); else if (dir->size == 1) diff -Naur xdvik-22.40l/libs/libwww/HTDir.h xdvik-22.40n/libs/libwww/HTDir.h --- xdvik-22.40l/libs/libwww/HTDir.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTDir.h Fri Sep 13 00:23:45 2002 @@ -136,7 +136,7 @@ -@(#) $Id: HTDir.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +@(#) $Id: HTDir.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTEPtoCl.c xdvik-22.40n/libs/libwww/HTEPtoCl.c --- xdvik-22.40l/libs/libwww/HTEPtoCl.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTEPtoCl.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTEPtoCl.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTEPtoCl.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This module contains the interface between the ** the XParse module and the client. The dummy function is diff -Naur xdvik-22.40l/libs/libwww/HTEPtoCl.h xdvik-22.40n/libs/libwww/HTEPtoCl.h --- xdvik-22.40l/libs/libwww/HTEPtoCl.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTEPtoCl.h Fri Sep 13 00:23:45 2002 @@ -1,15 +1,14 @@ /* - W3C Sample Code Library libwww callback stream + + + + W3C Sample Code Library libwww Callback Stream Callbacks - - - - - -!EPtoClient: interface between the XParse module and the Client! - +! + External Parser Callbacks +! */ /* @@ -19,14 +18,15 @@ /* -This module contains the interface between the XParse module and -the client. The dummy function is only here so that clients that use -the XParse module can overwrite it. See also HTXParse - -This module is implemented by HTEPtoCl.c, -and it is a part of the -W3C Sample Code Library. - +An interface between the XParse module and the +Application. This module contains the interface between the XParse module +and the client. The dummy function is only here so that clients that use +the XParse module can overwrite it. See also +HTXParse + +This module is implemented by HTEPtoCl.c, and it +is a part of the W3C Sample Code +Library. */ #ifndef HTEPTOCLIENT_H @@ -41,9 +41,8 @@ /* + - -@(#) $Id: HTEPtoCl.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ - + @(#) $Id: HTEPtoCl.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTError.c xdvik-22.40n/libs/libwww/HTError.c --- xdvik-22.40l/libs/libwww/HTError.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTError.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTError.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTError.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** This is the implementaion of an error message reporting system that ** reports errors occured either in a stream module (structured streams @@ -68,13 +68,11 @@ newError->length = length; } newError->where = where; - if (CORE_TRACE) { - HTTrace("Error....... Add %3d\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n", - element, - newError->severity, - newError->par ? (char *) newError->par : "Unspecified", - newError->where ? newError->where : "Unspecified"); - } + HTTRACE(CORE_TRACE, "Error....... Add %3d\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n" _ + element _ + newError->severity _ + newError->par ? (char *) newError->par : "Unspecified" _ + newError->where ? newError->where : "Unspecified"); return HTList_addObject(list, (void *) newError); } @@ -133,7 +131,7 @@ if (list) { HTError * old = (HTError *) HTList_removeLastObject(list); if (old) { - if (CORE_TRACE) HTTrace("Error....... Delete %p\n", old); + HTTRACE(CORE_TRACE, "Error....... Delete %p\n" _ old); HT_FREE(old->par); HT_FREE(old); return YES; @@ -152,7 +150,7 @@ if (list) { HTError * last = (HTError *) HTList_lastObject(list); if (last) { - if (CORE_TRACE) HTTrace("Error....... Ignore %p\n", last); + HTTRACE(CORE_TRACE, "Error....... Ignore %p\n" _ last); last->ignore = YES; return YES; } @@ -214,7 +212,7 @@ HTError * pres; while ((pres = (HTError *) HTList_nextObject(cur))) { if (pres->severity < severity) { - if (CORE_TRACE) HTTrace("Severity.... Found a severe error\n"); + HTTRACE(CORE_TRACE, "Severity.... Found a severe error\n"); return YES; } } diff -Naur xdvik-22.40l/libs/libwww/HTError.h xdvik-22.40n/libs/libwww/HTError.h --- xdvik-22.40l/libs/libwww/HTError.h Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTError.h Fri Sep 13 00:23:45 2002 @@ -47,15 +47,8 @@ /* . - Error Codes and Messages -. - -Note: All non-HTTP error codes have (index number > -HTERR_HTTP_CODES), and they will not be shown in the error-message -generated. -( The Error Message Object -) +. An error consists of a messsage code, a short, natural language specific message, and a URI which can point to more information. This module also @@ -76,8 +69,14 @@ Error Message Index ) +Note: All non-HTTP error codes have (index number > +HTERR_HTTP_CODES), and they will not be shown in the error-message +generated. + Error codes are registered in an array where the following enumerations serve -as an index. They must not be replaced! +as an index. They must not be replaced! See the +HTDialog module for default initialization +of these messages. */ typedef enum _HTErrorElement { @@ -127,6 +126,14 @@ HTERR_BAD_VERSION, /* 505 */ HTERR_NO_PARTIAL_UPDATE, /* 506 */ +#ifdef HT_DAV + /* WebDAV error codes */ + HTERR_UNPROCESSABLE, /* 422 */ + HTERR_LOCKED, /* 423 */ + HTERR_FAILED_DEPENDENCY, /* 424 */ + HTERR_INSUFFICIENT_STORAGE, /* 507 */ +#endif + /* Cache warnings */ HTERR_STALE, /* 10 */ HTERR_REVALIDATION_FAILED, /* 11 */ @@ -174,99 +181,9 @@ ) Default set of error messages arranged in an array into which the -index codes serve as index. These error objects can -of course be initialized as you like. -*/ - -/* CODE ERROR MESSAGE ERROR URL */ -#define HTERR_ENGLISH_INITIALIZER \ - { 100, "Continue", "information" }, \ - { 101, "Switching Protocols", "information" }, \ - { 200, "OK", "success" }, \ - { 201, "Created", "success" }, \ - { 202, "Accepted", "success" }, \ - { 203, "Non-authoritative Information", "success" }, \ - { 204, "Document Updated", "success" }, \ - { 205, "Reset Content", "success" }, \ - { 206, "Partial Content", "success" }, \ - { 207, "Partial Update OK", "success" }, \ - { 300, "Multiple Choices", "redirection" }, \ - { 301, "Moved Permanently", "redirection" }, \ - { 302, "Found", "redirection" }, \ - { 303, "See Other", "redirection" }, \ - { 304, "Not Modified", "redirection" }, \ - { 305, "Use Proxy", "redirection" }, \ - { 306, "Proxy Redirect", "redirection" }, \ - { 307, "Temporary Redirect", "redirection" }, \ - { 400, "Bad Request", "client_error" }, \ - { 401, "Unauthorized", "client_error" }, \ - { 402, "Payment Required", "client_error" }, \ - { 403, "Forbidden", "client_error" }, \ - { 404, "Not Found", "client_error" }, \ - { 405, "Method Not Allowed", "client_error" }, \ - { 406, "Not Acceptable", "client_error" }, \ - { 407, "Proxy Authentication Required", "client_error" }, \ - { 408, "Request Timeout", "client_error" }, \ - { 409, "Conflict", "client_error" }, \ - { 410, "Gone", "client_error" }, \ - { 411, "Length Required", "client_error" }, \ - { 412, "Precondition Failed", "client_error" }, \ - { 413, "Request Entity Too Large", "client_error" }, \ - { 414, "Request-URI Too Large", "client_error" }, \ - { 415, "Unsupported Media Type", "client_error" }, \ - { 416, "Range Not Satisfiable", "client_error" }, \ - { 417, "Expectation Failed", "client_error" }, \ - { 418, "Reauthentication Required", "client_error" }, \ - { 419, "Proxy Reauthentication Reuired", "client_error" }, \ - { 500, "Internal Server Error", "server_error" }, \ - { 501, "Not Implemented", "server_error" }, \ - { 502, "Bad Gateway", "server_error" }, \ - { 503, "Service Unavailable", "server_error" }, \ - { 504, "Gateway Timeout", "server_error" }, \ - { 505, "HTTP Version not supported", "server_error" }, \ - { 506, "Partial update Not Implemented", "server_error" }, \ - \ - /* Cache Warnings */ \ - { 10, "Response is Stale", "cache" }, \ - { 11, "Revalidation Failed", "cache" }, \ - { 12, "Disconnected Opeartion", "cache" }, \ - { 13, "Heuristic Expiration", "cache" }, \ - { 14, "Transformation Applied", "cache" }, \ - { 99, "Cache warning", "cache" }, \ - \ - /* Non-HTTP Error codes and warnings */ \ - { 0, "Can't locate remote host", "internal" }, \ - { 0, "No host name found", "internal" }, \ - { 0, "No file name found or file not accessible", "internal" }, \ - { 0, "FTP server replies", "internal" }, \ - { 0, "FTP server doesn't reply", "internal" }, \ - { 0, "FTP login failure", "internal" }, \ - { 0, "Server timed out", "internal" }, \ - { 0, "Gopher-server replies", "internal" }, \ - { 0, "Data transfer interrupted", "internal" }, \ - { 0, "Connection establishment interrupted", "internal" }, \ - { 0, "CSO-server replies", "internal" }, \ - { 0, "This is probably a HTTP server 0.9 or less","internal" }, \ - { 0, "Bad, Incomplete, or Unknown Response", "internal" }, \ - { 0, "Unknown access authentication scheme", "internal" }, \ - { 0, "News-server replies", "internal" }, \ - { 0, "Trying `ftp://' instead of `file://'", "internal" }, \ - { 0, "Too many redirections", "internal" }, \ - { 0, "Method not suited for automatic redirection","internal" }, \ - { 0, "Premature End Of File", "internal" }, \ - { 0, "Response from WAIS Server too Large - Extra lines \ -ignored","internal"}, \ - { 0, "WAIS-server doesn't return any data", "internal" }, \ - { 0, "Can't connect to WAIS-server", "internal" }, \ - { 0, "operation failed", "internal" }, \ - { 0, "Wrong or unknown access scheme", "internal" }, \ - { 0, "Access scheme not allowed in this context", "internal" }, \ - { 0, "When you are connected, you can log in", "internal" }, \ - { 0, "This version has expired and will be automatically reloaded", "internal" }, \ - { 0, "Loading new rules must be explicitly acknowledged", "internal" }, \ - { 0, "Automatic proxy redirection must be explicitly acknowledged", "internal" } - -/* +index codes serve as index. See the +HTDialog module for default initialization +of these strings. . What Errors should be Ignored or Passed Through? . @@ -436,12 +353,12 @@ /* */ -#endif +#endif /* HTERROR_H */ /* - @(#) $Id: HTError.h,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ + @(#) $Id: HTError.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTEscape.c xdvik-22.40n/libs/libwww/HTEscape.c --- xdvik-22.40l/libs/libwww/HTEscape.c Mon Apr 30 13:12:24 2001 +++ xdvik-22.40n/libs/libwww/HTEscape.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTEscape.c,v 1.2 2001/04/30 13:12:24 stefanulrich Exp $ +** @(#) $Id: HTEscape.c,v 1.2.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** history: ** Nov 13 94 Spawned from HTParse, as it then can be used in utility @@ -57,9 +57,7 @@ ** Unlike HTUnEscape(), this routine returns a HT_MALLOCed string. ** */ -PUBLIC char * HTEscape (str, mask) - const char * str; - HTURIEncoding mask; +PUBLIC char * HTEscape (const char * str, HTURIEncoding mask) { const char * p; char * q; @@ -85,8 +83,7 @@ } -PUBLIC char HTAsciiHexToChar (c) - char c; +PUBLIC char HTAsciiHexToChar (char c) { return c >= '0' && c <= '9' ? c - '0' : c >= 'A' && c <= 'F'? c - 'A' + 10 @@ -101,15 +98,13 @@ ** the acsii hex code for character 16x+y. ** The string is converted in place, as it will never grow. */ -PUBLIC char * HTUnEscape (str) - char *str; +PUBLIC char * HTUnEscape (char * str) { char * p = str; char * q = str; if (!str) { /* Just for safety ;-) */ - if (URI_TRACE) - HTTrace("HTUnEscape.. Called with NULL argument.\n"); + HTTRACE(URI_TRACE, "HTUnEscape.. Called with NULL argument.\n"); return NULL; } while(*p) { diff -Naur xdvik-22.40l/libs/libwww/HTEscape.h xdvik-22.40n/libs/libwww/HTEscape.h --- xdvik-22.40l/libs/libwww/HTEscape.h Mon Apr 30 13:12:24 2001 +++ xdvik-22.40n/libs/libwww/HTEscape.h Fri Sep 13 00:23:45 2002 @@ -31,24 +31,6 @@ #ifndef HTESCAPE_H #define HTESCAPE_H -#undef NeedFunctionPrototypes -#define NeedFunctionPrototypes 0 - -/* These are for X headers */ -#ifndef NeedFunctionPrototypes -#if __STDC__ -#define NeedFunctionPrototypes 1 -#else /* STDC */ -#define NeedFunctionPrototypes 0 -#endif /* STDC */ -#endif /* NeedFunctionPrototypes */ - -#if NeedFunctionPrototypes -#define ARGS(x) x -#else -#define ARGS(x) () -#endif - /* . @@ -68,7 +50,7 @@ URL_DOSFILE = 0x8 /* As URL_URLPATH but allows ':' */ } HTURIEncoding; -extern char * HTEscape ARGS((const char *, HTURIEncoding)); +extern char * HTEscape (const char * str, HTURIEncoding mask); /* @@ -78,7 +60,7 @@ */ -extern char HTAsciiHexToChar ARGS((char)); +extern char HTAsciiHexToChar (char c); /* @@ -92,7 +74,7 @@ grow. */ -extern char * HTUnEscape ARGS((char *)); +extern char * HTUnEscape (char * str); /* */ @@ -103,6 +85,6 @@ - @(#) $Id: HTEscape.h,v 1.2 2001/04/30 13:12:24 stefanulrich Exp $ + @(#) $Id: HTEscape.h,v 1.2.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTEvent.c xdvik-22.40n/libs/libwww/HTEvent.c --- xdvik-22.40l/libs/libwww/HTEvent.c Wed Apr 18 14:23:13 2001 +++ xdvik-22.40n/libs/libwww/HTEvent.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1996. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTEvent.c,v 1.1.1.1 2001/04/18 14:23:13 stefanulrich Exp $ +** @(#) $Id: HTEvent.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** The event dispatcher allows applications to register their own event ** models. They may register the standard HTEventrg methods from @@ -27,13 +27,13 @@ PUBLIC void HTEvent_setRegisterCallback(HTEvent_registerCallback * registerCBF) { - if (CORE_TRACE) HTTrace("Event....... registering %p\n", registerCBF); + HTTRACE(CORE_TRACE, "Event....... registering %p\n" _ registerCBF); RegisterCBF = registerCBF; } PUBLIC void HTEvent_setUnregisterCallback(HTEvent_unregisterCallback * unregisterCBF) { - if (CORE_TRACE) HTTrace("Event....... registering %p\n", unregisterCBF); + HTTRACE(CORE_TRACE, "Event....... registering %p\n" _ unregisterCBF); UnregisterCBF = unregisterCBF; } @@ -45,7 +45,7 @@ PUBLIC int HTEvent_unregister (SOCKET s, HTEventType type) { if (!UnregisterCBF) { - if (CORE_TRACE) HTTrace("Event....... No handler registered\n"); + HTTRACE(CORE_TRACE, "Event....... No handler registered\n"); return -1; } return (*UnregisterCBF)(s, type); @@ -54,7 +54,7 @@ PUBLIC int HTEvent_register(SOCKET s, HTEventType type, HTEvent * event) { if (!RegisterCBF) { - if (CORE_TRACE) HTTrace("Event....... No handler registered\n"); + HTTRACE(CORE_TRACE, "Event....... No handler registered\n"); return -1; } return (*RegisterCBF)(s, type, event); @@ -78,9 +78,8 @@ me->param = context; me->priority = priority; me->millis = millis; - if (CORE_TRACE) - HTTrace("Event....... Created event %p with context %p, priority %d, and timeout %d\n", - me, context, priority, millis); + HTTRACE(CORE_TRACE, "Event....... Created event %p with context %p, priority %d, and timeout %d\n" _ + me _ context _ priority _ millis); return me; } return NULL; @@ -90,7 +89,7 @@ { if (me) { HT_FREE(me); - if (CORE_TRACE) HTTrace("Event....... Deleted event %p\n", me); + HTTRACE(CORE_TRACE, "Event....... Deleted event %p\n" _ me); return YES; } return NO; diff -Naur xdvik-22.40l/libs/libwww/HTEvent.h xdvik-22.40n/libs/libwww/HTEvent.h --- xdvik-22.40l/libs/libwww/HTEvent.h Wed Apr 18 14:23:14 2001 +++ xdvik-22.40n/libs/libwww/HTEvent.h Fri Sep 13 00:23:45 2002 @@ -241,6 +241,6 @@ - @(#) $Id: HTEvent.h,v 1.1.1.1 2001/04/18 14:23:14 stefanulrich Exp $ + @(#) $Id: HTEvent.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTEvtLst.c xdvik-22.40n/libs/libwww/HTEvtLst.c --- xdvik-22.40l/libs/libwww/HTEvtLst.c Wed Apr 18 14:23:14 2001 +++ xdvik-22.40n/libs/libwww/HTEvtLst.c Fri Sep 13 00:23:45 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTEvtLst.c,v 1.1.1.1 2001/04/18 14:23:14 stefanulrich Exp $ +** @(#) $Id: HTEvtLst.c,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ ** ** Updated HTEvent module ** This new module combines the functions of the old HTEvent module and @@ -36,118 +36,83 @@ #include "HTEvtLst.h" /* Implemented here */ /* Type definitions and global variables etc. local to this module */ -#define PRIME_TABLE_SIZE 67 #define MILLI_PER_SECOND 1000 -#define HASH(s) ((s) % PRIME_TABLE_SIZE) -#define HT_EVENT_ORDER /* use event ordering code */ -#define EVENTS_TO_EXECUTE 5 /* how many to execute in one select loop */ +#define HASH(s) ((s) % HT_M_HASH_SIZE) -#ifdef WWW_WIN_ASYNC -#define TIMEOUT 1 /* WM_TIMER id */ -PRIVATE HWND HTSocketWin; -PRIVATE unsigned long HTwinMsg; -#else /* WWW_WIN_ASYNC */ -PRIVATE fd_set FdArray[HTEvent_TYPES]; -PRIVATE SOCKET MaxSock = 0; /* max socket value in use */ -#endif /* !WWW_WIN_ASYNC */ +#define EVENTS_TO_EXECUTE 10 /* how many to execute in one select loop */ -#define HT_FD_BYTES(a) ((a/16)+1)*4 +#define HT_FS_BYTES(a) ((((a)/16)+1) * 4) typedef struct { SOCKET s ; /* our socket */ HTEvent * events[HTEvent_TYPES]; /* event parameters for read, write, oob */ -#ifndef IN_EVENT HTTimer * timeouts[HTEvent_TYPES]; -#endif } SockEvents; +typedef struct { + HTEvent * event; + SOCKET s; + HTEventType type; + HTPriority skipped; +} EventOrder; + typedef enum { SockEvents_mayCreate, SockEvents_find } SockEvents_action; -HTList * HashTable[PRIME_TABLE_SIZE]; +PRIVATE HTList * HashTable [HT_M_HASH_SIZE]; +PRIVATE HTList * EventOrderList = NULL; PRIVATE int HTEndLoop = 0; /* If !0 then exit event loop */ +PRIVATE BOOL HTInLoop = NO; +#ifdef WWW_WIN_ASYNC +#define TIMEOUT 1 /* WM_TIMER id */ +PRIVATE HWND HTSocketWin; +PRIVATE ATOM HTclass; +PRIVATE HINSTANCE HTinstance; +PRIVATE unsigned long HTwinMsg; +#else /* WWW_WIN_ASYNC */ +PRIVATE fd_set FdArray[HTEvent_TYPES]; +PRIVATE SOCKET MaxSock = 0; /* max socket value in use */ +#endif /* !WWW_WIN_ASYNC */ + +/* ------------------------------------------------------------------------- */ +/* DEBUG FUNCTIONS */ /* ------------------------------------------------------------------------- */ -#ifdef WWW_WIN_ASYNC -PRIVATE BOOL Timer_setWindowsTimer (HTTimer * timer) +#ifdef HTDEBUG +PRIVATE void Event_trace (HTEvent * event) { - HWND hwnd; - UINT id; - hwnd = HTEventList_getWinHandle(&id); - return SetTimer(hwnd, (UINT)timer, (UINT)HTTimer_getTime(timer), NULL) != 0; + if (event) { + HTTRACE(ALL_TRACE, "%8p: %3d %6d %8p %8p %8p" _ + event _ event->priority _ event->millis _ event->cbf _ + event->param _ event->request); + } } -PRIVATE BOOL Timer_deleteWindowsTimer (HTTimer * timer) +PRIVATE void Event_traceHead (void) { - HWND hwnd; - UINT id; - hwnd = HTEventList_getWinHandle(&id); - return KillTimer(hwnd, (UINT)timer) != 0; + HTTRACE(ALL_TRACE, " event: pri millis callback param request "); } -#endif /* WWW_WIN_ASYNC */ -PRIVATE SockEvents * SockEvents_get (SOCKET s, SockEvents_action action) +PRIVATE void Timer_trace (HTTimer * timer) { - long v = HASH(s); - HTList* cur; - SockEvents * pres; - - if (HashTable[v] == NULL) - HashTable[v] = HTList_new(); - cur = HashTable[v]; - while ((pres = (SockEvents *) HTList_nextObject(cur))) - if (pres->s == s) - return pres; - - if (action == SockEvents_mayCreate) { - if ((pres = (SockEvents *) HT_CALLOC(1, sizeof(SockEvents))) == NULL) - HT_OUTOFMEM("HTEventList_register"); - pres->s = s; - HTList_addObject(HashTable[v], (void *)pres); - return pres; + if (timer) { + HTTRACE(ALL_TRACE, "%8p: %6d %ld %c %8p" _ + timer _ + HTTimer_expiresAbsolute(timer) _ + HTTimer_expiresRelative(timer) _ + HTTimer_isRelative(timer) ? 'R' : 'A' _ + HTTimer_callback(timer)); } - return NULL; } -PUBLIC void HTEvent_traceHead(void) -{ - HTTrace(" event: pri millis callback param request "); -} -PUBLIC void HTEvent_trace(HTEvent * event) -{ - if (event == NULL) - return; - HTTrace("%8p: %3d %6d %8p %8p %8p", event, event->priority, event->millis, event->cbf, event->param, event->request); -} -PUBLIC void HTTimer_traceHead(void) -{ - HTTrace(" timer: millis expires ? param callback "); -} -PRIVATE char * MyTime(unsigned long int time, int len) +PRIVATE void Timer_traceHead (void) { -static char space[100]; - sprintf(space, "1234567"); - return space; + HTTRACE(ALL_TRACE, " timer: millis expires ? param callback "); } -struct _HTTimer { - HTTimer * next; /* The next guy in line */ - ms_t millis; /* Relative value in millis */ - ms_t expires; /* Absolute value in millis */ - BOOL relative; - void * param; /* Client supplied context */ - HTTimerCallback * cbf; -}; -PUBLIC void HTTimer_trace(HTTimer * timer) -{ - if (timer == NULL) - return; - HTTrace("%8p: %6d %7s %c %8p %8p", timer, timer->millis, MyTime(timer->expires, 7), - timer->relative == YES ? 'R' : 'A', timer->param, timer->cbf); -} /* ** A simple debug function that dumps all the socket arrays ** as trace messages @@ -157,108 +122,157 @@ int v = 0; HTList* cur; SockEvents * pres; -#if 0 - if (HashTable[v] == NULL) { - HTTrace("Event....... No sockets registered\n"); - return; - } -#endif - HTTrace("Event....... Dumping socket events\n"); - HTTrace("soc "); - HTEvent_traceHead(); - HTTrace(" "); - HTTimer_traceHead(); - HTTrace("\n"); - for (v = 0; v < PRIME_TABLE_SIZE; v++) { + HTTRACE(ALL_TRACE, "Event....... Dumping socket events\n"); + HTTRACE(ALL_TRACE, "soc "); + Event_traceHead(); + HTTRACE(ALL_TRACE, " "); + Timer_traceHead(); + HTTRACE(ALL_TRACE, "\n"); + for (v = 0; v < HT_M_HASH_SIZE; v++) { cur = HashTable[v]; while ((pres = (SockEvents *) HTList_nextObject(cur))) { int i; - HTTrace("%3d \n", pres->s); + HTTRACE(ALL_TRACE, "%3d \n" _ pres->s); for (i = 0; i < HTEvent_TYPES; i++) if (pres->events[i]) { static char * names[HTEvent_TYPES] = {"read", "writ", "xcpt"}; - HTTrace("%s ", names[i]); - HTEvent_trace(pres->events[i]); - HTTrace(" "); -#ifndef IN_EVENT - HTTimer_trace(pres->timeouts[i]); - HTTrace(" "); -#endif + HTTRACE(ALL_TRACE, "%s " _ names[i]); + Event_trace(pres->events[i]); + HTTRACE(ALL_TRACE, " "); + Timer_trace(pres->timeouts[i]); + HTTRACE(ALL_TRACE, " "); } - HTTrace("\n"); + HTTRACE(ALL_TRACE, "\n"); } } } +PRIVATE void fd_dump (SOCKET maxfs, fd_set * rset, fd_set * wset, fd_set * oset, + struct timeval * wt) +{ + SOCKET cnt; + + /* Check read set */ + HTTRACE(THD_TRACE, "............ READ :"); + for (cnt=0; cnt<=maxfs; cnt++) + if (FD_ISSET(cnt, rset)) HTTRACE(THD_TRACE, " %d" _ cnt); + HTTRACE(THD_TRACE, "\n"); + + /* Check write set */ + HTTRACE(THD_TRACE, "............ WRITE:"); + for (cnt=0; cnt<=maxfs; cnt++) + if (FD_ISSET(cnt, wset)) HTTRACE(THD_TRACE, " %d" _ cnt); + HTTRACE(THD_TRACE, "\n"); + + /* Check oob set */ + HTTRACE(THD_TRACE, "............ OOB :"); + for (cnt=0; cnt<=maxfs; cnt++) + if (FD_ISSET(cnt, oset)) HTTRACE(THD_TRACE, " %d" _ cnt); + HTTRACE(THD_TRACE, "\n"); + + if (wt) + HTTRACE(THD_TRACE, "............ Timeout is %ld s, %ld microsecs\n" _ + wt->tv_sec _ wt->tv_usec); +} +#endif /* HTDEBUG */ + /* ------------------------------------------------------------------------- */ -/* T I M E O U T H A N D L E R */ +/* EVENT TIMING FUNCTIONS */ +/* ------------------------------------------------------------------------- */ + +#ifdef WWW_WIN_ASYNC +PRIVATE BOOL Timer_setWindowsTimer (HTTimer * timer) +{ + UINT id; + HWND hwnd = HTEventList_getWinHandle(&id); + BOOL status = (SetTimer(hwnd, (UINT)timer, (UINT)HTTimer_getTime(timer), NULL) == 0) ? NO : YES; + return status; +} + +PRIVATE BOOL Timer_deleteWindowsTimer (HTTimer * timer) +{ + UINT id; + HWND hwnd = HTEventList_getWinHandle(&id); + BOOL status = (KillTimer(hwnd, (UINT)timer) == 0) ? NO : YES; + return status; +} +#endif /* WWW_WIN_ASYNC */ + +/* +** Event timeout handler +** If an event didn't occur before the timeout then call it explicitly +** indicating that it timed out. +*/ PRIVATE int EventListTimerHandler (HTTimer * timer, void * param, HTEventType type) { SockEvents * sockp = (SockEvents *) param; HTEvent * event = NULL; - /* HTMemLog_flush(); keep around - very useful for debugging crashes - EGP */ -#ifdef IN_EVENT - if (sockp->events[HTEvent_INDEX(HTEvent_READ)]->timer == timer) -#else /* IN_EVENT */ - if (sockp->timeouts[HTEvent_INDEX(HTEvent_READ)] == timer) -#endif /* !IN_EVENT */ - { + + /* Check for read timeout */ + if (sockp->timeouts[HTEvent_INDEX(HTEvent_READ)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_READ)]; - if (THD_TRACE) HTTrace("Event....... READ timed out on %d.\n", sockp->s); + HTTRACE(THD_TRACE, "Event....... READ timed out on %d.\n" _ sockp->s); return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); } -#ifdef IN_EVENT - if (sockp->events[HTEvent_INDEX(HTEvent_WRITE)]->timer == timer) -#else /* IN_EVENT */ - if (sockp->timeouts[HTEvent_INDEX(HTEvent_WRITE)] == timer) -#endif /* !IN_EVENT */ - { + + /* Check for write timeout */ + if (sockp->timeouts[HTEvent_INDEX(HTEvent_WRITE)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_WRITE)]; - if (THD_TRACE) HTTrace("Event....... WRITE timed out on %d.\n", sockp->s); + HTTRACE(THD_TRACE, "Event....... WRITE timed out on %d.\n" _ sockp->s); return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); } -#ifdef IN_EVENT - if (sockp->events[HTEvent_INDEX(HTEvent_OOB)]->timer == timer) -#else /* IN_EVENT */ - if (sockp->timeouts[HTEvent_INDEX(HTEvent_OOB)] == timer) -#endif /* !IN_EVENT */ - { + + /* Check for out-of-band data timeout */ + if (sockp->timeouts[HTEvent_INDEX(HTEvent_OOB)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_OOB)]; - if (THD_TRACE) HTTrace("Event....... OOB timed out on %d.\n", sockp->s); + HTTRACE(THD_TRACE, "Event....... OOB timed out on %d.\n" _ sockp->s); return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); } - if (THD_TRACE) - HTTrace("Event....... Can't find event for timer %p with context %p\n", - timer, param); + HTTRACE(THD_TRACE, "Event....... No event for timer %p with context %p\n" _ timer _ param); return HT_ERROR; } +PUBLIC void CheckSockEvent (HTTimer * timer, HTTimerCallback * cbf, void * param) +{ + SockEvents * sockp = (SockEvents *)param; + if (cbf == EventListTimerHandler && + sockp->timeouts[0] != timer && + sockp->timeouts[1] != timer && + sockp->timeouts[2] != timer) { + HTDEBUGBREAK("Bad timer %p\n" _ timer); + } +} + +/* ------------------------------------------------------------------------- */ +/* EVENT ORDERING STUFF */ /* ------------------------------------------------------------------------- */ -/* E V E N T O R D E R I N G S T U F F */ -#ifdef HT_EVENT_ORDER -typedef struct { - HTEvent * event; - SOCKET s; - HTEventType type; - HTPriority skipped; -} EventOrder; -HTList * EventOrderList = NULL; -#if 0 -/* -** return -1 if a should be after b - */ -int EventOrderComparer (const void * a, const void * b) +PRIVATE SockEvents * SockEvents_get (SOCKET s, SockEvents_action action) { - EventOrder * placeMe = (EventOrder *)a; - EventOrder * maybeHere = (EventOrder *)b; - if (placeMe->event->priority+placeMe->skipped >= maybeHere->event->priority+maybeHere->skipped) - return 1; - return -1; + long v = HASH(s); + HTList* cur; + SockEvents * pres; + + /* if the socket doesn't exists, don't do anything */ + if (s == INVSOC) + return NULL; + + if (HashTable[v] == NULL) HashTable[v] = HTList_new(); + cur = HashTable[v]; + while ((pres = (SockEvents *) HTList_nextObject(cur))) + if (pres->s == s) return pres; + + if (action == SockEvents_mayCreate) { + if ((pres = (SockEvents *) HT_CALLOC(1, sizeof(SockEvents))) == NULL) + HT_OUTOFMEM("HTEventList_register"); + pres->s = s; + HTList_addObject(HashTable[v], (void *)pres); + return pres; + } + return NULL; } -#endif -int EventOrder_add (SOCKET s, HTEventType type, ms_t now) +PRIVATE int EventOrder_add (SOCKET s, HTEventType type, ms_t now) { EventOrder * pres; HTList * cur = EventOrderList; @@ -267,23 +281,16 @@ HTEvent * event; if (sockp == NULL || (event = sockp->events[HTEvent_INDEX(type)]) == NULL) { - HTTrace("EventOrder.. no event found for socket %d, type %s.\n", s, HTEvent_type2str(type)); + HTTRACE(THD_TRACE, "EventOrder.. no event found for socket %d, type %s.\n" _ + s _ HTEvent_type2str(type)); return HT_ERROR; } - /* Fixup the timeout - */ -#ifdef IN_EVENT - if (event->timer) - HTTimer_refresh(event->timer, now); -#else + /* Fixup the timeout */ if (sockp->timeouts[HTEvent_INDEX(type)]) HTTimer_refresh(sockp->timeouts[HTEvent_INDEX(type)], now); -#endif - /* - ** Look to see if it's already here from before - */ + /* Look to see if it's already here from before */ while ((pres = (EventOrder *) HTList_nextObject(cur))) { if (pres->s == s && pres->event == event && pres->type == type) { pres->skipped++; @@ -293,9 +300,7 @@ insertAfter = cur; } - /* - ** No, so create a new element - */ + /* Create a new element */ if ((pres = (EventOrder *) HT_CALLOC(1, sizeof(EventOrder))) == NULL) HT_OUTOFMEM("EventOrder_add"); pres->event = event; @@ -310,39 +315,46 @@ HTList * cur = EventOrderList; EventOrder * pres; int i = 0; - if (THD_TRACE) HTTrace("EventOrder.. execute ordered events\n"); + HTTRACE(THD_TRACE, "EventOrder.. execute ordered events\n"); if (cur == NULL) return NO; - while ((pres = (EventOrder *) HTList_removeLastObject(cur)) && i < EVENTS_TO_EXECUTE) { + while ((pres=(EventOrder *) HTList_removeLastObject(cur)) && ievent; int ret; - if (THD_TRACE) - HTTrace("EventList... calling socket %d, request %p handler %p type %s\n", - pres->s, (void *) event->request, - (void *) event->cbf, HTEvent_type2str(pres->type)); + HTTRACE(THD_TRACE, "EventList... calling socket %d, request %p handler %p type %s\n" _ + pres->s _ (void *) event->request _ + (void *) event->cbf _ HTEvent_type2str(pres->type)); ret = (*pres->event->cbf)(pres->s, pres->event->param, pres->type); HT_FREE(pres); - if (ret != HT_OK) - return ret; + if (ret != HT_OK) return ret; i++; } return HT_OK; } -PUBLIC BOOL EventOrder_deleteAll (void) +PRIVATE BOOL EventOrder_clearAll (void) { HTList * cur = EventOrderList; EventOrder * pres; - if (THD_TRACE) HTTrace("EventOrder.. all ordered events\n"); - if (cur == NULL) return NO; - while ((pres = (EventOrder *) HTList_nextObject(cur))) - HT_FREE(pres); + HTTRACE(THD_TRACE, "EventOrder.. Clearing all ordered events\n"); + if (cur) { + while ((pres = (EventOrder *) HTList_nextObject(cur))) + HT_FREE(pres); + return YES; + } + return NO; +} + +PUBLIC BOOL EventOrder_deleteAll (void) +{ + EventOrder_clearAll(); HTList_delete(EventOrderList); EventOrderList = NULL; return YES; } -#endif /* HT_EVENT_ORDER */ /* ------------------------------------------------------------------------- */ +/* EVENT REGISTRATION */ +/* ------------------------------------------------------------------------- */ /* ** ResetMaxSock - reset the value of the maximum socket in use @@ -360,13 +372,12 @@ if (cnt > t_max) t_max = cnt; } MaxSock = t_max+1; - if (THD_TRACE) - HTTrace("Event....... Reset MaxSock from %u to %u\n", old_max, MaxSock); + HTTRACE(THD_TRACE, "Event....... Reset MaxSock from %u to %u\n" _ old_max _ MaxSock); return; } #endif /* !WWW_WIN_ASYNC */ -PRIVATE int EventList_remaining(SockEvents * pres) +PRIVATE int EventList_remaining (SockEvents * pres) { int ret = 0; int i; @@ -386,10 +397,9 @@ { int newset = 0; SockEvents * sockp; - if (THD_TRACE) - HTTrace("Event....... Register socket %d, request %p handler %p type %s at priority %d\n", - s, (void *) event->request, - (void *) event->cbf, HTEvent_type2str(type), + HTTRACE(THD_TRACE, "Event....... Register socket %d, request %p handler %p type %s at priority %d\n" _ + s _ (void *) event->request _ + (void *) event->cbf _ HTEvent_type2str(type) _ (unsigned) event->priority); if (s==INVSOC || HTEvent_INDEX(type) >= HTEvent_TYPES) return 0; @@ -398,21 +408,24 @@ ** Insert socket into appropriate file descriptor set. We also make sure ** that it is registered in the global set. */ - if (THD_TRACE) HTTrace("Event....... Registering socket for %s\n", HTEvent_type2str(type)); + HTTRACE(THD_TRACE, "Event....... Registering socket for %s\n" _ HTEvent_type2str(type)); sockp = SockEvents_get(s, SockEvents_mayCreate); sockp->s = s; sockp->events[HTEvent_INDEX(type)] = event; newset = EventList_remaining(sockp); #ifdef WWW_WIN_ASYNC if (WSAAsyncSelect(s, HTSocketWin, HTwinMsg, HTEvent_BITS(newset)) < 0) { - if (THD_TRACE) HTTrace("Event....... WSAAsyncSelect returned error!"); + HTTRACE(THD_TRACE, "Event....... WSAAsyncSelect returned `%s'!" _ HTErrnoString(socerrno)); return HT_ERROR; } #else /* WWW_WIN_ASYNC */ FD_SET(s, FdArray+HTEvent_INDEX(type)); + + HTTRACEDATA((char *) FdArray+HTEvent_INDEX(type), 8, "HTEventList_register: (s:%d)" _ s); + if (s > MaxSock) { MaxSock = s ; - if (THD_TRACE) HTTrace("Event....... New value for MaxSock is %d\n", MaxSock); + HTTRACE(THD_TRACE, "Event....... New value for MaxSock is %d\n" _ MaxSock); } #endif /* !WWW_WIN_ASYNC */ @@ -421,14 +434,9 @@ ** a new timeout for this event unless we already have a timer. */ if (event->millis >= 0) { -#ifdef IN_EVENT - event->timer = HTTimer_new(event->timer, EventListTimerHandler, - sockp, event->millis, YES); -#else sockp->timeouts[HTEvent_INDEX(type)] = HTTimer_new(sockp->timeouts[HTEvent_INDEX(type)], EventListTimerHandler, sockp, event->millis, YES, YES); -#endif } return HT_OK; @@ -440,7 +448,7 @@ ** info is deleted, and, if the socket has been registered for notification, ** the HTEventCallback will be invoked. */ -PUBLIC int HTEventList_unregister(SOCKET s, HTEventType type) +PUBLIC int HTEventList_unregister (SOCKET s, HTEventType type) { long v = HASH(s); HTList * cur = HashTable[v]; @@ -448,6 +456,10 @@ SockEvents * pres; int ret = HT_ERROR; + /* if the socket doesn't exists, don't do anything */ + if (s == INVSOC) + return HT_OK; + while (cur && (pres = (SockEvents *) HTList_nextObject(cur))) { if (pres->s == s) { int remaining = 0; @@ -463,16 +475,9 @@ ** If so then delete the timeout as well. */ { -#ifdef IN_EVENT - HTTimer * timer = pres->events[HTEvent_INDEX(type)]->timer; - if (timer) HTTimer_delete(timer); - pres->events[HTEvent_INDEX(type)]->timer = NULL; -#else HTTimer * timer = pres->timeouts[HTEvent_INDEX(type)]; if (timer) HTTimer_delete(timer); pres->timeouts[HTEvent_INDEX(type)] = NULL; -#endif - } #ifdef WWW_WIN_ASYNC @@ -480,7 +485,9 @@ ret = HT_ERROR; #else /* WWW_WIN_ASYNC */ FD_CLR(s, FdArray+HTEvent_INDEX(type)); - HTTraceData((char*)FdArray+HTEvent_INDEX(type), 8, "HTEventList_unregister: (s:%d)", s); + + HTTRACEDATA((char*)FdArray+HTEvent_INDEX(type), 8, "HTEventList_unregister: (s:%d)" _ s); + #endif /* !WWW_WIN_ASYNC */ /* @@ -489,13 +496,11 @@ */ if (remaining == 0) { HTList * doomed = cur; - if (THD_TRACE) - HTTrace("Event....... No more events registered for socket %d\n", s); - + HTTRACE(THD_TRACE, "Event....... No more events registered for socket %d\n" _ s); #ifndef WWW_WIN_ASYNC /* Check to see if we have to update MaxSock */ - if(pres->s >= MaxSock) __ResetMaxSock(); + if (pres->s >= MaxSock) __ResetMaxSock(); #endif /* !WWW_WIN_ASYNC */ HT_FREE(pres); @@ -504,18 +509,19 @@ } ret = HT_OK; - if (THD_TRACE) HTTrace("Event....... Socket %d unregistered for %s\n", s, + HTTRACE(THD_TRACE, "Event....... Socket %d unregistered for %s\n" _ s _ HTEvent_type2str(type)); - /* - ** We found the socket and can break - */ + /* We found the socket and can break */ break; } last = cur; } - if (ret == HT_ERROR && THD_TRACE) HTTrace("Event....... Couldn't find socket %d. Can't unregister type %s\n", - s, HTEvent_type2str(type)); + if (THD_TRACE) { + if (ret == HT_ERROR) + HTTRACE(THD_TRACE, "Event....... Couldn't find socket %d. Can't unregister type %s\n" _ + s _ HTEvent_type2str(type)); + } return ret; } @@ -527,8 +533,8 @@ PUBLIC int HTEventList_unregisterAll (void) { int i; - if (THD_TRACE) HTTrace("Unregister.. all sockets\n"); - for (i = 0 ; i < PRIME_TABLE_SIZE; i++) { + HTTRACE(THD_TRACE, "Unregister.. all sockets\n"); + for (i = 0 ; i < HT_M_HASH_SIZE; i++) { HTList * cur = HashTable[i]; SockEvents * pres; while ((pres = (SockEvents *) HTList_nextObject(cur))) { @@ -540,16 +546,16 @@ HTList_delete(HashTable[i]); HashTable[i] = NULL; } + #ifndef WWW_WIN_ASYNC MaxSock = 0 ; - if (THD_TRACE) HTTrace("Event....... New value for MaxSock is %d\n", MaxSock); + HTTRACE(THD_TRACE, "Event....... New value for MaxSock is %d\n" _ MaxSock); FD_ZERO(FdArray+HTEvent_INDEX(HTEvent_READ)); FD_ZERO(FdArray+HTEvent_INDEX(HTEvent_WRITE)); FD_ZERO(FdArray+HTEvent_INDEX(HTEvent_OOB)); #endif /* !WWW_WIN_ASYNC */ -#ifdef HT_EVENT_ORDER + EventOrder_deleteAll(); -#endif /* HT_EVENT_ORDER */ return 0; } @@ -563,37 +569,23 @@ if (sockp) { HTEvent * event = sockp->events[HTEvent_INDEX(type)]; - /* Fixup the timeout - */ -#ifdef IN_EVENT - if (event->timer) - HTTimer_refresh(event->timer, now); -#else + /* Fixup the timeout */ if (sockp->timeouts[HTEvent_INDEX(type)]) HTTimer_refresh(sockp->timeouts[HTEvent_INDEX(type)], now); -#endif + /* ** If we have found an event object for this event then see ** is we should call it. */ if (event && event->priority!=HT_PRIORITY_OFF) return (*event->cbf) (s, event->param, type); - if (THD_TRACE) HTTrace("Dispatch.... Handler %p NOT called\n", sockp); + HTTRACE(THD_TRACE, "Dispatch.... Handler %p NOT called\n" _ sockp); return HT_OK; } - if (THD_TRACE) HTTrace("Dispatch.... Bad socket %d\n", s); + HTTRACE(THD_TRACE, "Dispatch.... Bad socket %d\n" _ s); return NO; } -/* -** Stops the (select based) event loop. The function does not guarantee -** that all requests have terminated. This is for the app to do -*/ -PUBLIC void HTEventList_stopLoop (void) -{ - HTEndLoop = 1; -} - PUBLIC HTEvent * HTEventList_lookup (SOCKET s, HTEventType type) { SockEvents * sockp = NULL; @@ -602,160 +594,39 @@ return sockp->events[HTEvent_INDEX(type)]; } -/* REGISTER DEFULT EVENT MANAGER -** ----------------------------- -** Not done automaticly - may be done by application! -*/ -PUBLIC BOOL HTEventInit (void) -{ -#ifdef WWW_WIN_ASYNC - /* - ** We are here starting a hidden window to take care of events from - ** the async select() call in the async version of the event loop in - ** the Internal event manager (HTEvtLst.c) - */ - static char className[] = "AsyncWindowClass"; - WNDCLASS wc; - OSVERSIONINFO osInfo; - - wc.style=0; - wc.lpfnWndProc=(WNDPROC)AsyncWindowProc; - wc.cbClsExtra=0; - wc.cbWndExtra=0; - wc.hIcon=0; - wc.hCursor=0; - wc.hbrBackground=0; - wc.lpszMenuName=(LPSTR)0; - wc.lpszClassName=className; - - osInfo.dwOSVersionInfoSize = sizeof(osInfo); - GetVersionEx(&osInfo); - if (osInfo.dwPlatformId == VER_PLATFORM_WIN32s || osInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) - wc.hInstance=GetModuleHandle(NULL); /* 95 and non threaded platforms */ - else - wc.hInstance=GetCurrentProcess(); /* NT and hopefully everything following */ - if (!RegisterClass(&wc)) { - HTTrace("HTLibInit.. Can't RegisterClass \"%s\"\n", className); - return NO; - } - if (!(HTSocketWin = CreateWindow(className, "WWW_WIN_ASYNC", WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, wc.hInstance,0))) { - char space[50]; - HTTrace("HTLibInit.. Can't CreateWindow \"WWW_WIN_ASYNC\" - error:"); - sprintf(space, "%ld\n", GetLastError()); - HTTrace(space); - return NO; - } - HTwinMsg = WM_USER; /* use first available message since app uses none */ - - /* - ** Register platform specific timer handlers for windows - */ - HTTimer_registerSetTimerCallback(Timer_setWindowsTimer); - HTTimer_registerDeleteTimerCallback(Timer_deleteWindowsTimer); - -#endif /* WWW_WIN_ASYNC */ - -#ifdef _WINSOCKAPI_ - /* - ** Initialise WinSock DLL. This must also be shut down! PMH - */ - { - WSADATA wsadata; - if (WSAStartup(DESIRED_WINSOCK_VERSION, &wsadata)) { - if (WWWTRACE) - HTTrace("HTEventInit. Can't initialize WinSoc\n"); - WSACleanup(); - return NO; - } - if (wsadata.wVersion < MINIMUM_WINSOCK_VERSION) { - if (WWWTRACE) - HTTrace("HTEventInit. Bad version of WinSoc\n"); - WSACleanup(); - return NO; - } - if (APP_TRACE) - HTTrace("HTEventInit. Using WinSoc version \"%s\".\n", - wsadata.szDescription); - } -#endif /* _WINSOCKAPI_ */ - - HTEvent_setRegisterCallback(HTEventList_register); - HTEvent_setUnregisterCallback(HTEventList_unregister); - return YES; -} - -PUBLIC BOOL HTEventTerminate (void) -{ -#ifdef _WINSOCKAPI_ - WSACleanup(); -#endif /* _WINSOCKAPI_ */ - return YES; -} - -#ifdef WWW_WIN_ASYNC +/* ------------------------------------------------------------------------- */ +/* THE EVENT LOOP */ +/* ------------------------------------------------------------------------- */ -/* HTEventList_get/setWinHandle -** -------------------------- -** Managing the windows handle on Windows +/* +** Start eventloop */ -PUBLIC BOOL HTEventList_setWinHandle (HWND window, unsigned long message) -{ - HTSocketWin = window; - HTwinMsg = message; - return YES; -} - -PUBLIC HWND HTEventList_getWinHandle (unsigned long * pMessage) +PUBLIC int HTEventList_newLoop (void) { - if (pMessage) - *pMessage = HTwinMsg; - return (HTSocketWin); + return HTEventList_loop (NULL); } -/* only responsible for WM_TIMER and WSA_AsyncSelect */ -PUBLIC LRESULT CALLBACK AsyncWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +/* +** Stops the event loop. The function does not guarantee +** that all requests have terminated. This is for the app to do +*/ +PUBLIC void HTEventList_stopLoop (void) { - WORD event; - SOCKET sock; - HTEventType type; - ms_t now = HTGetTimeInMillis(); - - /* timeout stuff */ - if (uMsg == WM_TIMER) { - HTTimer_dispatch((HTTimer *)wParam); - return (0); - } - - if (uMsg != HTwinMsg) /* not our async message */ - return (DefWindowProc(hwnd, uMsg, wParam, lParam)); - - event = LOWORD(lParam); - sock = (SOCKET)wParam; - switch (event) { - case FD_READ: type = HTEvent_READ; break; - case FD_WRITE: type = HTEvent_WRITE; break; - case FD_ACCEPT: type = HTEvent_ACCEPT; break; - case FD_CONNECT: type = HTEvent_CONNECT; break; - case FD_OOB: type = HTEvent_OOB; break; - case FD_CLOSE: type = HTEvent_CLOSE; break; - default: HTDebugBreak(__FILE__, __LINE__, "Unknown event %d\n", event); - } - if (HTEventList_dispatch((int)sock, type, now) != HT_OK) - HTEndLoop = -1; - return (0); + HTEndLoop = 1; } -PUBLIC int HTEventList_newLoop (void) +/* +** There are now two versions of the event loop. The first is if you want +** to use async I/O on windows, and the other is if you want to use normal +** Unix setup with sockets +*/ +PUBLIC int HTEventList_loop (HTRequest * theRequest) { - return HTEventList_loop (NULL); -} +#ifdef WWW_WIN_ASYNC -PUBLIC int HTEventList_loop (HTRequest * theRequest ) -{ MSG msg; int status; - while (GetMessage(&msg,0,0,0)) { + while (!HTEndLoop && GetMessage(&msg,0,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } @@ -766,25 +637,9 @@ HTEndLoop = 0; return (status == 1 ? HT_OK : HT_ERROR); -} #else /* WWW_WIN_ASYNC */ -PUBLIC int HTEventList_newLoop (void) -{ - return HTEventList_loop (NULL); -} - -/* -** We wait for activity from one of our registered -** channels, and dispatch on that. -** -** There are now two versions of the event loop. The first is if you want -** to use async I/O on windows, and the other is if you want to use normal -** Unix setup with sockets -*/ -PUBLIC int HTEventList_loop (HTRequest * theRequest) -{ fd_set treadset, twriteset, texceptset; struct timeval waittime, * wt; int active_sockets; @@ -794,13 +649,21 @@ SOCKET s; int status = HT_OK; - EventOrderList = HTList_new(); /* is kept around until EventOrder_deleteAll */ + /* Check that we don't have multiple loops started at once */ + if (HTInLoop) { + HTTRACE(THD_TRACE, "Event Loop.. Already one loop running - exiting\n"); + return HT_ERROR; + } + HTInLoop = YES; + + /* Set up list of events - is kept around until EventOrder_deleteAll */ + if (!EventOrderList) + EventOrderList = HTList_new(); + else + EventOrder_clearAll(); /* Don't leave this loop until we leave the application */ while (!HTEndLoop) { - treadset = FdArray[HTEvent_INDEX(HTEvent_READ)]; - twriteset = FdArray[HTEvent_INDEX(HTEvent_WRITE)]; - texceptset = FdArray[HTEvent_INDEX(HTEvent_OOB)]; /* ** Timeval struct copy needed for linux, as it set the value to the @@ -809,7 +672,7 @@ */ wt = NULL; if ((status = HTTimer_next(&timeout))) - return status; + break; if (timeout != 0) { waittime.tv_sec = timeout / MILLI_PER_SECOND; waittime.tv_usec = (timeout % MILLI_PER_SECOND) * @@ -817,32 +680,57 @@ wt = &waittime; } + /* + ** Check whether we still have to continue the event loop. It could + ** be that one of the timer handlers ended the loop. + */ + if (HTEndLoop) break; + + /* + ** Now we copy the current active file descriptors to pass them to select. + */ + treadset = FdArray[HTEvent_INDEX(HTEvent_READ)]; + twriteset = FdArray[HTEvent_INDEX(HTEvent_WRITE)]; + texceptset = FdArray[HTEvent_INDEX(HTEvent_OOB)]; + + /* And also get the max socket value */ maxfds = MaxSock; - if (THD_TRACE) HTTrace("Event Loop.. calling select: maxfds is %d\n", maxfds); -#ifdef EVENT_TRACE -#define HT_FS_BYTES(a) ((((a)/16)+1) * 4) - HTTraceData((char*)&treadset, HT_FS_BYTES(maxfds), "HTEventList_loop pre treadset: (maxfd:%d)", maxfds); - HTTraceData((char*)&twriteset, HT_FS_BYTES(maxfds), "HTEventList_loop pre twriteset:"); - HTTraceData((char*)&texceptset, HT_FS_BYTES(maxfds), "HTEventList_loop pre texceptset:"); -#endif /* EVENT_TRACE */ + HTTRACE(THD_TRACE, "Event Loop.. calling select: maxfds is %d\n" _ maxfds); +#ifdef HTDEBUG + fd_dump(maxfds, &treadset, &twriteset, &texceptset, wt); +#endif #ifdef __hpux active_sockets = select(maxfds+1, (int *)&treadset, (int *)&twriteset, (int *)&texceptset, wt); +#elif defined(_WINSOCKAPI_) + /* + * yovavm@contact.com + * + * On some WINSOCK versions select() with 3 empty sets and NULL timeout + * returns 0 and in some it returns -1. + * If 0 is returned in such situation, we will go into an infinite loop + * (cause the sets will stay empty forever ...), + * so make sure to set the active_sockets = -1 which will take us out + * of the loop. + */ + if ((treadset.fd_count || twriteset.fd_count || texceptset.fd_count) + && wt) + active_sockets = select(maxfds+1, &treadset, &twriteset, + &texceptset, wt); + else + active_sockets = -1; #else active_sockets = select(maxfds+1, &treadset, &twriteset, &texceptset, wt); #endif now = HTGetTimeInMillis(); -#ifdef EVENT_TRACE - HTTraceData((char*)&treadset, HT_FS_BYTES(maxfds), "HTEventList_loop post treadset: (active_sockets:%d)", active_sockets); - HTTraceData((char*)&twriteset, HT_FS_BYTES(maxfds), "HTEventList_loop post twriteset: (errno:%d)", errno); - HTTraceData((char*)&texceptset, HT_FS_BYTES(maxfds), "HTEventList_loop post texceptset:"); -#endif /* EVENT_TRACE */ - - if (THD_TRACE) HTTrace("Event Loop.. select returns %d\n", active_sockets); + HTTRACE(THD_TRACE, "Event Loop.. select returns %d\n" _ active_sockets); +#ifdef HTDEBUG + fd_dump(maxfds, &treadset, &twriteset, &texceptset, wt); +#endif if (active_sockets == -1) { #ifdef EINTR @@ -856,14 +744,29 @@ ** signal, it is implementation-dependent whether ** select() restarts or returns with EINTR. */ - if (THD_TRACE) - HTTrace("Event Loop.. select was interruted - try again\n"); + HTTRACE(THD_TRACE, "Event Loop.. select was interruted - try again\n"); continue; } #endif /* EINTR */ - if (THD_TRACE) HTTrace("Event Loop.. select returned error %d\n", socerrno); +#ifdef EBADF + if (socerrno == EBADF) { + /* + ** EBADF One or more of the file descriptor sets specified + ** a file descriptor that is not a valid open file + ** descriptor. + */ + HTTRACE(THD_TRACE, "Event Loop.. One or more sockets were not through their connect phase - try again\n"); + continue; + } +#endif + HTTRACE(THD_TRACE, "Event Loop.. select returned error %d\n" _ socerrno); + +#ifdef HTDEBUG EventList_dump(); - return HT_ERROR; +#endif /* HTDEBUG */ + + status = HT_ERROR; + break; } /* @@ -873,47 +776,184 @@ if (active_sockets == 0) continue; - /* - ** There were active sockets. Determine which fd sets they were in - */ -#ifdef HT_EVENT_ORDER -#define DISPATCH(socket, type, now) EventOrder_add(socket, type, now) -#else /* HT_EVENT_ORDER */ -#define DISPATCH(socket, type, now) HTEventList_dispatch(socket, type, now) -#endif /* !HT_EVENT_ORDER */ + /* There were active sockets. Determine which fd sets they were in */ for (s = 0 ; s <= maxfds ; s++) { if (FD_ISSET(s, &texceptset)) - if ((status = DISPATCH(s, HTEvent_OOB, now)) != HT_OK) - return status; + if ((status = EventOrder_add(s, HTEvent_OOB, now)) != HT_OK) + goto stop_loop; if (FD_ISSET(s, &twriteset)) - if ((status = DISPATCH(s, HTEvent_WRITE, now)) != HT_OK) - return status; + if ((status = EventOrder_add(s, HTEvent_WRITE, now)) != HT_OK) + goto stop_loop; if (FD_ISSET(s, &treadset)) - if ((status = DISPATCH(s, HTEvent_READ, now)) != HT_OK) - return status; + if ((status = EventOrder_add(s, HTEvent_READ, now)) != HT_OK) + goto stop_loop; } -#ifdef HT_EVENT_ORDER - if ((status = EventOrder_executeAndDelete()) != HT_OK) - return status; -#endif /* HT_EVENT_ORDER */ + if ((status = EventOrder_executeAndDelete()) != HT_OK) break; }; /* Reset HTEndLoop in case we want to start again */ + stop_loop: HTEndLoop = 0; + HTInLoop = NO; + return status; +#endif /* !WWW_WIN_ASYNC */ +} - return HT_OK; +/* ------------------------------------------------------------------------- */ +/* EVENT INITIALIZATION AND TERMINATION */ +/* ------------------------------------------------------------------------- */ + +#ifdef WWW_WIN_ASYNC + +/* Only responsible for WM_TIMER and WSA_AsyncSelect */ +PRIVATE LRESULT CALLBACK AsyncWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + WORD event; + SOCKET sock; + HTEventType type; + ms_t now = HTGetTimeInMillis(); + + /* timeout stuff */ + if (uMsg == WM_TIMER) { + HTTimer_dispatch((HTTimer *)wParam); + return (0); + } + + if (uMsg != HTwinMsg) /* not our async message */ + return (DefWindowProc(hwnd, uMsg, wParam, lParam)); + + event = LOWORD(lParam); + sock = (SOCKET)wParam; + switch (event) { + case FD_READ: type = HTEvent_READ; break; + case FD_WRITE: type = HTEvent_WRITE; break; + case FD_ACCEPT: type = HTEvent_ACCEPT; break; + case FD_CONNECT: type = HTEvent_CONNECT; break; + case FD_OOB: type = HTEvent_OOB; break; + /* JK: was returning HTEvent_CLOSE before, and this was a source of + errors, as libwww detects the socket shutdown with a call to recv */ + case FD_CLOSE: type = HTEvent_READ; break; + default: HTDEBUGBREAK("Unknown event %d\n" _ event); + } + if (HTEventList_dispatch((int)sock, type, now) != HT_OK) + HTEndLoop = -1; + return (0); } -#endif /* !WWW_WIN_ASYNC */ +/* HTEventList_get/setWinHandle +** -------------------------- +** Managing the windows handle on Windows +*/ +PUBLIC BOOL HTEventList_setWinHandle (HWND window, unsigned long message) +{ + HTSocketWin = window; + HTwinMsg = message; + return YES; +} -PUBLIC void CheckSockEvent(HTTimer * timer, HTTimerCallback * cbf, void * param) +PUBLIC HWND HTEventList_getWinHandle (unsigned long * pMessage) { - SockEvents * sockp = (SockEvents *)param; - if (cbf == EventListTimerHandler && - sockp->timeouts[0] != timer && - sockp->timeouts[1] != timer && - sockp->timeouts[2] != timer) { - HTDebugBreak(__FILE__, __LINE__, "Bad timer %p\n", timer); + if (pMessage) + *pMessage = HTwinMsg; + return (HTSocketWin); +} +#endif /* WWW_WIN_ASYNC */ + +PUBLIC BOOL HTEventInit (void) +{ +#ifdef WWW_WIN_ASYNC + /* + ** We are here starting a hidden window to take care of events from + ** the async select() call in the async version of the event loop in + ** the Internal event manager (HTEvtLst.c) + */ + static char className[] = "AsyncWindowClass"; + WNDCLASS wc; + OSVERSIONINFO osInfo; + + wc.style=0; + wc.lpfnWndProc=(WNDPROC)AsyncWindowProc; + wc.cbClsExtra=0; + wc.cbWndExtra=0; + wc.hIcon=0; + wc.hCursor=0; + wc.hbrBackground=0; + wc.lpszMenuName=(LPSTR)0; + wc.lpszClassName=className; + + osInfo.dwOSVersionInfoSize = sizeof(osInfo); + GetVersionEx(&osInfo); + + /* According to Gary Johnson, GetModuleHandle() works for NT as well */ +#if 0 + if (osInfo.dwPlatformId == VER_PLATFORM_WIN32s || osInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) + wc.hInstance=GetModuleHandle(NULL); /* 95 and non threaded platforms */ + else + wc.hInstance=GetCurrentProcess(); /* NT and hopefully everything following */ +#else + wc.hInstance=GetModuleHandle(NULL); /* Should work on all win32 stuff */ +#endif + + HTinstance = wc.hInstance; + HTclass = RegisterClass(&wc); + if (!HTclass) { + HTTRACE(THD_TRACE, "HTLibInit.. Can't RegisterClass \"%s\"\n" _ className); + return NO; + } + if (!(HTSocketWin = CreateWindow(className, "WWW_WIN_ASYNC", WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, wc.hInstance,0))) { +#ifdef HTDEBUG + char space[50]; + HTTRACE(THD_TRACE, "HTLibInit.. Can't Create Window \"WWW_WIN_ASYNC\" - error:"); + sprintf(space, "%ld\n", GetLastError()); + HTTRACE(THD_TRACE, space); +#endif /* HTDEBUG */ + return NO; + } + HTwinMsg = WM_USER; /* use first available message since app uses none */ + + /* Register platform specific timer handlers for windows */ + HTTimer_registerSetTimerCallback(Timer_setWindowsTimer); + HTTimer_registerDeleteTimerCallback(Timer_deleteWindowsTimer); + +#endif /* WWW_WIN_ASYNC */ + +#ifdef _WINSOCKAPI_ + /* + ** Initialise WinSock DLL. This must also be shut down! PMH + */ + { + WSADATA wsadata; + if (WSAStartup(DESIRED_WINSOCK_VERSION, &wsadata)) { + HTTRACE(THD_TRACE, "HTEventInit. Can't initialize WinSoc\n"); + WSACleanup(); + return NO; + } + if (wsadata.wVersion < MINIMUM_WINSOCK_VERSION) { + HTTRACE(THD_TRACE, "HTEventInit. Bad version of WinSoc\n"); + WSACleanup(); + return NO; + } + HTTRACE(APP_TRACE, "HTEventInit. Using WinSoc version \"%s\".\n" _ + wsadata.szDescription); } +#endif /* _WINSOCKAPI_ */ + + HTEvent_setRegisterCallback(HTEventList_register); + HTEvent_setUnregisterCallback(HTEventList_unregister); + return YES; } +PUBLIC BOOL HTEventTerminate (void) +{ +#ifdef _WINSOCKAPI_ + WSACleanup(); +#endif /* _WINSOCKAPI_ */ + +#ifdef WWW_WIN_ASYNC + DestroyWindow(HTSocketWin); + UnregisterClass((LPCTSTR)HTclass, HTinstance); +#endif /* WWW_WIN_ASYNC */ + + return YES; +} diff -Naur xdvik-22.40l/libs/libwww/HTEvtLst.h xdvik-22.40n/libs/libwww/HTEvtLst.h --- xdvik-22.40l/libs/libwww/HTEvtLst.h Wed Apr 18 14:23:14 2001 +++ xdvik-22.40n/libs/libwww/HTEvtLst.h Fri Sep 13 00:23:45 2002 @@ -175,6 +175,6 @@ - @(#) $Id: HTEvtLst.h,v 1.1.1.1 2001/04/18 14:23:14 stefanulrich Exp $ + @(#) $Id: HTEvtLst.h,v 1.1.1.1.8.1 2002/09/13 00:23:45 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTFSave.c xdvik-22.40n/libs/libwww/HTFSave.c --- xdvik-22.40l/libs/libwww/HTFSave.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTFSave.c Fri Sep 13 00:23:45 2002 @@ -0,0 +1,309 @@ +/* +** VARIOUS FILE WRITER STREAMS +** +** (c) COPYRIGHT MIT 1995. +** Please first read the full copyright statement in the file COPYRIGH. +** @(#) $Id: HTFSave.c,v 1.1.2.1 2002/09/13 00:23:45 stefanulrich Exp $ +** +** This version of the stream object just writes to a C file. +** The file is assumed open and left open. +** +** Bugs: +** strings written must be less than buffer size. +** +** History: +** HFN: wrote it +** HWL: converted the caching scheme to be hierachical by taking +** AL code from Deamon +** HFN: moved cache code to HTCache module +** +*/ + +/* Library include files */ +#include "wwwsys.h" +#include "WWWUtil.h" +#include "WWWCore.h" +#include "HTBind.h" +#include "HTFWrite.h" +#include "HTFSave.h" /* Implemented here */ + +struct _HTStream { + const HTStreamClass *isa; + HTStream * target; + char * end_command; /* Command to execute */ + BOOL remove_on_close; /* Remove file? */ + char * filename; /* Name of file */ + HTRequest * request; /* Saved for callback */ + HTRequestCallback * callback; +}; + +#define DEFAULT_LAST_SEGMENT "index" + +/* ------------------------------------------------------------------------- */ + +PRIVATE int HTFileSave_flush (HTStream * me) +{ + return (*me->target->isa->flush)(me->target); +} + +PRIVATE int HTFileSave_put_character (HTStream * me, char c) +{ + return (*me->target->isa->put_character)(me->target, c); +} + +PRIVATE int HTFileSave_put_string (HTStream * me, const char * s) +{ + return (*me->target->isa->put_string)(me->target, s); +} + +PRIVATE int HTFileSave_write (HTStream * me, const char * b, int l) +{ + return (*me->target->isa->put_block)(me->target, b, l); +} + +PRIVATE int HTFileSave_free (HTStream * me) +{ + if (me) { + (*me->target->isa->_free)(me->target); +#ifdef HAVE_SYSTEM + if (me->end_command) system(me->end_command); /* SECURITY HOLE!!! */ +#endif + if (me->callback) (*me->callback)(me->request, me->filename); + if (me->remove_on_close) REMOVE(me->filename); + HT_FREE(me->end_command); + HT_FREE(me->filename); + HT_FREE(me); + } + return HT_OK; +} + +PRIVATE int HTFileSave_abort (HTStream * me, HTList * e) +{ + HTTRACE(STREAM_TRACE, "Save File.. ABORTING...\n"); + if (me) { + (*me->target->isa->abort)(me->target, e); + if (me->remove_on_close) REMOVE(me->filename); + HT_FREE(me->end_command); + HT_FREE(me->filename); + HT_FREE(me); + } + return HT_ERROR; +} + +PRIVATE const HTStreamClass HTFileSave = +{ + "FileSave", + HTFileSave_flush, + HTFileSave_free, + HTFileSave_abort, + HTFileSave_put_character, + HTFileSave_put_string, + HTFileSave_write +}; + +PUBLIC HTStream * HTFileSave_new (HTRequest * request, FILE * fp, + BOOL leave_open) +{ + HTStream * me = NULL; + if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) + HT_OUTOFMEM("HTFileSave_new"); + me->isa = &HTFileSave; + me->target = HTFWriter_new(request, fp, leave_open); + me->request = request; + return me; +} + +/* ------------------------------------------------------------------------- */ + +/* +** This function tries really hard to find a non-existent filename relative +** to the path given. Returns a string that must be freed by the caller or +** NULL on error. +*/ +PRIVATE char * get_filename (char * base, const char * uri, + const char * suffix, BOOL use_last_segment) +{ + char * path = NULL; + if (use_last_segment) { + char * uri_path = NULL; + if (uri && (uri_path = HTParse(uri, "", PARSE_PATH|PARSE_PUNCTUATION))) { + char * last_segment = strrchr(uri_path, '/'); + BOOL slash = (base && *(base+strlen(base)-1)==DIR_SEPARATOR_CHAR); + if (last_segment && *(last_segment+1)) { + StrAllocMCopy(&path, base ? base : "", + slash ? "" : DIR_SEPARATOR_STR, ++last_segment, NULL); + } else { + StrAllocMCopy(&path, base ? base : "", + slash ? "" : DIR_SEPARATOR_STR, DEFAULT_LAST_SEGMENT, + suffix ? suffix : "", NULL); + } + } + } else { + path = HTGetTmpFileName(base); + if (path && suffix) StrAllocCat(path, suffix); + } + + HTTRACE(STREAM_TRACE, "Save file... Temporaray file `%s\'\n" _ path ? path : ""); + return path; +} + +/* Save Locally +** ------------ +** Saves a file to local disk. This can for example be used to dump +** data objects of unknown media types to local disk. The stream prompts +** for a file name for the temporary file. +*/ +PUBLIC HTStream* HTSaveLocally (HTRequest * request, + void * param, + HTFormat input_format, + HTFormat output_format, + HTStream * output_stream) +{ + FILE * fp = NULL; + char * filename = NULL; + HTUserProfile * up = HTRequest_userProfile(request); + char * tmproot = HTUserProfile_tmp(up); + if (HTLib_secure()) { + HTRequest_addError(request, ERR_NON_FATAL, NO, HTERR_UNAUTHORIZED, + NULL, 0, "HTSaveLocally"); + return HTErrorStream(); + } + if (!tmproot) { + HTTRACE(STREAM_TRACE, "Save File... turned off\n"); + return HTErrorStream(); + } + + /* Let's prompt the user for a file name for this file */ + { + HTAlertCallback *cbf = HTAlert_find(HT_A_PROMPT); + HTParentAnchor *anchor = (HTParentAnchor *) HTRequest_anchor(request); + + /* + ** If we found an alert handler for prompting the user then call it. + ** If not then either we are in non-interactive mode or no handler + ** has been registered. For now we then return a blackhole which may + ** not be the best thing to do. + */ + if (cbf) { + HTAlertPar * reply = HTAlert_newReply(); + char * suffix = HTBind_getSuffix(anchor); + char * deflt = get_filename(tmproot, HTAnchor_physical(anchor), suffix, YES); + if ((*cbf)(request, HT_A_PROMPT, HT_MSG_FILENAME,deflt,NULL,reply)) + filename = HTAlert_replyMessage(reply); + HTAlert_deleteReply(reply); + HT_FREE(suffix); + HT_FREE(deflt); + } + if (filename) { + if ((fp = fopen(filename, "wb")) == NULL) { + HTRequest_addError(request, ERR_NON_FATAL, NO, HTERR_NO_FILE, + filename, strlen(filename),"HTSaveLocally"); + HT_FREE(filename); + return HTErrorStream(); + } + } else if (cbf) { + HTTRACE(STREAM_TRACE, "Save File... No file name - error stream\n"); + return HTErrorStream(); + } else { + HTTRACE(STREAM_TRACE, "Save File... No file name - black hole\n"); + return HTBlackHole(); + } + } + + /* Now we are ready for creating the file writer stream */ + if (fp) { + HTStream * me = HTFileSave_new(request, fp, NO); + me->filename = filename; + return me; + } + HT_FREE(filename); + return HTErrorStream(); +} + +/* Take action using a system command +** ---------------------------------- +** Creates temporary file, writes to it and then executes system +** command (maybe an external viewer) when EOF has been reached. The +** stream finds a suitable name of the temporary file which preserves the +** suffix. This way, the system command can find out the file type from +** the name of the temporary file name. +*/ +PUBLIC HTStream* HTSaveAndExecute (HTRequest * request, + void * param, + HTFormat input_format, + HTFormat output_format, + HTStream * output_stream) +{ + FILE * fp = NULL; + char * filename = NULL; + HTUserProfile * up = HTRequest_userProfile(request); + char * tmproot = HTUserProfile_tmp(up); + if (HTLib_secure()) { + HTRequest_addError(request, ERR_NON_FATAL, NO, HTERR_UNAUTHORIZED, + NULL, 0, "HTSaveLocally"); + return HTErrorStream(); + } + if (!tmproot) { + HTTRACE(STREAM_TRACE, "Save File... turned off"); + return HTErrorStream(); + } + + /* Let's find a hash name for this file without asking user */ + { + HTParentAnchor *anchor = (HTParentAnchor *) HTRequest_anchor(request); + char *suffix = HTBind_getSuffix(anchor); + filename = get_filename(tmproot, HTAnchor_physical(anchor), suffix, NO); + HT_FREE(suffix); + if (filename) { + if ((fp = fopen(filename, "wb")) == NULL) { + HTRequest_addError(request, ERR_NON_FATAL, NO, HTERR_NO_FILE, + filename, strlen(filename),"HTSaveAndExecute"); + HT_FREE(filename); + return HTErrorStream(); + } + } else { + HTTRACE(STREAM_TRACE, "Save File... No file name\n"); + return HTErrorStream(); + } + } + + /* Now we are ready for creating the file writer stream */ + if (fp) { + HTStream * me = HTFileSave_new(request, fp, NO); + me->filename = filename; + if (param) { + if ((me->end_command = (char *) HT_MALLOC((strlen((char *) param) + 10 + 3*strlen(filename)))) == NULL) + HT_OUTOFMEM("SaveAndExecute"); + sprintf (me->end_command, + (char *)param, filename, filename, filename); + } + return me; + } + HT_FREE(filename); + return HTErrorStream(); +} + +/* Save and Call Back +** ------------------ +** This stream works exactly like the HTSaveAndExecute +** stream but in addition when EOF has been reached, it checks whether a +** callback function has been associated with the request object in which +** case, this callback is being called. This can be use by the +** application to do some processing after the system command +** has terminated. The callback function is called with the file name of +** the temporary file as parameter. +*/ +PUBLIC HTStream* HTSaveAndCallback (HTRequest * request, + void * param, + HTFormat input_format, + HTFormat output_format, + HTStream * output_stream) +{ + HTStream * me = HTSaveAndExecute(request, param, input_format, + output_format, output_stream); + if (me) { + me->callback = HTRequest_callback(request); + return me; + } + return HTErrorStream(); +} diff -Naur xdvik-22.40l/libs/libwww/HTFSave.h xdvik-22.40n/libs/libwww/HTFSave.h --- xdvik-22.40l/libs/libwww/HTFSave.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTFSave.h Fri Sep 13 00:23:46 2002 @@ -0,0 +1,82 @@ +/* + + + W3C Sample Code Library libwww ANSI C File Streams + + +! + Basic ANSI C File Writer Stream +! +*/ + +/* +** (c) COPYRIGHT MIT 1995. +** Please first read the full copyright statement in the file COPYRIGH. +*/ + +/* + +This module contains some local file writer streams based on the basic file +writer stream defined in the HTFWrite module. +They can be used to do save-as, save-and-callback etc. + +This module is implemented by HTFSave.c, and it +is a part of the W3C Sample Code +Library. +*/ + +#ifndef HTFSAVE_H +#define HTFSAVE_H + +#include "HTFWrite.h" + +/* +. + Various Converters using the File Writer Stream +. + +This is a set of functions that can be registered as converters. They all +use the basic ANSI C file writer stream for writing out to the local file +system. +*/ + +extern HTConverter HTSaveAndExecute, HTSaveLocally, HTSaveAndCallback; + +/* + + + + HTSaveLocally + + Saves a file to local disk. This can for example be used to dump date objects + of unknown media types to local disk. The stream prompts for a file name + for the temporary file. + + HTSaveAndExecute + + Creates temporary file, writes to it and then executes system command (maybe + an external viewer) when EOF has been reached. The stream finds + a suitable name of the temporary file which preserves the suffix. This way, + the system command can find out the file type from the name of the temporary + file name. + + HTSaveAndCallback + + This stream works exactly like the HTSaveAndExecute stream but + in addition when EOF has been reached, it checks whether a callback + function has been associated with the request object in which case, this + callback is being called. This can be use by the application to do some + processing after the system command has terminated. The callback + function is called with the file name of the temporary file as parameter. + +*/ + +#endif + +/* + + + + @(#) $Id: HTFSave.h,v 1.1.2.1 2002/09/13 00:23:46 stefanulrich Exp $ + +*/ diff -Naur xdvik-22.40l/libs/libwww/HTFTP.c xdvik-22.40n/libs/libwww/HTFTP.c --- xdvik-22.40l/libs/libwww/HTFTP.c Wed Apr 18 14:23:14 2001 +++ xdvik-22.40n/libs/libwww/HTFTP.c Fri Sep 13 00:23:46 2002 @@ -3,11 +3,11 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTFTP.c,v 1.1.1.1 2001/04/18 14:23:14 stefanulrich Exp $ +** @(#) $Id: HTFTP.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** A cache of control connections is kept. ** -** Note: Port allocation +** Note: Port allocation (not used anymore) ** ** It is essential that the port is allocated by the system, rather ** than chosen in rotation by us (FTP_POLL_PORTS), or the following @@ -52,6 +52,10 @@ ** Sep 95 HFN Rewritten to support streams and persistent conenctions ** and multiplexed IO ** Mar 1998 NG Neil Griffin - Bug fixes and additions for FTP support on NT. +** Jan 2000 JB Joe Bester - Fixed the protocol bug that appeared after +** after the CERT advisory warning on wu. Added code +** to do an incremental streaming of FTP data. +** ** Notes: ** Portions Copyright 1994 Trustees of Dartmouth College ** Code for recognizing different FTP servers and @@ -66,23 +70,12 @@ #include "WWWCore.h" #include "WWWStream.h" #include "WWWTrans.h" +#include "WWWFile.h" #include "HTReqMan.h" #include "HTNetMan.h" #include "HTFTPDir.h" #include "HTFTP.h" /* Implemented here */ -/* Macros and other defines */ -#if 0 -/* Only use this if ABSOLUTELY necessary! */ -#define FTP_POLL_PORTS /* If allocation does not work, poll ourselves.*/ -#endif - -#ifdef FTP_POLL_PORTS -#define FIRST_TCP_PORT 1024 /* Region to try for a listening port */ -#define LAST_TCP_PORT 5999 -PRIVATE int DataPort = FIRST_TCP_PORT; -#endif - #ifndef FTP_PORT #define FTP_PORT 21 #define FTP_DATA 20 @@ -120,10 +113,7 @@ FTPServerType server; /* Type of server */ HTNet * cnet; /* Control connection */ HTNet * dnet; /* Data connection */ -/* begin _GM_ */ -/* Note: libwww bug ID: GM3 */ BOOL alreadyLoggedIn; -/* end _GM_ */ } ftp_ctrl; typedef struct _ftp_data { @@ -154,12 +144,13 @@ const HTInputStreamClass * isa; }; +/* Determine whether we should use passive or active data TCP connections */ typedef enum _FTPDataCon { FTP_DATA_PASV = 0x1, FTP_DATA_PORT = 0x2 } FTPDataCon; -PRIVATE FTPDataCon FTPMode = FTP_DATA_PASV; +PRIVATE FTPDataCon FTPMode = FTP_DATA_PORT; /* Added by Neil Griffin */ PRIVATE FTPTransferMode g_FTPTransferMode = FTP_DEFAULT_TRANSFER_MODE; @@ -203,7 +194,7 @@ (*input->isa->_free)(input); } - /* Remove the request object and our own context structure for http */ + /* Remove the request object and our own context structure for ftp */ if (cnet && ctrl) { HTNet * dnet = ctrl->dnet; ftp_data * data = (ftp_data *) HTNet_context(dnet); @@ -217,14 +208,16 @@ HT_FREE(data->file); HT_FREE(data); } -#if 0 - HTNet_setPersistent(dnet, NO, HT_TP_SINGLE); -#endif + /* See if we got a content length */ if (status == HT_LOADED) HTAnchor_setLength(HTRequest_anchor(request), HTNet_bytesRead(dnet)); - HTNet_delete(dnet, HT_IGNORE); + /* Delete the data net object */ + HTChannel_deleteInput(HTNet_channel(dnet), status); + HTChannel_deleteOutput(HTNet_channel(dnet), status); + HTNet_delete(dnet, HT_IGNORE); + } HTNet_delete(cnet, status); return YES; @@ -250,14 +243,14 @@ /* end _GM_ */ if (isdigit((int) *(me->buffer))) sscanf(me->buffer, "%d%c", &reply, &cont); if (me->first_line) { - if (PROT_TRACE) HTTrace("FTP Rx...... `%s\'\n", me->buffer); + HTTRACE(PROT_TRACE, "FTP Rx...... `%s\'\n" _ me->buffer); if (!reply) return HT_ERROR; me->first_line = NO; me->ctrl->repcode = reply; StrAllocCopy(me->ctrl->reply, ptr); /* begin _GM_ */ /* Note: libwww bug ID: GM3 */ - if ( (reply == 530) && (strcasestr(me->buffer, "already") != NULL) ) { + if ( (reply == 530) && (HTStrCaseStr(me->buffer, "already") != NULL) ) { me->ctrl->alreadyLoggedIn = YES; } else { me->ctrl->alreadyLoggedIn = NO; @@ -306,7 +299,7 @@ } else { *(me->buffer+me->buflen++) = *b; if (me->buflen >= MAX_FTP_LINE) { - if (PROT_TRACE) HTTrace("FTP Status.. Line too long - chopped\n"); + HTTRACE(PROT_TRACE, "FTP Status.. Line too long - chopped\n"); me->junk = YES; if ((status = ScanResponse(me)) != HT_OK) { me->junk = NO; @@ -352,8 +345,7 @@ (*me->target->isa->abort)(me->target, e); HTChunk_delete(me->welcome); HT_FREE(me); - if (PROT_TRACE) - HTTrace("FTPStatus... ABORTING...\n"); + HTTRACE(PROT_TRACE, "FTPStatus... ABORTING...\n"); return HT_ERROR; } @@ -395,13 +387,12 @@ { int len = strlen(token) + (pars ? strlen(pars)+1:0) + 2; HTStream * input = HTRequest_inputStream(request); - HTChunk_clear(ctrl->cmd); - HTChunk_ensure(ctrl->cmd, len); + HTChunk_setSize(ctrl->cmd, len); if (pars && *pars) sprintf(HTChunk_data(ctrl->cmd), "%s %s%c%c", token, pars, CR, LF); else sprintf(HTChunk_data(ctrl->cmd), "%s%c%c", token, CR, LF); - if (PROT_TRACE) HTTrace("FTP Tx...... %s", HTChunk_data(ctrl->cmd)); + HTTRACE(PROT_TRACE, "FTP Tx...... %s" _ HTChunk_data(ctrl->cmd)); return (*input->isa->put_block)(input, HTChunk_data(ctrl->cmd), len); } @@ -429,10 +420,8 @@ HTUnEscape(login); StrAllocCopy(ctrl->uid, login); } else if (g_FTPControlMode & FTP_ALWAYS_ASK_UID_PW) { -/* Added by Marek Nagy. */ ctrl->uid=NULL; ctrl->passwd=NULL; -/* End of adding. */ } else { /* Use anonymous */ HTUserProfile * up = HTRequest_userProfile(request); const char * mailaddress = HTUserProfile_email(up); @@ -442,33 +431,25 @@ else StrAllocCopy(ctrl->passwd, WWW_FTP_CLIENT); } -/* begin _GM_ */ -/* Note: libwww bug ID: GM6 */ - { -/* char tempParams[512]; - sprintf(tempParams, "Username='%s', Password='%s'", ctrl->uid, ctrl->passwd); - HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, - tempParams, strlen(tempParams), "HTFTPParseURL"); -*/ } -/* end _GM_ */ - if (PROT_TRACE) - HTTrace("FTPParse.... uid `%s\' pw `%s\'\n", - ctrl->uid ? ctrl->uid : "", - ctrl->passwd ? ctrl->passwd : ""); + HTTRACE(PROT_TRACE, "FTPParse.... uid `%s\' pw `%s\'\n" _ + ctrl->uid ? ctrl->uid : "" _ + ctrl->passwd ? ctrl->passwd : ""); - ptr = strchr(path, ';'); - if (ptr) { + /* + ** Look for any type in the URI. If not 'type' parameter then look for + ** trailing slash. + */ + if ((ptr = strchr(path, ';')) != NULL) { *ptr = '\0'; if (strncasecomp(ptr, ";type=", 6)) /* Look for type */ data->type = TOUPPER(*(ptr+6)); else if (*(ptr-1) == '/') - data->type = 'N'; + data->type = 'D'; } else if (*(path+strlen(path)-1) == '/') { *(path+strlen(path)-1) = '\0'; - data->type = 'N'; + data->type = 'D'; } - if (data->type && PROT_TRACE) - HTTrace("FTPParse.... Datatype %c\n", data->type); + HTTRACE(PROT_TRACE, "FTPParse.... Datatype %c\n" _ data->type ? data->type : '?'); StrAllocCopy(data->file, path); data->offset = data->file; HT_FREE(login); @@ -505,48 +486,33 @@ ** Set up a port to listen for data ** Returns YES if OK, else NO */ -PRIVATE BOOL ListenSocket (HTNet *cnet, HTNet *dnet, ftp_data *data) +PRIVATE BOOL AcceptDataSocket (HTNet *cnet, HTNet *dnet, ftp_data *data) { -#ifdef FTP_POLL_PORTS - unsigned short old_DataPort = DataPort; - for (DataPort=old_DataPort+1;; DataPort++) { - if (DataPort > LAST_TCP_PORT) - DataPort = FIRST_TCP_PORT; - if (DataPort == old_DataPort) { - if(PROT_TRACE) HTTrace("FTP......... No data port found\n"); - return NO; - } - if (HTDoListen(dnet, DataPort, 1) == HT_OK) - break; -#if 0 - if (HTNet_socket(dnet) != INVSOC) { - NETCLOSE(HTNet_socket(dnet)); - HTNet_socket(dnet) = INVSOC; - } -#else - HTDoClose(dnet); -#endif - } -#else - if (HTDoListen(dnet, 0, HTNet_socket(cnet), 1) != HT_OK) return NO; -#endif /* FTP_POLL_PORTS */ + if (HTHost_listen(NULL, dnet, "ftp://localhost:0") == HT_ERROR) + return NO; - /* Now we must find out who we are to tell the other guy */ + /* + ** Now we must find out who we are to tell the other guy + ** We have to get the local IP interface from the control connection as + ** this is not yet set in the unaccepted data socket + */ { - SockA local_addr; - int addr_size = sizeof(local_addr); - memset((void *) &local_addr, '\0', sizeof(local_addr)); - if (getsockname(HTNet_socket(dnet), (struct sockaddr *) &local_addr, - &addr_size) < 0) { + SockA local_port, local_host; + int addr_size = sizeof(local_port); + memset((void *) &local_host, '\0', addr_size); + memset((void *) &local_port, '\0', addr_size); + if (getsockname(HTNet_socket(cnet), + (struct sockaddr *) &local_host, &addr_size) < 0 || + getsockname(HTNet_socket(dnet), + (struct sockaddr *) &local_port, &addr_size) < 0) { HTRequest_addSystemError(HTNet_request(dnet), ERR_FATAL, socerrno, NO, "getsockname"); return NO; } - if (PROT_TRACE) HTTrace("FTP......... This host is `%s\'\n", - HTInetString(&local_addr)); + HTTRACE(PROT_TRACE, "FTP......... This host is `%s\'\n" _ HTInetString(&local_host)); { - u_long addr = local_addr.sin_addr.s_addr; - u_short port = local_addr.sin_port; + u_long addr = local_host.sin_addr.s_addr; + u_short port = local_port.sin_port; sprintf(data->host, "%d,%d,%d,%d,%d,%d", (int)*((unsigned char *)(&addr)+0), (int)*((unsigned char *)(&addr)+1), @@ -588,13 +554,13 @@ { HTAlertCallback * cbf = HTAlert_find(HT_PROG_LOGIN); if (cbf) (*cbf)(request, HT_PROG_LOGIN, HT_MSG_NULL, NULL, NULL, NULL); - if (PROT_TRACE) HTTrace("FTP Login.. now in state NEED_SELECT\n"); + HTTRACE(PROT_TRACE, "FTP Login... now in state NEED_SELECT\n"); ctrl->substate = ctrl->reset ? NEED_REIN : NEED_GREETING; } break; case NEED_GREETING: - if (PROT_TRACE) HTTrace("FTP Login.. now in state NEED_GREETING\n"); + HTTRACE(PROT_TRACE, "FTP Login... now in state NEED_GREETING\n"); status = HTHost_read(HTNet_host(cnet), cnet); if (status == HT_WOULD_BLOCK) return HT_WOULD_BLOCK; @@ -611,7 +577,7 @@ break; case NEED_REIN: - if (PROT_TRACE) HTTrace("FTP Login.. now in state NEED_REIN\n"); + HTTRACE(PROT_TRACE, "FTP Login... now in state NEED_REIN\n"); if (!ctrl->sent) { status = SendCommand(request, ctrl, "REIN", NULL); if (status == HT_WOULD_BLOCK) @@ -624,13 +590,11 @@ if (status == HT_WOULD_BLOCK) return HT_WOULD_BLOCK; else if (status == HT_LOADED) { -/* begin _GM_ */ -/* Note: libwww bug ID: GM8 */ - /* if (ctrl->repcode/100 == 2) { */ - /* If the FTP server doesn't support the REIN command, then - the return code will be 502 */ + /* + ** If the FTP server doesn't support the REIN command, then + ** the return code will be 502 + */ if ((ctrl->repcode/100 == 2) || (ctrl->repcode == 502)) { -/* end _GM_ */ ctrl->substate = (ctrl->uid && *ctrl->uid) ? NEED_UID : PROMPT_USER; } else { @@ -644,7 +608,7 @@ break; case NEED_UID: - if (PROT_TRACE) HTTrace("FTP Login.. now in state NEED_UID\n"); + HTTRACE(PROT_TRACE, "FTP Login... now in state NEED_UID\n"); if (!ctrl->sent) { status = SendCommand(request, ctrl, "USER", ctrl->uid); if (status == HT_WOULD_BLOCK) @@ -670,10 +634,10 @@ } else if (ctrl->repcode == 530) { if (ctrl->alreadyLoggedIn == YES) { ctrl->substate = SUB_SUCCESS; - if (PROT_TRACE) HTTrace("FTP Login.. Already logged in\n"); + HTTRACE(PROT_TRACE, "FTP Login... Already logged in\n"); } else { ctrl->substate = PROMPT_USER; - if (PROT_TRACE) HTTrace("FTP Login.. User Unknown\n"); + HTTRACE(PROT_TRACE, "FTP Login... User Unknown\n"); } } /* end _GM_ */ @@ -686,7 +650,7 @@ break; case NEED_PASSWD: - if (PROT_TRACE) HTTrace("FTP Login.. now in state NEED_PASSWD\n"); + HTTRACE(PROT_TRACE, "FTP Login... now in state NEED_PASSWD\n"); if (!ctrl->sent) { status = SendCommand(request, ctrl, "PASS", ctrl->passwd); if (status == HT_WOULD_BLOCK) @@ -723,7 +687,7 @@ break; case NEED_ACCOUNT: - if (PROT_TRACE) HTTrace("FTP Login.. now in state NEED_ACCOUNT\n"); + HTTRACE(PROT_TRACE, "FTP Login... now in state NEED_ACCOUNT\n"); if (!ctrl->sent) { status = SendCommand(request, ctrl, "ACCT", ctrl->account); if (status == HT_WOULD_BLOCK) @@ -748,7 +712,7 @@ break; case PROMPT_USER: - if (PROT_TRACE) HTTrace("FTP Login.. now in state PROMPT_USER\n"); + HTTRACE(PROT_TRACE, "FTP Login... now in state PROMPT_USER\n"); { HTAlertCallback *cbf = HTAlert_find(HT_A_USER_PW); HTAlertPar * reply = HTAlert_newReply(); @@ -759,6 +723,10 @@ ctrl->uid = HTAlert_replyMessage(reply); ctrl->passwd = HTAlert_replySecret(reply); } + else { + ctrl->uid = NULL; + ctrl->passwd = NULL; + } HTAlert_deleteReply(reply); if (ctrl->uid && *ctrl->uid && ctrl->passwd && *ctrl->passwd) ctrl->substate = NEED_UID; @@ -768,17 +736,17 @@ break; case SUB_ERROR: - if (PROT_TRACE) HTTrace("FTP Login.. now in state SUB_ERROR\n"); + HTTRACE(PROT_TRACE, "FTP Login... now in state SUB_ERROR\n"); HTRequest_addError(request, ERR_FATAL, NO, HTERR_FTP_LOGIN_FAILURE, NULL, 0, "HTFTPLogin"); - if (PROT_TRACE) HTTrace("FTP......... Login failed\n"); + HTTRACE(PROT_TRACE, "FTP......... Login failed\n"); ctrl->substate = 0; return HT_ERROR; break; case SUB_SUCCESS: - if (PROT_TRACE) HTTrace("FTP Login.. now in state SUB_SUCCESS\n"); - if (PROT_TRACE) HTTrace("FTP......... Logged in as `%s\'\n", ctrl->uid); + HTTRACE(PROT_TRACE, "FTP Login... now in state SUB_SUCCESS\n"); + HTTRACE(PROT_TRACE, "FTP......... Logged in as `%s\'\n" _ ctrl->uid); ctrl->substate = 0; return HT_OK; break; @@ -810,7 +778,7 @@ while (1) { switch ((state) ctrl->substate) { case NEED_TYPE: - if (PROT_TRACE) HTTrace("FTP Data.... now in state NEED_TYPE\n"); + HTTRACE(PROT_TRACE, "FTP Data.... now in state NEED_TYPE\n"); if(!data->type|| data->pasv || data->type=='N' || data->type=='L'){ ctrl->substate = NEED_SELECT; break; @@ -841,17 +809,17 @@ break; case NEED_SELECT: - if (PROT_TRACE) HTTrace("FTP Data.... now in state NEED_SELECT\n"); + HTTRACE(PROT_TRACE, "FTP Data.... now in state NEED_SELECT\n"); if (FTPMode & FTP_DATA_PASV && !data->pasv) ctrl->substate = NEED_PASV; - else if (ListenSocket(cnet, dnet, data)) + else if (AcceptDataSocket(cnet, dnet, data)) ctrl->substate = NEED_PORT; else ctrl->substate = SUB_ERROR; break; case NEED_PASV: - if (PROT_TRACE) HTTrace("FTP Data.... now in state NEED_PASV\n"); + HTTRACE(PROT_TRACE, "FTP Data.... now in state NEED_PASV\n"); if (!ctrl->sent) { status = SendCommand(request, ctrl, "PASV", NULL); if (status == HT_WOULD_BLOCK) @@ -876,8 +844,7 @@ while (*host && !isdigit((int) *host++)); if (!*host || sscanf(--host, "%d,%d,%d,%d,%d,%d", &h0,&h1,&h2,&h3,&p0,&p1) < 6) { - if (PROT_TRACE) - HTTrace("FTP Data.... PASV No addr\n"); + HTTRACE(PROT_TRACE, "FTP Data.... PASV No addr\n"); ctrl->substate = SUB_ERROR; break; } else { @@ -888,7 +855,7 @@ ctrl->substate = SUB_SUCCESS; } } else { - ctrl->substate = ListenSocket(cnet, dnet, data) ? + ctrl->substate = AcceptDataSocket(cnet, dnet, data) ? NEED_PORT : SUB_ERROR; } } else @@ -898,7 +865,7 @@ break; case NEED_PORT: - if (PROT_TRACE) HTTrace("FTP Data.... now in state NEED_PORT\n"); + HTTRACE(PROT_TRACE, "FTP Data.... now in state NEED_PORT\n"); if (!ctrl->sent) { status = SendCommand(request, ctrl, "PORT", data->host); if (status == HT_WOULD_BLOCK) @@ -921,17 +888,15 @@ break; case SUB_ERROR: - if (PROT_TRACE) HTTrace("FTP Data.... now in state SUB_ERROR\n"); - if (PROT_TRACE) - HTTrace("FTP Data.... Can't setup data connection\n"); + HTTRACE(PROT_TRACE, "FTP Data.... now in state SUB_ERROR\n"); + HTTRACE(PROT_TRACE, "FTP Data.... Can't setup data connection\n"); ctrl->substate = 0; return HT_ERROR; break; case SUB_SUCCESS: - if (PROT_TRACE) HTTrace("FTP Data.... now in state SUB_SUCCESS\n"); - if (PROT_TRACE) - HTTrace("FTP Data.... Data connection negotiated\n"); + HTTRACE(PROT_TRACE, "FTP Data.... now in state SUB_SUCCESS\n"); + HTTRACE(PROT_TRACE, "FTP Data.... Data connection negotiated\n"); ctrl->substate = 0; return HT_OK; break; @@ -965,7 +930,7 @@ while (1) { switch ((state) ctrl->substate) { case NEED_SYST: - if (PROT_TRACE) HTTrace("FTP Server.. now in state NEED_SYST\n"); + HTTRACE(PROT_TRACE, "FTP Server.. now in state NEED_SYST\n"); if (!ctrl->sent) { if (ctrl->server != FTP_UNSURE) { FTPListType(data, ctrl->server); @@ -990,12 +955,11 @@ break; case CHECK_SYST: - if (PROT_TRACE) HTTrace("FTP Server.. now in state CHECK_SYST\n"); + HTTRACE(PROT_TRACE, "FTP Server.. now in state CHECK_SYST\n"); { char *reply = ctrl->reply; if (!*reply) { - if (PROT_TRACE) - HTTrace("FTP Server.. No server info?\n"); + HTTRACE(PROT_TRACE, "FTP Server.. No server info?\n"); ctrl->substate = NEED_PWD; break; } @@ -1028,7 +992,7 @@ break; case NEED_PWD: - if (PROT_TRACE) HTTrace("FTP Server.. now in state NEED_PWD\n"); + HTTRACE(PROT_TRACE, "FTP Server.. now in state NEED_PWD\n"); if (!ctrl->sent) { status = SendCommand(request, ctrl, "PWD", NULL); if (status == HT_WOULD_BLOCK) @@ -1050,13 +1014,12 @@ break; case CHECK_PWD: - if (PROT_TRACE) HTTrace("FTP Server.. now in state CHECK_PWD\n"); + HTTRACE(PROT_TRACE, "FTP Server.. now in state CHECK_PWD\n"); { char *start = strchr(ctrl->reply, '"'); char *end; if (!start || (end = strchr(++start, '"')) == NULL) { - if (PROT_TRACE) - HTTrace("FTP Server.. No current directory?\n"); + HTTRACE(PROT_TRACE, "FTP Server.. No current directory?\n"); ctrl->server = FTP_GENERIC; } else { *end = '\0'; @@ -1076,20 +1039,18 @@ break; case SUB_ERROR: - if (PROT_TRACE) HTTrace("FTP Server.. now in state SUB_ERROR\n"); - if (PROT_TRACE) - HTTrace("FTP Server.. Can't get server information\n"); + HTTRACE(PROT_TRACE, "FTP Server.. now in state SUB_ERROR\n"); + HTTRACE(PROT_TRACE, "FTP Server.. Can't get server information\n"); ctrl->substate = 0; ctrl->server = FTP_GENERIC; return HT_ERROR; break; case SUB_SUCCESS: - if (PROT_TRACE) HTTrace("FTP Server.. now in state SUB_SUCCESS\n"); + HTTRACE(PROT_TRACE, "FTP Server.. now in state SUB_SUCCESS\n"); { HTHost * host = HTNet_host(cnet); - if (PROT_TRACE) - HTTrace("FTP Server.. Guessed type %d\n", ctrl->server); + HTTRACE(PROT_TRACE, "FTP Server.. Guessed type %d\n" _ ctrl->server); HTHost_setVersion(host, ctrl->server); FTPListType(data, ctrl->server); ctrl->substate = 0; @@ -1115,6 +1076,7 @@ char *segment = NULL; HTNet *dnet = ctrl->dnet; BOOL data_is_active = (sockfd == HTNet_socket(dnet)); + HTPostCallback *pcbf; typedef enum _state { SUB_ERROR = -2, SUB_SUCCESS = -1, @@ -1132,29 +1094,23 @@ while (1) { switch ((state) ctrl->substate) { case NEED_SELECT: - if (PROT_TRACE) HTTrace("FTP Get Data now in state NEED_SELECT\n"); + HTTRACE(PROT_TRACE, "FTP Get Data now in state NEED_SELECT\n"); ctrl->substate = data->pasv ? NEED_CONNECT : NEED_ACTION; break; case NEED_CONNECT: - if (PROT_TRACE) HTTrace("FTP Get Data now in state NEED_CONNECT\n"); - status = HTHost_connect(HTNet_host(dnet), dnet, data->host, FTP_DATA); + HTTRACE(PROT_TRACE, "FTP Get Data now in state NEED_CONNECT\n"); + status = HTHost_connect(HTNet_host(dnet), dnet, data->host); if (status == HT_WOULD_BLOCK) return HT_WOULD_BLOCK; else if (status == HT_OK) { - if (PROT_TRACE) - HTTrace("FTP Get Data.... Active data socket %d\n", + HTTRACE(PROT_TRACE, "FTP Get Data Active data socket %d\n" _ HTNet_socket(dnet)); -#if 0 - /* HTNet_setPersistent(dnet, YES, HT_TP_INTERLEAVE); */ - HTNet_setPersistent(dnet, YES, HT_TP_SINGLE); -#endif ctrl->substate = NEED_ACTION; } else { /* Swap to PORT on the fly */ NETCLOSE(HTNet_socket(dnet)); HTNet_setSocket(dnet, INVSOC); - if (PROT_TRACE) - HTTrace("FTP Get Data Swap to PORT on the fly\n"); + HTTRACE(PROT_TRACE, "FTP Get Data Swap to PORT on the fly\n"); ctrl->substate = NEED_SELECT; HT_FREE(segment); return HT_OK; @@ -1162,27 +1118,24 @@ break; case NEED_ACCEPT: - if (PROT_TRACE) HTTrace("FTP Get Data now in state NEED_ACCEPT\n"); - { - status = HTDoAccept(ctrl->dnet, &ctrl->dnet); - dnet = ctrl->dnet; - if (status == HT_WOULD_BLOCK) - return HT_WOULD_BLOCK; - else if (status == HT_OK) { - if (PROT_TRACE) - HTTrace("FTP Get Data.... Passive data socket %d\n", - HTNet_socket(dnet)); - ctrl->substate = NEED_STREAM; - } else - ctrl->substate = SUB_ERROR; - } + HTTRACE(PROT_TRACE, "FTP Get Data now in state NEED_ACCEPT\n"); + status = HTHost_accept(HTNet_host(dnet), dnet, NULL); + if (status == HT_WOULD_BLOCK) + return HT_WOULD_BLOCK; + else if (status == HT_OK) { + HTTRACE(PROT_TRACE, "FTP Get Data Passive data socket %d\n" _ + HTNet_socket(dnet)); + ctrl->substate = NEED_STREAM; + } else + ctrl->substate = SUB_ERROR; break; case NEED_ACTION: - if (PROT_TRACE) HTTrace("FTP Get Data now in state NEED_ACTION\n"); + HTTRACE(PROT_TRACE, "FTP Get Data now in state NEED_ACTION\n"); if (!ctrl->sent) { char *cmd = (data->type=='L') ? "LIST" : (data->type=='N') ? "NLST" : "RETR"; + if (HTRequest_method(request) == METHOD_PUT) cmd = "STOR"; StrAllocCopy(segment, data->offset); HTUnEscape(segment); HTCleanTelnetString(segment); @@ -1203,18 +1156,13 @@ ctrl->substate = data->pasv ? NEED_STREAM : NEED_ACCEPT; else if (code/100==5 && !ctrl->cwd) ctrl->substate = NEED_SEGMENT; -/* begin _GM_ */ -/* Note: libwww bug ID: GM9 */ - /* else */ - /* ctrl->substate = SUB_ERROR; */ else { if (ctrl->repcode == 550) { - if (PROT_TRACE) HTTrace("FTP Get Data no such file or directory\n"); + HTTRACE(PROT_TRACE, "FTP Get Data no such file or directory\n"); data->stream_error = YES; } ctrl->substate = SUB_ERROR; } -/* end _GM_ */ } else ctrl->substate = SUB_ERROR; ctrl->sent = NO; @@ -1222,7 +1170,7 @@ break; case NEED_SEGMENT: - if (PROT_TRACE) HTTrace("FTP Get Data now in state NEED_SEGMENT\n"); + HTTRACE(PROT_TRACE, "FTP Get Data now in state NEED_SEGMENT\n"); { char *ptr; if (data->offset == data->file) { @@ -1250,7 +1198,7 @@ break; case NEED_CWD: - if (PROT_TRACE) HTTrace("FTP Get Data now in state NEED_CWD\n"); + HTTRACE(PROT_TRACE, "FTP Get Data now in state NEED_CWD\n"); if (!ctrl->sent) { status = SendCommand(request, ctrl, "CWD", segment); HT_FREE(segment); @@ -1276,7 +1224,7 @@ break; case NEED_STREAM: - if (PROT_TRACE) HTTrace("FTP Get Data now in state NEED_STREAM\n"); + HTTRACE(PROT_TRACE, "FTP Get Data now in state NEED_STREAM\n"); /* ** Create the stream pipe FROM the channel to the application. ** The target for the input stream pipe is set up using the @@ -1290,19 +1238,52 @@ HTRequest_outputStream(request), request, YES); HTNet_setReadStream(dnet, target); + HTRequest_setOutputConnected(request, YES); } - HTRequest_setOutputConnected(request, YES); data_is_active = YES; ctrl->substate = NEED_BODY; break; case NEED_BODY: - if (PROT_TRACE) HTTrace("FTP Get Data now in state NEED_BODY\n"); + HTTRACE(PROT_TRACE, "FTP Get Data now in state NEED_BODY\n"); if (data_is_active) { + if (HTRequest_method(request) == METHOD_PUT) { + HTParentAnchor * entity = HTRequest_entityAnchor(request); + const char * document = (const char *) HTAnchor_document(entity); + int length = (int)HTAnchor_length(entity); + HTStream * output = + (HTStream *)HTChannel_output(HTNet_host(dnet)->channel); + pcbf = HTRequest_postCallback(request); + if (pcbf) { + status = (*pcbf)(request, output); + } else { + status = (*output->isa->put_block)(output, + document, + length); + if (status == HT_OK) { + status = HT_LOADED; + } + } + + if (status == HT_WOULD_BLOCK) { + return HT_WOULD_BLOCK; + } else if ( status == HT_LOADED ) { + ctrl->substate = SUB_SUCCESS; + data->complete |= 3; + } else if ( status == HT_OK ) { + return HT_WOULD_BLOCK; + } else { + ctrl->substate = SUB_ERROR; + data->stream_error = YES; + } + continue; + } else { status = HTHost_read(HTNet_host(dnet), dnet); + } if (status == HT_WOULD_BLOCK) return HT_WOULD_BLOCK; - else if (status == HT_LOADED || status == HT_CLOSED) { + else if (status == HT_LOADED || status == HT_CLOSED || status == HT_OK) { + HTDoClose(dnet); data->complete |= 1; if (data->complete >= 3) ctrl->substate = SUB_SUCCESS; @@ -1331,7 +1312,7 @@ break; case SUB_ERROR: - if (PROT_TRACE) HTTrace("FTP Get Data now in state SUB_ERROR\n"); + HTTRACE(PROT_TRACE, "FTP Get Data now in state SUB_ERROR\n"); HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTFTPGetData"); ctrl->substate = 0; @@ -1340,7 +1321,7 @@ break; case SUB_SUCCESS: - if (PROT_TRACE) HTTrace("FTP Get Data now in state SUB_SUCCESS\n"); + HTTRACE(PROT_TRACE, "FTP Get Data now in state SUB_SUCCESS\n"); ctrl->substate = 0; HT_FREE(segment); return HT_LOADED; @@ -1370,13 +1351,12 @@ HTParentAnchor * anchor = HTRequest_anchor(request); char * url = HTAnchor_physical(anchor); - /* ** Initiate a new FTP ctrl and data structure and bind to request structure ** This is actually state FTP_BEGIN, but it can't be in the state ** machine as we need the structure first. */ - if (PROT_TRACE) HTTrace("FTP......... Looking for `%s\'\n",url); + HTTRACE(PROT_TRACE, "FTP......... Looking for `%s\'\n" _ url); if ((ctrl = (ftp_ctrl *) HT_CALLOC(1, sizeof(ftp_ctrl))) == NULL || (data = (ftp_data *) HT_CALLOC(1, sizeof(ftp_data))) == NULL) HT_OUTOFMEM("HTLoadFTP"); @@ -1413,15 +1393,21 @@ if (type == HTEvent_CLOSE) { /* Interrupted */ - if (soc == HTNet_socket(cnet)) + if (soc == HTNet_socket(cnet) && data->complete<1) FTPCleanup(request, HT_INTERRUPTED); else FTPCleanup(request, HT_LOADED); return HT_OK; } else if (type == HTEvent_TIMEOUT) { - HTRequest_addError(request, ERR_FATAL, NO, HTERR_TIME_OUT, - NULL, 0, "HTLoadHTTP"); - FTPCleanup(request, HT_TIMEOUT); + + /* + ** Don't time out the control connection if we are actually recieving data + ** on the data connection + */ + if (!(soc == HTNet_socket(cnet) && !(data->complete & 1) && HTNet_bytesRead(ctrl->dnet)>0)) { + HTRequest_addError(request, ERR_FATAL, NO, HTERR_TIME_OUT, NULL, 0, "HTLoadHTTP"); + FTPCleanup(request, HT_TIMEOUT); + } return HT_OK; } else { @@ -1433,9 +1419,17 @@ while (1) { switch (ctrl->state) { case FTP_BEGIN: - if (PROT_TRACE) HTTrace("FTP Event... now in state FTP_BEGIN\n"); - HTFTPParseURL(request, url, ctrl, data); + HTTRACE(PROT_TRACE, "FTP Event... now in state FTP_BEGIN\n"); + + /* Only handle GET requests for now */ + if (HTRequest_method(request) != METHOD_GET && + HTRequest_method(request) != METHOD_PUT ) { + HTTRACE(PROT_TRACE, "FTP Event... This module only supports the GET or PUT methods\n"); + ctrl->state = FTP_ERROR; + break; + } + HTFTPParseURL(request, url, ctrl, data); /* The following is added by Neil Griffin, GAIN Software */ @@ -1464,8 +1458,7 @@ } } - if (PROT_TRACE) - HTTrace("FTP Event... Transfer mode set to '%c'\n", data->type); + HTTRACE(PROT_TRACE, "FTP Event... Transfer mode set to '%c'\n" _ data->type); /* ** See if we can get any hints to what we might expect content wise. @@ -1477,8 +1470,8 @@ break; case FTP_NEED_CCON: - if (PROT_TRACE) HTTrace("FTP Event... now in state FTP_NEED_CONN\n"); - status = HTHost_connect(host, cnet, url, FTP_PORT); + HTTRACE(PROT_TRACE, "FTP Event... now in state FTP_NEED_CONN\n"); + status = HTHost_connect(host, cnet, url); host = HTNet_host(cnet); if (status == HT_OK) { @@ -1500,8 +1493,7 @@ /* Check persistent connection */ if (HTNet_persistent(cnet)) { ctrl->server = HTHost_version(host); - if (PROT_TRACE) - HTTrace("FTP Server.. Cache says type %d server\n", + HTTRACE(PROT_TRACE, "FTP Server.. Cache says type %d server\n" _ ctrl->server); ctrl->reset = 1; } else @@ -1546,14 +1538,14 @@ break; case FTP_NEED_LOGIN: - if (PROT_TRACE) HTTrace("FTP Event... now in state FTP_NEED_LOGIN\n"); + HTTRACE(PROT_TRACE, "FTP Event... now in state FTP_NEED_LOGIN\n"); status = HTFTPLogin(request, cnet, ctrl); if (status == HT_WOULD_BLOCK) return HT_OK; ctrl->state = (status == HT_OK) ? FTP_NEED_DCON : FTP_ERROR; break; case FTP_NEED_DCON: - if (PROT_TRACE) HTTrace("FTP Event... now in state FTP_NEED_DCON\n"); + HTTRACE(PROT_TRACE, "FTP Event... now in state FTP_NEED_DCON\n"); status = HTFTPDataConnection(request, cnet, ctrl, data); if (status == HT_WOULD_BLOCK) return HT_OK; if (status == HT_OK) @@ -1564,13 +1556,15 @@ break; case FTP_NEED_DATA: - if (PROT_TRACE) HTTrace("FTP Event... now in state FTP_NEED_DATA\n"); + HTTRACE(PROT_TRACE, "FTP Event... now in state FTP_NEED_DATA\n"); status = HTFTPGetData(request, cnet, soc, ctrl, data); if (status == HT_WOULD_BLOCK) return HT_OK; if (status == HT_LOADED) ctrl->state = FTP_SUCCESS; else if (status == HT_OK) ctrl->state = FTP_NEED_DCON; + else if (HTRequest_method(request) == METHOD_PUT) + ctrl->state = FTP_ERROR; else if (!FTP_DIR(data) && !data->stream_error) { FTPListType(data, ctrl->server); ctrl->state = FTP_NEED_SERVER; /* Try a dir instead? */ @@ -1579,20 +1573,20 @@ break; case FTP_NEED_SERVER: - if (PROT_TRACE) HTTrace("FTP Event... now in state FTP_NEED_SERVER\n"); + HTTRACE(PROT_TRACE, "FTP Event... now in state FTP_NEED_SERVER\n"); status = HTFTPServerInfo(request, cnet, ctrl, data); if (status == HT_WOULD_BLOCK) return HT_OK; ctrl->state = FTP_NEED_DATA; break; case FTP_SUCCESS: - if (PROT_TRACE) HTTrace("FTP Event... now in state FTP_SUCCESS\n"); + HTTRACE(PROT_TRACE, "FTP Event... now in state FTP_SUCCESS\n"); FTPCleanup(request, HT_LOADED); return HT_OK; break; case FTP_ERROR: - if (PROT_TRACE) HTTrace("FTP Event... now in state FTP_ERROR\n"); + HTTRACE(PROT_TRACE, "FTP Event... now in state FTP_ERROR\n"); FTPCleanup(request, HT_ERROR); return HT_OK; break; diff -Naur xdvik-22.40l/libs/libwww/HTFTP.h xdvik-22.40n/libs/libwww/HTFTP.h --- xdvik-22.40l/libs/libwww/HTFTP.h Wed Apr 18 14:23:14 2001 +++ xdvik-22.40n/libs/libwww/HTFTP.h Fri Sep 13 00:23:46 2002 @@ -99,7 +99,7 @@ -@(#) $Id: HTFTP.h,v 1.1.1.1 2001/04/18 14:23:14 stefanulrich Exp $ +@(#) $Id: HTFTP.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTFTPDir.c xdvik-22.40n/libs/libwww/HTFTPDir.c --- xdvik-22.40l/libs/libwww/HTFTPDir.c Wed Apr 18 14:23:14 2001 +++ xdvik-22.40n/libs/libwww/HTFTPDir.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTFTPDir.c,v 1.1.1.1 2001/04/18 14:23:14 stefanulrich Exp $ +** @(#) $Id: HTFTPDir.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Authors ** HF Henrik Frystyk @@ -221,8 +221,7 @@ } else { *(me->buffer+me->buflen++) = *b; if (me->buflen >= MAX_FTP_LINE) { - if (PROT_TRACE) - HTTrace("FTP Dir..... Line too long - ignored\n"); + HTTRACE(PROT_TRACE, "FTP Dir..... Line too long - ignored\n"); me->buflen = 0; me->junk = YES; } @@ -256,7 +255,7 @@ PRIVATE int FTPDir_abort (HTStream * me, HTList * e) { - if (PROT_TRACE) HTTrace("FTPDir...... ABORTING...\n"); + HTTRACE(PROT_TRACE, "FTPDir...... ABORTING...\n"); FTPDir_free(me); return HT_ERROR; } diff -Naur xdvik-22.40l/libs/libwww/HTFTPDir.h xdvik-22.40n/libs/libwww/HTFTPDir.h --- xdvik-22.40l/libs/libwww/HTFTPDir.h Wed Apr 18 14:23:14 2001 +++ xdvik-22.40n/libs/libwww/HTFTPDir.h Fri Sep 13 00:23:46 2002 @@ -40,7 +40,7 @@ -@(#) $Id: HTFTPDir.h,v 1.1.1.1 2001/04/18 14:23:14 stefanulrich Exp $ +@(#) $Id: HTFTPDir.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTFWrite.c xdvik-22.40n/libs/libwww/HTFWrite.c --- xdvik-22.40l/libs/libwww/HTFWrite.c Wed Apr 18 14:23:14 2001 +++ xdvik-22.40n/libs/libwww/HTFWrite.c Fri Sep 13 00:23:46 2002 @@ -1,9 +1,9 @@ /* HTFWrite.c -** FILE WRITER +** BASIC FILE WRITER STREAM ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTFWrite.c,v 1.1.1.1 2001/04/18 14:23:14 stefanulrich Exp $ +** @(#) $Id: HTFWrite.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This version of the stream object just writes to a C file. ** The file is assumed open and left open. @@ -22,32 +22,15 @@ /* Library include files */ #include "wwwsys.h" #include "WWWUtil.h" -#include "HTFormat.h" -#include "HTError.h" -#include "HTAlert.h" -#include "HTLib.h" -#include "HTInet.h" -#include "HTBind.h" -#include "HTParse.h" -#include "HTReq.h" +#include "WWWCore.h" #include "HTFWrite.h" /* Implemented here */ -#define HASH_SIZE 1001 /* Tunable */ - struct _HTStream { const HTStreamClass *isa; - FILE * fp; BOOL leave_open; /* Close file when free? */ - char * end_command; /* Command to execute */ - BOOL remove_on_close; /* Remove file? */ - char * filename; /* Name of file */ - HTRequest * request; /* saved for callback */ - HTRequestCallback * callback; }; -#define DEFAULT_LAST_SEGMENT "index" - /* ------------------------------------------------------------------------- */ PRIVATE int HTFWriter_put_character (HTStream * me, char c) @@ -82,13 +65,6 @@ fclose(me->fp); else HTFWriter_flush(me); -#ifdef HAVE_SYSTEM - if (me->end_command) system(me->end_command); /* SECURITY HOLE!!! */ -#endif - if (me->callback) (*me->callback)(me->request, me->filename); - if (me->remove_on_close) REMOVE(me->filename); - HT_FREE(me->end_command); - HT_FREE(me->filename); HT_FREE(me); } return HT_OK; @@ -96,12 +72,9 @@ PRIVATE int HTFWriter_abort (HTStream * me, HTList * e) { - if (STREAM_TRACE) HTTrace("FileWriter.. ABORTING...\n"); + HTTRACE(STREAM_TRACE, "FileWriter.. ABORTING...\n"); if (me) { if (me->leave_open != YES) fclose(me->fp); - if (me->remove_on_close) REMOVE(me->filename); - HT_FREE(me->end_command); - HT_FREE(me->filename); HT_FREE(me); } return HT_ERROR; @@ -123,7 +96,7 @@ { HTStream * me = NULL; if (!fp) { - if (STREAM_TRACE)HTTrace("FileWriter.. Bad file descriptor\n"); + HTTRACE(STREAM_TRACE, "FileWriter.. Bad file descriptor\n"); return HTErrorStream(); } if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) @@ -131,207 +104,6 @@ me->isa = &HTFWriter; me->fp = fp; me->leave_open = leave_open; - me->request = request; return me; -} - -/* ------------------------------------------------------------------------- */ -/* FILE WRITER ROUTINES */ -/* ------------------------------------------------------------------------- */ - -/* -** This function tries really hard to find a non-existent filename relative -** to the path given. Returns a string that must be freed by the caller or -** NULL on error. -*/ -PRIVATE char * get_filename (char * base, const char * uri, - const char * suffix, BOOL use_last_segment) -{ - char * path = NULL; - if (use_last_segment) { - char * uri_path = NULL; - if (uri && (uri_path = HTParse(uri, "", PARSE_PATH|PARSE_PUNCTUATION))) { - char * last_segment = strrchr(uri_path, '/'); - BOOL slash = (base && *(base+strlen(base)-1)=='/'); - if (last_segment && *(last_segment+1)) { - StrAllocMCopy(&path, base ? base : "", - slash ? "" : "/", ++last_segment, NULL); - } else { - StrAllocMCopy(&path, base ? base : "", - slash ? "" : "/", DEFAULT_LAST_SEGMENT, - suffix ? suffix : "", NULL); - } - } - } else { - path = HTGetTmpFileName(base); - if (path && suffix) StrAllocCat(path, suffix); - } - - if (STREAM_TRACE) - HTTrace("Save file... Temporaray file `%s\'\n", path ? path : ""); - return path; -} - -/* Save Locally -** ------------ -** Saves a file to local disk. This can for example be used to dump -** data objects of unknown media types to local disk. The stream prompts -** for a file name for the temporary file. -*/ -PUBLIC HTStream* HTSaveLocally (HTRequest * request, - void * param, - HTFormat input_format, - HTFormat output_format, - HTStream * output_stream) -{ - FILE * fp = NULL; - char * filename = NULL; - HTUserProfile * up = HTRequest_userProfile(request); - char * tmproot = HTUserProfile_tmp(up); - if (HTLib_secure()) { - HTRequest_addError(request, ERR_NON_FATAL, NO, HTERR_UNAUTHORIZED, - NULL, 0, "HTSaveLocally"); - return HTErrorStream(); - } - if (!tmproot) { - if (STREAM_TRACE) HTTrace("Save File... turned off\n"); - return HTErrorStream(); - } - - /* Let's prompt the user for a file name for this file */ - { - HTAlertCallback *cbf = HTAlert_find(HT_A_PROMPT); - HTParentAnchor *anchor = (HTParentAnchor *) HTRequest_anchor(request); - - /* - ** If we found an alert handler for prompting the user then call it. - ** If not then either we are in non-interactive mode or no handler - ** has been registered. For now we then return a blackhole which may - ** not be the best thing to do. - */ - if (cbf) { - HTAlertPar * reply = HTAlert_newReply(); - char * suffix = HTBind_getSuffix(anchor); - char * deflt = get_filename(tmproot, HTAnchor_physical(anchor), suffix, YES); - if ((*cbf)(request, HT_A_PROMPT, HT_MSG_FILENAME,deflt,NULL,reply)) - filename = HTAlert_replyMessage(reply); - HTAlert_deleteReply(reply); - HT_FREE(suffix); - HT_FREE(deflt); - } - if (filename) { - if ((fp = fopen(filename, "wb")) == NULL) { - HTRequest_addError(request, ERR_NON_FATAL, NO, HTERR_NO_FILE, - filename, strlen(filename),"HTSaveLocally"); - HT_FREE(filename); - return HTErrorStream(); - } - } else if (cbf) { - if (STREAM_TRACE) HTTrace("Save File... No file name - error stream\n"); - return HTErrorStream(); - } else { - if (STREAM_TRACE) HTTrace("Save File... No file name - black hole\n"); - return HTBlackHole(); - } - } - - /* Now we are ready for creating the file writer stream */ - if (fp) { - HTStream * me = HTFWriter_new(request, fp, NO); - me->filename = filename; - return me; - } - HT_FREE(filename); - return HTErrorStream(); -} - - -/* Take action using a system command -** ---------------------------------- -** Creates temporary file, writes to it and then executes system -** command (maybe an external viewer) when EOF has been reached. The -** stream finds a suitable name of the temporary file which preserves the -** suffix. This way, the system command can find out the file type from -** the name of the temporary file name. -*/ -PUBLIC HTStream* HTSaveAndExecute (HTRequest * request, - void * param, - HTFormat input_format, - HTFormat output_format, - HTStream * output_stream) -{ - FILE * fp = NULL; - char * filename = NULL; - HTUserProfile * up = HTRequest_userProfile(request); - char * tmproot = HTUserProfile_tmp(up); - if (HTLib_secure()) { - HTRequest_addError(request, ERR_NON_FATAL, NO, HTERR_UNAUTHORIZED, - NULL, 0, "HTSaveLocally"); - return HTErrorStream(); - } - if (!tmproot) { - if (STREAM_TRACE) HTTrace("Save File... turned off"); - return HTErrorStream(); - } - - /* Let's find a hash name for this file without asking user */ - { - HTParentAnchor *anchor = (HTParentAnchor *) HTRequest_anchor(request); - char *suffix = HTBind_getSuffix(anchor); - filename = get_filename(tmproot, HTAnchor_physical(anchor), suffix, NO); - HT_FREE(suffix); - if (filename) { - if ((fp = fopen(filename, "wb")) == NULL) { - HTRequest_addError(request, ERR_NON_FATAL, NO, HTERR_NO_FILE, - filename, strlen(filename),"HTSaveAndExecute"); - HT_FREE(filename); - return HTErrorStream(); - } - } else { - if (STREAM_TRACE) HTTrace("Save File... No file name\n"); - return HTErrorStream(); - } - } - - /* Now we are ready for creating the file writer stream */ - if (fp) { - HTStream * me = HTFWriter_new(request, fp, NO); - me->filename = filename; - if (param) { - if ((me->end_command = (char *) HT_MALLOC((strlen((char *) param) + 10 + 3*strlen(filename)))) == NULL) - HT_OUTOFMEM("SaveAndExecute"); - sprintf (me->end_command, - (char *)param, filename, filename, filename); - } - return me; - } - HT_FREE(filename); - return HTErrorStream(); -} - - -/* Save and Call Back -** ------------------ -** This stream works exactly like the HTSaveAndExecute -** stream but in addition when EOF has been reached, it checks whether a -** callback function has been associated with the request object in which -** case, this callback is being called. This can be use by the -** application to do some processing after the system command -** has terminated. The callback function is called with the file name of -** the temporary file as parameter. -*/ -PUBLIC HTStream* HTSaveAndCallback (HTRequest * request, - void * param, - HTFormat input_format, - HTFormat output_format, - HTStream * output_stream) -{ - HTStream * me = HTSaveAndExecute(request, param, input_format, - output_format, output_stream); - if (me) { - me->callback = HTRequest_callback(request); - return me; - } - return HTErrorStream(); } diff -Naur xdvik-22.40l/libs/libwww/HTFWrite.h xdvik-22.40n/libs/libwww/HTFWrite.h --- xdvik-22.40l/libs/libwww/HTFWrite.h Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTFWrite.h Fri Sep 13 00:23:46 2002 @@ -5,7 +5,7 @@ ! - ANSI C File Streams + Basic ANSI C File Writer Stream ! */ @@ -16,19 +16,11 @@ /* -This module contains a set of basic file writer streams that are used to -dump data objects to disk at various places within the Library core. Most -notably, we use these streams in the Format Manager -in order to handle external presenters, for example post script viewers etc. -These streams can of course also be used in other contexts by the application. - - - o - An ANSI C File Writer Stream - o - Various Converters using the File Writer Stream +This module contains a basic file writer stream that can be used to +dump data objects to local disk. See also the various subclasses of +this basic stream which can be used to do save-as, save-and-callback etc. +in the HTFSave module - This module is implemented by HTFWrite.c, and it is a part of the W3C Sample Code Library. @@ -38,11 +30,11 @@ #define HTFWRITE_H #include "HTStream.h" -#include "HTFormat.h" +#include "HTReq.h" /* . - ANSI C File Writer Stream + Basic ANSI C File Writer Stream . This function puts up a new stream given an open file descripter. @@ -50,48 +42,12 @@ leave_open=NO. */ -extern HTStream * HTFWriter_new (HTRequest * request, - FILE * fp, - BOOL leave_open); +extern HTStream * HTFWriter_new ( + HTRequest * request, + FILE * fp, + BOOL leave_open); /* -. - Various Converters using the File Writer Stream -. - -This is a set of functions that can be registered as converters. They all -use the basic ANSI C file writer stream for writing out to the local file -system. -*/ - -extern HTConverter HTSaveAndExecute, HTSaveLocally, HTSaveAndCallback; - -/* - - - - HTSaveLocally - - Saves a file to local disk. This can for example be used to dump date objects - of unknown media types to local disk. The stream prompts for a file name - for the temporary file. - - HTSaveAndExecute - - Creates temporary file, writes to it and then executes system command (maybe - an external viewer) when EOF has been reached. The stream finds - a suitable name of the temporary file which preserves the suffix. This way, - the system command can find out the file type from the name of the temporary - file name. - - HTSaveAndCallback - - This stream works exactly like the HTSaveAndExecute stream but - in addition when EOF has been reached, it checks whether a callback - function has been associated with the request object in which case, this - callback is being called. This can be use by the application to do some - processing after the system command has terminated. The callback - function is called with the file name of the temporary file as parameter. */ @@ -101,6 +57,6 @@ - @(#) $Id: HTFWrite.h,v 1.1.1.1 2001/04/18 14:23:15 stefanulrich Exp $ + @(#) $Id: HTFWrite.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTFile.c xdvik-22.40n/libs/libwww/HTFile.c --- xdvik-22.40l/libs/libwww/HTFile.c Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTFile.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTFile.c,v 1.1.1.1 2001/04/18 14:23:15 stefanulrich Exp $ +** @(#) $Id: HTFile.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This is unix-specific code in general, with some VMS bits. ** These are routines for file access used by browsers. @@ -33,6 +33,7 @@ #include "WWWDir.h" #include "WWWTrans.h" #include "HTReqMan.h" +#include "HTBind.h" #include "HTMulti.h" #include "HTFile.h" /* Implemented here */ @@ -43,6 +44,7 @@ FS_NO_DATA = -2, FS_GOT_DATA = -1, FS_BEGIN = 0, + FS_PENDING, FS_DO_CN, FS_NEED_OPEN_FILE, FS_NEED_BODY, @@ -135,7 +137,7 @@ char *url = HTAnchor_physical(anchor); char fullname[HT_MAX_PATH+1]; char *name; - if (PROT_TRACE) HTTrace("Reading..... directory\n"); + HTTRACE(PROT_TRACE, "Reading..... directory\n"); if (dir_access == HT_DIR_FORBID) { HTRequest_addError(request, ERR_FATAL, NO, HTERR_FORBIDDEN, NULL, 0, "HTFile_readDir"); @@ -158,9 +160,7 @@ if (dir_access == HT_DIR_SELECTIVE) { strcpy(name, DEFAULT_DIR_FILE); if (HT_STAT(fullname, &file_info)) { - if (PROT_TRACE) - HTTrace( - "Read dir.... `%s\' not found\n", DEFAULT_DIR_FILE); + HTTRACE(PROT_TRACE, "Read dir.... `%s\' not found\n" _ DEFAULT_DIR_FILE); HTRequest_addError(request, ERR_FATAL, NO, HTERR_FORBIDDEN, NULL, 0, "HTFile_readDir"); return HT_FORBIDDEN; @@ -175,10 +175,15 @@ HTFileMode mode; #ifdef HT_REENTRANT struct dirent result; /* For readdir_r */ - while ((dirbuf = (struct dirent *) readdir_r(dp, &result))) +#endif + +#ifdef HAVE_READDIR_R_2 + while ((dirbuf = (struct dirent *) readdir_r(dp, &result))) +#elif defined(HAVE_READDIR_R_3) + while (readdir_r(dp, &result, &dirbuf) == 0) #else while ((dirbuf = readdir(dp))) -#endif /* HT_REENTRANT */ +#endif /* HAVE_READDIR_R_2 */ { /* Current and parent directories are never shown in list */ #ifdef HAVE_DIRENT_INO @@ -192,8 +197,7 @@ /* Make a lstat on the file */ strcpy(name, dirbuf->d_name); if (HT_LSTAT(fullname, &file_info)) { - if (PROT_TRACE) - HTTrace("Read dir.... lstat failed: %s\n",fullname); + HTTRACE(PROT_TRACE, "Read dir.... lstat failed: %s\n" _ fullname); continue; } @@ -256,15 +260,18 @@ ngroups = getgroups(NGROUPS, groups); /* Groups to which I belong */ myUid = geteuid(); /* Get my user identifier */ +#ifdef HTDEBUG if (PROT_TRACE) { int i; - HTTrace( - "File mode is 0%o, uid=%d, gid=%d. My uid=%d, %d groups (", - (unsigned int) fileptr->st_mode, (int) fileptr->st_uid, - (int) fileptr->st_gid, (int) myUid, ngroups); - for (i=0; ist_mode _ + (int) fileptr->st_uid _ (int) fileptr->st_gid _ + (int) myUid _ ngroups); + for (i=0; ist_mode & 0002) /* I can write anyway? */ return YES; @@ -280,7 +287,7 @@ return YES; } } - if (PROT_TRACE) HTTrace("\tFile is not editable.\n"); + HTTRACE(PROT_TRACE, "\tFile is not editable.\n"); return NO; /* If no excuse, can't do */ #else /* @@ -345,7 +352,7 @@ HTNet * net = HTRequest_net(request); HTParentAnchor * anchor = HTRequest_anchor(request); - if (PROT_TRACE) HTTrace("HTLoadFile.. Looking for `%s\'\n", + HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _ HTAnchor_physical(anchor)); if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL) HT_OUTOFMEM("HTLoadFILE"); @@ -362,12 +369,13 @@ { file_info * file = (file_info *) param; if (timer != file->timer) - HTDebugBreak(__FILE__, __LINE__, "File timer %p not in sync\n", timer); - if (PROT_TRACE) HTTrace("HTLoadFile.. Continuing %p with timer %p\n", file, timer); + HTDEBUGBREAK("File timer %p not in sync\n" _ timer); + HTTRACE(PROT_TRACE, "HTLoadFile.. Continuing %p with timer %p\n" _ file _ timer); /* ** Delete the timer */ + HTTimer_delete(file->timer); file->timer = NULL; /* @@ -401,10 +409,19 @@ /* Now jump into the machine. We know the state from the previous run */ while (1) { switch (file->state) { - case FS_BEGIN: + case FS_BEGIN: + + /* We only support safe (GET, HEAD, etc) methods for the moment */ + if (!HTMethod_isSafe(HTRequest_method(request))) { + HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_ALLOWED, + NULL, 0, "HTLoadFile"); + file->state = FS_ERROR; + break; + } + + /* Check whether we have access to local disk at all */ if (HTLib_secure()) { - if (PROT_TRACE) - HTTrace("LoadFile.... No access to local file system\n"); + HTTRACE(PROT_TRACE, "LoadFile.... No access to local file system\n"); file->state = FS_TRY_FTP; break; } @@ -415,20 +432,47 @@ break; } + /* Create a new host object and link it to the net object */ + { + HTHost * host = NULL; + if ((host = HTHost_new("localhost", 0)) == NULL) return HT_ERROR; + HTNet_setHost(net, host); + if (HTHost_addNet(host, net) == HT_PENDING) { + HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n"); + /* move to the hack state */ + file->state = FS_PENDING; + return HT_OK; + } + } + file->state = FS_DO_CN; + break; + + case FS_PENDING: /* - ** Create a new host object and link it to the net object + ** 2000/08/10 JK : This is a funny state. Because of the + ** internal libwww stacks, when doing multiple local + ** requests (e.g., while using the Robot), we need to ask + ** again for the host object. If we had jumped directly to + ** the FS_DO_CN state, libwww would have blocked because + ** of socket starvation. + ** This state is similar to FS_BEGINNING, but just requests + ** the host object. + ** YES. THIS IS AN UGLY HACK!! */ { HTHost * host = NULL; if ((host = HTHost_new("localhost", 0)) == NULL) return HT_ERROR; HTNet_setHost(net, host); - if (HTHost_addNet(host, net) == HT_PENDING) - if (PROT_TRACE) HTTrace("HTLoadFile.. Pending...\n"); + if (HTHost_addNet(host, net) == HT_PENDING) { + HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n"); + file->state = FS_PENDING; + return HT_OK; + } } file->state = FS_DO_CN; break; - case FS_DO_CN: + case FS_DO_CN: /* ** If we have to do content negotiation then find the object that ** fits best into either what the client has indicated in the @@ -445,10 +489,9 @@ HT_FREE(file->local); file->local = conneg; HTAnchor_setPhysical(anchor, conneg); - if (PROT_TRACE) HTTrace("Load File... Found `%s\'\n", conneg); + HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ conneg); } else { - if (PROT_TRACE) - HTTrace("Load File... Not found - even tried content negotiation\n"); + HTTRACE(PROT_TRACE, "Load File... Not found - even tried content negotiation\n"); HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTLoadFile"); file->state = FS_ERROR; @@ -456,8 +499,7 @@ } } else { if (HT_STAT(file->local, &file->stat_info) == -1) { - if (PROT_TRACE) - HTTrace("Load File... Not found `%s\'\n", file->local); + HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local); HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTLoadFile"); file->state = FS_ERROR; @@ -466,10 +508,17 @@ } /* - ** Check to see if the 'localname' is in fact a directory + ** Check to see if the 'localname' is in fact a directory. + ** Note that we can't do a HEAD on a directory */ if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR) { - file->state = FS_PARSE_DIR; + if (HTRequest_method(request) == METHOD_GET) + file->state = FS_PARSE_DIR; + else { + HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, + NULL, 0, "HTLoadFile"); + file->state = FS_NO_DATA; + } break; } @@ -495,8 +544,10 @@ HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile"); file->state = FS_NO_DATA; - } else - file->state = FS_NEED_OPEN_FILE; + } else { + file->state = (HTRequest_method(request)==METHOD_GET) ? + FS_NEED_OPEN_FILE : FS_GOT_DATA; + } } break; @@ -547,10 +598,10 @@ if (HTEvent_isCallbacksRegistered()) { if (!HTRequest_preemptive(request)) { if (!HTNet_preemptive(net)) { - if (PROT_TRACE) HTTrace("HTLoadFile.. Returning\n"); + HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n"); HTHost_register(HTNet_host(net), net, HTEvent_READ); } else if (!file->timer) { - if (PROT_TRACE) HTTrace("HTLoadFile.. Returning\n"); + HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n"); file->timer = HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO); } @@ -606,59 +657,21 @@ break; case FS_GOT_DATA: - if (HTRequest_isPostWeb(request)) { - if (HTRequest_isDestination(request)) { - HTRequest * source = HTRequest_source(request); - HTLink *link = - HTLink_find((HTAnchor *)HTRequest_anchor(source), - (HTAnchor *) anchor); - HTLink_setResult(link, HT_LINK_OK); - } - } FileCleanup(request, HT_LOADED); return HT_OK; break; case FS_NO_DATA: - if (HTRequest_isPostWeb(request)) { - if (HTRequest_isDestination(request)) { - HTRequest * source = HTRequest_source(request); - HTLink *link = - HTLink_find((HTAnchor *)HTRequest_anchor(source), - (HTAnchor *) anchor); - HTLink_setResult(link, HT_LINK_OK); - } - } FileCleanup(request, HT_NO_DATA); return HT_OK; break; case FS_RETRY: - if (HTRequest_isPostWeb(request)) { - if (HTRequest_isDestination(request)) { - HTRequest * source = HTRequest_source(request); - HTLink *link = - HTLink_find((HTAnchor *)HTRequest_anchor(source), - (HTAnchor *) anchor); - HTLink_setResult(link, HT_LINK_ERROR); - } - HTRequest_killPostWeb(request); - } FileCleanup(request, HT_RETRY); return HT_OK; break; case FS_ERROR: - if (HTRequest_isPostWeb(request)) { - if (HTRequest_isDestination(request)) { - HTRequest * source = HTRequest_source(request); - HTLink *link = - HTLink_find((HTAnchor *)HTRequest_anchor(source), - (HTAnchor *) anchor); - HTLink_setResult(link, HT_LINK_ERROR); - } - HTRequest_killPostWeb(request); - } FileCleanup(request, HT_ERROR); return HT_OK; break; diff -Naur xdvik-22.40l/libs/libwww/HTFile.h xdvik-22.40n/libs/libwww/HTFile.h --- xdvik-22.40l/libs/libwww/HTFile.h Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTFile.h Fri Sep 13 00:23:46 2002 @@ -97,6 +97,6 @@ - @(#) $Id: HTFile.h,v 1.1.1.1 2001/04/18 14:23:15 stefanulrich Exp $ + @(#) $Id: HTFile.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTFilter.c xdvik-22.40n/libs/libwww/HTFilter.c --- xdvik-22.40l/libs/libwww/HTFilter.c Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTFilter.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTFilter.c,v 1.1.1.1 2001/04/18 14:23:15 stefanulrich Exp $ +** @(#) $Id: HTFilter.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module implrments a set of default filters that can be registerd ** as BEFORE and AFTER filters to the Net manager @@ -97,165 +97,6 @@ } /* -** Cache Validation BEFORE Filter -** ------------------------------ -** Check the cache mode to see if we can use an already loaded version -** of this document. If so and our copy is valid then we don't have -** to go out and get it unless we are forced to -** We only check the cache in caseof a GET request. Otherwise, we go -** directly to the source. -*/ -PUBLIC int HTCacheFilter (HTRequest * request, void * param, int mode) -{ - HTParentAnchor * anchor = HTRequest_anchor(request); - HTCache * cache = NULL; - HTReload reload = HTRequest_reloadMode(request); - HTMethod method = HTRequest_method(request); - HTDisconnectedMode disconnect = HTCacheMode_disconnected(); - BOOL validate = NO; - - /* - ** If the cache is disabled all together then it won't help looking, huh? - */ - if (!HTCacheMode_enabled()) return HT_OK; - if (CACHE_TRACE) HTTrace("Cachefilter. Checking persistent cache\n"); - - /* - ** Now check the cache... - */ - if (method != METHOD_GET) { - if (CACHE_TRACE) HTTrace("Cachefilter. We only check GET methods\n"); - } else if (reload == HT_CACHE_FLUSH) { - /* - ** If the mode if "Force Reload" then don't even bother to check the - ** cache - we flush everything we know abut this document anyway. - ** Add the appropriate request headers. We use both the "pragma" - ** and the "cache-control" headers in order to be - ** backwards compatible with HTTP/1.0 - */ - validate = YES; - HTRequest_addGnHd(request, HT_G_PRAGMA_NO_CACHE); - HTRequest_addCacheControl(request, "no-cache", ""); - - /* - ** We also flush the information in the anchor as we don't want to - ** inherit any "old" values - */ - HTAnchor_clearHeader(anchor); - - } else { - /* - ** Check the persistent cache manager. If we have a cache hit then - ** continue to see if the reload mode requires us to do a validation - ** check. This filter assumes that we can get the cached version - ** through one of our protocol modules (for example the file module) - */ - cache = HTCache_find(anchor); - if (cache) { - HTReload cache_mode = HTCache_isFresh(cache, request); - if (cache_mode == HT_CACHE_ERROR) cache = NULL; - reload = HTMAX(reload, cache_mode); - HTRequest_setReloadMode(request, reload); - - /* - ** Now check the mode and add the right headers for the validation - ** If we are to validate a cache entry then we get a lock - ** on it so that not other requests can steal it. - */ - if (reload == HT_CACHE_RANGE_VALIDATE) { - /* - ** If we were asked to range validate the cached object then - ** use the etag or the last modified for cache validation - */ - validate = YES; - HTCache_getLock(cache, request); - HTRequest_addRqHd(request, HT_C_IF_RANGE); - } else if (reload == HT_CACHE_END_VALIDATE) { - /* - ** If we were asked to end-to-end validate the cached object - ** then use a max-age=0 cache control directive - */ - validate = YES; - HTCache_getLock(cache, request); - HTRequest_addCacheControl(request, "max-age", "0"); - } else if (reload == HT_CACHE_VALIDATE) { - /* - ** If we were asked to validate the cached object then - ** use the etag or the last modified for cache validation - ** We use both If-None-Match or If-Modified-Since. - */ - validate = YES; - HTCache_getLock(cache, request); - HTRequest_addRqHd(request, HT_C_IF_NONE_MATCH | HT_C_IMS); - } else if (cache) { - /* - ** The entity does not require any validation at all. We - ** can just go ahead and get it from the cache. In case we - ** have a fresh subpart of the entity, then we issue a - ** conditional GET request with the range set by the cache - ** manager. Issuing the conditional range request is - ** equivalent to a validation as we have to go out on the - ** net. This may have an effect if running in disconnected - ** mode. We disable all BEFORE filters as they don't make - ** sense while loading the cache entry. - */ - { - char * name = HTCache_name(cache); - HTAnchor_setPhysical(anchor, name); - HTCache_addHit(cache); - HT_FREE(name); - } - } - } - } - - /* - ** If we are in disconnected mode and we are to validate an entry - ** then check whether what mode of disconnected mode we're in. If - ** we are to use our own cache then return a "504 Gateway Timeout" - */ - if ((!cache || validate) && disconnect != HT_DISCONNECT_NONE) { - if (disconnect == HT_DISCONNECT_EXTERNAL) - HTRequest_addCacheControl(request, "only-if-cached", ""); - else { - HTRequest_addError(request, ERR_FATAL, NO, - HTERR_GATE_TIMEOUT, "Disconnected Cache Mode", - 0, "HTCacheFilter"); - return HT_ERROR; - } - } - return HT_OK; -} - -/* -** A small BEFORE filter that just finds a cache entry unconditionally -** and loads the entry. All freshness and any other constraints are -** ignored. -*/ -PUBLIC int HTCacheLoadFilter (HTRequest * request, void * param, int mode) -{ - HTParentAnchor * anchor = HTRequest_anchor(request); - HTCache * cache = HTCache_find(anchor); - if (cache) { - char * name = HTCache_name(cache); - HTAnchor_setPhysical(anchor, name); - HTCache_addHit(cache); - HT_FREE(name); - - /* - ** Start request directly from the cache. As with the redirection - ** filter we reuse the same request object which means that we must - ** keep this around until the cache load request has terminated - */ - { - HTLoad(request, NO); - return HT_ERROR; - } - } - return HT_OK; -} - -/* ** Check the Memory Cache (History list) BEFORE filter ** --------------------------------------------------- ** Check if document is already loaded. The user can define whether @@ -274,7 +115,7 @@ ** We only check the memory cache if it's a GET method */ if (HTRequest_method(request) != METHOD_GET) { - if (CACHE_TRACE) HTTrace("Mem Cache... We only check GET methods\n"); + HTTRACE(CACHE_TRACE, "Mem Cache... We only check GET methods\n"); return HT_OK; } @@ -284,7 +125,7 @@ ** then just exit from this filter. */ if (!document || validation > HT_CACHE_FLUSH_MEM) { - if (CACHE_TRACE) HTTrace("Mem Cache... No fresh document...\n"); + HTTRACE(CACHE_TRACE, "Mem Cache... No fresh document...\n"); return HT_OK; } @@ -294,61 +135,13 @@ ** we can add a cache validator */ if (document && validation != HT_CACHE_FLUSH_MEM) { - if (CACHE_TRACE) HTTrace("Mem Cache... Document already in memory\n"); + HTTRACE(CACHE_TRACE, "Mem Cache... Document already in memory\n"); return HT_LOADED; } return HT_OK; } /* -** Cache Update AFTER filter -** ------------------------- -** On our way out we catch the metainformation and stores it in -** our persistent store. If we have a cache validation (a 304 -** response then we use the new metainformation and merges it with -** the existing information already captured in the cache. -*/ -PUBLIC int HTCacheUpdateFilter (HTRequest * request, HTResponse * response, - void * param, int status) -{ - HTParentAnchor * anchor = HTRequest_anchor(request); - HTCache * cache = HTCache_find(anchor); - if (cache) { - - /* - ** It may in fact be that the information in the 304 response - ** told us that we can't cache the entity anymore. If this is the - ** case then flush it now. Otherwise prepare for a cache read - */ - if (CACHE_TRACE) HTTrace("Cache....... Merging metainformation\n"); - if (HTResponse_isCachable(response) == HT_NO_CACHE) { - HTCache_remove(cache); - } else { - char * name = HTCache_name(cache); - HTAnchor_setPhysical(anchor, name); - HTCache_addHit(cache); - HT_FREE(name); - HTCache_updateMeta(cache, request, response); - } - - /* - ** Start request directly from the cache. As with the redirection filter - ** we reuse the same request object which means that we must - ** keep this around until the cache load request has terminated - ** In the case of a - */ - HTLoad(request, YES); - return HT_ERROR; - } else { - - /* If entry doesn't already exist then create a new entry */ - HTCache_touch(request, response, anchor); - - } - return HT_OK; -} - -/* ** Error and Information AFTER filter ** ---------------------------------- ** It checks the status code from a request and generates an @@ -364,8 +157,7 @@ HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE); if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL, HTRequest_error(request), NULL); - if (PROT_TRACE) - HTTrace("Load End.... NOT AVAILABLE, RETRY AT %ld\n", + HTTRACE(PROT_TRACE, "Load End.... NOT AVAILABLE, RETRY AT %ld\n" _ HTResponse_retryTime(response)); } break; @@ -378,14 +170,13 @@ HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE); if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL, HTRequest_error(request), NULL); - if (PROT_TRACE) - HTTrace("Load End.... EMPTY: No content `%s\'\n", + HTTRACE(PROT_TRACE, "Load End.... EMPTY: No content `%s\'\n" _ uri ? uri : ""); break; } case HT_LOADED: - if (PROT_TRACE) HTTrace("Load End.... OK: `%s\'\n", uri); + HTTRACE(PROT_TRACE, "Load End.... OK: `%s\'\n" _ uri); break; default: @@ -397,8 +188,7 @@ HTAlertCallback *cbf = HTAlert_find(HT_A_MESSAGE); if (cbf) (*cbf)(request, HT_A_MESSAGE, HT_MSG_NULL, NULL, HTRequest_error(request), NULL); - if (PROT_TRACE) - HTTrace("Load End.... Request ended with code %d\n", status); + HTTRACE(PROT_TRACE, "Load End.... Request ended with code %d\n" _ status); break; } } @@ -417,8 +207,10 @@ { HTMethod method = HTRequest_method(request); HTAnchor * new_anchor = HTResponse_redirection(response); + + /* Check for destination */ if (!new_anchor) { - if (PROT_TRACE) HTTrace("Redirection. No destination\n"); + HTTRACE(PROT_TRACE, "Redirection. No destination\n"); return HT_OK; } @@ -433,8 +225,7 @@ ** Otherwise ask the user whether we should continue. */ if (status == HT_SEE_OTHER) { - if (PROT_TRACE) - HTTrace("Redirection. Changing method from %s to GET\n", + HTTRACE(PROT_TRACE, "Redirection. Changing method from %s to GET\n" _ HTMethod_name(method)); HTRequest_setMethod(request, METHOD_GET); } else { @@ -446,7 +237,21 @@ } } } - + + /* Register the redirection as a link relationship */ + { + HTLinkType ltype = status==HT_PERM_REDIRECT ? HT_LR_PERM_REDIRECT : + (status==HT_TEMP_REDIRECT || status==HT_FOUND) ? HT_LR_TEMP_REDIRECT : + status==HT_SEE_OTHER ? HT_LR_SEE_OTHER : NULL; + if (ltype) { + HTLink_add((HTAnchor *) HTRequest_anchor(request), new_anchor, + ltype, method); + } + } + + /* Delete any auth credendials as they get regenerated */ + HTRequest_deleteCredentialsAll(request); + /* ** Start new request with the redirect anchor found in the headers. ** Note that we reuse the same request object which means that we must @@ -459,6 +264,7 @@ } else { HTRequest_addError(request, ERR_FATAL, NO, HTERR_MAX_REDIRECT, NULL, 0, "HTRedirectFilter"); + return HT_OK; /* Wanna fall through */ } /* @@ -481,7 +287,7 @@ HTAlertCallback * cbf = HTAlert_find(HT_A_CONFIRM); HTAnchor * proxy_anchor = HTResponse_redirection(response); if (!proxy_anchor) { - if (PROT_TRACE) HTTrace("Use Proxy... No proxy location\n"); + HTTRACE(PROT_TRACE, "Use Proxy... No proxy location\n"); return HT_OK; } @@ -535,7 +341,7 @@ ** that understands this scheme */ if (HTAA_beforeFilter(request, param, mode) == HT_OK) { - if (PROT_TRACE) HTTrace("Credentials. verified\n"); + HTTRACE(PROT_TRACE, "Credentials. verified\n"); return HT_OK; } else { HTRequest_addError(request, ERR_FATAL, NO, HTERR_UNAUTHORIZED, @@ -576,6 +382,25 @@ return HT_ERROR; } return HT_OK; +} + +/* +** Client side authentication info AFTER filter +** --------------------------------------- +*/ +PUBLIC int HTAuthInfoFilter (HTRequest * request, HTResponse * response, + void * param, int status) +{ + /* + ** Ask the authentication module to call the right authentication info + ** parser + */ + if (! HTResponse_challenge (response)) + return HT_OK; + else if (HTAA_updateFilter(request, response, param, status) == HT_OK) + return HT_OK; + else + return HT_ERROR; } /* diff -Naur xdvik-22.40l/libs/libwww/HTFilter.h xdvik-22.40n/libs/libwww/HTFilter.h --- xdvik-22.40l/libs/libwww/HTFilter.h Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTFilter.h Fri Sep 13 00:23:46 2002 @@ -84,18 +84,6 @@ /* ( - Persistent Cache Validation BEFORE Filter -) - -Check the cache mode to see if we can use an already loaded version of this -document. If so and our copy is valid then we don't have to go out and get -it unless we are forced to -*/ - -extern HTNetBefore HTCacheFilter; - -/* -( Client side authentication BEFORE filter ) @@ -116,19 +104,6 @@ doing this is to call the HTAfterInit() function in the Initialization interface. ( - Persistent Cache Update AFTER filter -) - -On our way out we catch the metainformation and stores it in our persistent -store. If we have a cache validation (a 304 response then we use the new -metainformation and merges it with the existing information already captured -in the cache. -*/ - -extern HTNetAfter HTCacheUpdateFilter; - -/* -( Error and Information filter ) @@ -175,6 +150,20 @@ /* ( + Client side authentication information filter +) + +This filter updates the client's local authentication information database +with new information sent by the server via the authentication-info header. +This header is currently used only by the Digest authentication scheme. +This filter is initialized by default, but you can just register something +else. +*/ + +extern HTNetAfter HTAuthInfoFilter; + +/* +( Request Common Log File Filter ) @@ -206,6 +195,6 @@ - @(#) $Id: HTFilter.h,v 1.1.1.1 2001/04/18 14:23:15 stefanulrich Exp $ + @(#) $Id: HTFilter.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTFormat.c xdvik-22.40n/libs/libwww/HTFormat.c --- xdvik-22.40l/libs/libwww/HTFormat.c Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTFormat.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTFormat.c,v 1.1.1.1 2001/04/18 14:23:15 stefanulrich Exp $ +** @(#) $Id: HTFormat.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Bugs: ** Assumes the incoming stream is ASCII, rather than a local file @@ -34,6 +34,8 @@ PRIVATE double HTMaxSecs = 1e10; /* No effective limit */ +PRIVATE HTConverter * presentation_converter = NULL; + struct _HTStream { const HTStreamClass * isa; }; @@ -99,7 +101,7 @@ HTFormat output_format, HTStream * output_stream) { - if (STREAM_TRACE) HTTrace("BlackHole... Converter Created\n"); + HTTRACE(STREAM_TRACE, "BlackHole... Converter Created\n"); HTBaseConverterStreamInstance.isa = &HTBlackHoleConverterClass; return &HTBaseConverterStreamInstance; } @@ -152,6 +154,16 @@ /* CONTENT TYPES */ /* ------------------------------------------------------------------------- */ +PUBLIC void HTPresentation_setConverter (HTConverter * pconv) +{ + presentation_converter = pconv; +} + +PUBLIC HTConverter * HTPresentation_converter (void) +{ + return presentation_converter; +} + /* Define a presentation system command for a content-type ** ------------------------------------------------------- ** INPUT: @@ -171,24 +183,24 @@ double secs_per_byte) { HTPresentation * pres; - if ((pres = (HTPresentation *) HT_CALLOC(1,sizeof(HTPresentation))) == NULL) - HT_OUTOFMEM("HTSetPresentation"); - - pres->rep = HTAtom_for(representation); - pres->rep_out = WWW_PRESENT; /* Fixed for now ... :-) */ - pres->converter = HTSaveAndExecute; /* Fixed for now ... */ - pres->quality = quality; - pres->secs = secs; - pres->secs_per_byte = secs_per_byte; - pres->rep = HTAtom_for(representation); - pres->command = NULL; - StrAllocCopy(pres->command, command); - pres->test_command = NULL; - StrAllocCopy(pres->test_command, test_command); - if (CORE_TRACE) - HTTrace("Presentation Adding `%s\' with quality %.2f\n", - command, quality); - HTList_addObject(conversions, pres); + if (presentation_converter) { + if ((pres = (HTPresentation *) HT_CALLOC(1,sizeof(HTPresentation))) == NULL) + HT_OUTOFMEM("HTSetPresentation"); + pres->rep = HTAtom_for(representation); + pres->rep_out = WWW_PRESENT; /* Fixed for now ... :-) */ + pres->converter = presentation_converter; + pres->quality = quality; + pres->secs = secs; + pres->secs_per_byte = secs_per_byte; + pres->rep = HTAtom_for(representation); + pres->command = NULL; + StrAllocCopy(pres->command, command); + pres->test_command = NULL; + StrAllocCopy(pres->test_command, test_command); + HTTRACE(CORE_TRACE, "Presentation Adding `%s\' with quality %.2f\n" _ + command _ quality); + HTList_addObject(conversions, pres); + } } PUBLIC void HTPresentation_deleteAll (HTList * list) @@ -226,9 +238,8 @@ pres->quality = quality; pres->secs = secs; pres->secs_per_byte = secs_per_byte; - if (CORE_TRACE) - HTTrace("Conversions. Adding %p with quality %.2f\n", - converter, quality); + HTTRACE(CORE_TRACE, "Conversions. Adding %p with quality %.2f\n" _ + converter _ quality); HTList_addObject(conversions, pres); } @@ -255,12 +266,11 @@ me->encoder = encoder; me->decoder = decoder; me->quality = quality; - if (CORE_TRACE) - HTTrace("Codings..... Adding %s with quality %.2f\n", - encoding, quality); + HTTRACE(CORE_TRACE, "Codings..... Adding %s with quality %.2f\n" _ + encoding _ quality); return HTList_addObject(list, (void *) me); } - if (CORE_TRACE) HTTrace("Codings..... Bad argument\n"); + HTTRACE(CORE_TRACE, "Codings..... Bad argument\n"); return NO; } @@ -295,8 +305,7 @@ { HTAcceptNode * node; if (!list || !lang || !*lang) { - if (CORE_TRACE) - HTTrace("Languages... Bad argument\n"); + HTTRACE(CORE_TRACE, "Languages... Bad argument\n"); return; } if ((node = (HTAcceptNode *) HT_CALLOC(1, sizeof(HTAcceptNode))) == NULL) @@ -329,8 +338,7 @@ { HTAcceptNode * node; if (!list || !charset || !*charset) { - if (CORE_TRACE) - HTTrace("Charset..... Bad argument\n"); + HTTRACE(CORE_TRACE, "Charset..... Bad argument\n"); return; } if ((node = (HTAcceptNode *) HT_CALLOC(1, sizeof(HTAcceptNode))) == NULL) @@ -523,22 +531,24 @@ double best_quality = -1e30; /* Pretty bad! */ HTPresentation *pres, *best_match=NULL; if (rep_out == WWW_RAW) { - if (CORE_TRACE) HTTrace("StreamStack. Raw output...\n"); + HTTRACE(CORE_TRACE, "StreamStack. Raw output...\n"); return output_stream ? output_stream : HTErrorStream(); } if (rep_out == rep_in) { - if (CORE_TRACE) - HTTrace("StreamStack. Identical input/output format (%s)\n", + HTTRACE(CORE_TRACE, "StreamStack. Identical input/output format (%s)\n" _ HTAtom_name(rep_out)); return output_stream ? output_stream : HTErrorStream(); } + +#ifdef HTDEBUG if (CORE_TRACE) { const char *p = HTAtom_name(rep_in); const char *q = HTAtom_name(rep_out); - HTTrace("StreamStack. Constructing stream stack for %s to %s\n", - p ? p : "", q ? q : ""); + HTTRACE(CORE_TRACE, "StreamStack. Constructing stream stack for %s to %s\n" _ + p ? p : "" _ q ? q : ""); } +#endif /* HTDEBUG */ conversion[0] = HTRequest_conversion(request); conversion[1] = HTConversions; @@ -555,8 +565,7 @@ int result=0; if (pres->test_command) { result = system(pres->test_command); - if (CORE_TRACE) - HTTrace("StreamStack. system(%s) returns %d\n", pres->test_command, result); + HTTRACE(CORE_TRACE, "StreamStack. system(%s) returns %d\n" _ pres->test_command _ result); } if (!result) { best_match = pres; @@ -573,18 +582,18 @@ if (best_match) { if (rep_out == WWW_SOURCE && best_match->rep_out != WWW_SOURCE) { - if (CORE_TRACE) HTTrace("StreamStack. Source output\n"); + HTTRACE(CORE_TRACE, "StreamStack. Source output\n"); return output_stream ? output_stream : HTErrorStream(); } return (*best_match->converter)(request, best_match->command, rep_in, rep_out, output_stream); } if (rep_out == WWW_SOURCE) { - if (CORE_TRACE) HTTrace("StreamStack. Source output\n"); + HTTRACE(CORE_TRACE, "StreamStack. Source output\n"); return output_stream ? output_stream : HTErrorStream(); } - if (CORE_TRACE) HTTrace("StreamStack. NOT FOUND - error!\n"); + HTTRACE(CORE_TRACE, "StreamStack. NOT FOUND - error!\n"); return HTBlackHole(); } @@ -606,13 +615,10 @@ int which_list; HTList* conversion[2]; - if (CORE_TRACE) { - HTTrace("StackValue.. Evaluating stream stack for %s worth %.3f to %s\n", - HTAtom_name(rep_in), initial_value, - HTAtom_name(rep_out)); - } - if (rep_out == WWW_SOURCE || - rep_out == rep_in) return 0.0; + HTTRACE(CORE_TRACE, "StackValue.. Evaluating stream stack for %s worth %.3f to %s\n" _ + HTAtom_name(rep_in) _ initial_value _ HTAtom_name(rep_out)); + + if (rep_out == WWW_SOURCE || rep_out == rep_in) return 0.0; conversion[0] = theseConversions; conversion[1] = HTConversions; @@ -654,13 +660,12 @@ double best_quality = -1e30; /* Pretty bad! */ int cnt; if (!encoding || !request) { - if (CORE_TRACE) HTTrace("Codings... Nothing applied...\n"); + HTTRACE(CORE_TRACE, "Codings... Nothing applied...\n"); return target ? target : HTErrorStream(); } coders[0] = HTRequest_encoding(request); coders[1] = HTContentCoders; - if (CORE_TRACE) - HTTrace("C-E......... Looking for `%s\'\n", HTAtom_name(encoding)); + HTTRACE(CORE_TRACE, "C-E......... Looking for `%s\'\n" _ HTAtom_name(encoding)); for (cnt=0; cnt < 2; cnt++) { HTList * cur = coders[cnt]; while ((pres = (HTCoding *) HTList_nextObject(cur))) { @@ -673,8 +678,7 @@ } if (best_match) { - if (CORE_TRACE) - HTTrace("C-E......... Found `%s\'\n", HTAtom_name(best_match->encoding)); + HTTRACE(CORE_TRACE, "C-E......... Found `%s\'\n" _ HTAtom_name(best_match->encoding)); if (encode) { if (best_match->encoder) top = (*best_match->encoder)(request, param, encoding, top); @@ -690,9 +694,9 @@ ** instead of the stream that we got. */ if (encode) { - if (CORE_TRACE) HTTrace("C-E......... NOT FOUND - can't encode stream!\n"); + HTTRACE(CORE_TRACE, "C-E......... NOT FOUND - can't encode stream!\n"); } else { - if (CORE_TRACE) HTTrace("C-E......... NOT FOUND - error!\n"); + HTTRACE(CORE_TRACE, "C-E......... NOT FOUND - error!\n"); top = HTBlackHole(); } } @@ -763,18 +767,17 @@ HTCoding * pres = NULL; int cnt; if (!encoding || !request) { - if (CORE_TRACE) HTTrace("Codings... Nothing applied...\n"); + HTTRACE(CORE_TRACE, "Codings... Nothing applied...\n"); return target ? target : HTErrorStream(); } coders[0] = HTRequest_transfer(request); coders[1] = HTTransferCoders; - if (CORE_TRACE) - HTTrace("C-E......... Looking for `%s\'\n", HTAtom_name(encoding)); + HTTRACE(CORE_TRACE, "C-E......... Looking for `%s\'\n" _ HTAtom_name(encoding)); for (cnt=0; cnt < 2; cnt++) { HTList * cur = coders[cnt]; while ((pres = (HTCoding *) HTList_nextObject(cur))) { if (pres->encoding == encoding || HTMIMEMatch(pres->encoding, encoding)) { - if (CORE_TRACE) HTTrace("C-E......... Found...\n"); + HTTRACE(CORE_TRACE, "C-E......... Found...\n"); if (encode) { if (pres->encoder) top = (*pres->encoder)(request, param, encoding, top); @@ -794,9 +797,9 @@ */ if (!HTFormat_isUnityContent(encoding) && target==top) { if (encode) { - if (CORE_TRACE) HTTrace("C-E......... NOT FOUND - can't encode stream!\n"); + HTTRACE(CORE_TRACE, "C-E......... NOT FOUND - can't encode stream!\n"); } else { - if (CORE_TRACE) HTTrace("C-E......... NOT FOUND - error!\n"); + HTTRACE(CORE_TRACE, "C-E......... NOT FOUND - error!\n"); top = HTBlackHole(); } } @@ -867,7 +870,7 @@ HTCoding * pres = NULL; int cnt; if (!encoding || !request) { - if (CORE_TRACE) HTTrace("C-T-E..... Nothing applied...\n"); + HTTRACE(CORE_TRACE, "C-T-E..... Nothing applied...\n"); return target ? target : HTErrorStream(); } @@ -876,13 +879,12 @@ */ coders[0] = HTRequest_transfer(request); coders[1] = HTTransferCoders; - if (CORE_TRACE) - HTTrace("C-T-E....... Looking for %s\n", HTAtom_name(encoding)); + HTTRACE(CORE_TRACE, "C-T-E....... Looking for %s\n" _ HTAtom_name(encoding)); for (cnt=0; cnt < 2; cnt++) { HTList * cur = coders[cnt]; while ((pres = (HTCoding *) HTList_nextObject(cur))) { if (pres->encoding == encoding) { - if (CORE_TRACE) HTTrace("C-T-E....... Found...\n"); + HTTRACE(CORE_TRACE, "C-T-E....... Found...\n"); if (encode) { if (pres->encoder) top = (*pres->encoder)(request, param, encoding, top); @@ -902,10 +904,10 @@ */ if (!HTFormat_isUnityTransfer(encoding) && target==top) { if (encode) { - if (CORE_TRACE) HTTrace("C-T-E....... NOT FOUND - removing encoding!\n"); + HTTRACE(CORE_TRACE, "C-T-E....... NOT FOUND - removing encoding!\n"); HTAnchor_setContentTransferEncoding(HTRequest_anchor(request), NULL); } else { - if (CORE_TRACE) HTTrace("C-T-E....... NOT FOUND - error!\n"); + HTTRACE(CORE_TRACE, "C-T-E....... NOT FOUND - error!\n"); top = HTBlackHole(); } } diff -Naur xdvik-22.40l/libs/libwww/HTFormat.h xdvik-22.40n/libs/libwww/HTFormat.h --- xdvik-22.40l/libs/libwww/HTFormat.h Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTFormat.h Fri Sep 13 00:23:46 2002 @@ -98,6 +98,14 @@ to other apps! */ +#define WWW_INTERNAL HTAtom_for("www/*") /* All internal formats */ + +/* + +WWW_INTERNAL represent all internal formats. This can for example +be used to match using the HTMIMEMatch(...). +*/ + #define WWW_RAW HTAtom_for("www/void") /* Raw output from Protocol */ /* @@ -171,6 +179,9 @@ #define WWW_MIME_FOOT HTAtom_for("message/x-rfc822-foot") #define WWW_MIME_PART HTAtom_for("message/x-rfc822-partial") #define WWW_MIME_CONT HTAtom_for("message/x-rfc822-cont") +#define WWW_MIME_UPGRADE HTAtom_for("message/x-rfc822-upgrade") + +#define WWW_MIME_COPYHEADERS HTAtom_for("www/x-rfc822-headers") #define WWW_AUDIO HTAtom_for("audio/basic") @@ -278,16 +289,24 @@ can present a graphic object of a certain MIME type to the user. That is, presenters are normally used to present objects that the converters are not able to handle. Data is transferred to the -external program using for example the -HTSaveAndExecute stream which writes to a local -file. Both presenters and converters are of the type -HTConverter. +external program using a special "presenter stream" which for example can +use the local disk to transfer the data from libwww to the external program. + +Libwww provides a default HTSaveAndExecute +stream which you may want to use for this purpose. However, any stream +that is of type HTConverter will do. You can manage the +special presenter stream using the following methods: */ -extern void HTPresentation_add (HTList * conversions, +extern void HTPresentation_setConverter (HTConverter * pconv); +extern HTConverter * HTPresentation_converter (void); /* +Both presenters and converters are of the type +HTConverter. */ + +extern void HTPresentation_add (HTList * conversions, const char * representation, const char * command, const char * test_command, @@ -513,8 +532,8 @@ /* -We also define a macro to find out whether a content encoding is really -an encoding or whether it is a unity encoder. +We also define a macro to find out whether a content encoding is really an +encoding or whether it is a unity encoder. */ #define HTFormat_isUnityContent(me) \ @@ -743,6 +762,6 @@ - @(#) $Id: HTFormat.h,v 1.1.1.1 2001/04/18 14:23:15 stefanulrich Exp $ + @(#) $Id: HTFormat.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTGopher.c xdvik-22.40n/libs/libwww/HTGopher.c --- xdvik-22.40l/libs/libwww/HTGopher.c Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTGopher.c Fri Sep 13 00:23:46 2002 @@ -230,8 +230,7 @@ { HTStructured *target = me->target; HTGopherType gtype = (HTGopherType) *line++; - if (PROT_TRACE) - HTTrace("HTGopher.... Menu line: `%s\'\n", line); + HTTRACE(PROT_TRACE, "HTGopher.... Menu line: `%s\'\n" _ line); if (gtype == GT_INFO) { char *stop = strchr(line, '\t'); if (stop) *stop = '\0'; @@ -325,8 +324,7 @@ HT_FREE(escaped); PUTC('\n'); } else { /* If parse error */ - if (PROT_TRACE) - HTTrace("HTGopher.... Bad menu item, `%s\'\n", line); + HTTRACE(PROT_TRACE, "HTGopher.... Bad menu item, `%s\'\n" _ line); } } return YES; @@ -342,13 +340,13 @@ HTStructured *target = me->target; if (*line == '1') { /* Information line */ char *start = strchr(line, ':'); - start = start ? ++start : line; + if (start) start++; else start=line; PUTS(start); } else if (*line == '2') { /* Transfer complete */ return NO; } else if (*line == '5') { /* Error */ char *start = strchr(line, ':'); - start = start ? ++start : line; + if (start) start++; else start=line; PUTS(start); } else if (*line == '-') { /* data */ /* data lines look like '-200:code:field:value' @@ -401,7 +399,7 @@ } } else { /* Unknown line */ char *start = strchr(line, ':'); - start = start ? ++start : line; + if (start) start++; else start=line; PUTS(start); } return YES; @@ -442,8 +440,7 @@ } else { *(me->buffer+me->buflen++) = *b; if (me->buflen >= MAX_GOPHER_LINE) { - if (PROT_TRACE) - HTTrace("Gopher...... Line too long - ignored\n"); + HTTRACE(PROT_TRACE, "Gopher...... Line too long - ignored\n"); me->buflen = 0; me->junk = YES; } @@ -482,8 +479,7 @@ { (*me->target->isa->abort)(me->target, e); HT_FREE(me); - if (PROT_TRACE) - HTTrace("Gopher...... ABORTING...\n"); + HTTRACE(PROT_TRACE, "Gopher...... ABORTING...\n"); return HT_ERROR; } @@ -646,7 +642,7 @@ ** This is actually state GOPHER_BEGIN, but it can't be in the state ** machine as we need the structure first. */ - if (PROT_TRACE) HTTrace("Gopher...... Looking for `%s\'\n",url); + HTTRACE(PROT_TRACE, "Gopher...... Looking for `%s\'\n" _ url); if ((gopher = (gopher_info *) HT_CALLOC(1, sizeof(gopher_info))) == NULL) HT_OUTOFMEM("HTLoadGopher"); gopher->type = GT_MENU; @@ -741,7 +737,7 @@ break; case GOPHER_NEED_CONNECTION: - status = HTHost_connect(host, net, url, GOPHER_PORT); + status = HTHost_connect(host, net, url); host = HTNet_host(net); if (status == HT_OK) { /* @@ -795,7 +791,7 @@ break; case GOPHER_NEED_REQUEST: - if (PROT_TRACE) HTTrace("Gopher Tx... `%s\'", gopher->cmd); + HTTRACE(PROT_TRACE, "Gopher Tx... `%s\'" _ gopher->cmd); { HTStream * input = HTRequest_inputStream(request); status = (*input->isa->put_block) diff -Naur xdvik-22.40l/libs/libwww/HTGopher.h xdvik-22.40n/libs/libwww/HTGopher.h --- xdvik-22.40l/libs/libwww/HTGopher.h Wed Apr 18 14:23:15 2001 +++ xdvik-22.40n/libs/libwww/HTGopher.h Fri Sep 13 00:23:46 2002 @@ -37,7 +37,7 @@ -@(#) $Id: HTGopher.h,v 1.1.1.1 2001/04/18 14:23:15 stefanulrich Exp $ +@(#) $Id: HTGopher.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTGuess.c xdvik-22.40n/libs/libwww/HTGuess.c --- xdvik-22.40l/libs/libwww/HTGuess.c Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTGuess.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTGuess.c,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ +** @(#) $Id: HTGuess.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This version of the stream object just writes its input ** to its output, but prepends Content-Type: field and an @@ -18,6 +18,7 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWLib.h" +#include "WWWFile.h" #include "HTGuess.h" #define SAMPLE_SIZE 200 /* Number of chars to look at */ @@ -79,11 +80,10 @@ ** that we are investigating. */ if (me->cnt) { - if (STREAM_TRACE) - HTTrace("GUESSING.... Result of content analysis: Text=%d%% Newlines=%d%% Ctrl=%d%% High=%d%%\n", - (int)(100*me->text_cnt/me->cnt + 0.5), - (int)(100*me->lf_cnt /me->cnt + 0.5), - (int)(100*me->ctrl_cnt/me->cnt + 0.5), + HTTRACE(STREAM_TRACE, "GUESSING.... Result of content analysis: Text=%d%% Newlines=%d%% Ctrl=%d%% High=%d%%\n" _ + (int)(100*me->text_cnt/me->cnt + 0.5) _ + (int)(100*me->lf_cnt /me->cnt + 0.5) _ + (int)(100*me->ctrl_cnt/me->cnt + 0.5) _ (int)(100*me->high_cnt/me->cnt + 0.5)); } @@ -153,7 +153,7 @@ if (HTResponse_format(response) == WWW_UNKNOWN) { HTParentAnchor * anchor = HTRequest_anchor(me->request); char * addr = HTAnchor_physical(anchor); - if (STREAM_TRACE) HTTrace("GUESSING.... Hmm - trying local bindings\n"); + HTTRACE(STREAM_TRACE, "GUESSING.... Hmm - trying local bindings\n"); HTBind_getResponseBindings (response, addr); } @@ -161,14 +161,11 @@ ** If nothing worked then give up and say binary... */ if (HTResponse_format(response) == WWW_UNKNOWN) { - if (STREAM_TRACE) HTTrace("GUESSING.... That's it - I'm giving up!\n"); + HTTRACE(STREAM_TRACE, "GUESSING.... That's it - I'm giving up!\n"); HTResponse_setFormat(response, WWW_BINARY); } - if (STREAM_TRACE) { - HTFormat format = HTResponse_format(response); - HTTrace("Guessed..... Content-Type `%s\'\n", HTAtom_name(format)); - } + HTTRACE(STREAM_TRACE, "Guessed..... Content-Type `%s\'\n" _ HTAtom_name(HTResponse_format(response))); /* ** Set up the new stream stack with the type we figured out @@ -176,7 +173,7 @@ if ((me->target = HTStreamStack(HTResponse_format(response), me->output_format, me->output_stream, me->request, NO)) == NULL) { - if (STREAM_TRACE) HTTrace("HTGuess..... Can't convert media type\n"); + HTTRACE(STREAM_TRACE, "HTGuess..... Can't convert media type\n"); me->target = HTErrorStream(); } me->transparent = YES; diff -Naur xdvik-22.40l/libs/libwww/HTGuess.h xdvik-22.40n/libs/libwww/HTGuess.h --- xdvik-22.40l/libs/libwww/HTGuess.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTGuess.h Fri Sep 13 00:23:46 2002 @@ -43,6 +43,6 @@ - @(#) $Id: HTGuess.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ + @(#) $Id: HTGuess.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTHInit.c xdvik-22.40n/libs/libwww/HTHInit.c --- xdvik-22.40l/libs/libwww/HTHInit.c Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHInit.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTHInit.c,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ +** @(#) $Id: HTHInit.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Set up the HTML parsers in libwww */ diff -Naur xdvik-22.40l/libs/libwww/HTHInit.h xdvik-22.40n/libs/libwww/HTHInit.h --- xdvik-22.40l/libs/libwww/HTHInit.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHInit.h Fri Sep 13 00:23:46 2002 @@ -66,6 +66,6 @@ - @(#) $Id: HTHInit.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ + @(#) $Id: HTHInit.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTHash.c xdvik-22.40n/libs/libwww/HTHash.c --- xdvik-22.40l/libs/libwww/HTHash.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTHash.c Fri Sep 13 00:23:46 2002 @@ -0,0 +1,247 @@ +/* +** HASH TABLE CLASS +** +** This HashTable class implements a simple hash table to keep +** objects associated with key words. +** +** Author: +** JP John Punin +** +*/ + +#include "wwwsys.h" +#include "HTUtils.h" +#include "HTString.h" +#include "HTHash.h" + +/* +( + Creation and Deletion Methods +) + +These methods create and deletes a Hash Table +*/ + +PUBLIC HTHashtable * HTHashtable_new (int size) +{ + HTHashtable *newHashtable; + int c = size > 0 ? size : HT_L_HASH_SIZE; + if ((newHashtable = (HTHashtable *) HT_CALLOC(1, sizeof (HTHashtable))) == NULL) + HT_OUTOFMEM("HTHashtable_new"); + + if((newHashtable->table = (void **) HT_CALLOC(c, sizeof (void *))) == NULL) + HT_OUTOFMEM("HTHashtable_new"); + + newHashtable->count = 0; + newHashtable->size = c; + return newHashtable; +} + +PUBLIC BOOL HTHashtable_delete (HTHashtable *me) +{ + if (me) { + int i; + for(i = 0; i< me->size; i++) { + HTList * l = (HTList *)me->table[i]; + if (l) { + HTList *cur = l; + keynode *kn; + while ((kn = (keynode *) HTList_nextObject(cur))) { + HT_FREE(kn->key); + HT_FREE(kn); + } + HTList_delete(l); + } + } + HT_FREE(me->table); + HT_FREE(me); + return YES; + } + return NO; +} + +PRIVATE int hash_number (const char *key, int size) +{ + int hash = 0; + + if (key) { + const char * ptr = key; + for(; *ptr; ptr++) + hash = (int) ((hash*3 + (*(unsigned char*)ptr)) % size); + } + return hash; +} + +/* +( + Add an Element to a HashTable +) +*/ + +PUBLIC BOOL HTHashtable_addObject (HTHashtable *me, const char *key, + void *newObject) +{ + if(me) { + int size = me->size; + int i = hash_number(key,size); + HTList *l = (HTList *)me->table[i]; + keynode *kn; + if(!l) + l = me->table[i] = HTList_new(); + if ((kn = (keynode *) HT_CALLOC(1, sizeof (keynode))) == NULL) + HT_OUTOFMEM("HTHashtable_addObject"); + StrAllocCopy(kn->key,key); + kn->object = newObject; + HTList_addObject(l,kn); + me->count++; + return YES; + } + return NO; +} + +/* +( + Remove an Element from the HashTable +) +*/ + +PUBLIC BOOL HTHashtable_removeObject (HTHashtable *me, const char *key) +{ + if(me) { + int size = me->size; + int i = hash_number(key,size); + HTList *l = (HTList *)me->table[i]; + if(l) { + HTList *cur = l; + keynode *kn; + while ((kn = (keynode *) HTList_nextObject(cur))) { + if(!strcmp(key,kn->key)) { + HTList_removeObject(l,kn); + me->count--; + return YES; + } + } + } + } + return NO; +} + +/* +( + Search for an Element in a Hash Table +) +*/ + +PUBLIC void *HTHashtable_object (HTHashtable * me, const char *key) +{ + if(me) { + int size = me->size; + int i = hash_number(key,size); + HTList * l = (HTList *)me->table[i]; + if (l) { + HTList *cur = l; + keynode *kn; + while ((kn = (keynode *) HTList_nextObject(cur))) { + if(!strcmp(key,kn->key)) + return kn->object; + } + } + } + return NULL; +} + +/* +( + Size of a Hash Table +) +*/ + +PUBLIC int HTHashtable_count (HTHashtable *me) +{ + if(me) + return me->count; + return -1; +} + +/* +( + Walk all Elements in the HashTable +) +*/ + +PUBLIC BOOL HTHashtable_walk (HTHashtable *me, + int (*walkFunc)(HTHashtable *,char *, void *)) +{ + if(me) { + int i, j; + for(i = 0; i< me->size; i++) { + HTList *l = (HTList *)me->table[i]; + if(l) { + HTList *cur = l; + keynode *kn, *nextkn; + for(kn = (keynode *)HTList_nextObject(cur); kn; kn = nextkn) { + j = walkFunc(me, kn->key, kn->object); + if(j == 0) + return YES; + nextkn = (keynode *)HTList_nextObject(cur); + if (j < 0) { + HTList_removeObject(l, kn); + me->count--; + } + } + } + } + return YES; + } + return NO; +} + +/* +( + Extract in a dynamic array all keys of the Hash Table +) +*/ + +PUBLIC HTArray * HTHashtable_keys (HTHashtable *me) +{ + if(me) { + HTArray *keys = HTArray_new(me->count); + int i; + + for(i = 0; i< me->size; i++) { + HTList * l = (HTList *)me->table[i]; + if (l) { + HTList *cur = l; + keynode *kn; + while ((kn = (keynode *) HTList_nextObject(cur))) { + char * nkey = NULL; + StrAllocCopy(nkey,kn->key); + HTArray_addObject(keys,nkey); + } + } + } + return keys; + } + return NULL; +} + +/* +( + Print the keys of the Hash Table +) +*/ + +PUBLIC void HTHashtable_print (HTHashtable *me) +{ + HTArray *keys = HTHashtable_keys(me); + int i; + HTPrint("Printing Hash Table of size %d\n", HTArray_size(keys)); + for(i = 0; i< HTArray_size(keys); i++) { + HTPrint("Key %d %s\n",i,HTArray_data(keys)[i]); + } + for(i = 0; i< HTArray_size(keys); i++) { + HT_FREE(HTArray_data(keys)[i]); + } + HTArray_delete(keys); +} + diff -Naur xdvik-22.40l/libs/libwww/HTHash.h xdvik-22.40n/libs/libwww/HTHash.h --- xdvik-22.40l/libs/libwww/HTHash.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTHash.h Fri Sep 13 00:23:46 2002 @@ -0,0 +1,129 @@ +/* + + W3C Sample Code Library libwww Hash Table Class + + +! + Hash Table Class +! + +Written and integrated into libwww by John Punin - thanks! + +This module is implemented by HTHash.c, and is a part +of the W3C Sample Code Library. + +This HashTable class implements a simple hash table to keep objects associated +with key words. +*/ + +#ifndef HTHASH_H +#define HTHASH_H + +#include "HTList.h" + +typedef struct _HTHashtable HTHashtable; + +struct _HTHashtable { + void **table; + int count; + int size; +}; + +typedef struct _keynode keynode; + +struct _keynode { + char *key; + void *object; +}; + +/* +. + Creation and Deletion Methods +. + +These methods create and deletes a Hash Table +*/ + +extern HTHashtable * HTHashtable_new (int size); + +extern BOOL HTHashtable_delete (HTHashtable *me); + +/* +. + Add an Element to a HashTable +. +*/ + +extern BOOL HTHashtable_addObject (HTHashtable *me, const char *key, void *newObject); + +/* +. + Remove an Element from a HashTable +. +*/ + +extern BOOL HTHashtable_removeObject (HTHashtable *me, const char *key); + +/* +. + Search for an Element in a Hash Table +. +*/ + +extern void * HTHashtable_object (HTHashtable * me, const char *key); + +/* +. + Size of a Hash Table +. +*/ + +extern int HTHashtable_count (HTHashtable *me); + +/* +. + Walk all the elements in a Hash Table +. + +Walking the hashtable calls the specified function pointer with each key +and object that is in the hash table. If the callback function returns 0, +the walking stops. If it returns a negative number, the current element +is removed from the hash table. Return a positive number to keep going. + +Note that it is legal for the walkFunc to call HTHashtable_removeObject() +on any element in the current hash table except the current +one (if you intend to keep going, that is). The only legal way to delete the +current element while continuing to walk the table is to use the negative +return value. +*/ + +extern BOOL HTHashtable_walk (HTHashtable *me, int (*walkFunc)(HTHashtable *, char *, void *)); + +/* +. + Extract in a dynamic array all keys of the Hash Table +. +*/ + +extern HTArray * HTHashtable_keys (HTHashtable *me); + +/* +. + Print the keys of the Hash Table +. +*/ + +extern void HTHashtable_print (HTHashtable *me); + +/* +*/ + +#endif + +/* + + + + @(#) $Id: HTHash.h,v 1.1.2.1 2002/09/13 00:23:46 stefanulrich Exp $ + +*/ diff -Naur xdvik-22.40l/libs/libwww/HTHeader.c xdvik-22.40n/libs/libwww/HTHeader.c --- xdvik-22.40l/libs/libwww/HTHeader.c Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHeader.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTHeader.c,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ +** @(#) $Id: HTHeader.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** HISTORY: ** 2 Nov 95 HFN Written on a rainy night @@ -19,7 +19,6 @@ #include "HTHeader.h" /* Implemented here */ #include "HTMIMPrs.h" -#define MIME_HASH_SIZE 101 HTMIMEParseSet * ParseSet = NULL; PRIVATE HTList * HTGenerators = NULL; diff -Naur xdvik-22.40l/libs/libwww/HTHeader.h xdvik-22.40n/libs/libwww/HTHeader.h --- xdvik-22.40l/libs/libwww/HTHeader.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHeader.h Fri Sep 13 00:23:46 2002 @@ -82,6 +82,8 @@ ) */ +#define MIME_HASH_SIZE HT_L_HASH_SIZE + extern void HTHeader_setMIMEParseSet (HTMIMEParseSet * list); extern HTMIMEParseSet * HTHeader_MIMEParseSet (void); extern BOOL HTHeader_addParser (const char * token, BOOL case_sensitive, @@ -118,6 +120,6 @@ - @(#) $Id: HTHeader.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ + @(#) $Id: HTHeader.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTHist.c xdvik-22.40n/libs/libwww/HTHist.c --- xdvik-22.40l/libs/libwww/HTHist.c Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHist.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTHist.c,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ +** @(#) $Id: HTHist.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** The history manager for the Library. This module is not called any ** where in the Library so if the application does not call it, it is diff -Naur xdvik-22.40l/libs/libwww/HTHist.h xdvik-22.40n/libs/libwww/HTHist.h --- xdvik-22.40l/libs/libwww/HTHist.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHist.h Fri Sep 13 00:23:46 2002 @@ -222,7 +222,7 @@ -@(#) $Id: HTHist.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ +@(#) $Id: HTHist.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTHome.c xdvik-22.40n/libs/libwww/HTHome.c --- xdvik-22.40l/libs/libwww/HTHome.c Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHome.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTHome.c,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ +** @(#) $Id: HTHome.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Authors ** TBL Tim Berners-Lee timbl@w3.org @@ -55,9 +55,11 @@ char * result = NULL; #endif /* HAVE_GETWD */ #endif /* HAVE_GETCWD */ - *(wd+HT_MAX_PATH) = '\0'; - if (*(wd+strlen(wd)-1) != '/') strcat(wd, "/"); - return result ? HTLocalToWWW(result) : NULL; + if (result) { + *(wd+HT_MAX_PATH) = '\0'; + if (*(wd+strlen(wd)-1) != '/') strcat(wd, "/"); + } + return result ? HTLocalToWWW(result, NULL) : NULL; } @@ -120,9 +122,8 @@ if (fp) { fclose(fp); } else { - if (WWWTRACE) - HTTrace("Home Anchor. No local home document in ~/%s or %s\n", - PERSONAL_DEFAULT, LOCAL_DEFAULT_FILE); + HTTRACE(APP_TRACE, "Home Anchor. No local home document in ~/%s or %s\n" _ + PERSONAL_DEFAULT _ LOCAL_DEFAULT_FILE); HT_FREE(my_home_document); my_home_document = NULL; } @@ -132,9 +133,8 @@ HTLib_secure() ? REMOTE_ADDRESS : LAST_RESORT, "file:", PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION); if (my_home_document) { - if (WWWTRACE) - HTTrace("Home Anchor. `%s\' used for custom home page as\n`%s\'\n", - my_home_document, ref); + HTTRACE(APP_TRACE, "Home Anchor. `%s\' used for custom home page as\n`%s\'\n" _ + my_home_document _ ref); HT_FREE(my_home_document); } anchor = (HTParentAnchor*) HTAnchor_findAddress(ref); @@ -148,6 +148,7 @@ PUBLIC HTParentAnchor * HTTmpAnchor (HTUserProfile * up) { static int offset = 0; /* Just keep counting... */ + HTParentAnchor * htpa = NULL; time_t t = time(NULL); char * tmpfile = HTGetTmpFileName(HTUserProfile_tmp(up)); char * tmpurl = HTParse(tmpfile, "file:", PARSE_ALL); @@ -160,13 +161,49 @@ #else sprintf(result, "%s.%d.%d", tmpurl, t, offset++); #endif - if (APP_TRACE) HTTrace("Tmp Anchor.. With location `%s\'\n", result); - return HTAnchor_parent(HTAnchor_findAddress(result)); + HTTRACE(APP_TRACE, "Tmp Anchor.. With location `%s\'\n" _ result); + htpa = HTAnchor_parent(HTAnchor_findAddress(result)); HT_FREE(result); } HT_FREE(tmpfile); HT_FREE(tmpurl); - return NULL; + return htpa; +} + +/* +** Takes a string of the form "a=b" containing HTML form data, escapes +** it accordingly and puts it into the association list so that it +** readily can be passed to any of the HTAccess function that handles +** HTML form data. +*/ +PUBLIC BOOL HTParseFormInput (HTAssocList * list, const char * str) +{ + if (list && str) { + char * me = NULL; + char * name = NULL; + char * value = NULL; + StrAllocCopy(me, str); + value = strchr(me, '='); + if (value) + *value++ = '\0'; + else + value = ""; + name = HTStrip(me); + + /* Escape the name and value */ + if (name) { + char * escaped_name = HTEscape(name, URL_XALPHAS); + char * escaped_value = HTEscape(value, URL_XALPHAS); + HTTRACE(APP_TRACE, "Form data... Adding name `%s\' with value `%s\' to %p\n" _ + escaped_name _ escaped_value _ list); + HTAssocList_addObject(list, escaped_name, escaped_value); + HT_FREE(escaped_name); + HT_FREE(escaped_value); + } + HT_FREE(me); + return YES; + } + return NO; } /* @@ -177,30 +214,32 @@ */ PUBLIC int HTSetTraceMessageMask (const char * shortnames) { -#ifdef WWWTRACE +#if defined(HTDEBUG) && defined(WWWTRACE) WWWTRACE = 0; if (shortnames && *shortnames) { char * ptr = (char *) shortnames; for(; *ptr; ptr++) { switch (*ptr) { - case 'f': WWWTRACE |= SHOW_UTIL_TRACE; break; - case 'l': WWWTRACE |= SHOW_APP_TRACE; break; + case 'a': WWWTRACE |= SHOW_ANCHOR_TRACE; break; + case 'b': WWWTRACE |= SHOW_BIND_TRACE; break; case 'c': WWWTRACE |= SHOW_CACHE_TRACE; break; + case 'e': WWWTRACE |= SHOW_MUX_TRACE; break; + case 'f': WWWTRACE |= SHOW_UTIL_TRACE; break; case 'g': WWWTRACE |= SHOW_SGML_TRACE; break; - case 'b': WWWTRACE |= SHOW_BIND_TRACE; break; - case 't': WWWTRACE |= SHOW_THREAD_TRACE; break; - case 's': WWWTRACE |= SHOW_STREAM_TRACE; break; - case 'p': WWWTRACE |= SHOW_PROTOCOL_TRACE; break; - case 'm': WWWTRACE |= SHOW_MEM_TRACE; break; - case 'q': WWWTRACE |= SHOW_SQL_TRACE; break; - case 'u': WWWTRACE |= SHOW_URI_TRACE; break; case 'h': WWWTRACE |= SHOW_AUTH_TRACE; break; - case 'a': WWWTRACE |= SHOW_ANCHOR_TRACE; break; case 'i': WWWTRACE |= SHOW_PICS_TRACE; break; + case 'l': WWWTRACE |= SHOW_APP_TRACE; break; + case 'm': WWWTRACE |= SHOW_MEM_TRACE; break; case 'o': WWWTRACE |= SHOW_CORE_TRACE; break; - case 'x': WWWTRACE |= SHOW_MUX_TRACE; break; + case 'p': WWWTRACE |= SHOW_PROTOCOL_TRACE; break; + case 'q': WWWTRACE |= SHOW_SQL_TRACE; break; + case 's': WWWTRACE |= SHOW_STREAM_TRACE; break; + case 't': WWWTRACE |= SHOW_THREAD_TRACE; break; + case 'u': WWWTRACE |= SHOW_URI_TRACE; break; + case 'x': WWWTRACE |= SHOW_XML_TRACE; break; + case '*': WWWTRACE |= SHOW_ALL_TRACE; break; default: - if (WWWTRACE) HTTrace("Trace....... Bad argument\n"); + if (WWWTRACE) HTTRACE(APP_TRACE, "Trace....... Bad argument\n"); } } if (!WWWTRACE) WWWTRACE = SHOW_ALL_TRACE; diff -Naur xdvik-22.40l/libs/libwww/HTHome.h xdvik-22.40n/libs/libwww/HTHome.h --- xdvik-22.40l/libs/libwww/HTHome.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHome.h Fri Sep 13 00:23:46 2002 @@ -98,6 +98,9 @@ can also be the location for backups and for security "auto-save" functionality. This functions creates a new anchor with a URL pointing to the temporary location defined by this user profile and returns that anchor. +Andy Levine: I additionally found that calling HTTmpAnchor repeatedly without +freeing the newly allocated anchor will cause the anchor hash table to +continue to grow. */ extern HTParentAnchor * HTTmpAnchor (HTUserProfile * up); @@ -119,11 +122,28 @@ /* . + Handle HTML Form Input fields +. + +Takes a string of the form "a=b" containing HTML form data, +escapes it accordingly and puts it into the association list so that it readily +can be passed to any of the HTAccess function that handles HTML form data. +The string should not be encoded in any way - this function encodes it according +to the HTML form encoding rules. + +Examples are "foo=bar", "baz=foo and bar", "a= b ", " a = b ", "toto=", "four += two + two", "six three + three", and "a=b=c" +*/ + +extern BOOL HTParseFormInput (HTAssocList * list, const char * str); + +/* +. Handle Library Trace Messages . Standard interface to libwww TRACE messages. -Pass this function a string of characters and it will set up the appropriate +Pass this function a string of characters. It will set up the appropriate TRACE flags. The following characters are used as follows: @@ -190,6 +210,10 @@ x Show MUX Trace Messages + + * + + Show ALL Trace Messages The string must be null terminated, an example is "sop". @@ -206,6 +230,6 @@ - @(#) $Id: HTHome.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ + @(#) $Id: HTHome.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTHost.c xdvik-22.40n/libs/libwww/HTHost.c --- xdvik-22.40l/libs/libwww/HTHost.c Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHost.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTHost.c,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ +** @(#) $Id: HTHost.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This object manages the information that we know about a remote host. ** This can for example be what type of host it is, and what version @@ -95,7 +95,7 @@ PRIVATE BOOL delete_object (HTList * list, HTHost * me) { - if (CORE_TRACE) HTTrace("Host info... object %p from list %p\n", me, list); + HTTRACE(CORE_TRACE, "Host info... object %p from list %p\n" _ me _ list); HTList_removeObject(list, (void *) me); free_object(me); return YES; @@ -113,48 +113,33 @@ int pending = HTList_count(host->pending); int cnt; - if (CORE_TRACE) - HTTrace("Host kill... Pipeline due to %s event\n", HTEvent_type2str(type)); + HTTRACE(CORE_TRACE, "Host kill... Pipeline due to %s event\n" _ HTEvent_type2str(type)); /* Terminate all net objects in pending queue */ for (cnt=0; cntpending); - if (CORE_TRACE) HTTrace("Host kill... Terminating net object %p from pending queue\n", net); - net->registeredFor = 0; - (*net->event.cbf)(HTChannel_socket(host->channel), net->event.param, type); + if (net) { + HTTRACE(CORE_TRACE, "Host kill... Terminating net object %p from pending queue\n" _ net); + net->registeredFor = 0; + (*net->event.cbf)(HTChannel_socket(host->channel), net->event.param, type); + if (host->lock == net) host->lock = NULL; + } } /* Terminate all net objects in pipeline */ if (piped >= 1) { -#if 0 - /* - ** Unregister this host for all events - */ - HTEvent_unregister(HTChannel_socket(host->channel), HTEvent_READ); - HTEvent_unregister(HTChannel_socket(host->channel), HTEvent_WRITE); - host->registeredFor = 0; - - /* - ** Set new mode to single until we know what is going on - */ - host->mode = HT_TP_SINGLE; -#endif /* ** Terminte all net objects in the pipeline */ for (cnt=0; cntpipeline); - if (CORE_TRACE) HTTrace("Host kill... Terminating net object %p from pipe line\n", net); - net->registeredFor = 0; - (*net->event.cbf)(HTChannel_socket(host->channel), net->event.param, type); + if (net) { + HTTRACE(CORE_TRACE, "Host kill... Terminating net object %p from pipe line\n" _ net); + net->registeredFor = 0; + (*net->event.cbf)(HTChannel_socket(host->channel), net->event.param, type); + } } - -#if 0 - HTChannel_setSemaphore(host->channel, 0); - HTHost_clearChannel(host, HT_INTERRUPTED); -#endif - } return YES; } @@ -169,10 +154,11 @@ { HTHost * host = (HTHost *) param; SOCKET sockfd = HTChannel_socket(host->channel); - int result = HostEvent (sockfd, host, HTEvent_CLOSE); + HTTimer_delete(timer); host->timer = NULL; - return result; + + return HostEvent (sockfd, host, HTEvent_CLOSE); } /* @@ -185,7 +171,7 @@ { HTHost * host = (HTHost *)pVoid; - if (type == HTEvent_READ || type == HTEvent_CLOSE) { + if (type == HTEvent_READ || type == HTEvent_CLOSE || type == HTEvent_ACCEPT) { HTNet * targetNet; /* call the first net object */ @@ -196,26 +182,23 @@ * of previous socket has been dispensed by the library, * the section below makes sure the event does not get miss attributed */ - if (HTChannel_socket(host->channel) != soc) { - if (CORE_TRACE) - HTTrace("Host Event.. wild socket %d type = %s real socket is %d\n", soc, - type == HTEvent_CLOSE ? "Event_Close" : "Event_Read", - HTChannel_socket(host->channel)); - return HT_OK; + if (HTChannel_socket(host->channel) != soc && type != HTEvent_ACCEPT && !host->listening) { + HTTRACE(CORE_TRACE, "Host Event.. wild socket %d type = %s real socket is %d\n" _ soc _ + type == HTEvent_CLOSE ? "Event_Close" : "Event_Read" _ + HTChannel_socket(host->channel)); + return HT_OK; } targetNet = (HTNet *)HTList_firstObject(host->pipeline); if (targetNet) { - if (CORE_TRACE) - HTTrace("Host Event.. READ passed to `%s\'\n", + HTTRACE(CORE_TRACE, "Host Event.. READ passed to `%s\'\n" _ HTAnchor_physical(HTRequest_anchor(HTNet_request(targetNet)))); if ((ret = (*targetNet->event.cbf)(HTChannel_socket(host->channel), targetNet->event.param, type)) != HT_OK) return ret; } if (targetNet == NULL && host->remainingRead > 0) { - if (CORE_TRACE) - HTTrace("HostEvent... Error: %d bytes left to read and nowhere to put them\n", + HTTRACE(CORE_TRACE, "HostEvent... Error: %d bytes left to read and nowhere to put them\n" _ host->remainingRead); host->remainingRead = 0; /* @@ -230,21 +213,21 @@ return HT_OK; /* If there was notargetNet, it should be a close */ - if (CORE_TRACE) - HTTrace("Host Event.. host %p `%s\' closed connection.\n", - host, host->hostname); + HTTRACE(CORE_TRACE, "Host Event.. host %p `%s\' closed connection.\n" _ + host _ host->hostname); /* Is there garbage in the channel? Let's check: */ { char buf[256]; int ret; memset(buf, '\0', sizeof(buf)); - while ((ret = NETREAD(HTChannel_socket(host->channel), buf, sizeof(buf)-1)) > 0) { - if (CORE_TRACE) - HTTrace("Host Event.. Host %p `%s\' had %d extraneous bytes: `%s\'\n", - host, host->hostname, ret, buf); + if (HTChannel_socket(host->channel) != INVSOC) { + while ((ret = NETREAD(HTChannel_socket(host->channel), buf, sizeof(buf)-1)) > 0) { + HTTRACE(CORE_TRACE, "Host Event.. Host %p `%s\' had %d extraneous bytes: `%s\'\n" _ + host _ host->hostname _ ret _ buf); memset(buf, '\0', sizeof(buf)); - } + } + } } HTHost_clearChannel(host, HT_OK); return HT_OK; /* extra garbage does not constitute an application error */ @@ -252,17 +235,28 @@ } else if (type == HTEvent_WRITE || type == HTEvent_CONNECT) { HTNet * targetNet = (HTNet *)HTList_lastObject(host->pipeline); if (targetNet) { - if (CORE_TRACE) - HTTrace("Host Event.. WRITE passed to `%s\'\n", + HTTRACE(CORE_TRACE, "Host Event.. WRITE passed to `%s\'\n" _ HTAnchor_physical(HTRequest_anchor(HTNet_request(targetNet)))); return (*targetNet->event.cbf)(HTChannel_socket(host->channel), targetNet->event.param, type); } - HTTrace("Host Event.. Who wants to write to `%s\'?\n", host->hostname); + HTTRACE(CORE_TRACE, "Host Event Host %p (`%s\') dispatched with event %s but doesn't have a target - %d requests made, %d requests in pipe, %d pending\n" _ + host _ + host ? host->hostname : "" _ + HTEvent_type2str(type) _ + host ? host->reqsMade : -1 _ + HTList_count(host->pipeline) _ + HTList_count(host->pending)); +#if 0 + HTDEBUGBREAK("Host Event.. Host %p (`%s\') dispatched with event %d\n" _ + host _ host ? host->hostname : "" _ type); return HT_ERROR; +#else + return HT_OK; +#endif } else if (type == HTEvent_TIMEOUT) { killPipeline(host, HTEvent_TIMEOUT); } else { - HTTrace("Don't know how to handle OOB data from `%s\'?\n", + HTTRACE(CORE_TRACE, "Don't know how to handle OOB data from `%s\'?\n" _ host->hostname); } return HT_OK; @@ -285,7 +279,7 @@ HTHost * pres = NULL; int hash = 0; if (!host) { - if (CORE_TRACE) HTTrace("Host info... Bad argument\n"); + HTTRACE(CORE_TRACE, "Host info... Bad argument\n"); return NULL; } @@ -309,8 +303,7 @@ while ((pres = (HTHost *) HTList_nextObject(cur))) { if (!strcmp(pres->hostname, host) && u_port == pres->u_port) { if (HTHost_isIdle(pres) && time(NULL)>pres->ntime+HostTimeout){ - if (CORE_TRACE) - HTTrace("Host info... Collecting host info %p\n",pres); + HTTRACE(CORE_TRACE, "Host info... Collecting host info %p\n" _ pres); delete_object(list, pres); pres = NULL; } @@ -330,16 +323,16 @@ if (pres->expires > 0) { time_t t = time(NULL); if (HTHost_isIdle(pres) && pres->expires < t) { - if (CORE_TRACE) - HTTrace("Host info... Persistent channel %p gotten cold\n", + HTTRACE(CORE_TRACE, "Host info... Persistent channel %p gotten cold\n" _ pres->channel); HTHost_clearChannel(pres, HT_OK); } else { pres->expires = t + HTPassiveTimeout; - if (CORE_TRACE) - HTTrace("Host info... REUSING CHANNEL %p\n",pres->channel); + HTTRACE(CORE_TRACE, "Host info... REUSING CHANNEL %p\n" _ pres->channel); } } + } else { + HTTRACE(CORE_TRACE, "Host info... Found Host %p with no active channel\n" _ pres); } } else { if ((pres = (HTHost *) HT_CALLOC(1, sizeof(HTHost))) == NULL) @@ -350,14 +343,14 @@ pres->ntime = time(NULL); pres->mode = HT_TP_SINGLE; pres->delay = WriteDelay; + pres->inFlush = NO; { int i; for (i = 0; i < HTEvent_TYPES; i++) pres->events[i]= HTEvent_new(HostEvent, pres, HT_PRIORITY_MAX, EventTimeout); } - if (CORE_TRACE) - HTTrace("Host info... added `%s\' with host %p to list %p\n", - host, pres, list); + HTTRACE(CORE_TRACE, "Host info... added `%s\' with host %p to list %p\n" _ + host _ pres _ list); HTList_addObject(list, (void *) pres); } return pres; @@ -374,7 +367,7 @@ fullhost = HTParse(proxy ? proxy : url, "", PARSE_HOST); - /* If there's an @ then use the stuff after it as a hostname */ + /* If there's an @ then use the stuff after it as a hostname */ if (fullhost) { char * at_sign; if ((at_sign = strchr(fullhost, '@')) != NULL) @@ -388,18 +381,17 @@ HT_FREE(fullhost); return NULL; } - port = strchr(parsedHost, ':'); - if (PROT_TRACE) - HTTrace("HTHost parse Looking up `%s\'\n", parsedHost); - if (port) { + + /* See if the default port should be overridden */ + if ((port = strchr(parsedHost, ':')) != NULL) { *port++ = '\0'; - if (!*port || !isdigit((int) *port)) - port = 0; - u_port = (u_short) atol(port); + if (*port && isdigit((int) *port)) u_port = (u_short) atol(port); } + HTTRACE(PROT_TRACE, "HTHost parse Looking up `%s\' on port %u\n" _ parsedHost _ u_port); + /* Find information about this host */ if ((me = HTHost_new(parsedHost, u_port)) == NULL) { - if (PROT_TRACE)HTTrace("HTHost parse Can't get host info\n"); + HTTRACE(PROT_TRACE, "HTHost parse Can't get host info\n"); me->tcpstate = TCP_ERROR; return NULL; } @@ -429,8 +421,7 @@ { HTList * list = NULL; /* Current list in cache */ HTHost * pres = NULL; - if (CORE_TRACE) - HTTrace("Host info... Looking for `%s\'\n", host ? host : ""); + HTTRACE(CORE_TRACE, "Host info... Looking for `%s\'\n" _ host ? host : ""); /* Find a hash for this host */ if (host && HostTable) { @@ -447,13 +438,11 @@ while ((pres = (HTHost *) HTList_nextObject(cur))) { if (!strcmp(pres->hostname, host)) { if (time(NULL) > pres->ntime + HostTimeout) { - if (CORE_TRACE) - HTTrace("Host info... Collecting host %p\n", pres); + HTTRACE(CORE_TRACE, "Host info... Collecting host %p\n" _ pres); delete_object(list, pres); pres = NULL; } else { - if (CORE_TRACE) - HTTrace("Host info... Found `%s\'\n", host); + HTTRACE(CORE_TRACE, "Host info... Found `%s\'\n" _ host); } return pres; } @@ -464,6 +453,32 @@ } /* +** Cleanup the host list +*/ +PUBLIC void HTHost_deleteAll (void) +{ + HTList * list; + HTHost * host; + int i; + + if (!HostTable) + return; + + for (i=0; i < HOST_HASH_SIZE; i++) { + list = HostTable[i]; + if (!list) continue; + + while ((host = (HTHost *) HTList_removeFirstObject(list)) != NULL) + free_object(host); + + HTList_delete(list); + } + + HT_FREE(HostTable); + HostTable = NULL; +} + +/* ** Get and set the hostname of the remote host */ PUBLIC char * HTHost_name (HTHost * host) @@ -645,7 +660,7 @@ if (host && unit) { #if 0 if (host->range_units) { - char * start = strcasestr(host->range_units, "none"); + char * start = HTStrCaseStr(host->range_units, "none"); /* ** Check that "none" is infact a token. It could be part of some @@ -699,17 +714,15 @@ host->expires = time(NULL) + HTPassiveTimeout; /* Default timeout */ HTChannel_setHost(host->channel, host); HTNet_increasePersistentSocket(); - if (CORE_TRACE) - HTTrace("Host info... added host %p as persistent\n", host); + HTTRACE(CORE_TRACE, "Host info... added host %p as persistent\n" _ host); return YES; } else { - if (CORE_TRACE) - HTTrace("Host info... no room for persistent socket %d\n", + HTTRACE(CORE_TRACE, "Host info... no room for persistent socket %d\n" _ sockfd); return NO; } } else { - if (CORE_TRACE) HTTrace("Host info... %p already persistent\n", host); + HTTRACE(CORE_TRACE, "Host info... %p already persistent\n" _ host); return YES; } return NO; @@ -781,11 +794,12 @@ host->broken_pipe = NO; host->mode = HT_TP_SINGLE; - if (CORE_TRACE) HTTrace("Host info... removed host %p as persistent\n", host); + host->recovered = 0; + + HTTRACE(CORE_TRACE, "Host info... removed host %p as persistent\n" _ host); if (!HTList_isEmpty(host->pending)) { - if (CORE_TRACE) - HTTrace("Host has %d object(s) pending - attempting launch\n", HTList_count(host->pending)); + HTTRACE(CORE_TRACE, "Host has %d object(s) pending - attempting launch\n" _ HTList_count(host->pending)); HTHost_launchPending(host); } return YES; @@ -806,12 +820,23 @@ { if (host) { int piped = HTList_count(host->pipeline); + + /* + ** First check that we haven't already recovered more than we want + */ + if (host->recovered > MAX_HOST_RECOVER) { + HTTRACE(CORE_TRACE, "Host recover %p already %d times - not doing it anymore\n" _ host _ host->recovered); + return NO; + } + + /* + ** If we decided to recover and actually have something in the pipe + ** then go ahead. + */ if (piped > 0) { int cnt; host->recovered++; - if (CORE_TRACE) - HTTrace("Host recovered %d times. Moving %d Net objects from pipe line to pending queue\n", - host->recovered, piped); + HTTRACE(CORE_TRACE, "Host recover %p recovered %d times. Moving %d Net objects from pipe line to pending queue\n" _ host _ host->recovered _ piped); /* ** Unregister this host for all events @@ -831,10 +856,11 @@ if (!host->pending) host->pending = HTList_new(); for (cnt=0; cntpipeline); - if (CORE_TRACE) HTTrace("Host recover Resetting net object %p\n", net); + HTTRACE(CORE_TRACE, "Host recover Resetting net object %p\n" _ net); net->registeredFor = 0; (*net->event.cbf)(HTChannel_socket(host->channel), net->event.param, HTEvent_RESET); HTList_appendObject(host->pending, net); + host->lock = net; } HTChannel_setSemaphore(host->channel, 0); @@ -880,12 +906,11 @@ int piped = HTList_count(host->pipeline); if (piped > 0) { int cnt; - if (CORE_TRACE) - HTTrace("Host info... Moving %d Net objects from pipe line to pending queue\n", piped); + HTTRACE(CORE_TRACE, "Host info... Moving %d Net objects from pipe line to pending queue\n" _ piped); if (!host->pending) host->pending = HTList_new(); for (cnt=0; cntpipeline); - if (CORE_TRACE) HTTrace("Host info... Resetting net object %p\n", net); + HTTRACE(CORE_TRACE, "Host info... Resetting net object %p\n" _ net); (*net->event.cbf)(HTChannel_socket(host->channel), net->event.param, HTEvent_RESET); HTList_appendObject(host->pending, net); } @@ -899,13 +924,11 @@ ** single mode. We can't recover connections for the rest of our life */ if (mode == HT_TP_PIPELINE && host->recovered > MAX_HOST_RECOVER) { - if (PROT_TRACE) - HTTrace("Host info... %p is bad for pipelining so we won't do it!!!\n", + HTTRACE(PROT_TRACE, "Host info... %p is bad for pipelining so we won't do it!!!\n" _ host); } else { host->mode = mode; - if (PROT_TRACE) - HTTrace("Host info... New mode is %d for host %p\n", host->mode, host); + HTTRACE(PROT_TRACE, "Host info... New mode is %d for host %p\n" _ host->mode _ host); } } return NO; @@ -960,13 +983,27 @@ ** one. Otherwise we put the host object into our pending queue. */ if (!host->channel && HTNet_availableSockets() <= 0) { + + /* Create list for pending Host objects */ if (!PendHost) PendHost = HTList_new(); - HTList_addObject(PendHost, host); + + /* Add the host object ad pending if not already */ + if (HTList_indexOf(PendHost, host) < 0) HTList_addObject(PendHost, host); + + /* + ** Add the Net object to the Host object. If it is the current Net + ** obejct holding the lock then add it to the beginning of the list. + ** Otherwise add it to the end + */ if (!host->pending) host->pending = HTList_new(); - HTList_addObject(host->pending, net); - if (CORE_TRACE) - HTTrace("Host info... Added Host %p with Net %p (request %p) as pending, %d requests made, %d requests in pipe, %d pending\n", - host, net, net->request, host->reqsMade, HTList_count(host->pipeline), HTList_count(host->pending)); + if (host->lock == net) + HTList_appendObject(host->pending, net); + else + HTList_addObject(host->pending, net); + + HTTRACE(CORE_TRACE, "Host info... Added Net %p (request %p) as pending on pending Host %p, %d requests made, %d requests in pipe, %d pending\n" _ + net _ net->request _ host _ host->reqsMade _ + HTList_count(host->pipeline) _ HTList_count(host->pending)); return HT_PENDING; } @@ -977,27 +1014,23 @@ ** the pipeline or pending list (if it's already on the list). */ if (HTList_indexOf(host->pipeline, net) >= 0) { - if (CORE_TRACE) - HTTrace("Host info... The Net %p (request %p) is already in pipe," - " %d requests made, %d requests in pipe, %d pending\n", - net, net->request, host->reqsMade, - HTList_count(host->pipeline), + HTTRACE(CORE_TRACE, "Host info... The Net %p (request %p) is already in pipe," + " %d requests made, %d requests in pipe, %d pending\n" _ + net _ net->request _ host->reqsMade _ + HTList_count(host->pipeline) _ HTList_count(host->pending)); - HTDebugBreak(__FILE__, __LINE__, - "Net object %p registered multiple times in pipeline\n", + HTDEBUGBREAK("Net object %p registered multiple times in pipeline\n" _ net); return HT_OK; } if (HTList_indexOf(host->pending, net) >= 0) { - if (CORE_TRACE) - HTTrace("Host info... The Net %p (request %p) already pending," - " %d requests made, %d requests in pipe, %d pending\n", - net, net->request, host->reqsMade, - HTList_count(host->pipeline), + HTTRACE(CORE_TRACE, "Host info... The Net %p (request %p) already pending," + " %d requests made, %d requests in pipe, %d pending\n" _ + net _ net->request _ host->reqsMade _ + HTList_count(host->pipeline) _ HTList_count(host->pending)); - HTDebugBreak(__FILE__, __LINE__, - "Net object %p registered multiple times in pending queue\n", + HTDEBUGBREAK("Net object %p registered multiple times in pending queue\n" _ net); return HT_PENDING; @@ -1012,9 +1045,9 @@ if (!host->pipeline) host->pipeline = HTList_new(); HTList_addObject(host->pipeline, net); host->reqsMade++; - if (CORE_TRACE) - HTTrace("Host info... Add Net %p (request %p) to pipe, %d requests made, %d requests in pipe, %d pending\n", - net, net->request, host->reqsMade, HTList_count(host->pipeline), HTList_count(host->pending)); + HTTRACE(CORE_TRACE, "Host info... Added Net %p (request %p) to pipe on Host %p, %d requests made, %d requests in pipe, %d pending\n" _ + net _ net->request _ host _ host->reqsMade _ + HTList_count(host->pipeline) _ HTList_count(host->pending)); /* ** If we have been idle then make sure we delete the timer @@ -1033,9 +1066,10 @@ } else { if (!host->pending) host->pending = HTList_new(); HTList_addObject(host->pending, net); - if (CORE_TRACE) - HTTrace("Host info... Add Net %p (request %p) to pending, %d requests made, %d requests in pipe, %d pending\n", - net, net->request, host->reqsMade, HTList_count(host->pipeline), HTList_count(host->pending)); + HTTRACE(CORE_TRACE, "Host info... Added Net %p (request %p) as pending on Host %p, %d requests made, %d requests in pipe, %d pending\n" _ + net _ net->request _ + host _ host->reqsMade _ + HTList_count(host->pipeline) _ HTList_count(host->pending)); status = HT_PENDING; } return status; @@ -1051,8 +1085,7 @@ if (HTHost_isPersistent(host)) { int piped = HTList_count(host->pipeline); if (HTHost_closeNotification(host)) { - if (CORE_TRACE) - HTTrace("Host Object. got close notifiation on socket %d\n", + HTTRACE(CORE_TRACE, "Host Object. got close notifiation on socket %d\n" _ HTChannel_socket(host->channel)); /* @@ -1061,18 +1094,22 @@ */ if (piped > 1) { host->reqsPerConnection = host->reqsMade - piped; - if (CORE_TRACE) - HTTrace("%d requests made, %d in pipe, max %d requests pr connection\n", - host->reqsMade, piped, host->reqsPerConnection); + HTTRACE(CORE_TRACE, "%d requests made, %d in pipe, max %d requests pr connection\n" _ + host->reqsMade _ piped _ host->reqsPerConnection); host->do_recover = YES; - HTChannel_delete(host->channel, status); + /* @@ JK: not clear yet if I need or not to set the channel to NULL. I think not */ + /* HTChannel_delete(host->channel, status); */ + if (HTChannel_delete(host->channel, status)) { + HTTRACE(CORE_TRACE, "Host Event.. clearing channel on host %p (%s)\n" _ host _ host->hostname); + host->channel = NULL; + } } else { HTChannel_setSemaphore(host->channel, 0); HTHost_clearChannel(host, status); } } else if (piped<=1 && host->reqsMade==host->reqsPerConnection) { - if (CORE_TRACE) HTTrace("Host Object. closing persistent socket %d\n", - HTChannel_socket(host->channel)); + HTTRACE(CORE_TRACE, "Host Object. closing persistent socket %d\n" _ + HTChannel_socket(host->channel)); /* ** By lowering the semaphore we make sure that the channel @@ -1082,9 +1119,12 @@ HTHost_clearChannel(host, status); } else { - if (CORE_TRACE) HTTrace("Host Object. keeping persistent socket %d\n", HTChannel_socket(host->channel)); - HTChannel_delete(host->channel, status); - + HTTRACE(CORE_TRACE, "Host Object. keeping persistent socket %d\n" _ + HTChannel_socket(host->channel)); + if (HTChannel_delete(host->channel, status)) { + HTDEBUGBREAK("Host Event.. Channel unexpected deleted from host %p (%s)\n" _ host _ host->hostname); + host->channel = NULL; + } /* ** If connection is idle then set a timer so that we close the ** connection if idle too long @@ -1092,12 +1132,12 @@ if (piped<=1 && HTList_isEmpty(host->pending) && !host->timer) { host->timer = HTTimer_new(NULL, IdleTimeoutEvent, host, HTActiveTimeout, YES, NO); - if (PROT_TRACE) HTTrace("Host........ Object %p going idle...\n", host); + HTTRACE(PROT_TRACE, "Host........ Object %p going idle...\n" _ host); } } return YES; } else { - if (CORE_TRACE) HTTrace("Host Object. closing socket %d\n", HTChannel_socket(host->channel)); + HTTRACE(CORE_TRACE, "Host Object. closing socket %d\n" _ HTChannel_socket(host->channel)); HTChannel_setSemaphore(host->channel, 0); HTHost_clearChannel(host, status); } @@ -1108,7 +1148,7 @@ PUBLIC BOOL HTHost_deleteNet (HTHost * host, HTNet * net, int status) { if (host && net) { - if (CORE_TRACE) HTTrace("Host info... Remove %p from pipe\n", net); + HTTRACE(CORE_TRACE, "Host info... Remove %p from pipe\n" _ net); /* If the Net object is in the pipeline then also update the channel */ if (host->pipeline && HTList_indexOf(host->pipeline, net) >= 0) { @@ -1117,6 +1157,7 @@ } HTList_removeObjectAll(host->pending, net); /* just to make sure */ + host->lock = HTList_firstObject(host->pending); return YES; } return NO; @@ -1144,8 +1185,8 @@ **above if. There was a missing pair of brackets. */ if ((net = (HTNet *) HTList_removeFirstObject(host->pending)) != NULL) { - if (CORE_TRACE) - HTTrace("Host info... Popping %p from pending net queue\n", net); + HTTRACE(CORE_TRACE, "Host info... Popping %p from pending net queue on host %p\n" _ + net _ host); #if 0 { HTRequest * request = HTNet_request(net); @@ -1167,8 +1208,7 @@ HTHost * host = NULL; if (PendHost) { if ((host = (HTHost *) HTList_removeFirstObject(PendHost)) != NULL) - if (PROT_TRACE) - HTTrace("Host info... Popping %p from pending host queue\n", + HTTRACE(PROT_TRACE, "Host info... Popping %p from pending host queue\n" _ host); } return host; @@ -1183,7 +1223,7 @@ { HTNet * net = NULL; if (!host) { - if (PROT_TRACE) HTTrace("Host info... Bad arguments\n"); + HTTRACE(PROT_TRACE, "Host info... Bad arguments\n"); return NO; } @@ -1204,9 +1244,8 @@ if (_roomInPipe(host) && DoPendingReqLaunch && (net = HTHost_nextPendingNet(host))) { HTHost_ActivateRequest(net); - if (CORE_TRACE) - HTTrace("Launch pending net object %p with %d reqs in pipe (%d reqs made)\n", - net, HTList_count(host->pipeline), host->reqsMade); + HTTRACE(CORE_TRACE, "Launch pending net object %p with %d reqs in pipe (%d reqs made)\n" _ + net _ HTList_count(host->pipeline) _ host->reqsMade); return HTNet_execute(net, HTEvent_WRITE); } @@ -1219,9 +1258,8 @@ if (!pending->pipeline) pending->pipeline = HTList_new(); HTList_addObject(pending->pipeline, net); host->reqsMade++; - if (CORE_TRACE) - HTTrace("Launch pending host object %p, net %p with %d reqs in pipe (%d reqs made)\n", - pending, net, HTList_count(pending->pipeline), pending->reqsMade); + HTTRACE(CORE_TRACE, "Launch pending host object %p, net %p with %d reqs in pipe (%d reqs made)\n" _ + pending _ net _ HTList_count(pending->pipeline) _ pending->reqsMade); HTHost_ActivateRequest(net); return HTNet_execute(net, HTEvent_WRITE); } @@ -1234,13 +1272,23 @@ return (HTNet *) HTList_firstObject(host->pipeline); } +PUBLIC int HTHost_numberOfOutstandingNetObjects (HTHost * host) +{ + return host ? HTList_count(host->pipeline) : -1; +} + +PUBLIC int HTHost_numberOfPendingNetObjects (HTHost * host) +{ + return host ? HTList_count(host->pending) : -1; +} + /* ** The host event manager keeps track of the state of it's client engines ** (typically HTTPEvent), accepting multiple blocks on read or write from ** multiple pipelined engines. It then registers its own engine ** (HostEvent) with the event manager. */ -PUBLIC int HTHost_connect (HTHost * host, HTNet * net, char * url, HTProtocolId port) +PUBLIC int HTHost_connect (HTHost * host, HTNet * net, char * url) { HTRequest * request = HTNet_request(net); int status = HT_OK; @@ -1251,27 +1299,45 @@ /* ** If not already locked and without a channel - ** then lock the darn thing + ** then lock the darn thing with the first Net object + ** pending. */ if (!host->lock && !host->channel) { + HTNet * next_pending = NULL; host->forceWriteFlush = YES; - host->lock = net; + host->lock = (next_pending = HTList_firstObject(host->pending)) ? + next_pending : net; + HTTRACE(CORE_TRACE, "Host connect Grabbing lock on Host %p with %p\n" _ host _ host->lock); } HTNet_setHost(net, host); } if (!host->lock || (host->lock && host->lock == net)) { - status = HTDoConnect(net, url, port); - if (status == HT_OK) { - host->lock = NULL; - return HT_OK; - } - if (status == HT_WOULD_BLOCK) { + status = HTDoConnect(net); + if (status == HT_PENDING) + return HT_WOULD_BLOCK; + else if (status == HT_WOULD_BLOCK) { host->lock = net; return status; + } else { + + /* + ** See if there is already a new pending request that should + ** take over the current lock + */ + HTNet * next_pending = NULL; + if ((next_pending = HTList_firstObject(host->pending))) { + HTTRACE(CORE_TRACE, "Host connect Changing lock on Host %p to %p\n" _ + host _ next_pending); + host->lock = next_pending; + } else { + HTTRACE(CORE_TRACE, "Host connect Unlocking Host %p\n" _ host); + host->lock = NULL; + } + return status; } - if (status == HT_PENDING) return HT_WOULD_BLOCK; } else { + HTTRACE(CORE_TRACE, "Host connect Host %p already locked with %p\n" _ host _ host->lock); if ((status = HTHost_addNet(host, net)) == HT_PENDING) { return HT_PENDING; } @@ -1279,8 +1345,7 @@ return HT_ERROR; /* @@@ - some more deletion and stuff here? */ } -PUBLIC int HTHost_accept (HTHost * host, HTNet * net, HTNet ** accepted, - char * url, HTProtocolId port) +PUBLIC int HTHost_listen (HTHost * host, HTNet * net, char * url) { HTRequest * request = HTNet_request(net); int status = HT_OK; @@ -1288,52 +1353,75 @@ HTProtocol * protocol = HTNet_protocol(net); if ((host = HTHost_newWParse(request, url, HTProtocol_id(protocol))) == NULL) return HT_ERROR; - else { - SockA *sin = &host->sock_addr; - sin->sin_addr.s_addr = INADDR_ANY; - } /* ** If not already locked and without a channel - ** then lock the darn thing + ** then lock the darn thing with the first Net object + ** pending. */ if (!host->lock && !host->channel) { host->forceWriteFlush = YES; host->lock = net; } HTNet_setHost(net, host); - - /* - ** Start listening on the socket - */ - { - status = HTDoListen(net, port, INVSOC, HT_BACKLOG); - if (status != HT_OK) { - if (CORE_TRACE) HTTrace("Listen...... On Host %p resulted in %d\n", host, status); - return HT_ERROR; - } - } } - if (!host->lock || (host->lock && host->lock == net)) { - status = HTDoAccept(net, accepted); - if (status == HT_OK) { + /* + ** See if we already have a dedicated listen Net object. If not + ** then create one. + */ + if (!host->listening) host->listening = HTNet_new(host); - /* Add the new accepted Net object to the pipeline */ - HTList_appendObject(host->pipeline, *accepted); + /* + ** Start listening on the Net object + */ + status = HTDoListen(host->listening, net, HT_BACKLOG); + if (status != HT_OK) { + HTTRACE(CORE_TRACE, "Host listen. On Host %p resulted in %d\n" _ host _ status); + return status; + } + return HT_OK; +} - /* Unlock the accept object */ - host->lock = NULL; +PUBLIC int HTHost_accept (HTHost * host, HTNet * net, char * url) +{ + int status = HT_OK; + if (!host || !host->listening) { + HTTRACE(CORE_TRACE, "Host accept. No host object or not listening on anything\n"); + return HT_ERROR; + } - return HT_OK; - } - if (status == HT_WOULD_BLOCK) { + if (!host->lock || (host->lock && host->lock == net)) { + status = HTDoAccept(host->listening, net); + if (status == HT_PENDING) + return HT_WOULD_BLOCK; + else if (status == HT_WOULD_BLOCK) { host->lock = net; return status; + } else { + + /* + ** See if there is already a new pending request that should + ** take over the current lock + */ + HTNet * next_pending = NULL; + if ((next_pending = HTList_firstObject(host->pending))) { + HTTRACE(CORE_TRACE, "Host connect Changing lock on Host %p to %p\n" _ + host _ next_pending); + host->lock = next_pending; + } else { + HTTRACE(CORE_TRACE, "Host connect Unlocking Host %p\n" _ host); + host->lock = NULL; + } + return status; + } + } else { + HTTRACE(CORE_TRACE, "Host connect Host %p already locked with %p\n" _ host _ host->lock); + if ((status = HTHost_addNet(host, net)) == HT_PENDING) { + return HT_PENDING; } - if (status == HT_PENDING) return HT_WOULD_BLOCK; } - return HT_ERROR; /* @@@ - some more deletion and stuff here? */ + return HT_ERROR; } /* @@ -1383,7 +1471,7 @@ return YES; } - if ("HTHost req.. Bad arguments\n"); + HTTRACE(CORE_TRACE, "HTHost...... Don't register event with bad arguments\n"); return NO; } @@ -1419,9 +1507,9 @@ { if (host == NULL) return NO; host->remainingRead = remaining; - if (PROT_TRACE) HTTrace("Host........ %d bytes remaining \n", remaining); + HTTRACE(PROT_TRACE, "Host........ %d bytes remaining \n" _ remaining); if (host->broken_pipe && remaining == 0) { - if (PROT_TRACE) HTTrace("Host........ Emtied out connection\n"); + HTTRACE(PROT_TRACE, "Host........ Emtied out connection\n"); } return YES; } @@ -1511,7 +1599,7 @@ HTChannel_setInput(ch, input); return HTChannel_getChannelIStream(ch); } - if (CORE_TRACE) HTTrace("Host Object. Can't create input stream\n"); + HTTRACE(CORE_TRACE, "Host Object. Can't create input stream\n"); return NULL; } @@ -1524,7 +1612,7 @@ HTChannel_setOutput(ch, output); return output; } - if (CORE_TRACE) HTTrace("Host Object. Can't create output stream\n"); + HTTRACE(CORE_TRACE, "Host Object. Can't create output stream\n"); return NULL; } @@ -1560,8 +1648,7 @@ if (!host || !host->channel) return NO; if ((input = HTChannel_input(host->channel)) == NULL) return NO; - if (CORE_TRACE) - HTTrace("Host........ passing %d bytes as consumed to %p\n", bytes, input); + HTTRACE(CORE_TRACE, "Host........ passing %d bytes as consumed to %p\n" _ bytes _ input); return (*input->isa->consumed)(input, bytes); } @@ -1605,7 +1692,7 @@ { if (delay >= 0) { WriteDelay = delay; - if (CORE_TRACE) HTTrace("Host........ Default write delay is %d ms\n", delay); + HTTRACE(CORE_TRACE, "Host........ Default write delay is %d ms\n" _ delay); return YES; } return NO; @@ -1621,12 +1708,23 @@ HTNet * targetNet = (HTNet *) HTList_lastObject(host->pipeline); int ret; if (targetNet == NULL) return HT_ERROR; - if (CORE_TRACE) - HTTrace("Host Event.. FLUSH passed to `%s\'\n", + /* 2000/28/07 JK: The following test was proposed by Heiner Kallweit, as there's a problem + ** while using SSL because of a recursive call to this function. We tested the + ** fix and it doesn't seem to introduce any side effects... but one never knows, + ** thus this comment. This seems more like a bug in the SSL code than here. + */ + if (host->inFlush) { + HTTRACE(CORE_TRACE, "Host Event.. FLUSH requested for `%s\'\n, but ignoring it as we're already processing a flush in this host" _ + HTAnchor_physical(HTRequest_anchor(HTNet_request(targetNet)))); + return HT_OK; + } + HTTRACE(CORE_TRACE, "Host Event.. FLUSH passed to `%s\'\n" _ HTAnchor_physical(HTRequest_anchor(HTNet_request(targetNet)))); host->forceWriteFlush = YES; + host->inFlush = YES; ret = (*targetNet->event.cbf)(HTChannel_socket(host->channel), targetNet->event.param, HTEvent_FLUSH); host->forceWriteFlush = NO; + host->inFlush = NO; return ret; } @@ -1651,7 +1749,7 @@ PUBLIC void HTHost_setEventTimeout (int millis) { EventTimeout = millis; - if (CORE_TRACE) HTTrace("Host........ Setting event timeout to %d ms\n", millis); + HTTRACE(CORE_TRACE, "Host........ Setting event timeout to %d ms\n" _ millis); } PUBLIC BOOL HTHost_setMaxPipelinedRequests (int max) @@ -1670,7 +1768,7 @@ PUBLIC void HTHost_setActivateRequestCallback (HTHost_ActivateRequestCallback * cbf) { - if (CORE_TRACE) HTTrace("HTHost...... Registering %p\n", cbf); + HTTRACE(CORE_TRACE, "HTHost...... Registering %p\n" _ cbf); ActivateReqCBF = cbf; } @@ -1678,8 +1776,7 @@ { HTRequest * request = NULL; if (!ActivateReqCBF) { - if (CORE_TRACE) - HTTrace("HTHost...... No ActivateRequest callback handler registered\n"); + HTTRACE(CORE_TRACE, "HTHost...... No ActivateRequest callback handler registered\n"); return HT_ERROR; } request = HTNet_request(net); diff -Naur xdvik-22.40l/libs/libwww/HTHost.h xdvik-22.40n/libs/libwww/HTHost.h --- xdvik-22.40l/libs/libwww/HTHost.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHost.h Fri Sep 13 00:23:46 2002 @@ -30,7 +30,7 @@ #define HTHOST_H typedef struct _HTHost HTHost; -#define HOST_HASH_SIZE 67 +#define HOST_HASH_SIZE HT_M_HASH_SIZE #include "HTChannl.h" #include "HTReq.h" @@ -85,6 +85,16 @@ /* ( + Delete the Host table +) + +Cleanup and delete the host table. +*/ + +extern void HTHost_deleteAll (void); + +/* +( Is Host Idle? ) @@ -236,11 +246,11 @@ it must do an explicit connect the the host. */ -extern int HTHost_connect (HTHost * host, HTNet * net, char * url, - HTProtocolId port); +extern int HTHost_connect (HTHost * host, HTNet * net, char * url); + +extern int HTHost_accept (HTHost * host, HTNet * net, char * url); -extern int HTHost_accept (HTHost * host, HTNet * net, HTNet ** accepted, - char * url, HTProtocolId port); +extern int HTHost_listen (HTHost * host, HTNet * net, char * url); /* ( @@ -487,6 +497,18 @@ /* ( + How many Pending and Outstanding Net objects are there on a Host? +) + +You can query how many Het objects (essentially requests) are outstanding +or pending on a host object using these methods: +*/ + +extern int HTHost_numberOfOutstandingNetObjects (HTHost * host); +extern int HTHost_numberOfPendingNetObjects (HTHost * host); + +/* +( Pipeline Recovery ) @@ -615,6 +637,6 @@ - @(#) $Id: HTHost.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ + @(#) $Id: HTHost.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTHstMan.h xdvik-22.40n/libs/libwww/HTHstMan.h --- xdvik-22.40l/libs/libwww/HTHstMan.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTHstMan.h Fri Sep 13 00:23:46 2002 @@ -76,6 +76,7 @@ HTList * pending; /* List of pending Net objects */ HTNet * doit; /* Transfer from pending to pipe */ HTNet * lock; /* This is a kludge! */ + HTNet * listening; /* Master for accepting connections */ BOOL persistent; HTTransportMode mode; /* Supported mode */ HTTimer * timer; /* Timer for handling idle connection */ @@ -104,6 +105,8 @@ ms_t delay; /* Write delay in ms */ void * context; /* Protocol Specific context */ int forceWriteFlush; + int inFlush; /* Tells if we're currently processing + a file flush */ }; #define HTHost_bytesRead(me) ((me) ? (me)->bytes_read : -1) @@ -122,6 +125,6 @@ - @(#) $Id: HTHstMan.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ + @(#) $Id: HTHstMan.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTIOStream.h xdvik-22.40n/libs/libwww/HTIOStream.h --- xdvik-22.40l/libs/libwww/HTIOStream.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTIOStream.h Fri Sep 13 00:23:46 2002 @@ -196,6 +196,19 @@ int mode); /* +( + Transport Output Stream Converter +) +*/ + +typedef HTOutputStream * HTOutputConverter_new( + HTHost * host, + HTChannel * ch, + void * param, + int mode, + HTOutputStream * target); + +/* */ #endif /* HTIOSTREAM_H */ @@ -204,6 +217,6 @@ - @(#) $Id: HTIOStream.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ + @(#) $Id: HTIOStream.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTIcons.c xdvik-22.40n/libs/libwww/HTIcons.c --- xdvik-22.40l/libs/libwww/HTIcons.c Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTIcons.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTIcons.c,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ +** @(#) $Id: HTIcons.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module contains the functions for initializing, adding ** and selecting the icon for local directory listings, FTP and Gopher. @@ -138,9 +138,8 @@ if (!icons) icons = HTList_new(); HTList_addObject(icons, (void *) node); alt_resize(alt); - if (PROT_TRACE) - HTTrace("AddIcon..... %s => SRC=\"%s\" ALT=\"%s\"\n", - type_templ,url, alt ? alt : ""); + HTTRACE(PROT_TRACE, "AddIcon..... %s => SRC=\"%s\" ALT=\"%s\"\n" _ + type_templ _ url _ alt ? alt : ""); return YES; } return NO; @@ -158,8 +157,7 @@ if (url) icon_unknown->icon_url = prefixed(url, prefix); if (alt) StrAllocCopy(icon_unknown->icon_alt, alt); alt_resize(alt); - if (PROT_TRACE) - HTTrace("Icon add.... UNKNOWN => SRC=\"%s\" ALT=\"%s\"\n",url, + HTTRACE(PROT_TRACE, "Icon add.... UNKNOWN => SRC=\"%s\" ALT=\"%s\"\n" _ url _ alt ? alt : ""); return YES; } @@ -175,8 +173,7 @@ if (url) icon_blank->icon_url = prefixed(url, prefix); if (alt) StrAllocCopy(icon_blank->icon_alt, alt); alt_resize(alt); - if (PROT_TRACE) - HTTrace("Icon add.... BLANK => SRC=\"%s\" ALT=\"%s\"\n",url, + HTTRACE(PROT_TRACE, "Icon add.... BLANK => SRC=\"%s\" ALT=\"%s\"\n" _ url _ alt ? alt : ""); return YES; } @@ -192,8 +189,7 @@ if (url) icon_parent->icon_url = prefixed(url, prefix); if (alt) StrAllocCopy(icon_parent->icon_alt, alt); alt_resize(alt); - if (PROT_TRACE) - HTTrace("Icon add.... PARENT => SRC=\"%s\" ALT=\"%s\"\n",url, + HTTRACE(PROT_TRACE, "Icon add.... PARENT => SRC=\"%s\" ALT=\"%s\"\n" _ url _ alt ? alt : ""); return YES; } @@ -209,8 +205,7 @@ if (url) icon_dir->icon_url = prefixed(url, prefix); if (alt) StrAllocCopy(icon_dir->icon_alt, alt); alt_resize(alt); - if (PROT_TRACE) - HTTrace("Icon add.... DIRECTORY => SRC=\"%s\" ALT=\"%s\"\n",url, + HTTRACE(PROT_TRACE, "Icon add.... DIRECTORY => SRC=\"%s\" ALT=\"%s\"\n" _ url _ alt ? alt : ""); return YES; } @@ -245,4 +240,40 @@ return icon_parent ? icon_parent : icon_unknown; } return icon_unknown; +} + +PRIVATE void HTIconNode_delete (HTIconNode* pNode) +{ + if (pNode) { + HT_FREE(pNode->icon_url); + HT_FREE(pNode->icon_alt); + HT_FREE(pNode->type_templ); + HT_FREE(pNode); + } +} +/* +** cleans up all memory used by icons. Should be called by +** HTLibTerminate() (but it isn't) +** +*/ +PUBLIC void HTIcon_deleteAll (void) +{ + if(icons != NULL) { + HTList * iconList = icons; + HTIconNode * node; + while((node = (HTIconNode*)HTList_removeLastObject(iconList))) { + HTIconNode_delete(node); + } + /* delete the list as well */ + HTList_delete(icons); + icons = NULL; + } + HTIconNode_delete(icon_unknown); + icon_unknown = NULL; + HTIconNode_delete(icon_blank); + icon_blank = NULL; + HTIconNode_delete(icon_parent); + icon_parent = NULL; + HTIconNode_delete(icon_dir); + icon_dir = NULL; } diff -Naur xdvik-22.40l/libs/libwww/HTIcons.h xdvik-22.40n/libs/libwww/HTIcons.h --- xdvik-22.40l/libs/libwww/HTIcons.h Wed Apr 18 14:23:16 2001 +++ xdvik-22.40n/libs/libwww/HTIcons.h Fri Sep 13 00:23:46 2002 @@ -146,6 +146,16 @@ /* . + Delete all icons +. + +Cleans up all memory used by icons. Should be called by +HTLibTerminate() (but it isn't). +*/ +extern void HTIcon_deleteAll (void); + +/* +. A Standard Set of Icons . @@ -189,6 +199,6 @@ - @(#) $Id: HTIcons.h,v 1.1.1.1 2001/04/18 14:23:16 stefanulrich Exp $ + @(#) $Id: HTIcons.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTInet.c xdvik-22.40n/libs/libwww/HTInet.c --- xdvik-22.40l/libs/libwww/HTInet.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTInet.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTInet.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTInet.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This code is in common between client and server sides. ** @@ -78,22 +78,24 @@ PUBLIC int HTInetStatus (int errnum, char * where) { #ifdef VMS - if (PROT_TRACE) HTTrace("System Error Unix = %ld dec\n", errno); - if (PROT_TRACE) HTTrace("System Error VMS = %lx hex\n", vaxc$errno); + HTTRACE(CORE_TRACE, "System Error Unix = %ld dec\n" _ errno); + HTTRACE(CORE_TRACE, "System Error VMS = %lx hex\n" _ vaxc$errno); return (-vaxc$errno); #else #ifdef _WINSOCKAPI_ - if (PROT_TRACE) HTTrace("System Error Unix = %ld dec\n", errno); - if (PROT_TRACE) HTTrace("System Error WinSock error=%lx hex\n", + HTTRACE(CORE_TRACE, "System Error Unix = %ld dec\n" _ errno); + HTTRACE(CORE_TRACE, "System Error WinSock error=%lx hex\n" _ WSAGetLastError()); return (-errnum); #else - if (PROT_TRACE) { +#ifdef HTDEBUG + if (CORE_TRACE) { char * errmsg = HTErrnoString(errnum); - HTTrace("System Error %d after call to %s() failed\n............ %s\n", - errno, where, errmsg); + HTTRACE(CORE_TRACE, "System Error %d after call to %s() failed\n............ %s\n" _ + errno _ where _ errmsg); HT_FREE(errmsg); } +#endif /* HTDEBUG */ return (-errnum); #endif /* _WINSOCKAPI_ */ #endif /* VMS */ @@ -143,6 +145,7 @@ ** call if the application has its own handlers. */ #include + PUBLIC void HTSetSignal (void) { /* On some systems (SYSV) it is necessary to catch the SIGPIPE signal @@ -150,15 +153,15 @@ ** get `connection refused' back */ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { - if (PROT_TRACE) HTTrace("HTSignal.... Can't catch SIGPIPE\n"); + HTTRACE(CORE_TRACE, "HTSignal.... Can't catch SIGPIPE\n"); } else { - if (PROT_TRACE) HTTrace("HTSignal.... Ignoring SIGPIPE\n"); + HTTRACE(CORE_TRACE, "HTSignal.... Ignoring SIGPIPE\n"); } } -#else -#ifdef WWW_WIN_DLL -PUBLIC void HTSetSignal (void) {} -#endif /* WWW_WIN_DLL */ +#else /* WWWLIB_SIG */ + +PUBLIC void HTSetSignal (void) { } + #endif /* WWWLIB_SIG */ /* ------------------------------------------------------------------------- */ @@ -215,9 +218,8 @@ sin->sdn_nam.n_len = min(DN_MAXNAML, strlen(hostname)); /* <=6 in phase 4 */ strncpy (sin->sdn_nam.n_name, hostname, sin->sdn_nam.n_len + 1); - if (PROT_TRACE) - HTTrace("DECnet: Parsed address as object number %d on host %.6s...\n", - sin->sdn_objnum, hostname); + HTTRACE(CORE_TRACE, "DECnet: Parsed address as object number %d on host %.6s...\n" _ + sin->sdn_objnum _ hostname); #else /* Internet */ { char *strptr = hostname; @@ -241,11 +243,11 @@ if (port) *port = '\0'; status = HTGetHostByName(host, hostname, request); } - if (PROT_TRACE) { - if (status > 0) - HTTrace("ParseInet... as port %d on %s with %d homes\n", - (int) ntohs(sin->sin_port), HTInetString(sin), status); - } +#ifdef HTDEBUG + if (status > 0) + HTTRACE(CORE_TRACE, "ParseInet... as port %d on %s with %d homes\n" _ + (int) ntohs(sin->sin_port) _ HTInetString(sin) _ status); +#endif /* HTDEBUG */ } #endif /* Internet vs. Decnet */ return status; @@ -301,7 +303,7 @@ #if defined(HAVE_SYSINFO) && defined(SI_HOSTNAME) if (!fqdn && sysinfo(SI_HOSTNAME, name, MAXHOSTNAMELEN) > 0) { char * dot = strchr(name, '.'); - if (PROT_TRACE) HTTrace("HostName.... sysinfo says `%s\'\n", name); + HTTRACE(CORE_TRACE, "HostName.... sysinfo says `%s\'\n" _ name); StrAllocCopy(hostname, name); fqdn = dot ? 2 : 1; } @@ -310,7 +312,7 @@ #ifdef HAVE_GETHOSTNAME if (!fqdn && gethostname(name, MAXHOSTNAMELEN) == 0) { char * dot = strchr(name, '.'); - if (PROT_TRACE) HTTrace("HostName.... gethostname says `%s\'\n", name); + HTTRACE(CORE_TRACE, "HostName.... gethostname says `%s\'\n" _ name); StrAllocCopy(hostname, name); fqdn = dot ? 2 : 1; } @@ -351,8 +353,7 @@ /* If everything else has failed then try getdomainname */ if (fqdn==1) { if (getdomainname(name, MAXHOSTNAMELEN)) { - if (PROT_TRACE) - HTTrace("HostName.... Can't get domain name\n"); + HTTRACE(CORE_TRACE, "HostName.... Can't get domain name\n"); StrAllocCopy(hostname, ""); return NULL; } @@ -376,7 +377,7 @@ } if (*(hostname+strlen(hostname)-1) == '.') /* Remove trailing dot */ *(hostname+strlen(hostname)-1) = '\0'; - if (PROT_TRACE) HTTrace("HostName.... FQDN is `%s\'\n", hostname); + HTTRACE(CORE_TRACE, "HostName.... FQDN is `%s\'\n" _ hostname); } return hostname; } @@ -401,7 +402,8 @@ PUBLIC char * HTGetMailAddress (void) { #ifdef HT_REENTRANT - char name[LOGNAME_MAX+1]; /* For getlogin_r or getUserName */ + char name[HT_LOGNAME_MAX]; /* For getlogin_r or getUserName */ + int result; #endif #ifdef WWW_MSWINDOWS/* what was the plan for this under windows? - EGP */ char name[256]; /* For getlogin_r or getUserName */ @@ -414,21 +416,27 @@ #ifdef WWW_MSWINDOWS if (!login && GetUserName(name, &bufSize) != TRUE) - if (PROT_TRACE) HTTrace("MailAddress. GetUsername returns NO\n"); + HTTRACE(CORE_TRACE, "MailAddress. GetUsername returns NO\n"); #endif /* WWW_MSWINDOWS */ #ifdef HAVE_CUSERID if (!login && (login = (char *) cuserid(NULL)) == NULL) - if (PROT_TRACE) HTTrace("MailAddress. cuserid returns NULL\n"); + HTTRACE(CORE_TRACE, "MailAddress. cuserid returns NULL\n"); #endif /* HAVE_CUSERID */ #ifdef HAVE_GETLOGIN -#ifdef HT_REENTRANT - if (!login && (login = (char *) getlogin_r(name, LOGNAME_MAX)) == NULL) +#ifdef GETLOGIN_R_RETURNS_POINTER + if (!login && (login = (char *) getlogin_r(name, HT_LOGNAME_MAX)) == NULL) +#elif defined(GETLOGIN_R_RETURNS_INT) + if (!login && (result = getlogin_r(name, HT_LOGNAME_MAX)) == 0) + { + login = &name[0]; + } + else #else if (!login && (login = (char *) getlogin()) == NULL) #endif /* HT_REENTRANT */ - if (PROT_TRACE) HTTrace("MailAddress. getlogin returns NULL\n"); + HTTRACE(CORE_TRACE, "MailAddress. getlogin returns NULL\n"); #endif /* HAVE_GETLOGIN */ #ifdef HAVE_PWD_H @@ -437,10 +445,10 @@ #endif /* HAVE_PWD_H */ if (!login && (login = getenv("LOGNAME")) == NULL) - if (PROT_TRACE) HTTrace("MailAddress. LOGNAME not found\n"); + HTTRACE(CORE_TRACE, "MailAddress. LOGNAME not found\n"); if (!login && (login = getenv("USER")) == NULL) - if (PROT_TRACE) HTTrace("MailAddress. USER not found\n"); + HTTRACE(CORE_TRACE, "MailAddress. USER not found\n"); if (!login) login = HT_DEFAULT_LOGIN; @@ -560,8 +568,7 @@ #endif } HTTimeZone = -HTTimeZone; - if (CORE_TRACE) - HTTrace("TimeZone.... GMT + (%02d) hours (including DST)\n", + HTTRACE(CORE_TRACE, "TimeZone.... GMT + (%02d) hours (including DST)\n" _ (int) HTTimeZone/3600); } #else @@ -575,12 +582,11 @@ struct tm * local = localtime(&cur_t); #endif /* HT_REENTRANT */ HTTimeZone = local->tm_gmtoff; - if (CORE_TRACE) - HTTrace("TimeZone.... GMT + (%02d) hours (including DST)\n", + HTTRACE(CORE_TRACE, "TimeZone.... GMT + (%02d) hours (including DST)\n" _ (int)local->tm_gmtoff / 3600); } #else - if (CORE_TRACE) HTTrace("TimeZone.... Not defined\n"); + HTTRACE(CORE_TRACE, "TimeZone.... Not defined\n"); #endif /* HAVE_TM_GMTOFF */ #endif /* HAVE_TIMEZONE */ return HTTimeZone; @@ -593,19 +599,35 @@ */ PUBLIC char * HTGetTmpFileName (const char * abs_dir) { + char * result = NULL; #ifdef HAVE_TEMPNAM + static char * envtmpdir = NULL; + size_t len = 0; + if (abs_dir && *abs_dir) { + char * tmpdir = getenv("TMPDIR"); + if (tmpdir) + len = strlen(tmpdir); + if (len) { + if (!(envtmpdir = (char *) HT_REALLOC(envtmpdir, len + 8))) + HT_OUTOFMEM("HTGetTmpFileName"); + strcpy(envtmpdir, "TMPDIR="); + strcpy(envtmpdir + 7, tmpdir); + putenv("TMPDIR="); + } + } #ifdef __CYGWIN__ - return tempnam(abs_dir, ""); + result = tempnam(abs_dir, ""); #else - return tempnam(abs_dir, NULL); + result = tempnam(abs_dir, NULL); #endif /* __CYGWIN__ */ + if (len) + putenv(envtmpdir); #else /* ** This is only approx. as we don't know if this file exists or not. ** Hopefully, tempnam() exists on enough platforms so that this is not ** a problem. */ - char * result = NULL; char * offset = NULL; if (!(result = (char *) HT_MALLOC((abs_dir ? strlen(abs_dir) : 0) + HT_MAX_TMPNAM + 2))) @@ -614,11 +636,11 @@ #ifdef WWW_MSWINDOWS if (abs_dir) { #else - if (abs_dir && *abs_dir=='/') { + if (abs_dir && *abs_dir==DIR_SEPARATOR_CHAR) { #endif /* WWW_MSWINDOWS */ strcpy(result, abs_dir); offset = result+strlen(result); - if (*(offset-1) != '/') *offset++ = '/'; + if (*(offset-1) != DIR_SEPARATOR_CHAR) *offset++ = DIR_SEPARATOR_CHAR; #ifdef HT_REENTRANT tmpnam_r(offset); @@ -627,11 +649,7 @@ #endif { -#ifdef WWW_MSWINDOWS - char * orig = strrchr(offset, '\\'); -#else - char * orig = strrchr(offset, '/'); -#endif /* WWW_MSWINDOWS */ + char * orig = strrchr(offset, DIR_SEPARATOR_CHAR); char * dest = offset; if (orig++) while ((*dest++ = *orig++)); } @@ -644,8 +662,8 @@ #endif offset = result; } - return result; #endif /* HAVE_TEMPNAM */ + return result; } /* diff -Naur xdvik-22.40l/libs/libwww/HTInet.h xdvik-22.40n/libs/libwww/HTInet.h --- xdvik-22.40l/libs/libwww/HTInet.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTInet.h Fri Sep 13 00:23:46 2002 @@ -173,6 +173,6 @@ - @(#) $Id: HTInet.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ + @(#) $Id: HTInet.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTInit.c xdvik-22.40n/libs/libwww/HTInit.c --- xdvik-22.40l/libs/libwww/HTInit.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTInit.c Fri Sep 13 00:23:46 2002 @@ -3,9 +3,12 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTInit.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTInit.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** -** Define a basic set of suffixes and presentations +** General initialization functions. +** +** @@@A lot of these should be moved to the various modules instead +** of being here */ /* Library include files */ @@ -40,6 +43,13 @@ HTConversion_add(c,"*/*", "www/debug", HTBlackHoleConverter, 1.0, 0.0, 0.0); /* + ** Set our own local file save stream for the MIME parser so that + ** we know how to dump to local disk in case we get content type + ** application/octect stream, or an encoding that we don't know. + */ + HTMIME_setSaveStream (HTSaveLocally); + + /* ** These are converters that converts to something other than www/present, ** that is not directly outputting someting to the user on the screen */ @@ -47,7 +57,11 @@ HTConversion_add(c,"message/x-rfc822-foot", "*/*", HTMIMEFooter, 1.0, 0.0, 0.0); HTConversion_add(c,"message/x-rfc822-head", "*/*", HTMIMEHeader, 1.0, 0.0, 0.0); HTConversion_add(c,"message/x-rfc822-cont", "*/*", HTMIMEContinue, 1.0, 0.0, 0.0); + HTConversion_add(c,"message/x-rfc822-upgrade","*/*", HTMIMEUpgrade, 1.0, 0.0, 0.0); HTConversion_add(c,"message/x-rfc822-partial","*/*", HTMIMEPartial, 1.0, 0.0, 0.0); +#ifndef NO_CACHE + HTConversion_add(c,"www/x-rfc822-headers","*/*", HTCacheCopyHeaders, 1.0, 0.0, 0.0); +#endif HTConversion_add(c,"multipart/*", "*/*", HTBoundary, 1.0, 0.0, 0.0); HTConversion_add(c,"text/plain", "text/html", HTPlainToHTML, 1.0, 0.0, 0.0); @@ -108,6 +122,12 @@ */ PUBLIC void HTPresenterInit (HTList * c) { + /* + ** First we set the special "presenter" stream that writes to a + ** temporary file before executing the external presenter + */ + HTPresentation_setConverter(HTSaveAndExecute); + #ifdef NeXT HTPresentation_add(c,"application/postscript", "open %s", NULL, 1.0, 2.0, 0.0); /* The following needs the GIF previewer -- you might not have it. */ @@ -172,11 +192,6 @@ */ PUBLIC void HTBeforeInit (void) { -#if 0 - /* Often handled better by the application */ - HTNet_addBefore(HTMemoryCacheFilter, NULL, NULL, HT_FILTER_MIDDLE); -#endif - HTNet_addBefore(HTCacheFilter, "http://*", NULL, HT_FILTER_MIDDLE); HTNet_addBefore(HTCredentialsFilter, "http://*", NULL, HT_FILTER_LATE); HTNet_addBefore(HTPEP_beforeFilter, "http://*", NULL, HT_FILTER_LATE); HTNet_addBefore(HTRuleFilter, NULL, NULL, HT_FILTER_LATE); @@ -199,8 +214,8 @@ HTNet_addAfter(HTRedirectFilter, "http://*", NULL, HT_FOUND, HT_FILTER_MIDDLE); HTNet_addAfter(HTRedirectFilter, "http://*", NULL, HT_SEE_OTHER, HT_FILTER_MIDDLE); HTNet_addAfter(HTRedirectFilter, "http://*", NULL, HT_TEMP_REDIRECT, HT_FILTER_MIDDLE); + HTNet_addAfter(HTAuthInfoFilter, "http://*", NULL, HT_ALL, HT_FILTER_MIDDLE); HTNet_addAfter(HTUseProxyFilter, "http://*", NULL, HT_USE_PROXY, HT_FILTER_MIDDLE); - HTNet_addAfter(HTCacheUpdateFilter, "http://*", NULL, HT_NOT_MODIFIED, HT_FILTER_MIDDLE); HTNet_addAfter(HTInfoFilter, NULL, NULL, HT_ALL, HT_FILTER_LATE); } @@ -210,9 +225,12 @@ */ PUBLIC void HTAAInit (void) { - HTAA_newModule ("basic", HTBasic_generate, HTBasic_parse, HTBasic_delete); + HTAA_newModule ("basic", HTBasic_generate, HTBasic_parse, NULL, + HTBasic_delete); +#ifdef HT_MD5 HTAA_newModule ("digest", HTDigest_generate, HTDigest_parse, - HTDigest_delete); + HTDigest_updateInfo, HTDigest_delete); +#endif /* HT_MD5 */ } /* REGISTER BEFORE AND AFTER FILTERS diff -Naur xdvik-22.40l/libs/libwww/HTInit.h xdvik-22.40n/libs/libwww/HTInit.h --- xdvik-22.40l/libs/libwww/HTInit.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTInit.h Sat Sep 14 00:24:46 2002 @@ -133,12 +133,17 @@ type, or to present it on screen. This is a part of the stream stack algorithm. The Presenters are also used in the stream stack, but are initialized separately. */ + #include "WWWMIME.h" #include "WWWHTML.h" #include "WWWStream.h" #include "WWWDir.h" #include "WWWCache.h" +#ifdef HT_EXPAT +#include "WWWXML.h" +#endif + extern void HTConverterInit (HTList * conversions); /* @@ -146,8 +151,8 @@ Presenters ) -The Presenters are used to present a media type to the use by calling -an external program, for example a post script viewer. This is a part of +The Presenters are used to present media types by calling +external programs, for example, a Postscript viewer. This is a part of the stream stack algorithm. The Converters are also used in the stream stack, but are initialized separately. The Presenters use the same include files as the Converters. @@ -238,9 +243,9 @@ The Access Manager which is implemented as a BEFORE and an AFTER filter (automatically registered in -HTNetInit()) does not by default know of any access authentication -schemes. As everything else, this must be registered! This function does -the job and should be all you need. +HTNetInit()) does not, by default, know of any access +authentication schemes. As everything else, this must be registered! This +function does the job and should be all you need. */ extern void HTAAInit (void); @@ -281,6 +286,6 @@ - @(#) $Id: HTInit.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ + @(#) $Id: HTInit.h,v 1.1.1.1.8.2 2002/09/14 00:24:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTLib.c xdvik-22.40n/libs/libwww/HTLib.c --- xdvik-22.40l/libs/libwww/HTLib.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTLib.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTLib.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTLib.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Authors ** HFN Henrik Frystyk Nielsen, frystyk@w3.org @@ -15,7 +15,6 @@ /* Library include files */ #include "WWWUtil.h" -#include "HTBind.h" #include "HTAnchor.h" #include "HTProt.h" #include "HTDNS.h" @@ -146,8 +145,7 @@ */ PUBLIC BOOL HTLibInit (const char * AppName, const char * AppVersion) { - if (WWWTRACE) - HTTrace("WWWLibInit.. INITIALIZING LIBRARY OF COMMON CODE\n"); + HTTRACE(CORE_TRACE, "WWWLibInit.. INITIALIZING LIBRARY OF COMMON CODE\n"); /* Set the application name and version */ HTLib_setAppName(AppName); @@ -162,9 +160,6 @@ UserProfile = HTUserProfile_new(HT_DEFAULT_USER, NULL); HTUserProfile_localize(UserProfile); - /* Initialize bindings */ - HTBind_init(); - #ifdef WWWLIB_SIG /* On Solaris (and others?) we get a BROKEN PIPE signal when connecting ** to a port where we should get `connection refused'. We ignore this @@ -185,9 +180,10 @@ */ PUBLIC BOOL HTLibTerminate (void) { - if (WWWTRACE) HTTrace("WWWLibTerm.. Cleaning up LIBRARY OF COMMON CODE\n"); + HTTRACE(CORE_TRACE, "WWWLibTerm.. Cleaning up LIBRARY OF COMMON CODE\n"); HTNet_killAll(); + HTHost_deleteAll(); /* Delete remaining hosts */ HTChannel_deleteAll(); /* Delete remaining channels */ HT_FREE(HTAppName); /* Freed thanks to Wade Ogden */ @@ -198,7 +194,6 @@ HTAnchor_deleteAll(NULL); /* Delete anchors and drop hyperdocs */ HTProtocol_deleteAll(); /* Remove bindings between access and protocols */ - HTBind_deleteAll(); /* Remove bindings between suffixes, media types */ HTUserProfile_delete(UserProfile); /* Free our default User profile */ diff -Naur xdvik-22.40l/libs/libwww/HTLib.h xdvik-22.40n/libs/libwww/HTLib.h --- xdvik-22.40l/libs/libwww/HTLib.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTLib.h Fri Sep 13 00:23:46 2002 @@ -33,7 +33,7 @@ Initializing and Terminating libwww . -These two functions initiates memory and settings for the libwww core and +These two functions initialize memory and settings for the libwww core and cleans up memory kept by libwww core when exiting the application. They  MUST be used as libwww otherwise is in a undefined state. */ @@ -101,7 +101,7 @@ . Libwww does normally use the local file system for dumping unknown data objects, -file cache etc. In some situations this is not desired and we can therefore +file cache etc. In some situations this is not desired, and we can therefore turn it off. This mode also prevents you from being able to access other resources where you have to login telnet, for example. */ @@ -131,6 +131,6 @@ - @(#) $Id: HTLib.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ + @(#) $Id: HTLib.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTLink.c xdvik-22.40n/libs/libwww/HTLink.c --- xdvik-22.40l/libs/libwww/HTLink.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTLink.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTLink.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTLink.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** An anchor represents a region of a hypertext document which is ** linked to another anchor in the same or a different document. @@ -50,10 +50,9 @@ HTMethod method) { if (source && destination) { - if (ANCH_TRACE) - HTTrace("Link create. from anchor %p to %p with type %s, method %s\n", - (void *) source, (void *) destination, - type ? HTAtom_name(type) : "NONE", + HTTRACE(ANCH_TRACE, "Link create. from anchor %p to %p with type %s, method %s\n" _ + (void *) source _ (void *) destination _ + type ? HTAtom_name(type) : "NONE" _ method != METHOD_INVALID ? HTMethod_name(method) : "NONE"); if (!source->mainLink.dest) { source->mainLink.dest = destination; @@ -72,7 +71,7 @@ HTList_addObject (destination->parent->sources, source); return YES; } else - if (ANCH_TRACE) HTTrace("Link........ Bad argument\n"); + HTTRACE(ANCH_TRACE, "Link........ Bad argument\n"); return NO; } @@ -83,9 +82,8 @@ PUBLIC BOOL HTLink_remove (HTAnchor * source, HTAnchor * destination) { if (!source || !destination) return NO; - if (ANCH_TRACE) - HTTrace("Link delete. from anchor %p to anchor %p\n", - (void *) source, (void *) destination); + HTTRACE(ANCH_TRACE, "Link delete. from anchor %p to anchor %p\n" _ + (void *) source _ (void *) destination); /* Remove if dest is the main link */ if (source->mainLink.dest == destination) { @@ -97,12 +95,12 @@ } /* Remove link information for other links */ - if (destination->links) { - HTList *cur = destination->links; + if (source->links) { + HTList *cur = source->links; HTLink *pres; while ((pres = (HTLink *) HTList_nextObject(cur))) { if (pres->dest == destination) { - HTList_removeObject(destination->links, pres); + HTList_removeObject(source->links, pres); HT_FREE(pres); return YES; } @@ -118,7 +116,7 @@ PUBLIC BOOL HTLink_removeAll (HTAnchor * me) { if (!me) return NO; - if (ANCH_TRACE) HTTrace("Link delete. from anchor %p\n", (void *) me); + HTTRACE(ANCH_TRACE, "Link delete. from anchor %p\n" _ (void *) me); /* Remove if dest is the main link */ me->mainLink.dest = NULL; @@ -146,9 +144,8 @@ PUBLIC BOOL HTLink_moveAll (HTAnchor * src, HTAnchor * dest) { if (!src || !dest) return NO; - if (ANCH_TRACE) - HTTrace("Link move... all from anchor %p to anchor %p\n", - (void *) src, (void *) dest); + HTTRACE(ANCH_TRACE, "Link move... all from anchor %p to anchor %p\n" _ + (void *) src _ (void *) dest); /* Move main link information */ dest->mainLink.dest = src->mainLink.dest; diff -Naur xdvik-22.40l/libs/libwww/HTLink.h xdvik-22.40n/libs/libwww/HTLink.h --- xdvik-22.40l/libs/libwww/HTLink.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTLink.h Fri Sep 13 00:23:46 2002 @@ -1,54 +1,58 @@ + /* - - W3C Sample Code Library libwww Link Class -! - The Link Class -! -*/ + W3C Sample Code Library libwww Link Class + + +!The Link Class! +*/ /* -** (c) COPYRIGHT MIT 1995. -** Please first read the full copyright statement in the file COPYRIGH. +** (c) COPYRIGHT MIT 1995. +** Please first read the full copyright statement in the file COPYRIGH. */ - /* -A Link represents the link between anchor objects. -By keeping the link as a object and not as part of the anchor we are capable -of handling link semantics in a much more organized way. For example, we -can then search for link types among all the link objects that we have created. -Anchor objects are bound together using Link -objects. Each anchor can be the source or destination of zero, one, or more -links from and to other anchors. +The HTLink class represents links between anchor objects. By keeping the link as a object and +not as part of the anchor we are capable of handling link semantics in a much +more organized way. For example, we can then search for link types among all +the link objects that we have created. Anchor +objects are bound together using Link objects. Each anchor can be the +source or destination of zero, one, or more links from and to other +anchors. -This module is implemented by HTLink.c, and it is -a part of the W3C Sample Code +Link information can come from many places - two classic examples are the +HTML LINK element and the HTTP Link header field. +Libwww supports both - the HTML LINK element is handled by the HTML parser and the HTTP Link header field +is handled by the MIME parser. + +The Webbot uses the link class to maintain the +information of the Web that it is seeing when traversing the Web as a +robot. + +This module is implemented by HTLink.c, and it is a +part of the W3C Sample Code Library. */ - #ifndef HTLINK_H #define HTLINK_H -typedef struct _HTLink HTLink; +typedef struct _HTLink HTLink; #include "WWWUtil.h" #include "HTMethod.h" #include "HTAnchor.h" - /* -. - Creation and Deletion Methods -. + +.Creation and Deletion Methods. These are the methods for crating and deleting new link objects -( - Create a new Link Object -) + +(Create a new Link Object) */ -typedef HTAtom * HTLinkType; +typedef HTAtom * HTLinkType; typedef enum _HTLinkResult { HT_LINK_INVALID = -1, @@ -58,90 +62,94 @@ } HTLinkResult; struct _HTLink { - HTAnchor * dest; /* The anchor to which this leads */ - HTLinkType type; /* Semantics of this link */ - HTMethod method; /* Method for this link, e.g. PUT */ - HTLinkResult result; /* Result of any attempt to get this link */ + HTAnchor * dest; /* The anchor to which this leads */ + HTLinkType type; /* Semantics of this link */ + HTMethod method; /* Method for this link, e.g. PUT */ + HTLinkResult result; /* Result of any attempt to get this link */ }; HTLink * HTLink_new (void); - /* -( - Delete a Link Object -) + +(Delete a Link Object) A link can be removed as any other object */ BOOL HTLink_delete (HTLink * link); - /* -( - Remove All Link Information from an Anchor -) + +(Remove All Link Information from an Anchor) This is normally a part of deleting anchor objects. */ extern BOOL HTLink_removeAll (HTAnchor * me); +/* +.Predefined Link Types. + +Just for ease of use, we define a seet of commonly used link types. You can +ofcourse use any other link type you want. +*/ +#define HT_LR_PERM_REDIRECT HTAtom_for("PERMANENT_REDIRECTION") +#define HT_LR_TEMP_REDIRECT HTAtom_for("TEMPORARY_REDIRECTION") +#define HT_LR_SEE_OTHER HTAtom_for("SEE_OTHER") /* -. - Handle Link Between Anchors -. + +.Handle Link Between Anchors. As mentioned, link objects are the ones that bind anchor objects together in a Web like structure -( - Add a Link between two Anchors -) + +(Add a Link between two Anchors) This method creates a new link between two anchor objects. */ -extern BOOL HTLink_add (HTAnchor * source, - HTAnchor * destination, - HTLinkType type, - HTMethod method); - +extern BOOL HTLink_add ( + HTAnchor * source, + HTAnchor * destination, + HTLinkType type, + HTMethod method); /* -( - Remove All Links Between two Anchors -) + +(Remove All Links Between two Anchors) Removes link information from one anchor to another. */ -extern BOOL HTLink_remove (HTAnchor * source, HTAnchor * destination); - +extern BOOL HTLink_remove ( + HTAnchor * source, + HTAnchor * destination); /* -( - Find a Link -) + +(Find a Link) Find the anchor object between a destination and a source ancher. Return link object if any, else NULL */ extern HTLink * HTLink_find (HTAnchor * source, HTAnchor * destination); +/* + +(Find a Link with a given link type) +Returns a link with a given link type or NULL if nothing found +*/ +extern HTLink * HTLink_findType (HTAnchor * me, HTLinkType type); /* -. - Link Information -. + +.Link Information. This is the set of methods for accessing the information carried by a link object -( - Link Destination -) + +(Link Destination) The link destination is the destination anchor pointed to by the link. */ extern BOOL HTLink_setDestination (HTLink * link, HTAnchor * dest); extern HTAnchor * HTLink_destination (HTLink * link); - /* -( - Link Types and Semantic Links -) + +(Link Types and Semantic Links) Each link has a sematic representation associated with it. This means that the application can distinguish between pages based on the semantics of the @@ -150,43 +158,37 @@ */ extern BOOL HTLink_setType (HTLink * link, HTLinkType type); extern HTLinkType HTLink_type (HTLink * link); - /* -( - Link Method -) + +(Link Method) The link method is the HTTP method we have performed between the two links. -For example, it can be a POST operation, or a PUT operation where the operation -on the first anchor created a new anchor. +For example, it can be a POST operation, or a PUT operation where the +operation on the first anchor created a new anchor. */ extern BOOL HTLink_setMethod (HTLink * link, HTMethod method); extern HTMethod HTLink_method (HTLink * link); - /* -( - Link Result -) - -When a link has been used for posting an object from a source to a destination -link, the result of the operation is stored as part of the link information. -This means that we can keep track of which operations we have performed on -a link and hence the application can ask the user whether he or she wants -to do a re-post, for example. -*/ +(Link Result) + +When a link has been used for posting an object from a source to a +destination link, the result of the operation is stored as part of the link +information. This means that we can keep track of which operations we have +performed on a link and hence the application can ask the user whether he or +she wants to do a re-post, for example. +*/ extern BOOL HTLink_setResult (HTLink * link, HTLinkResult result); extern HTLinkResult HTLink_result (HTLink * link); - /* */ - #endif /* HTLINK_H */ - /* - - @(#) $Id: HTLink.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ + + + +@(#) $Id: HTLink.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTList.c xdvik-22.40n/libs/libwww/HTList.c --- xdvik-22.40l/libs/libwww/HTList.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTList.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTList.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTList.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** A list is represented as a sequence of linked nodes of type HTList. ** The first node is a header which contains no object. @@ -49,8 +49,7 @@ me->next = newNode; return YES; } else { - if (CORE_TRACE) - HTTrace("HTList...... Can not add object %p to nonexisting list\n", + HTTRACE(CORE_TRACE, "HTList...... Can not add object %p to nonexisting list\n" _ newObject); } return NO; @@ -82,6 +81,33 @@ return NO; /* object not found or NULL list */ } +PUBLIC HTList * HTList_addList (HTList * me, void * newObject) +{ + if (me) { + HTList *newNode; + if ((newNode = (HTList *) HT_CALLOC(1, sizeof(HTList))) == NULL) + HT_OUTOFMEM("HTList_addObject"); + newNode->object = newObject; + newNode->next = me->next; + me->next = newNode; + return newNode; + } else { + HTTRACE(CORE_TRACE, "HTList...... Can not add object %p to nonexisting List\n" _ newObject); + } + return (HTList *) NULL; +} + +PUBLIC HTList * HTList_appendList (HTList * me, void *newObject) +{ + if (me) { + while (me->next) + me = me->next; + return HTList_addList(me, newObject); + } + return (HTList *) NULL; +} + + PUBLIC BOOL HTList_quickRemoveElement (HTList * me, HTList * last) { if (me && last) { @@ -296,7 +322,7 @@ } return YES; } else { - if (CORE_TRACE) HTTrace("List........ Empty list or no sort algorithm\n"); + HTTRACE(CORE_TRACE, "List........ Empty list or no sort algorithm\n"); } return NO; } diff -Naur xdvik-22.40l/libs/libwww/HTList.h xdvik-22.40n/libs/libwww/HTList.h --- xdvik-22.40l/libs/libwww/HTList.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTList.h Fri Sep 13 00:23:46 2002 @@ -67,6 +67,17 @@ extern BOOL HTList_appendObject (HTList * me, void * newObject); /* +The following two functions, contributed by Vic +Bancroft (bancroft@america.net) that do the same operation as above, but return +a pointer to the new HTList element that was added or appended. This allows +one to keep a reference to the end of the list outside of the list itself, +which can be used to speed up certain list operations. +*/ + +extern HTList * HTList_addList (HTList * me, void * newObject); +extern HTList * HTList_appendList (HTList * me, void * newObject); + +/* . Remove List Elements . @@ -172,6 +183,6 @@ - @(#) $Id: HTList.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ + @(#) $Id: HTList.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTLocal.c xdvik-22.40n/libs/libwww/HTLocal.c --- xdvik-22.40l/libs/libwww/HTLocal.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTLocal.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTLocal.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTLocal.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** History: ** HFN: Written @@ -63,9 +63,8 @@ status = fcntl(sockfd, F_SETFL, status); } #endif /* HAVE_FCNTL */ - if (PROT_TRACE) - HTTrace("HTFileOpen.. `%s\' opened using %sblocking socket\n", - local, status == -1 ? "" : "NON-"); + HTTRACE(PROT_TRACE, "HTFileOpen.. `%s\' opened %d as %sblocking socket\n" _ + local _ sockfd _ status == -1 ? "" : "NON-"); } /* #endif - HAVE_FCNTL <- wrong location, moved up JTD:5/30/96 */ #else /* !NO_UNIX_IO */ @@ -80,7 +79,7 @@ return HT_ERROR; } #endif /* VMS */ - if (PROT_TRACE) HTTrace("HTDoOpen.... `%s\' opened using FILE %p\n",local, fp); + HTTRACE(PROT_TRACE, "HTDoOpen.... `%s\' opened using FILE %p\n" _ local _ fp); #endif /* !NO_UNIX_IO */ /* @@ -116,14 +115,14 @@ #ifdef NO_UNIX_IO FILE * fp = HTChannel_file(ch); if (fp) { - if (PROT_TRACE) HTTrace("Closing..... ANSI file %p\n", fp); + HTTRACE(PROT_TRACE, "Closing..... ANSI file %p\n" _ fp); status = fclose(fp); HTChannel_setFile(ch, NULL); } #else SOCKET sockfd = HTChannel_socket(ch); if (sockfd != INVSOC) { - if (PROT_TRACE) HTTrace("Closing..... fd %d\n", sockfd); + HTTRACE(PROT_TRACE, "Closing..... fd %d\n" _ sockfd); status = NETCLOSE(sockfd); HTChannel_setSocket(ch, INVSOC); } diff -Naur xdvik-22.40l/libs/libwww/HTLocal.h xdvik-22.40n/libs/libwww/HTLocal.h --- xdvik-22.40l/libs/libwww/HTLocal.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTLocal.h Fri Sep 13 00:23:46 2002 @@ -54,7 +54,7 @@ #define HT_FT_APPEND HT_FB_APPEND #else -typedef const char HTLocalMode[10]; +typedef const char *HTLocalMode; #define HT_FB_RDONLY "rb" #define HT_FT_RDONLY "r" @@ -104,6 +104,6 @@ - @(#) $Id: HTLocal.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ + @(#) $Id: HTLocal.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTLog.c xdvik-22.40n/libs/libwww/HTLog.c --- xdvik-22.40l/libs/libwww/HTLog.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTLog.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTLog.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTLog.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module contains a simple logging mechanism for requests. ** The user must open and close the log file!!! @@ -38,17 +38,17 @@ { HTLog * log; if (!filename || !*filename) { - if (WWWTRACE) HTTrace("Log......... No log file given\n"); + HTTRACE(APP_TRACE, "Log......... No log file given\n"); return NULL; } if ((log = (HTLog *) HT_CALLOC(1, sizeof(HTLog))) == NULL) HT_OUTOFMEM("HTLog_open"); - if (WWWTRACE) HTTrace("Log......... Open log file `%s\'\n", filename); + HTTRACE(APP_TRACE, "Log......... Open log file `%s\'\n" _ filename); log->fp = fopen(filename, append ? "a" : "w"); if (!log->fp) { - if (WWWTRACE) HTTrace("Log......... Can't open log file `%s\'\n", filename); + HTTRACE(APP_TRACE, "Log......... Can't open log file `%s\'\n" _ filename); HT_FREE(log); return NULL; } @@ -65,7 +65,7 @@ { if (log && log->fp) { int status; - if (WWWTRACE) HTTrace("Log......... Closing log file %p\n", log->fp); + HTTRACE(APP_TRACE, "Log......... Closing log file %p\n" _ log->fp); status = fclose(log->fp); HT_FREE(log); return (status != EOF); @@ -94,7 +94,7 @@ time_t now = time(NULL); HTParentAnchor * anchor = HTRequest_anchor(request); char * uri = HTAnchor_address((HTAnchor *) anchor); - if (WWWTRACE) HTTrace("Log......... Writing CLF log\n"); + HTTRACE(APP_TRACE, "Log......... Writing CLF log\n"); fprintf(log->fp, "localhost - - [%s] %s %s %d %ld\n", HTDateTimeStr(&now, log->localtime), HTMethod_name(HTRequest_method(request)), @@ -123,7 +123,7 @@ if (parent_anchor) { char * me = HTAnchor_address((HTAnchor *) HTRequest_anchor(request)); char * parent = HTAnchor_address((HTAnchor *) parent_anchor); - if (WWWTRACE) HTTrace("Log......... Writing Referer log\n"); + HTTRACE(APP_TRACE, "Log......... Writing Referer log\n"); if (me && parent && *parent) { fprintf(log->fp, "%s -> %s\n", parent, me); } diff -Naur xdvik-22.40l/libs/libwww/HTLog.h xdvik-22.40n/libs/libwww/HTLog.h --- xdvik-22.40l/libs/libwww/HTLog.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTLog.h Fri Sep 13 00:23:46 2002 @@ -113,7 +113,7 @@ -@(#) $Id: HTLog.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +@(#) $Id: HTLog.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMIME.c xdvik-22.40n/libs/libwww/HTMIME.c --- xdvik-22.40l/libs/libwww/HTMIME.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTMIME.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMIME.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTMIME.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This is RFC 1341-specific code. ** The input stream pushed into this parser is assumed to be @@ -22,21 +22,26 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWCore.h" -#include "WWWCache.h" -#include "WWWStream.h" #include "HTReqMan.h" #include "HTNetMan.h" #include "HTHeader.h" #include "HTWWWStr.h" -#include "HTMIME.h" /* Implemented here */ -#define MIME_HASH_SIZE 101 +#ifndef NO_CACHE +#include "HTTee.h" +#include "HTConLen.h" +#include "HTMerge.h" +#include "WWWCache.h" +#endif + +#include "HTMIME.h" /* Implemented here */ typedef enum _HTMIMEMode { HT_MIME_HEADER = 0x1, HT_MIME_FOOTER = 0x2, HT_MIME_PARTIAL = 0x4, - HT_MIME_CONT = 0x8 + HT_MIME_CONT = 0x8, + HT_MIME_UPGRADE = 0x10 } HTMIMEMode; struct _HTStream { @@ -45,6 +50,7 @@ HTResponse * response; HTNet * net; HTStream * target; + HTConverter * save_stream; HTFormat target_format; HTChunk * token; HTChunk * value; @@ -56,6 +62,8 @@ BOOL hasBody; }; +PRIVATE HTConverter * LocalSaveStream = NULL; /* Where to save unknown stuff */ + /* ------------------------------------------------------------------------- */ PRIVATE int pumpData (HTStream * me) @@ -70,9 +78,6 @@ BOOL savestream = NO; me->transparent = YES; /* Pump rest of data right through */ - /* If this request is a source in PostWeb then pause here */ - if (HTRequest_isSource(request)) return HT_PAUSE; - /* ** Cache the metainformation in the anchor object by copying ** it from the response object. This we do regardless if @@ -103,6 +108,16 @@ return HT_CONTINUE; /* + ** If we get a 101 Protocol Switch then we are done here + ** but not done with the response (which we don't know + ** how to go about parsing + */ + if (me->mode & HT_MIME_UPGRADE) { + me->hasBody = YES; + return HT_OK; + } + + /* ** If there is no content-length, no transfer encoding and no ** content type then we assume that there is no body part in ** the message and we can return HT_LOADED @@ -112,12 +127,12 @@ if (length<0 && te==NULL && HTHost_isPersistent(host) && !HTHost_closeNotification(host)) { if (format != WWW_UNKNOWN) { - if (STREAM_TRACE) HTTrace("MIME Parser. BAD - there seems to be a body but no length. This must be an HTTP/1.0 server pretending that it is HTTP/1.1\n"); + HTTRACE(STREAM_TRACE, "MIME Parser. BAD - there seems to be a body but no length. This must be an HTTP/1.0 server pretending that it is HTTP/1.1\n"); HTHost_setCloseNotification(host, YES); } else { HTAlertCallback * cbf = HTAlert_find(HT_PROG_DONE); if (cbf) (*cbf)(request, HT_PROG_DONE, HT_MSG_NULL, NULL, NULL, NULL); - if (STREAM_TRACE) HTTrace("MIME Parser. No body in this messsage\n"); + HTTRACE(STREAM_TRACE, "MIME Parser. No body in this message\n"); return HT_LOADED; } } @@ -134,14 +149,15 @@ if (!(me->mode & HT_MIME_PARTIAL) && (format != WWW_UNKNOWN || length > 0 || te)) { HTStream * target; - if (STREAM_TRACE) HTTrace("Building.... C-T stack from %s to %s\n", - HTAtom_name(format), + HTTRACE(STREAM_TRACE, "Building.... C-T stack from %s to %s\n" _ + HTAtom_name(format) _ HTAtom_name(me->target_format)); if ((target = HTStreamStack(format, me->target_format, me->target, request, YES))==BlackHole) { if (!savestream) { if (me->target) (*me->target->isa->abort)(me->target, NULL); - me->target = HTSaveLocally(request, NULL, NULL, NULL, NULL); + me->target = me->save_stream(request, NULL, + format, me->target_format, me->target); savestream = YES; } } else @@ -151,13 +167,14 @@ /* ** Handle any Content Encodings */ - if (STREAM_TRACE) HTTrace("Building.... Content-Decoding stack\n"); + HTTRACE(STREAM_TRACE, "Building.... Content-Decoding stack\n"); if (ce) { HTStream * target = HTContentDecodingStack(ce, me->target, request, NULL); if (target == BlackHole) { if (!savestream) { if (me->target) (*me->target->isa->abort)(me->target, NULL); - me->target = HTSaveLocally(request, NULL, NULL, NULL, NULL); + me->target = me->save_stream(request, NULL, + format, me->target_format, me->target); savestream = YES; } } else @@ -171,29 +188,36 @@ ** If we are appending to a cache entry then use a different stream than ** if creating a new entry. */ +#ifndef NO_CACHE if (HTCacheMode_enabled()) { if (me->mode & HT_MIME_PARTIAL) { HTStream * append = HTStreamStack(WWW_CACHE_APPEND, me->target_format, me->target, request, NO); - me->target = append; + if (append) me->target = HTTee(me->target, append, NULL); +#if 0 + /* @@ JK: change */ + if (append) me->target = append; +#endif } else if (HTResponse_isCachable(me->response) == HT_CACHE_ALL) { HTStream * cache = HTStreamStack(WWW_CACHE, me->target_format, me->target, request, NO); if (cache) me->target = HTTee(me->target, cache, NULL); } } +#endif /* ** Handle any Transfer Encodings */ - if (STREAM_TRACE) HTTrace("Building.... Transfer-Decoding stack\n"); + HTTRACE(STREAM_TRACE, "Building.... Transfer-Decoding stack\n"); if (te) { HTStream * target = HTTransferDecodingStack(te, me->target, request, NULL); if (target == BlackHole) { if (!savestream) { if (me->target) (*me->target->isa->abort)(me->target, NULL); - me->target = HTSaveLocally(request, NULL, NULL, NULL, NULL); + me->target = me->save_stream(request, NULL, + format, me->target_format, me->target); savestream = YES; } } else @@ -208,34 +232,28 @@ return HT_OK; } -/* _dispatchParsers - call request's MIME header parser. -** Use global parser if no appropriate one is found for request. +/* _dispatchParsers + * call request's MIME header parser. Use global parser if no + * appropriate one is found for request. */ -PRIVATE int _dispatchParsers (HTStream * me) +PRIVATE int _dispatchParsers (HTRequest * req, char * token, char * value) { int status; - char * token = HTChunk_data(me->token); - char * value = HTChunk_data(me->value); BOOL found = NO; BOOL local = NO; HTMIMEParseSet * parseSet; /* In case we get an empty header consisting of a CRLF, we fall thru */ - if (STREAM_TRACE) HTTrace("MIME header. %s: %s\n", - token ? token : "", + HTTRACE(STREAM_TRACE, "MIME header. %s: %s\n" _ + token ? token : "" _ value ? value : ""); if (!token) return HT_OK; /* Ignore noop token */ /* - ** Remember the original header - */ - HTResponse_addHeader(me->response, token, value); - - /* ** Search the local set of MIME parsers */ - if ((parseSet = HTRequest_MIMEParseSet(me->request, &local)) != NULL) { - status = HTMIMEParseSet_dispatch(parseSet, me->request, + if ((parseSet = HTRequest_MIMEParseSet(req, &local)) != NULL) { + status = HTMIMEParseSet_dispatch(parseSet, req, token, value, &found); if (found) return status; } @@ -244,7 +262,7 @@ ** Search the global set of MIME parsers */ if (local==NO && (parseSet = HTHeader_MIMEParseSet()) != NULL) { - status = HTMIMEParseSet_dispatch(parseSet, me->request, + status = HTMIMEParseSet_dispatch(parseSet, req, token, value, &found); if (found) return status; } @@ -252,6 +270,30 @@ return HT_OK; } +/* _stream2dispatchParsers - extracts the arguments from a + * MIME stream before calling the generic _dispatchParser + * function. + */ +PRIVATE int _stream2dispatchParsers (HTStream * me) +{ + char * token = HTChunk_data(me->token); + char * value = HTChunk_data(me->value); + + /* In case we get an empty header consisting of a CRLF, we fall thru */ + HTTRACE(STREAM_TRACE, "MIME header. %s: %s\n" _ + token ? token : "" _ + value ? value : ""); + if (!token) return HT_OK; /* Ignore noop token */ + + /* + ** Remember the original header + */ + HTResponse_addHeader(me->response, token, value); + + /* call the parsers to set the headers */ + return (_dispatchParsers (me->request, token, value)); +} + /* ** Header is terminated by CRCR, LFLF, CRLFLF, CRLFCRLF ** Folding is either of CF LWS, LF LWS, CRLF LWS @@ -260,7 +302,7 @@ { const char * start = b; const char * end = start; - const char * value = me->value->size ? b : NULL; + const char * value = HTChunk_size(me->value) > 0 ? b : NULL; int length = l; int status; @@ -302,7 +344,7 @@ me->haveToken = YES; } else { unsigned char ch = *(unsigned char *) b; - ch = tolower(ch); + ch = TOLOWER(ch); me->hash = (me->hash * 3 + ch) % MIME_HASH_SIZE; } } else if (value == NULL && *b != ':' && !isspace((int) *b)) @@ -316,7 +358,7 @@ int ret = HT_ERROR; HTChunk_putb(me->value, value, end-value); HTChunk_putc(me->value, '\0'); - ret = _dispatchParsers(me); + ret = _stream2dispatchParsers(me); HTNet_addBytesRead(me->net, b-start); start=b, end=b; if (me->EOLstate == EOL_END) { /* EOL_END */ @@ -332,8 +374,8 @@ } } } else { /* EOL_LINE */ - HTChunk_clear(me->token); - HTChunk_clear(me->value); + HTChunk_truncate(me->token,0); + HTChunk_truncate(me->value,0); me->haveToken = NO; me->hash = 0; value = NULL; @@ -450,14 +492,13 @@ { int status = HT_OK; if (!me->transparent) - if (_dispatchParsers(me) == HT_OK) + if (_stream2dispatchParsers(me) == HT_OK) pumpData(me); if (me->target) { if ((status = (*me->target->isa->_free)(me->target))==HT_WOULD_BLOCK) return HT_WOULD_BLOCK; } - if (PROT_TRACE) - HTTrace("MIME........ FREEING....\n"); + HTTRACE(PROT_TRACE, "MIME........ FREEING....\n"); HTChunk_delete(me->token); HTChunk_delete(me->value); HT_FREE(me); @@ -470,8 +511,7 @@ { int status = HT_ERROR; if (me->target) status = (*me->target->isa->abort)(me->target, e); - if (PROT_TRACE) - HTTrace("MIME........ ABORTING...\n"); + HTTRACE(PROT_TRACE, "MIME........ ABORTING...\n"); HTChunk_delete(me->token); HTChunk_delete(me->value); HT_FREE(me); @@ -516,6 +556,7 @@ me->net = HTRequest_net(request); me->target = output_stream; me->target_format = output_format; + me->save_stream = LocalSaveStream ? LocalSaveStream : HTBlackHoleConverter; me->token = HTChunk_new(256); me->value = HTChunk_new(256); me->hash = 0; @@ -555,6 +596,18 @@ return me; } +PUBLIC HTStream * HTMIMEUpgrade (HTRequest * request, + void * param, + HTFormat input_format, + HTFormat output_format, + HTStream * output_stream) +{ + HTStream * me = HTMIMEConvert(request, param, input_format, + output_format, output_stream); + me->mode |= HT_MIME_UPGRADE; + return me; +} + /* MIME footer ONLY parser stream ** ------------------------------ ** Parse only a footer, for example after a chunked encoding. @@ -571,6 +624,7 @@ return me; } +#ifndef NO_CACHE /* ** A small BEFORE filter that just finds a cache entry unconditionally ** and loads the entry. All freshness and any other constraints are @@ -579,8 +633,13 @@ PRIVATE int HTCacheLoadFilter (HTRequest * request, void * param, int mode) { HTParentAnchor * anchor = HTRequest_anchor(request); - HTCache * cache = HTCache_find(anchor); - if (STREAM_TRACE) HTTrace("Cache Load.. loading partial cache entry\n"); + char * default_name; + HTCache * cache; + + default_name = HTRequest_defaultPutName (request); + cache = HTCache_find(anchor, default_name); + + HTTRACE(STREAM_TRACE, "Cache Load.. loading partial cache entry\n"); if (cache) { char * name = HTCache_name(cache); HTAnchor_setPhysical(anchor, name); @@ -599,9 +658,13 @@ { HTStream * pipe = (HTStream *) param; if (pipe) { - if (STREAM_TRACE) HTTrace("Cache Flush. Flushing and freeing PIPE buffer\n"); + HTTRACE(STREAM_TRACE, "Cache Flush. Flushing and freeing PIPE buffer\n"); (*pipe->isa->flush)(pipe); +#if 0 + /* @@ JK: flush converts the pipe to an open one, we shouldn't + free it as we'll loose our references */ (*pipe->isa->_free)(pipe); +#endif } /* @@ -611,6 +674,7 @@ HTRequest_delete(request); return HT_ERROR; } +#endif /* Partial Response MIME parser stream ** ----------------------------------- @@ -628,6 +692,7 @@ HTFormat output_format, HTStream * output_stream) { +#ifndef NO_CACHE HTParentAnchor * anchor = HTRequest_anchor(request); HTFormat format = HTAnchor_format(anchor); HTStream * pipe = NULL; @@ -652,6 +717,8 @@ me->mode |= HT_MIME_PARTIAL; me->target = merge; +#if 0 + /* JK: this doesn't work because this work is repeated before */ /* ** Create the cache append stream, and a Tee stream */ @@ -660,6 +727,7 @@ output_stream, request, NO); if (append) me->target = HTTee(me->target, append, NULL); } +#endif /* ** Create the pipe buffer stream to buffer the data that we read @@ -693,9 +761,76 @@ HTRequest_addAfter(cache_request, HTCacheFlushFilter, NULL, pipe, HT_ALL, HT_FILTER_FIRST, YES); - if (STREAM_TRACE) HTTrace("Partial..... Starting cache load\n"); + HTTRACE(STREAM_TRACE, "Partial..... Starting cache load\n"); HTLoad(cache_request, NO); } return me; +#else + return NULL; +#endif +} + +PUBLIC void HTMIME_setSaveStream (HTConverter * save_stream) +{ + LocalSaveStream = save_stream; } +PUBLIC HTConverter * HTMIME_saveStream (void) +{ + return LocalSaveStream; +} + +#ifndef NO_CACHE +/* HTMIME_anchor2response + * Copies the anchor HTTP headers into a response object by means + * of the generic _dispatchParsers function. Written so that we can + * copy the HTTP headers stored in the cache to the response object. + */ +PRIVATE void HTMIME_anchor2response (HTRequest * req) +{ + char * token; + char * value; + HTAssocList * header; + HTAssoc * pres; + HTResponse * res; + HTParentAnchor * anchor; + + if (!req) + return; + + anchor = HTRequest_anchor (req); + header = HTAnchor_header (anchor); + if (!anchor || !header) + return; + + while ((pres = (HTAssoc *) HTAssocList_nextObject (header))) + { + token = HTAssoc_name (pres); + value = HTAssoc_value (pres); + _dispatchParsers (req, token, value); + } + + /* + ** Notify the response object not to delete the lists that we + ** have inherited from the anchor object + */ + res = HTRequest_response (req); + HTResponse_isCached (res, YES); +} + +/* +** A small AFTER filter that is a frontend to the +** HTMIME_anchor2headers function. +*/ + +PUBLIC HTStream * HTCacheCopyHeaders (HTRequest * request, + void * param, + HTFormat input_format, + HTFormat output_format, + HTStream * output_stream) +{ + HTTRACE(STREAM_TRACE, "Cache Copy Headers.. Copying headers into the response object\n"); + HTMIME_anchor2response (request); + return HT_OK; +} +#endif /* NO_CACHE */ diff -Naur xdvik-22.40l/libs/libwww/HTMIME.h xdvik-22.40n/libs/libwww/HTMIME.h --- xdvik-22.40l/libs/libwww/HTMIME.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTMIME.h Fri Sep 13 00:23:46 2002 @@ -1,11 +1,10 @@ /* - - W3C Sample Code Library libwww MIME/RFC822 Parsers + W3C Sample Code Library libwww MIME Parsers ! - MIME Parsers + Libwww MIME Parsers ! */ @@ -20,7 +19,8 @@ a footer. It recursively invokes the format manager to handle embedded formats like MIME multipart. As well as stripping off and parsing the headers, the MIME parser has to parse any weird MIME encodings it may meet within the -body parts of messages, and must deal with multipart messages. +body parts of messages, and must deal with multipart +messages (see HTBound.h). This module is implemented to the level necessary for operation with WWW, but is not currently complete for any arbitrary MIME message. @@ -37,34 +37,54 @@ #include "HTFormat.h" /* -( - MIME header parser stream -) - -This stream parses a complete MIME header and if a content type header is -found then the stream stack is called. Any left over data is pumped right -through the stream. +. + How to Deal with Unknown Data +. + +When the MIME parser can't find a target stream, for example because the +media type is unknown, or it has a content encoding or transfer encoding +that it doesn't know about then it has to get rid of the data in some other +fashion, for example by dumping it to local disk (but it could also be dumping +it to a black hole). The following two functions allow you to set and get +the stream to use in this situation. By default, libwww provides an +implementation of a save stream as HTSaveLocally +which you may want to use - this is for example used by the +current profiles. +*/ + +extern void HTMIME_setSaveStream (HTConverter * save_stream); +extern HTConverter * HTMIME_saveStream (void); + +/* +. + MIME Parse Stream +. + +This stream parses a complete MIME message and if a media type header is +found then the stream stack is called to create the nest stream instance +in the stream pipe. Any piece of the MIME body is pumped right through the +stream. */ extern HTConverter HTMIMEConvert; /* -( - MIME Header ONLY parser stream -) - -This stream parses a complete MIME header and then returnes HT_PAUSE. It -does not set up any streams and resting data stays in the buffer. This can -be used if you only want to parse the headers before you decide what to do -next. This is for example the case in a server app. +. + MIME Header ONLY Parse Stream +. + +This stream parses a complete MIME header and then returnes +HT_LOADED. It does not set up any streams and resting data stays +in the buffer. This can be used if you only want to parse the headers before +you decide what to do next. This is for example the case with HTTP HEAD requests. */ extern HTConverter HTMIMEHeader; /* -( - MIME Footer ONLY parser -) +. + MIME Footer ONLY Parse Stream +. Parse only a footer, for example after a chunked encoding. */ @@ -72,30 +92,64 @@ extern HTConverter HTMIMEFooter; /* -( - MIME 1xx Continue Header Parser -) - -When parsed the header it returns HT_CONTINUE +. + HTTP 100 Continue Parse Stream +. + +The 100 continue status codes can come at any time - we take them and put +the data down a temporary stream. When the 100 continue message has been +parsed, the stream returns HT_CONTINUE */ extern HTConverter HTMIMEContinue; /* -( - Partial MIME Response parser -) - -In case we sent a Range conditional GET we may get back a partial -response. This response must be appended to the already existing cache entry -before presented to the user. That is, first we load the cached object and -pump it down the pipe and then the new data follows. Only the latter part -gets appended to the cache, of course. +. + HTTP 101 Switching Protocol Parse Stream +. + +The 101 Switching Protocol status code indicates that the rest of the stream +is using another format, protocol, what ever. The result is the same - we +are done parsing here and must leave the rest to the next stream which hopefully +knows more about how to parse the rest of the stream. The stream stack is +called to look for a stream registered for handling +WWW_MIME_UPGRADE. This steam should +return HT_LOADED when it is done, HT_ERROR if an +error occurred and HT_OK as long as it just reads more data. +*/ + +extern HTConverter HTMIMEUpgrade; + +/* +. + HTTP 206 Partial Data MIME Parse Stream +. + +In case we sent a Range conditional GET we may get back a 206 Partial +Response. This response must be appended to the already existing cache entry +before presented to the user. That is, first we load the +cached object and pump it down the pipe and then +the new data follows. Only the latter part gets appended to the cache, of +course. */ extern HTConverter HTMIMEPartial; /* +. + HTMIME_anchor2response +. + +Copies the anchor HTTP headers into a response object by means +of the generic _dispatchParsers function. Written so that we can +copy the HTTP headers stored in the cache to the response object. +*/ + +#ifndef NO_CACHE +extern HTConverter HTCacheCopyHeaders; +#endif + +/* */ #endif @@ -104,6 +158,6 @@ - @(#) $Id: HTMIME.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ + @(#) $Id: HTMIME.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMIMERq.c xdvik-22.40n/libs/libwww/HTMIMERq.c --- xdvik-22.40l/libs/libwww/HTMIMERq.c Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTMIMERq.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMIMERq.c,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +** @(#) $Id: HTMIMERq.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module implements the output stream for MIME used for sending ** requests with a entity body to HTTP, NEWS, etc. or for generating @@ -238,7 +238,7 @@ if (transfer_coding) { HTStream * target = HTTransferCodingStack(WWW_CODING_CHUNKED, me->target, request, NULL, YES); - if (STREAM_TRACE) HTTrace("Building.... Transfer-Encoding stack\n"); + HTTRACE(STREAM_TRACE, "Building.... Transfer-Encoding stack\n"); if (target == HTBlackHole()) { if (me->target) (*me->target->isa->abort)(me->target, NULL); me->target = HTErrorStream(); @@ -256,7 +256,7 @@ { HTEncoding cte = HTAnchor_contentTransferEncoding(entity); if (!HTFormat_isUnityTransfer(cte)) { - if (STREAM_TRACE) HTTrace("Building.... C-T-E stack\n"); + HTTRACE(STREAM_TRACE, "Building.... C-T-E stack\n"); me->target = HTContentTransferCodingStack(cte, me->target, request, NULL, YES); } @@ -266,13 +266,13 @@ { HTList * cc = HTAnchor_encoding(entity); if (cc) { - if (STREAM_TRACE) HTTrace("Building.... C-E stack\n"); + HTTRACE(STREAM_TRACE, "Building.... C-E stack\n"); me->target = HTContentEncodingStack(cc, me->target, request, NULL); } } #endif - if (PROT_TRACE) HTTrace("MIME........ Generating Entity Headers\n"); + HTTRACE(PROT_TRACE, "MIME........ Generating Entity Headers\n"); return HT_OK; } @@ -344,7 +344,7 @@ { if (me->target) (*me->target->isa->abort)(me->target, e); HT_FREE(me); - if (PROT_TRACE) HTTrace("MIMERequest. ABORTING...\n"); + HTTRACE(PROT_TRACE, "MIMERequest. ABORTING...\n"); return HT_ERROR; } diff -Naur xdvik-22.40l/libs/libwww/HTMIMERq.h xdvik-22.40n/libs/libwww/HTMIMERq.h --- xdvik-22.40l/libs/libwww/HTMIMERq.h Wed Apr 18 14:23:17 2001 +++ xdvik-22.40n/libs/libwww/HTMIMERq.h Fri Sep 13 00:23:46 2002 @@ -50,7 +50,7 @@ -@(#) $Id: HTMIMERq.h,v 1.1.1.1 2001/04/18 14:23:17 stefanulrich Exp $ +@(#) $Id: HTMIMERq.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMIMImp.c xdvik-22.40n/libs/libwww/HTMIMImp.c --- xdvik-22.40l/libs/libwww/HTMIMImp.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMIMImp.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMIMImp.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMIMImp.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module contains the default MIME header parsers for the MIME ** parser in HTMIME.c. They are all initialized at run time and can hence @@ -74,19 +74,14 @@ return HT_OK; } -/* @@@ WARNING: The following function hasn't been thoroughly tested yet */ PUBLIC int HTMIME_authenticationInfo (HTRequest * request, HTResponse * response, char * token, char * value) { - /* deal here with the next nonce, the qop, and the digest response (mutual - authentication */ - if (value) { - if (PROT_TRACE) - HTTrace("Protocol.... Authentication-Info: `%s\', value: `%s\'\n", - value); - HTDigest_refresh (request, response, FALSE, value); - } + if (token && value) { + HTResponse_addChallenge(response, token, value); + HTResponse_setScheme(response, "digest"); + } return HT_OK; } @@ -135,7 +130,7 @@ HTNet * net = HTRequest_net(request); HTHost * host = HTNet_host(net); if (!strcasecomp(name, "close")) { /* HTTP/1.1 */ - if (STREAM_TRACE) HTTrace("MIMEParser.. Close received...\n"); + HTTRACE(STREAM_TRACE, "MIMEParser.. Close received...\n"); HTHost_setCloseNotification(host, YES); } else if (!strcasecomp(name, "keep-alive")) { /* HTTP/1.0 */ @@ -145,9 +140,9 @@ */ if (HTHost_version(host) < HTTP_11) { HTNet_setPersistent(net, YES, HT_TP_SINGLE); - if (STREAM_TRACE) HTTrace("MIMEParser.. HTTP/1.0 Keep Alive\n"); + HTTRACE(STREAM_TRACE, "MIMEParser.. HTTP/1.0 Keep Alive\n"); } else - if (STREAM_TRACE) HTTrace("MIMEParser.. HTTP/1.0 Keep Alive ignored\n"); + HTTRACE(STREAM_TRACE, "MIMEParser.. HTTP/1.0 Keep Alive ignored\n"); } else HTResponse_addConnection(response, name, val ? val : ""); } @@ -257,11 +252,11 @@ char * val = HTNextField(&name_val); if (!strcasecomp(name, "max") && val) { int max = atoi(val); - if (STREAM_TRACE) HTTrace("MIMEParser.. Max %d requests pr connection\n", max); + HTTRACE(STREAM_TRACE, "MIMEParser.. Max %d requests pr connection\n" _ max); HTHost_setReqsPerConnection(host, max); } else if (!strcasecomp(name, "timeout") && val) { int timeout = atoi(val); - if (STREAM_TRACE) HTTrace("MIMEParser.. Timeout after %d secs\n", timeout); + HTTRACE(STREAM_TRACE, "MIMEParser.. Timeout after %d secs\n" _ timeout); } } return HT_OK; @@ -270,7 +265,42 @@ PUBLIC int HTMIME_link (HTRequest * request, HTResponse * response, char * token, char * value) { - + char * element; + HTParentAnchor * me = HTRequest_anchor(request); + while ((element = HTNextElement(&value))) { + char * param_pair; + char * uri = HTNextField(&element); + HTChildAnchor * child_dest = HTAnchor_findChildAndLink(me, NULL, uri, NULL); + HTParentAnchor * parent_dest = + HTAnchor_parent(HTAnchor_followMainLink((HTAnchor *) child_dest)); + if (parent_dest) { + while ((param_pair = HTNextPair(&element))) { + char * name = HTNextField(¶m_pair); + char * val = HTNextField(¶m_pair); + if (name) { + if (!strcasecomp(name, "rel") && val && *val) { + HTTRACE(STREAM_TRACE, "MIMEParser.. Link forward relationship `%s\'\n" _ + val); + HTLink_add((HTAnchor *) me, (HTAnchor *) parent_dest, + (HTLinkType) HTAtom_caseFor(val), + METHOD_INVALID); + } else if (!strcasecomp(name, "rev") && val && *val) { + HTTRACE(STREAM_TRACE, "MIMEParser.. Link reverse relationship `%s\'\n" _ + val); + HTLink_add((HTAnchor *) parent_dest, (HTAnchor *) me, + (HTLinkType) HTAtom_caseFor(val), + METHOD_INVALID); + } else if (!strcasecomp(name, "type") && val && *val) { + HTTRACE(STREAM_TRACE, "MIMEParser.. Link type `%s\'\n" _ val); + if (HTAnchor_format(parent_dest) == WWW_UNKNOWN) + HTAnchor_setFormat(parent_dest, (HTFormat) HTAtom_caseFor(val)); + } else + HTTRACE(STREAM_TRACE, "MIMEParser.. Link unknown `%s\' with value `%s\'\n" _ + name _ val ? val : ""); + } + } + } + } return HT_OK; } @@ -323,7 +353,7 @@ if (name) { if (!strcasecomp(name, "no-cache")) { HTResponse_setCachable(response, HT_NO_CACHE); - if (STREAM_TRACE) HTTrace("MIMEParser.. No-Cache Pragma\n"); + HTTRACE(STREAM_TRACE, "MIMEParser.. No-Cache Pragma\n"); } } } @@ -336,9 +366,8 @@ char * param = NULL; char * protocol = HTNextSExp(&value, ¶m); if (protocol) { - if (PROT_TRACE) - HTTrace("Protocol.... Name: `%s\', value: `%s\'\n", - protocol, param); + HTTRACE(PROT_TRACE, "Protocol.... Name: `%s\', value: `%s\'\n" _ + protocol _ param); HTResponse_addProtocol(response, protocol, param); } return HT_OK; @@ -350,9 +379,8 @@ char * param = NULL; char * info = HTNextSExp(&value, ¶m); if (info) { - if (PROT_TRACE) - HTTrace("Protocol.... Info: `%s\', value: `%s\'\n", - info, param); + HTTRACE(PROT_TRACE, "Protocol.... Info: `%s\', value: `%s\'\n" _ + info _ param); HTResponse_addProtocolInfo(response, info, param); } return HT_OK; @@ -364,9 +392,8 @@ char * param = NULL; char * preq = HTNextSExp(&value, ¶m); if (preq) { - if (PROT_TRACE) - HTTrace("Protocol.... Request: `%s\', value: `%s\'\n", - preq, param); + HTTRACE(PROT_TRACE, "Protocol.... Request: `%s\', value: `%s\'\n" _ + preq _ param); HTResponse_addProtocolRequest(response, preq, param); } return HT_OK; @@ -379,20 +406,16 @@ return HT_OK; } - -/* @@@ WARNING: The following function hasn't been thoroughly tested yet */ PUBLIC int HTMIME_proxyAuthenticationInfo (HTRequest * request, - HTResponse * response, - char * token, char * value) + HTResponse * response, + char * token, char * value) { /* deal here with the next nonce, the qop, and the digest response (mutual authentication */ - if (value) { - if (PROT_TRACE) - HTTrace("Protocol.... Proxy-Authentication-Info: `%s\', value: `%s\'\n", - value); - HTDigest_refresh (request, response, TRUE, value); - } + if (token && value) { + HTResponse_addChallenge(response, token, value); + HTResponse_setScheme(response, "digest"); + } return HT_OK; } @@ -408,8 +431,7 @@ if ((new_method = HTMethod_enum(field)) != METHOD_INVALID) HTHost_appendPublicMethods(host, new_method); } - if (STREAM_TRACE) - HTTrace("MIMEParser.. Public methods: %d\n", + HTTRACE(STREAM_TRACE, "MIMEParser.. Public methods: %d\n" _ HTHost_publicMethods(host)); return HT_OK; } @@ -539,7 +561,7 @@ HTRequest_addError(request, ERR_WARN, NO, idx, agent, (int) strlen(agent), "HTMIME_warning"); } else { - if (STREAM_TRACE) HTTrace("MIMEParser.. Invalid warning\n"); + HTTRACE(STREAM_TRACE, "MIMEParser.. Invalid warning\n"); } return HT_OK; } diff -Naur xdvik-22.40l/libs/libwww/HTMIMImp.h xdvik-22.40n/libs/libwww/HTMIMImp.h --- xdvik-22.40l/libs/libwww/HTMIMImp.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMIMImp.h Fri Sep 13 00:23:46 2002 @@ -90,6 +90,6 @@ - @(#) $Id: HTMIMImp.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ + @(#) $Id: HTMIMImp.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMIMPrs.c xdvik-22.40n/libs/libwww/HTMIMPrs.c --- xdvik-22.40l/libs/libwww/HTMIMPrs.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMIMPrs.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1996. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMIMPrs.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMIMPrs.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** See HTHshLst.html for a description of HashLists. ** @@ -18,12 +18,10 @@ #include "HTString.h" #include "HTMIMPrs.h" -#define DEFAULT_HASH_SIZE 11 - struct _HTMIMEParseEl{ HTMIMEParseEl * next; - const char * token; - BOOL caseSensitive; + char * token; + BOOL caseSensitive; HTParserCallback * pFunk; }; @@ -49,6 +47,7 @@ PRIVATE int HTMIMEParseEl_delete(HTMIMEParseEl * me, HTMIMEParseEl ** pBefore) { *pBefore = me->next; + HT_FREE(me->token); HT_FREE(me); return HT_OK; } @@ -61,7 +60,7 @@ for (p=token, ret=0; *p; p++) { char ch; ch = *(unsigned char *) p; - ch = tolower(ch); + ch = TOLOWER(ch); ret = (ret * 3 +(ch)) % me->size; } return ret; @@ -81,18 +80,18 @@ { int i; HTMIMEParseEl * pEl, * next; - - for (i=0; isize; i++) - for (pEl = me->parsers[i]; pEl; pEl = next) { - next = pEl->next; - HT_FREE(pEl); - } - for (pEl = me->parsers[i]; pEl; pEl = next) { - next = pEl->next; - HT_FREE(pEl); + if (me && me->parsers) { + for (i=0; isize; i++) { + for (pEl = me->parsers[i]; pEl; pEl = next) { + next = pEl->next; + HT_FREE(pEl->token); + HT_FREE(pEl); + } + } + HT_FREE(me->parsers); + HT_FREE(me); } - HT_FREE(me); return HT_OK; } @@ -107,7 +106,7 @@ */ if (!me->parsers) { if (!me->size) - me->size = DEFAULT_HASH_SIZE; + me->size = HT_S_HASH_SIZE; if ((me->parsers = (HTMIMEParseEl **) HT_CALLOC(me->size, sizeof(HTMIMEParseEl *))) == NULL) HT_OUTOFMEM("HTMIME parsers"); } diff -Naur xdvik-22.40l/libs/libwww/HTMIMPrs.h xdvik-22.40n/libs/libwww/HTMIMPrs.h --- xdvik-22.40l/libs/libwww/HTMIMPrs.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMIMPrs.h Fri Sep 13 00:23:46 2002 @@ -107,6 +107,6 @@ - @(#) $Id: HTMIMPrs.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ + @(#) $Id: HTMIMPrs.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTML.c xdvik-22.40n/libs/libwww/HTML.c --- xdvik-22.40l/libs/libwww/HTML.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTML.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTML.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTML.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This generates of a hypertext object. It converts from the ** structured stream interface foo HTML events into the style- @@ -57,8 +57,8 @@ ** Entity values -- for ISO Latin 1 local representation ** This MUST match exactly the table referred to in the DTD! */ -#define ENTITY_SIZE 67 -static char * ISO_Latin1[ENTITY_SIZE] = { +static char * ISO_Latin1[HTML_ENTITIES] = { +/* 00 */ "\306", /* capital AE diphthong (ligature) */ "\301", /* capital A, acute accent */ "\302", /* capital A, circumflex accent */ @@ -69,6 +69,7 @@ "\307", /* capital C, cedilla */ "\320", /* capital Eth, Icelandic */ "\311", /* capital E, acute accent */ +/* 10 */ "\312", /* capital E, circumflex accent */ "\310", /* capital E, grave accent */ "\313", /* capital E, dieresis or umlaut mark */ @@ -79,6 +80,7 @@ "\321", /* capital N, tilde */ "\323", /* capital O, acute accent */ "\324", /* capital O, circumflex accent */ +/* 20 */ "\322", /* capital O, grave accent */ "\330", /* capital O, slash */ "\325", /* capital O, tilde */ @@ -89,43 +91,84 @@ "\331", /* capital U, grave accent */ "\334", /* capital U, dieresis or umlaut mark */ "\335", /* capital Y, acute accent */ +/* 30 */ "\341", /* small a, acute accent */ "\342", /* small a, circumflex accent */ + "\264", /* acute accent */ "\346", /* small ae diphthong (ligature) */ "\340", /* small a, grave accent */ "\046", /* ampersand */ "\345", /* small a, ring */ "\343", /* small a, tilde */ "\344", /* small a, dieresis or umlaut mark */ + "\246", /* broken vertical bar */ +/* 40 */ "\347", /* small c, cedilla */ + "\270", /* cedilla */ + "\242", /* cent sign */ + "\251", /* copyright */ + "\244", /* general currency sign */ + "\260", /* degree sign */ + "\367", /* division sign */ "\351", /* small e, acute accent */ "\352", /* small e, circumflex accent */ "\350", /* small e, grave accent */ +/* 50 */ "\360", /* small eth, Icelandic */ "\353", /* small e, dieresis or umlaut mark */ + "\275", /* fraction one-half */ + "\274", /* fraction one-fourth */ + "\276", /* fraction three-fourth */ "\076", /* greater than */ "\355", /* small i, acute accent */ "\356", /* small i, circumflex accent */ + "\241", /* inverted exclamation */ "\354", /* small i, grave accent */ +/* 60 */ + "\277", /* inverted question mark */ "\357", /* small i, dieresis or umlaut mark */ + "\253", /* left angle quote */ "\074", /* less than */ + "\257", /* macron accent */ + "\265", /* micro sign (greek mu) */ + "\267", /* middle dot */ "\040", /* non-breaking space */ + "\254", /* not sign */ "\361", /* small n, tilde */ +/* 70 */ "\363", /* small o, acute accent */ "\364", /* small o, circumflex accent */ "\362", /* small o, grave accent */ + "\252", /* feminine ordinal */ + "\272", /* masculine ordinal */ "\370", /* small o, slash */ "\365", /* small o, tilde */ "\366", /* small o, dieresis or umlaut mark */ + "\266", /* paragraph sign */ + "\261", /* plus or minus */ +/* 80 */ + "\243", /* pound sign */ "\042", /* double quote sign - June 94 */ + "\273", /* right angle quote */ + "\256", /* registered trademark */ + "\247", /* section sign */ + "\255", /* soft hyphen */ + "\271", /* superscript 1 */ + "\262", /* superscript 2 */ + "\263", /* superscript 3 */ "\337", /* small sharp s, German (sz ligature) */ +/* 90 */ "\376", /* small thorn, Icelandic */ + "\327", /* multiply sign */ "\372", /* small u, acute accent */ "\373", /* small u, circumflex accent */ "\371", /* small u, grave accent */ + "\250", /* dieresis or umlaut mark */ "\374", /* small u, dieresis or umlaut mark */ "\375", /* small y, acute accent */ - "\377", /* small y, dieresis or umlaut mark */ + "\245", /* yen sign */ + "\377" /* small y, dieresis or umlaut mark */ +/* 100 */ }; PRIVATE char ** CurrentEntityValues = ISO_Latin1; @@ -136,7 +179,7 @@ CurrentEntityValues = ISO_Latin1; return YES; } else { - if (SGML_TRACE) HTTrace("HTML Parser. Doesn't support this character set\n"); + HTTRACE(SGML_TRACE, "HTML Parser. Doesn't support this character set\n"); return NO; } } @@ -151,9 +194,6 @@ /* Look at what we got */ switch (me->sp[0]) { - case HTML_COMMENT: - break; /* Do Nothing */ - case HTML_TITLE: HTChunk_putb(me->title, b, l); /* Fall through */ @@ -203,8 +243,7 @@ } HTextImp_foundLink(me->text, element_number, HTML_A_HREF, address, present, value); - if (SGML_TRACE) - HTTrace("HTML Parser. Anchor `%s\'\n", value[HTML_A_HREF]); + HTTRACE(SGML_TRACE, "HTML Parser. Anchor `%s\'\n" _ value[HTML_A_HREF]); } break; @@ -214,16 +253,14 @@ value[HTML_AREA_HREF], NULL); HTextImp_foundLink(me->text, element_number, HTML_AREA_HREF, address, present, value); - if (SGML_TRACE) - HTTrace("HTML Parser. Image map area `%s\'\n", value[HTML_AREA_HREF]); + HTTRACE(SGML_TRACE, "HTML Parser. Image map area `%s\'\n" _ value[HTML_AREA_HREF]); } break; case HTML_BASE: if (present[HTML_BASE_HREF] && value[HTML_BASE_HREF]) { HTAnchor_setBase(me->node_anchor, (char *) value[HTML_BASE_HREF]); - if (SGML_TRACE) - HTTrace("HTML Parser. New base `%s\'\n", value[HTML_BASE_HREF]); + HTTRACE(SGML_TRACE, "HTML Parser. New base `%s\'\n" _ value[HTML_BASE_HREF]); } break; @@ -233,8 +270,16 @@ value[HTML_BODY_BACKGROUND], NULL); HTextImp_foundLink(me->text, element_number, HTML_BODY_BACKGROUND, address, present, value); - if (SGML_TRACE) - HTTrace("HTML Parser. Background `%s\'\n", value[HTML_BODY_BACKGROUND]); + HTTRACE(SGML_TRACE, "HTML Parser. Background `%s\'\n" _ value[HTML_BODY_BACKGROUND]); + } + break; + + case HTML_FORM: + if (present[HTML_FORM_ACTION] && value[HTML_FORM_ACTION]) { + address = HTAnchor_findChildAndLink(me->node_anchor, NULL, + value[HTML_FORM_ACTION], NULL); + HTextImp_foundLink(me->text, element_number, HTML_FORM_ACTION, + address, present, value); } break; @@ -244,11 +289,19 @@ value[HTML_FRAME_SRC], NULL); HTextImp_foundLink(me->text, element_number, HTML_FRAME_SRC, address, present, value); - if (SGML_TRACE) - HTTrace("HTML Parser. Frame `%s\'\n", value[HTML_FRAME_SRC]); + HTTRACE(SGML_TRACE, "HTML Parser. Frame `%s\'\n" _ value[HTML_FRAME_SRC]); } break; + case HTML_INPUT: + if (present[HTML_INPUT_SRC] && value[HTML_INPUT_SRC]) { + address = HTAnchor_findChildAndLink(me->node_anchor, NULL, + value[HTML_INPUT_SRC], NULL); + HTextImp_foundLink(me->text, element_number, HTML_INPUT_SRC, + address, present, value); + } + break; + case HTML_IMG: if (present[HTML_IMG_SRC] && value[HTML_IMG_SRC]) { address = HTAnchor_findChildAndLink(me->node_anchor, NULL, @@ -367,15 +420,14 @@ break; case HTML_TITLE: - HTChunk_clear(me->title); + HTChunk_truncate(me->title,0); break; } /* Update our parse stack */ if (SGML_findTagContents(me->dtd, element_number) != SGML_EMPTY) { if (me->sp == me->stack) { - if (SGML_TRACE) - HTTrace("HTML Parser. Maximum nesting of %d exceded!\n", MAX_NESTING); + HTTRACE(SGML_TRACE, "HTML Parser. Maximum nesting of %d exceded!\n" _ MAX_NESTING); me->overflow++; return; } @@ -401,7 +453,7 @@ } me->sp++; if (me->sp > me->stack + MAX_NESTING - 1) { - if (SGML_TRACE) HTTrace("HTML Parser. Bottom of parse stack reached\n"); + HTTRACE(SGML_TRACE, "HTML Parser. Bottom of parse stack reached\n"); me->sp = me->stack + MAX_NESTING - 1; } @@ -427,7 +479,7 @@ HTextImp_build(me->text, HTEXT_BEGIN); me->started = YES; } - if (entity_number>=0 && entity_number=0 && entity_numberstarted) HTextImp_build(me->text, HTEXT_BEGIN); if (me->comment_end) HTML_put_string(me, me->comment_end); HTextImp_build(me->text, HTEXT_END); + HTextImp_delete(me->text); HTChunk_delete(me->title); if (me->target) FREE_TARGET(me); HT_FREE(me); @@ -486,6 +539,7 @@ { if (!me->started) HTextImp_build(me->text, HTEXT_BEGIN); HTextImp_build(me->text, HTEXT_ABORT); + HTextImp_delete(me->text); HTChunk_delete(me->title); if (me->target) ABORT_TARGET(me); HT_FREE(me); diff -Naur xdvik-22.40l/libs/libwww/HTML.h xdvik-22.40n/libs/libwww/HTML.h --- xdvik-22.40l/libs/libwww/HTML.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTML.h Fri Sep 13 00:23:46 2002 @@ -85,6 +85,6 @@ - @(#) $Id: HTML.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ + @(#) $Id: HTML.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMLGen.c xdvik-22.40n/libs/libwww/HTMLGen.c --- xdvik-22.40l/libs/libwww/HTMLGen.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMLGen.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMLGen.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMLGen.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This version of the HTML object sends HTML markup to the output stream. ** @@ -404,8 +404,7 @@ me->dtd = HTML_dtd(); if ((me->target = HTStreamStack(WWW_HTML, output_format, output_stream, request, YES)) == NULL) { - if (STREAM_TRACE) - HTTrace("HTMLGen..... Can't convert to media type\n"); + HTTRACE(STREAM_TRACE, "HTMLGen..... Can't convert to media type\n"); HT_FREE(me); me->target = HTErrorStream(); } diff -Naur xdvik-22.40l/libs/libwww/HTMLGen.h xdvik-22.40n/libs/libwww/HTMLGen.h --- xdvik-22.40l/libs/libwww/HTMLGen.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMLGen.h Fri Sep 13 00:23:46 2002 @@ -55,7 +55,7 @@ -@(#) $Id: HTMLGen.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +@(#) $Id: HTMLGen.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMLPDTD.c xdvik-22.40n/libs/libwww/HTMLPDTD.c --- xdvik-22.40l/libs/libwww/HTMLPDTD.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMLPDTD.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMLPDTD.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMLPDTD.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** 6 Nov 93 MD Increased size of img_attr array to make space ** for terminator. @@ -12,6 +12,7 @@ /* Library include files */ #include "wwwsys.h" #include "HTUtils.h" + #include "HTMLPDTD.h" struct _HTStructured { @@ -24,6 +25,7 @@ ** This table must be matched exactly with ALL the translation tables */ PRIVATE const char* entities[HTML_ENTITIES] = { +/* 00 */ "AElig", /* capital AE diphthong (ligature) */ "Aacute", /* capital A, acute accent */ "Acirc", /* capital A, circumflex accent */ @@ -34,6 +36,7 @@ "Ccedil", /* capital C, cedilla */ "ETH", /* capital Eth, Icelandic */ "Eacute", /* capital E, acute accent */ +/* 10 */ "Ecirc", /* capital E, circumflex accent */ "Egrave", /* capital E, grave accent */ "Euml", /* capital E, dieresis or umlaut mark */ @@ -44,6 +47,7 @@ "Ntilde", /* capital N, tilde */ "Oacute", /* capital O, acute accent */ "Ocirc", /* capital O, circumflex accent */ +/* 20 */ "Ograve", /* capital O, grave accent */ "Oslash", /* capital O, slash */ "Otilde", /* capital O, tilde */ @@ -54,46 +58,101 @@ "Ugrave", /* capital U, grave accent */ "Uuml", /* capital U, dieresis or umlaut mark */ "Yacute", /* capital Y, acute accent */ +/* 30 */ "aacute", /* small a, acute accent */ "acirc", /* small a, circumflex accent */ + "acute", /* acute accent */ "aelig", /* small ae diphthong (ligature) */ "agrave", /* small a, grave accent */ "amp", /* ampersand */ "aring", /* small a, ring */ "atilde", /* small a, tilde */ "auml", /* small a, dieresis or umlaut mark */ + "brvbar", /* broken vertical bar */ +/* 40 */ "ccedil", /* small c, cedilla */ + "cedil", /* cedilla */ + "cent", /* cent sign */ + "copy", /* copyright */ + "curren", /* general currency sign */ + "deg", /* degree sign */ + "divide", /* division sign */ "eacute", /* small e, acute accent */ "ecirc", /* small e, circumflex accent */ "egrave", /* small e, grave accent */ +/* 50 */ "eth", /* small eth, Icelandic */ "euml", /* small e, dieresis or umlaut mark */ + "frac12", /* fraction one-half */ + "frac14", /* fraction one-fourth */ + "frac34", /* fraction three-fourth */ "gt", /* greater than */ "iacute", /* small i, acute accent */ "icirc", /* small i, circumflex accent */ + "iexcl", /* inverted exclamation */ "igrave", /* small i, grave accent */ +/* 60 */ + "iquest", /* inverted question mark */ "iuml", /* small i, dieresis or umlaut mark */ + "laquo", /* left angle quote */ "lt", /* less than */ + "macr", /* macron accent */ + "micro", /* micro sign (greek mu) */ + "middot", /* middle dot */ "nbsp", /* non breaking space */ + "not", /* not sign */ "ntilde", /* small n, tilde */ +/* 70 */ "oacute", /* small o, acute accent */ "ocirc", /* small o, circumflex accent */ "ograve", /* small o, grave accent */ + "ordf", /* feminine ordinal */ + "ordm", /* masculine ordinal */ "oslash", /* small o, slash */ "otilde", /* small o, tilde */ "ouml", /* small o, dieresis or umlaut mark */ + "para", /* paragraph sign */ + "plusmn", /* plus or minus */ +/* 80 */ + "pound", /* pound sign */ "quot", /* double quote sign - June 1994 */ + "raquo", /* right angle quote */ + "reg", /* registered trademark */ + "sect", /* section sign */ + "shi", /* soft hyphen */ + "sup1", /* superscript 1 */ + "sup2", /* superscript 2 */ + "sup3", /* superscript 3 */ "szlig", /* small sharp s, German (sz ligature) */ +/* 90 */ "thorn", /* small thorn, Icelandic */ + "times", /* multiply sign */ "uacute", /* small u, acute accent */ "ucirc", /* small u, circumflex accent */ "ugrave", /* small u, grave accent */ + "uml", /* dieresis or umlaut mark */ "uuml", /* small u, dieresis or umlaut mark */ "yacute", /* small y, acute accent */ - "yuml", /* small y, dieresis or umlaut mark */ + "yen", /* yen sign */ + "yuml" /* small y, dieresis or umlaut mark */ +/* 100 */ }; /* +** ATTRIBUTE DEFINITION MACROS (see HTMLPDTD.h) +*/ + +/* + * redefine the macros, so that the "stringized" attribute name + * is generated + */ + +#undef HTML_ATTR +#define HTML_ATTR(t,a) { #a } +#undef HTML_ATTRIBUTES +#define HTML_ATTRIBUTES(t) { 0 } + +/* ** ATTRIBUTE LISTS */ @@ -101,204 +160,411 @@ {{ 0 }}; PRIVATE HTAttr body_attr[HTML_BODY_ATTRIBUTES+1] = { /* to catch images */ - { "BACKGROUND" }, - { 0 } /* Terminate list */ + HTML_ATTR(BODY,ALINK), + HTML_ATTR(BODY,BACKGROUND), + HTML_ATTR(BODY,BGCOLOR), + HTML_ATTR(BODY,CLASS), + HTML_ATTR(BODY,DIR), + HTML_ATTR(BODY,ID), + HTML_ATTR(BODY,LANG), + HTML_ATTR(BODY,LINK), + HTML_ATTR(BODY,STYLE), + HTML_ATTR(BODY,TEXT), + HTML_ATTR(BODY,TITLE), + HTML_ATTR(BODY,VLINK), + HTML_ATTRIBUTES(BODY) }; PRIVATE HTAttr frame_attr[HTML_FRAME_ATTRIBUTES+1] = { /* frame attributes */ - { "SRC" }, - { 0 } /* Terminate list */ + HTML_ATTR(FRAME,CLASS), + HTML_ATTR(FRAME,FRAMEBORDER), + HTML_ATTR(FRAME,ID), + HTML_ATTR(FRAME,NAME), + HTML_ATTR(FRAME,MARGINHEIGHT), + HTML_ATTR(FRAME,MARGINWIDTH), + HTML_ATTR(FRAME,NORESIZE), + HTML_ATTR(FRAME,LONGDESC), + HTML_ATTR(FRAME,SCROLLING), + HTML_ATTR(FRAME,SRC), + HTML_ATTR(FRAME,STYLE), + HTML_ATTR(FRAME,TARGET), + HTML_ATTR(FRAME,TITLE), + HTML_ATTRIBUTES(FRAME) }; PRIVATE HTAttr frameset_attr[HTML_FRAMESET_ATTRIBUTES+1] = { /* frameset attributes */ - - { "BORDER" }, - { "BORDERCOLOR" }, - { "COLS" }, - { "FRAMEBORDER" }, - { "ONBLUR" }, - { "ONFOCUS" }, - { "ONLOAD" }, - { "ONUNLOAD" }, - { "ROWS" }, - { 0 } /* Terminate list */ + HTML_ATTR(FRAMESET,CLASS), + HTML_ATTR(FRAMESET,COLS), + HTML_ATTR(FRAMESET,ID), + HTML_ATTR(FRAMESET,ROWS), + HTML_ATTR(FRAMESET,STYLE), + HTML_ATTR(FRAMESET,TITLE), + HTML_ATTRIBUTES(FRAMESET) }; PRIVATE HTAttr a_attr[HTML_A_ATTRIBUTES+1] = { /* Anchor attributes */ - { "EFFECT" }, - { "HREF"}, - { "ID" }, - { "METHODS" }, - { "NAME" }, /* Should be ID */ - { "PRINT" }, - { "REL" }, /* Relationship */ - { "REV" }, /* Reverse relationship */ - { "SHAPE" }, - { "TITLE" }, - { 0 } /* Terminate list */ + HTML_ATTR(A,ACCESSKEY), + HTML_ATTR(A,CHARSET), + HTML_ATTR(A,CLASS), + HTML_ATTR(A,COORDS), + HTML_ATTR(A,DIR), + HTML_ATTR(A,HREF), + HTML_ATTR(A,HREFLANG), + HTML_ATTR(A,ID), + HTML_ATTR(A,NAME), + HTML_ATTR(A,REL), + HTML_ATTR(A,REV), + HTML_ATTR(A,SHAPE), + HTML_ATTR(A,STYLE), + HTML_ATTR(A,TABINDEX), + HTML_ATTR(A,TARGET), + HTML_ATTR(A,TYPE), + HTML_ATTR(A,TITLE), + HTML_ATTRIBUTES(A) }; +PRIVATE HTAttr applet_attr[HTML_APPLET_ATTRIBUTES+1] = { + HTML_ATTR(APPLET,ALIGN), + HTML_ATTR(APPLET,ALT), + HTML_ATTR(APPLET,ARCHIVE), + HTML_ATTR(APPLET,CLASS), + HTML_ATTR(APPLET,CODE), + HTML_ATTR(APPLET,CODEBASE), + HTML_ATTR(APPLET,HEIGHT), + HTML_ATTR(APPLET,HSPACE), + HTML_ATTR(APPLET,ID), + HTML_ATTR(APPLET,NAME), + HTML_ATTR(APPLET,OBJECT), + HTML_ATTR(APPLET,STYLE), + HTML_ATTR(APPLET,TITLE), + HTML_ATTR(APPLET,VSPACE), + HTML_ATTR(APPLET,WIDTH), + HTML_ATTRIBUTES(APPLET) +}; + PRIVATE HTAttr area_attr[HTML_AREA_ATTRIBUTES+1] = { /* Area attributes */ - { "ALT" }, - { "ACCESSKEY"}, - { "COORDS" }, - { "HREF" }, - { "NOHREF" }, - { "ONBLUR" }, - { "ONFOCUS" }, - { "SHAPE" }, - { "TABINDEX" }, - { 0 } /* Terminate list */ + HTML_ATTR(AREA,ACCESSKEY), + HTML_ATTR(AREA,ALT), + HTML_ATTR(AREA,CLASS), + HTML_ATTR(AREA,COORDS), + HTML_ATTR(AREA,DIR), + HTML_ATTR(AREA,HREF), + HTML_ATTR(AREA,ID), + HTML_ATTR(AREA,NAME), + HTML_ATTR(AREA,NOHREF), + HTML_ATTR(AREA,LANG), + HTML_ATTR(AREA,SHAPE), + HTML_ATTR(AREA,STYLE), + HTML_ATTR(AREA,TABINDEX), + HTML_ATTR(AREA,TARGET), + HTML_ATTR(AREA,TITLE), + HTML_ATTRIBUTES(AREA) }; PRIVATE HTAttr base_attr[HTML_BASE_ATTRIBUTES+1] = { /* BASE attributes */ - { "HREF"}, - { 0 } /* Terminate list */ + HTML_ATTR(BASE,HREF), + HTML_ATTR(BASE,TARGET), + HTML_ATTRIBUTES(BASE) }; - -PRIVATE HTAttr changed_attr[] = { - { "ID" }, - { "IDREF" }, - { 0 } /* terminate list */ -}; - -PRIVATE HTAttr fig_attr[] = { /* Figures */ - { "ALIGN" }, - { "ID" }, - { "INDEX" }, - { "ISMAP" }, /* @@@ NO! */ - { "LANG" }, - { "SRC" }, - { 0 } /* terminate list */ -}; - -PRIVATE HTAttr form_attr[] = { /* General, for many things */ - { "ACTION" }, - { "ID" }, - { "INDEX" }, - { "LANG" }, - { "METHOD" }, - { 0 } /* terminate list */ -}; - -PRIVATE HTAttr gen_attr[] = { /* General, for many things */ - { "ID" }, - { "INDEX" }, - { "LANG" }, - { 0 } /* terminate list */ -}; - -PRIVATE HTAttr htmlplus_attr[] = { /* wrapper HTMLPLUS */ - { "FORMS" }, - { "VERSION" }, - { 0 } /* terminate list */ -}; - -PRIVATE HTAttr id_attr[2] = { - { "ID" }, - { 0 } /* terminate list */ -}; - -PRIVATE HTAttr image_attr[HTML_IMAGE_ATTRIBUTES+1] = { /* Image attributes */ - { "ALIGN" }, - { "ISMAP"}, /* Use HTTP SpaceJump instead */ - { "LANG" }, - { "SEETHRU"}, - { "SRC"}, - { 0 } /* Terminate list */ -}; +PRIVATE HTAttr bdo_attr[HTML_BDO_ATTRIBUTES+1] = { + HTML_ATTR(BDO,CLASS), + HTML_ATTR(BDO,DIR), + HTML_ATTR(BDO,ID), + HTML_ATTR(BDO,LANG), + HTML_ATTR(BDO,STYLE), + HTML_ATTR(BDO,TITLE), + HTML_ATTRIBUTES(BDO) +}; + +PRIVATE HTAttr bq_attr[HTML_BQ_ATTRIBUTES+1] = { + HTML_ATTR(BQ,CITE), + HTML_ATTR(BQ,CLASS), + HTML_ATTR(BQ,DIR), + HTML_ATTR(BQ,ID), + HTML_ATTR(BQ,LANG), + HTML_ATTR(BQ,STYLE), + HTML_ATTR(BQ,TITLE), + HTML_ATTRIBUTES(BQ) +}; + +PRIVATE HTAttr br_attr[HTML_BR_ATTRIBUTES+1] = { + HTML_ATTR(BR,CLASS), + HTML_ATTR(BR,CLEAR), + HTML_ATTR(BR,ID), + HTML_ATTR(BR,STYLE), + HTML_ATTR(BR,TITLE), + HTML_ATTRIBUTES(BR) +}; + +PRIVATE HTAttr button_attr[HTML_BUTTON_ATTRIBUTES+1] = { + HTML_ATTR(BUTTON,ACCESSKEY), + HTML_ATTR(BUTTON,CLASS), + HTML_ATTR(BUTTON,DIR), + HTML_ATTR(BUTTON,DISABLED), + HTML_ATTR(BUTTON,ID), + HTML_ATTR(BUTTON,LANG), + HTML_ATTR(BUTTON,NAME), + HTML_ATTR(BUTTON,STYLE), + HTML_ATTR(BUTTON,TABINDEX), + HTML_ATTR(BUTTON,TITLE), + HTML_ATTR(BUTTON,TYPE), + HTML_ATTR(BUTTON,VALUE), + HTML_ATTRIBUTES(BUTTON), +}; + +PRIVATE HTAttr col_attr[HTML_COL_ATTRIBUTES+1] = { + HTML_ATTR(COL,CLASS), + HTML_ATTR(COL,DIR), + HTML_ATTR(COL,ID), + HTML_ATTR(COL,LANG), + HTML_ATTR(COL,SPAN), + HTML_ATTR(COL,STYLE), + HTML_ATTR(COL,TITLE), + HTML_ATTR(COL,WIDTH), + HTML_ATTRIBUTES(COL) +}; + +PRIVATE HTAttr changes_attr[HTML_CHANGES_ATTRIBUTES+1] = { + HTML_ATTR(CHANGES,CITE), + HTML_ATTR(CHANGES,CLASS), + HTML_ATTR(CHANGES,DATETIME), + HTML_ATTR(CHANGES,DIR), + HTML_ATTR(CHANGES,ID), + HTML_ATTR(CHANGES,LANG), + HTML_ATTR(CHANGES,STYLE), + HTML_ATTR(CHANGES,TITLE), + HTML_ATTRIBUTES(CHANGES) +}; + +PRIVATE HTAttr font_attr[HTML_FONT_ATTRIBUTES+1] = { + HTML_ATTR(FONT,CLASS), + HTML_ATTR(FONT,COLOR), + HTML_ATTR(FONT,DIR), + HTML_ATTR(FONT,FACE), + HTML_ATTR(FONT,ID), + HTML_ATTR(FONT,LANG), + HTML_ATTR(FONT,SIZE), + HTML_ATTR(FONT,STYLE), + HTML_ATTR(FONT,TITLE), + HTML_ATTRIBUTES(FONT) +}; + +PRIVATE HTAttr form_attr[HTML_FORM_ATTRIBUTES+1] = { + HTML_ATTR(FORM,ACCEPT), + { "ACCEPT-CHARSET" }, /* HTML_ATTR(FORM,ACCEPT_CHARSET) */ + HTML_ATTR(FORM,ACTION), + HTML_ATTR(FORM,CLASS), + HTML_ATTR(FORM,DIR), + HTML_ATTR(FORM,ENCTYPE), + HTML_ATTR(FORM,ID), + HTML_ATTR(FORM,LANG), + HTML_ATTR(FORM,METHOD), + HTML_ATTR(FORM,STYLE), + HTML_ATTR(FORM,TARGET), + HTML_ATTR(FORM,TITLE), + HTML_ATTRIBUTES(FORM) +}; + +PRIVATE HTAttr gen_attr[HTML_GEN_ATTRIBUTES+1] = { /* General, for many things */ + HTML_ATTR(GEN,CLASS), + HTML_ATTR(GEN,DIR), + HTML_ATTR(GEN,ID), + HTML_ATTR(GEN,LANG), + HTML_ATTR(GEN,STYLE), + HTML_ATTR(GEN,TITLE), + HTML_ATTRIBUTES(GEN) +}; + +PRIVATE HTAttr block_attr[HTML_BLOCK_ATTRIBUTES+1] = { /* DIV, SPAN, H1-H6 */ + HTML_ATTR(BLOCK,ALIGN), + HTML_ATTR(BLOCK,CLASS), + HTML_ATTR(BLOCK,DIR), + HTML_ATTR(BLOCK,ID), + HTML_ATTR(BLOCK,LANG), + HTML_ATTR(BLOCK,STYLE), + HTML_ATTR(BLOCK,TITLE), + HTML_ATTRIBUTES(BLOCK) +}; + +PRIVATE HTAttr head_attr[HTML_HEAD_ATTRIBUTES+1] = { + HTML_ATTR(HEAD,DIR), + HTML_ATTR(HEAD,LANG), + HTML_ATTR(HEAD,PROFILE), + HTML_ATTRIBUTES(HEAD) +}; + +PRIVATE HTAttr hr_attr[HTML_HR_ATTRIBUTES+1] = { + HTML_ATTR(HR,ALIGN), + HTML_ATTR(HR,CLASS), + HTML_ATTR(HR,DIR), + HTML_ATTR(HR,ID), + HTML_ATTR(HR,LANG), + HTML_ATTR(HR,NOSHADE), + HTML_ATTR(HR,SIZE), + HTML_ATTR(HR,STYLE), + HTML_ATTR(HR,TITLE), + HTML_ATTR(HR,WIDTH), + HTML_ATTRIBUTES(HR) +}; + +PRIVATE HTAttr html_attr[HTML_HTML_ATTRIBUTES+1] = { + HTML_ATTR(HTML,DIR), + HTML_ATTR(HTML,LANG), + HTML_ATTR(HTML,VERSION), + HTML_ATTRIBUTES(HTML) +}; + +PRIVATE HTAttr iframe_attr[HTML_IFRAME_ATTRIBUTES+1] = { + HTML_ATTR(IFRAME,ALIGN), + HTML_ATTR(IFRAME,CLASS), + HTML_ATTR(IFRAME,FRAMEBORDER), + HTML_ATTR(IFRAME,HEIGHT), + HTML_ATTR(IFRAME,ID), + HTML_ATTR(IFRAME,LONGDESC), + HTML_ATTR(IFRAME,MARGINHEIGHT), + HTML_ATTR(IFRAME,MARGINWIDTH), + HTML_ATTR(IFRAME,NAME), + HTML_ATTR(IFRAME,SCROLLING), + HTML_ATTR(IFRAME,SRC), + HTML_ATTR(IFRAME,STYLE), + HTML_ATTR(IFRAME,TARGET), + HTML_ATTR(IFRAME,TITLE), + HTML_ATTR(IFRAME,WIDTH), + HTML_ATTRIBUTES(IFRAME) +}; PRIVATE HTAttr img_attr[HTML_IMG_ATTRIBUTES+1] = { /* IMG attributes */ - { "ALIGN" }, - { "ALT" }, - { "ISMAP"}, /* Use HTTP SpaceJump instead */ - { "LOWSRC"}, - { "SEETHRU"}, - { "SRC"}, - { 0 } /* Terminate list */ + HTML_ATTR(IMG,ALIGN), + HTML_ATTR(IMG,ALT), + HTML_ATTR(IMG,BORDER), + HTML_ATTR(IMG,CLASS), + HTML_ATTR(IMG,DIR), + HTML_ATTR(IMG,HEIGHT), + HTML_ATTR(IMG,HSPACE), + HTML_ATTR(IMG,ID), + HTML_ATTR(IMG,ISMAP), + HTML_ATTR(IMG,LANG), + HTML_ATTR(IMG,LONGDESC), + HTML_ATTR(IMG,SRC), + HTML_ATTR(IMG,STYLE), + HTML_ATTR(IMG,TITLE), + HTML_ATTR(IMG,USEMAP), + HTML_ATTR(IMG,VSPACE), + HTML_ATTR(IMG,WIDTH), + HTML_ATTRIBUTES(IMG) }; PRIVATE HTAttr input_attr[HTML_INPUT_ATTRIBUTES+1] = { - { "ALIGN" }, - { "CHECKED" }, - { "DISABLED" }, - { "ERROR" }, - { "MAXLENGTH" }, /* WSM bug fix, was MAX */ - { "MIN" }, - { "NAME" }, - { "SIZE" }, - { "SRC" }, - { "TYPE" }, - { "VALUE" }, - { "0" } -}; - -PRIVATE HTAttr l_attr[] = { - { "ALIGN"}, - { "ID" }, - { "LANG" }, - { "INDEX" }, - { 0 } /* Terminate list */ -}; - -PRIVATE HTAttr li_attr[] = { - { "ID" }, - { "INDEX" }, - { "LANG" }, - { "SRC"}, - { 0 } /* Terminate list */ + HTML_ATTR(INPUT,ACCEPT), + HTML_ATTR(INPUT,ACCESSKEY), + HTML_ATTR(INPUT,ALIGN), + HTML_ATTR(INPUT,ALT), + HTML_ATTR(INPUT,CHECKED), + HTML_ATTR(INPUT,CLASS), + HTML_ATTR(INPUT,DIR), + HTML_ATTR(INPUT,DISABLED), + HTML_ATTR(INPUT,ID), + HTML_ATTR(INPUT,LANG), + HTML_ATTR(INPUT,MAXLENGTH), + HTML_ATTR(INPUT,NAME), + HTML_ATTR(INPUT,READONLY), + HTML_ATTR(INPUT,SIZE), + HTML_ATTR(INPUT,SRC), + HTML_ATTR(INPUT,STYLE), + HTML_ATTR(INPUT,TABINDEX), + HTML_ATTR(INPUT,TITLE), + HTML_ATTR(INPUT,TYPE), + HTML_ATTR(INPUT,USEMAP), + HTML_ATTR(INPUT,VALUE), + HTML_ATTRIBUTES(INPUT) +}; + +PRIVATE HTAttr isindex_attr[HTML_ISINDEX_ATTRIBUTES+1] = { + HTML_ATTR(ISINDEX,CLASS), + HTML_ATTR(ISINDEX,DIR), + HTML_ATTR(ISINDEX,ID), + HTML_ATTR(ISINDEX,LANG), + HTML_ATTR(ISINDEX,PROMPT), + HTML_ATTR(ISINDEX,STYLE), + HTML_ATTR(ISINDEX,TITLE), + HTML_ATTRIBUTES(ISINDEX) +}; + +PRIVATE HTAttr label_attr[HTML_LABEL_ATTRIBUTES+1] = { + HTML_ATTR(LABEL,ACCESSKEY), + HTML_ATTR(LABEL,CLASS), + HTML_ATTR(LABEL,DIR), + HTML_ATTR(LABEL,FOR), + HTML_ATTR(LABEL,ID), + HTML_ATTR(LABEL,LANG), + HTML_ATTR(LABEL,STYLE), + HTML_ATTR(LABEL,TITLE), + HTML_ATTRIBUTES(LABEL) +}; + +PRIVATE HTAttr legend_attr[HTML_LEGEND_ATTRIBUTES+1] = { + HTML_ATTR(LEGEND,ACCESSKEY), + HTML_ATTR(LEGEND,ALIGN), + HTML_ATTR(LEGEND,CLASS), + HTML_ATTR(LEGEND,DIR), + HTML_ATTR(LEGEND,ID), + HTML_ATTR(LEGEND,LANG), + HTML_ATTR(LEGEND,STYLE), + HTML_ATTR(LEGEND,TITLE), + HTML_ATTRIBUTES(LEGEND) +}; + +PRIVATE HTAttr li_attr[HTML_LI_ATTRIBUTES+1] = { + HTML_ATTR(LI,CLASS), + HTML_ATTR(LI,COMPACT), + HTML_ATTR(LI,DIR), + HTML_ATTR(LI,ID), + HTML_ATTR(LI,LANG), + HTML_ATTR(LI,STYLE), + HTML_ATTR(LI,TITLE), + HTML_ATTR(LI,TYPE), + HTML_ATTR(LI,VALUE), + HTML_ATTRIBUTES(LI) }; PRIVATE HTAttr link_attr[HTML_LINK_ATTRIBUTES+1] = { /* link attributes */ - { "CHARSET"}, - { "HREF"}, - { "HREFLANG"}, - { "MEDIA" }, - { "REL" }, /* Relationship */ - { "REV" }, /* Reverse relationship */ - { "TYPE" }, - { 0 } /* Terminate list */ -}; - -PRIVATE HTAttr object_attr[HTML_OBJECT_ATTRIBUTES+1] = { /* object attributes */ - { "ARCHIVE" }, - { "CLASSID" }, - { "CODEBASE" }, - { "CODETYPE" }, - { "DATA" }, - { "DECLARE" }, - { "HIGHT" }, - { "NAME" }, - { "STANDBY" }, - { "TABINDEX" }, - { "TYPE" }, - { "USEMAP" }, - { "WIDTH" }, - { 0 } + HTML_ATTR(LINK,CHARSET), + HTML_ATTR(LINK,CLASS), + HTML_ATTR(LINK,DIR), + HTML_ATTR(LINK,HREF), + HTML_ATTR(LINK,HREFLANG), + HTML_ATTR(LINK,ID), + HTML_ATTR(LINK,LANG), + HTML_ATTR(LINK,MEDIA), + HTML_ATTR(LINK,REL), + HTML_ATTR(LINK,REV), + HTML_ATTR(LINK,STYLE), + HTML_ATTR(LINK,TARGET), + HTML_ATTR(LINK,TITLE), + HTML_ATTR(LINK,TYPE), + HTML_ATTRIBUTES(LINK) }; -PRIVATE HTAttr list_attr[] = { - { "COMPACT"}, - { "ID" }, - { "LANG" }, - { "INDEX" }, - { 0 } /* Terminate list */ -}; - -PRIVATE HTAttr glossary_attr[HTML_DL_ATTRIBUTES+1] = { - { "ID" }, - { "COMPACT " }, - { "INDEX" }, - { 0 } /* Terminate list */ +PRIVATE HTAttr map_attr[HTML_MAP_ATTRIBUTES+1] = { + HTML_ATTR(MAP,CLASS), + HTML_ATTR(MAP,DIR), + HTML_ATTR(MAP,ID), + HTML_ATTR(MAP,LANG), + HTML_ATTR(MAP,NAME), + HTML_ATTR(MAP,STYLE), + HTML_ATTR(MAP,TITLE), + HTML_ATTRIBUTES(MAP) }; PRIVATE HTAttr meta_attr[HTML_META_ATTRIBUTES+1] = { - { "CONTENT"}, - { "HTTP-EQUIV"}, - { "NAME"}, - { "SCHEME" }, - { 0 } /* Terminate list */ + HTML_ATTR(META,CONTENT), + HTML_ATTR(META,DIR), + { "HTTP-EQUIV" }, /* HTML_ATTR(META,HTTP_EQUIV) */ + HTML_ATTR(META,LANG), + HTML_ATTR(META,NAME), + HTML_ATTR(META,SCHEME), + HTML_ATTRIBUTES(META) }; PRIVATE HTAttr nextid_attr[HTML_NEXTID_ATTRIBUTES+1] = { @@ -306,76 +572,214 @@ { 0 } /* Terminate list */ }; -PRIVATE HTAttr note_attr[HTML_NOTE_ATTRIBUTES+1] = { /* Footnotes etc etc */ - { "ID" }, - { "INDEX" }, - { "LANG" }, - { "ROLE" }, - { 0 } /* terminate list */ -}; +PRIVATE HTAttr object_attr[HTML_OBJECT_ATTRIBUTES+1] = { /* object attributes */ + HTML_ATTR(OBJECT,ALIGN), + HTML_ATTR(OBJECT,ARCHIVE), + HTML_ATTR(OBJECT,BORDER), + HTML_ATTR(OBJECT,CLASS), + HTML_ATTR(OBJECT,CLASSID), + HTML_ATTR(OBJECT,CODEBASE), + HTML_ATTR(OBJECT,CODETYPE), + HTML_ATTR(OBJECT,DATA), + HTML_ATTR(OBJECT,DECLARE), + HTML_ATTR(OBJECT,DIR), + HTML_ATTR(OBJECT,HEIGHT), + HTML_ATTR(OBJECT,HSPACE), + HTML_ATTR(OBJECT,ID), + HTML_ATTR(OBJECT,LANG), + HTML_ATTR(OBJECT,NAME), + HTML_ATTR(OBJECT,STANDBY), + HTML_ATTR(OBJECT,STYLE), + HTML_ATTR(OBJECT,TABINDEX), + HTML_ATTR(OBJECT,TITLE), + HTML_ATTR(OBJECT,TYPE), + HTML_ATTR(OBJECT,USEMAP), + HTML_ATTR(OBJECT,VSPACE), + HTML_ATTR(OBJECT,WIDTH), + HTML_ATTRIBUTES(OBJECT) +}; -PRIVATE HTAttr option_attr[HTML_OPTION_ATTRIBUTES+1] = { - { "DISABLED" }, - { "LANG" }, - { "SELECTED" }, - { 0 } +PRIVATE HTAttr ol_attr[HTML_OL_ATTRIBUTES+1] = { + HTML_ATTR(OL,CLASS), + HTML_ATTR(OL,COMPACT), + HTML_ATTR(OL,DIR), + HTML_ATTR(OL,ID), + HTML_ATTR(OL,LANG), + HTML_ATTR(OL,START), + HTML_ATTR(OL,STYLE), + HTML_ATTR(OL,TITLE), + HTML_ATTR(OL,TYPE), + HTML_ATTRIBUTES(OL) +}; + +PRIVATE HTAttr optgroup_attr[HTML_OPTGROUP_ATTRIBUTES+1] = { + HTML_ATTR(OPTGROUP,CLASS), + HTML_ATTR(OPTGROUP,DISABLED), + HTML_ATTR(OPTGROUP,DIR), + HTML_ATTR(OPTGROUP,ID), + HTML_ATTR(OPTGROUP,LABEL), + HTML_ATTR(OPTGROUP,LANG), + HTML_ATTR(OPTGROUP,STYLE), + HTML_ATTR(OPTGROUP,TITLE), + HTML_ATTRIBUTES(OPTGROUP) }; -PRIVATE HTAttr render_attr[HTML_RENDER_ATTRIBUTES+1] = { - { "STYLE" }, - { "TAG" }, - { 0 } /* Terminate list */ +PRIVATE HTAttr option_attr[HTML_OPTION_ATTRIBUTES+1] = { + HTML_ATTR(OPTION,CLASS), + HTML_ATTR(OPTION,DISABLED), + HTML_ATTR(OPTION,DIR), + HTML_ATTR(OPTION,ID), + HTML_ATTR(OPTION,LABEL), + HTML_ATTR(OPTION,LANG), + HTML_ATTR(OPTION,SELECTED), + HTML_ATTR(OPTION,STYLE), + HTML_ATTR(OPTION,TITLE), + HTML_ATTR(OPTION,VALUE), + HTML_ATTRIBUTES(OPTION) +}; + +PRIVATE HTAttr param_attr[HTML_PARAM_ATTRIBUTES+1] = { + HTML_ATTR(PARAM,ID), + HTML_ATTR(PARAM,NAME), + HTML_ATTR(PARAM,TYPE), + HTML_ATTR(PARAM,VALUE), + HTML_ATTR(PARAM,VALUETYPE), + HTML_ATTRIBUTES(PARAM) +}; + +PRIVATE HTAttr pre_attr[HTML_PRE_ATTRIBUTES+1] = { + HTML_ATTR(PRE,CLASS), + HTML_ATTR(PRE,DIR), + HTML_ATTR(PRE,ID), + HTML_ATTR(PRE,LANG), + HTML_ATTR(PRE,STYLE), + HTML_ATTR(PRE,TITLE), + HTML_ATTR(PRE,WIDTH), + HTML_ATTRIBUTES(PRE) +}; + +PRIVATE HTAttr script_attr[HTML_SCRIPT_ATTRIBUTES+1] = { + HTML_ATTR(SCRIPT,CHARSET), + HTML_ATTR(SCRIPT,DEFER), + HTML_ATTR(SCRIPT,LANGUAGE), + HTML_ATTR(SCRIPT,SRC), + HTML_ATTR(SCRIPT,TYPE), + HTML_ATTRIBUTES(SCRIPT) }; PRIVATE HTAttr select_attr[HTML_SELECT_ATTRIBUTES+1] = { - { "ERROR" }, - { "LANG" }, - { "MULTIPLE" }, /* WSM bug fix, was SEVERAL */ - { "NAME" }, - { "SIZE" }, /* WSM bug fix, missing */ - { 0 }, -}; - -PRIVATE HTAttr tab_attr[HTML_TAB_ATTRIBUTES+1] = { - { "ALIGN" }, - { "AT" }, - { 0 } + HTML_ATTR(SELECT,CLASS), + HTML_ATTR(SELECT,DIR), + HTML_ATTR(SELECT,DISABLED), + HTML_ATTR(SELECT,ID), + HTML_ATTR(SELECT,LANG), + HTML_ATTR(SELECT,MULTIPLE), + HTML_ATTR(SELECT,NAME), + HTML_ATTR(SELECT,SIZE), + HTML_ATTR(SELECT,STYLE), + HTML_ATTR(SELECT,TABINDEX), + HTML_ATTR(SELECT,TITLE), + HTML_ATTRIBUTES(SELECT) +}; + +PRIVATE HTAttr style_attr[HTML_STYLE_ATTRIBUTES+1] = { + HTML_ATTR(STYLE,DIR), + HTML_ATTR(STYLE,LANG), + HTML_ATTR(STYLE,MEDIA), + HTML_ATTR(STYLE,TITLE), + HTML_ATTR(STYLE,TYPE), + HTML_ATTRIBUTES(STYLE) }; PRIVATE HTAttr table_attr[HTML_TABLE_ATTRIBUTES+1] = { - { "BORDER" }, - { "ID" }, - { "INDEX" }, - { "LANG" }, - { 0 } + HTML_ATTR(TABLE,ALIGN), + HTML_ATTR(TABLE,BGCOLOR), + HTML_ATTR(TABLE,BORDER), + HTML_ATTR(TABLE,CELLPADDING), + HTML_ATTR(TABLE,CELLSPACING), + HTML_ATTR(TABLE,CLASS), + HTML_ATTR(TABLE,DIR), + HTML_ATTR(TABLE,FRAME), + HTML_ATTR(TABLE,ID), + HTML_ATTR(TABLE,LANG), + HTML_ATTR(TABLE,RULES), + HTML_ATTR(TABLE,SUMMARY), + HTML_ATTR(TABLE,STYLE), + HTML_ATTR(TABLE,TITLE), + HTML_ATTR(TABLE,WIDTH), + HTML_ATTRIBUTES(TABLE) +}; + +PRIVATE HTAttr tele_attr[HTML_TELE_ATTRIBUTES+1] = { + HTML_ATTR(TELE,ALIGN), + HTML_ATTR(TELE,CHAR), + HTML_ATTR(TELE,CHAROFF), + HTML_ATTR(TELE,CLASS), + HTML_ATTR(TELE,DIR), + HTML_ATTR(TELE,ID), + HTML_ATTR(TELE,LANG), + HTML_ATTR(TELE,STYLE), + HTML_ATTR(TELE,TITLE), + HTML_ATTR(TELE,VALIGN), + HTML_ATTRIBUTES(TELE) }; PRIVATE HTAttr td_attr[HTML_TD_ATTRIBUTES+1] = { - { "ALIGN" }, - { "COLSPAN" }, - { "ROWSPAN" }, - { "TAG" }, - { 0 } + HTML_ATTR(TD,ABBR), + HTML_ATTR(TD,ALIGN), + HTML_ATTR(TD,AXIS), + HTML_ATTR(TD,BGCOLOR), + HTML_ATTR(TD,CHAR), + HTML_ATTR(TD,CHAROFF), + HTML_ATTR(TD,CLASS), + HTML_ATTR(TD,COLSPAN), + HTML_ATTR(TD,DIR), + HTML_ATTR(TD,ID), + HTML_ATTR(TD,HEADERS), + HTML_ATTR(TD,HEIGHT), + HTML_ATTR(TD,LANG), + HTML_ATTR(TD,NOWRAP), + HTML_ATTR(TD,ROWSPAN), + HTML_ATTR(TD,SCOPE), + HTML_ATTR(TD,STYLE), + HTML_ATTR(TD,TITLE), + HTML_ATTR(TD,VALIGN), + HTML_ATTR(TD,WIDTH), + HTML_ATTRIBUTES(TD) }; PRIVATE HTAttr textarea_attr[HTML_TEXTAREA_ATTRIBUTES+1] = { - { "COLS" }, - { "DISABLED" }, - { "ERROR" }, - { "LANG" }, - { "NAME" }, - { "ROWS" }, - { 0 } + HTML_ATTR(TEXTAREA,CLASS), + HTML_ATTR(TEXTAREA,COLS), + HTML_ATTR(TEXTAREA,DIR), + HTML_ATTR(TEXTAREA,DISABLED), + HTML_ATTR(TEXTAREA,ID), + HTML_ATTR(TEXTAREA,LANG), + HTML_ATTR(TEXTAREA,NAME), + HTML_ATTR(TEXTAREA,READONLY), + HTML_ATTR(TEXTAREA,ROWS), + HTML_ATTR(TEXTAREA,STYLE), + HTML_ATTR(TEXTAREA,TABINDEX), + HTML_ATTR(TEXTAREA,TITLE), + HTML_ATTRIBUTES(TEXTAREA) +}; + +PRIVATE HTAttr title_attr[HTML_TITLE_ATTRIBUTES+1] = { + HTML_ATTR(TITLE,DIR), + HTML_ATTR(TITLE,LANG), + HTML_ATTRIBUTES(TITLE) }; PRIVATE HTAttr ul_attr[HTML_UL_ATTRIBUTES+1] = { - { "COMPACT" }, - { "ID" }, - { "INDEX" }, - { "LANG" }, - { "PLAIN" }, - { "WRAP" }, - { 0 } + HTML_ATTR(UL,CLASS), + HTML_ATTR(UL,COMPACT), + HTML_ATTR(UL,DIR), + HTML_ATTR(UL,ID), + HTML_ATTR(UL,LANG), + HTML_ATTR(UL,STYLE), + HTML_ATTR(UL,TITLE), + HTML_ATTR(UL,TYPE), + HTML_ATTRIBUTES(UL) }; /* @@ -387,96 +791,97 @@ */ PRIVATE HTTag tags[HTML_ELEMENTS] = { { "A" , a_attr, HTML_A_ATTRIBUTES, SGML_MIXED }, - { "ABBREV" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "ABSTRACT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "ABBR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "ACRONYM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "ADDED" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "ADDRESS" , no_attr, 0, SGML_MIXED }, + { "ADDRESS" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "APPLET" , applet_attr, HTML_APPLET_ATTRIBUTES, SGML_MIXED }, { "AREA" , area_attr, HTML_AREA_ATTRIBUTES, SGML_EMPTY }, - { "ARG" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "B" , no_attr, 0, SGML_MIXED }, + { "B" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "BASE" , base_attr, HTML_BASE_ATTRIBUTES, SGML_EMPTY }, - { "BLOCKQUOTE", no_attr, 0, SGML_MIXED }, + { "BASEFONT", font_attr, HTML_FONT_ATTRIBUTES, SGML_EMPTY }, + { "BDO" , bdo_attr, HTML_BDO_ATTRIBUTES, SGML_EMPTY }, + { "BIG" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "BLOCKQUOTE", bq_attr, HTML_BQ_ATTRIBUTES, SGML_MIXED }, { "BODY" , body_attr, HTML_BODY_ATTRIBUTES, SGML_MIXED }, - { "BOX" , no_attr, 0, SGML_MIXED }, - { "BR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, - { "BYLINE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "CAPTION" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "CHANGED" , changed_attr, HTML_CHANGED_ATTRIBUTES, SGML_MIXED }, + { "BR" , br_attr, HTML_BR_ATTRIBUTES, SGML_EMPTY }, + { "BUTTON" , button_attr, HTML_BUTTON_ATTRIBUTES, SGML_MIXED }, + { "CAPTION" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "CENTER" , no_attr, 0, SGML_MIXED }, { "CITE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "CMD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "CODE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "COMMENT" , no_attr, 0, SGML_MIXED }, + { "COL" , col_attr, HTML_COL_ATTRIBUTES, SGML_MIXED }, + { "COLGROUP", col_attr, HTML_COL_ATTRIBUTES, SGML_MIXED }, { "DD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, + { "DEL" , changes_attr, HTML_CHANGES_ATTRIBUTES,SGML_EMPTY }, { "DFN" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "DIR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "DL" , glossary_attr,HTML_DL_ATTRIBUTES, SGML_MIXED }, + { "DIV" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "DL" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "DT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, { "EM" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "FIG" , fig_attr, HTML_FIG_ATTRIBUTES, SGML_MIXED }, - { "FOOTNOTE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "FIELDSET", gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "FONT" , font_attr, HTML_FONT_ATTRIBUTES, SGML_MIXED }, { "FORM" , form_attr, HTML_FORM_ATTRIBUTES, SGML_MIXED }, { "FRAME" , frame_attr, HTML_FRAME_ATTRIBUTES, SGML_EMPTY }, - { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES, SGML_EMPTY }, - { "H1" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "H2" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "H3" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "H4" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "H5" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "H6" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "H7" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "HEAD" , no_attr, 0, SGML_MIXED }, - { "HR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_EMPTY }, - { "HTML" , no_attr, 0, SGML_MIXED }, /* */ - { "HTMLPLUS", htmlplus_attr,HTML_HTMLPLUS_ATTRIBUTES, SGML_MIXED }, + { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES,SGML_MIXED }, + { "H1" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "H2" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "H3" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "H4" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "H5" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "H6" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "HEAD" , head_attr, HTML_HEAD_ATTRIBUTES, SGML_MIXED }, + { "HR" , hr_attr, HTML_HR_ATTRIBUTES, SGML_EMPTY }, + { "HTML" , html_attr, HTML_HTML_ATTRIBUTES, SGML_MIXED }, /* */ { "I" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "IMAGE" , image_attr, HTML_IMAGE_ATTRIBUTES, SGML_EMPTY }, + { "IFRAME" , iframe_attr, HTML_IFRAME_ATTRIBUTES, SGML_MIXED }, { "IMG" , img_attr, HTML_IMG_ATTRIBUTES, SGML_EMPTY }, { "INPUT" , input_attr, HTML_INPUT_ATTRIBUTES, SGML_EMPTY }, - { "ISINDEX" , no_attr, 0, SGML_EMPTY }, + { "INS" , changes_attr, HTML_CHANGES_ATTRIBUTES,SGML_MIXED }, + { "ISINDEX" , isindex_attr, HTML_ISINDEX_ATTRIBUTES,SGML_EMPTY }, { "KBD" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "L" , l_attr, HTML_L_ATTRIBUTES, SGML_MIXED }, + { "LABEL" , label_attr, HTML_LABEL_ATTRIBUTES, SGML_MIXED }, + { "LEGEND" , legend_attr, HTML_LEGEND_ATTRIBUTES, SGML_MIXED }, { "LI" , li_attr, HTML_LI_ATTRIBUTES, SGML_EMPTY }, { "LINK" , link_attr, HTML_LINK_ATTRIBUTES, SGML_EMPTY }, - { "LISTING" , no_attr, 0, SGML_LITERAL }, - { "LIT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "MARGIN" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "MATH" , id_attr, HTML_ID_ATTRIBUTE, SGML_MIXED }, + { "MAP" , map_attr, HTML_MAP_ATTRIBUTES, SGML_MIXED }, { "MENU" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "META" , meta_attr, HTML_META_ATTRIBUTES, SGML_EMPTY }, { "NEXTID" , nextid_attr, 1, SGML_EMPTY }, - { "NOTE" , note_attr, HTML_NOTE_ATTRIBUTES, SGML_EMPTY }, - { "NOFRAMES", no_attr, 0, SGML_MIXED }, + { "NOFRAMES", gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "NOSCRIPT", gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "OBJECT" , object_attr, HTML_OBJECT_ATTRIBUTES, SGML_MIXED }, - { "OL" , list_attr, HTML_LIST_ATTRIBUTES, SGML_MIXED }, + { "OL" , ol_attr, HTML_OL_ATTRIBUTES, SGML_MIXED }, + { "OPTGROUP", optgroup_attr,HTML_OPTGROUP_ATTRIBUTES,SGML_MIXED }, { "OPTION" , option_attr, HTML_OPTION_ATTRIBUTES, SGML_EMPTY },/*Mixed?*/ - { "OVER" , no_attr, 0, SGML_MIXED }, - { "P" , l_attr, HTML_L_ATTRIBUTES, SGML_EMPTY }, - { "PERSON" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "PLAINTEXT", no_attr, 0, SGML_LITERAL }, - { "PRE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "P" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_EMPTY }, + { "PARAM" , param_attr, HTML_PARAM_ATTRIBUTES, SGML_EMPTY }, + { "PRE" , pre_attr, HTML_PRE_ATTRIBUTES, SGML_MIXED }, { "Q" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "QUOTE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "RENDER" , render_attr, HTML_RENDER_ATTRIBUTES, SGML_MIXED }, - { "REMOVED" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "S" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "SAMP" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "SCRIPT" , script_attr, HTML_SCRIPT_ATTRIBUTES, SGML_MIXED }, { "SELECT" , select_attr, HTML_SELECT_ATTRIBUTES, SGML_MIXED }, + { "SMALL" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "SPAN" , block_attr, HTML_BLOCK_ATTRIBUTES, SGML_MIXED }, + { "STRIKE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "STRONG" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, + { "STYLE" , style_attr, HTML_STYLE_ATTRIBUTES, SGML_MIXED }, { "SUB" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "SUP" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "TAB" , tab_attr, HTML_TAB_ATTRIBUTES, SGML_EMPTY }, { "TABLE" , table_attr, HTML_TABLE_ATTRIBUTES, SGML_MIXED }, - { "TD" , td_attr, HTML_TABLE_ATTRIBUTES, SGML_MIXED }, + { "TBODY" , tele_attr, HTML_TELE_ATTRIBUTES, SGML_MIXED }, + { "TD" , td_attr, HTML_TD_ATTRIBUTES, SGML_EMPTY /*SGML_MIXED*/ }, { "TEXTAREA", textarea_attr,HTML_TEXTAREA_ATTRIBUTES,SGML_MIXED}, - { "TH" , td_attr, HTML_TD_ATTRIBUTES, SGML_MIXED }, - { "TITLE" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "TR" , id_attr, HTML_ID_ATTRIBUTE, SGML_MIXED }, + { "TFOOT" , tele_attr, HTML_TELE_ATTRIBUTES, SGML_MIXED }, + { "TH" , td_attr, HTML_TD_ATTRIBUTES, SGML_EMPTY /*SGML_MIXED*/}, + { "THEAD" , tele_attr, HTML_TELE_ATTRIBUTES, SGML_MIXED }, + { "TITLE" , title_attr, HTML_TITLE_ATTRIBUTES, SGML_MIXED }, + { "TR" , tele_attr, HTML_TELE_ATTRIBUTES, SGML_EMPTY /*SGML_MIXED*/}, { "TT" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "U" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, { "UL" , ul_attr, HTML_UL_ATTRIBUTES, SGML_MIXED }, { "VAR" , gen_attr, HTML_GEN_ATTRIBUTES, SGML_MIXED }, - { "XMP" , no_attr, 0, SGML_LITERAL } }; PRIVATE SGML_dtd HTMLP_dtd = { diff -Naur xdvik-22.40l/libs/libwww/HTMLPDTD.h xdvik-22.40n/libs/libwww/HTMLPDTD.h --- xdvik-22.40l/libs/libwww/HTMLPDTD.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMLPDTD.h Fri Sep 13 00:23:46 2002 @@ -41,7 +41,7 @@ Must Match all tables by element! */ -#define HTML_ENTITIES 67 +#define HTML_ENTITIES 100 /* . @@ -55,34 +55,36 @@ typedef enum _HTMLElement { HTML_A = 0, - HTML_ABBREV, - HTML_ABSTRACT, + HTML_ABBR, HTML_ACRONYM, - HTML_ADDED, HTML_ADDRESS, + HTML_APPLET, HTML_AREA, - HTML_ARG, HTML_B, HTML_BASE, + HTML_BASEFONT, + HTML_BDO, + HTML_BIG, HTML_BLOCKQUOTE, HTML_BODY, - HTML_BOX, HTML_BR, - HTML_BYLINE, + HTML_BUTTON, HTML_CAPTION, - HTML_CHANGED, + HTML_CENTER, HTML_CITE, - HTML_CMD, HTML_CODE, - HTML_COMMENT, + HTML_COL, + HTML_COLGROUP, HTML_DD, + HTML_DEL, HTML_DFN, HTML_DIR, + HTML_DIV, HTML_DL, HTML_DT, HTML_EM, - HTML_FIG, - HTML_FOOTNOTE, + HTML_FIELDSET, + HTML_FONT, HTML_FORM, HTML_FRAME, HTML_FRAMESET, @@ -92,59 +94,58 @@ HTML_H4, HTML_H5, HTML_H6, - HTML_H7, HTML_HEAD, HTML_HR, HTML_HTML, - HTML_HTMLPLUS, HTML_I, - HTML_IMAGE, + HTML_IFRAME, HTML_IMG, HTML_INPUT, + HTML_INS, HTML_ISINDEX, - HTML_KBD, - HTML_L, + HTML_KBD, + HTML_LABEL, + HTML_LEGEND, HTML_LI, HTML_LINK, - HTML_LISTING, - HTML_LIT, - HTML_MARGIN, - HTML_MATH, + HTML_MAP, HTML_MENU, HTML_META, - HTML_NEXTID, + HTML_NEXTID, /* !!! */ HTML_NOFRAMES, - HTML_NOTE, + HTML_NOSCRIPT, HTML_OBJECT, HTML_OL, + HTML_OPTGROUP, HTML_OPTION, - HTML_OVER, HTML_P, - HTML_PERSON, - HTML_PLAINTEXT, + HTML_PARAM, HTML_PRE, HTML_Q, - HTML_QUOTE, - HTML_RENDER, - HTML_REMOVED, HTML_S, HTML_SAMP, + HTML_SCRIPT, HTML_SELECT, + HTML_SMALL, + HTML_SPAN, + HTML_STRIKE, HTML_STRONG, + HTML_STYLE, HTML_SUB, HTML_SUP, - HTML_TAB, HTML_TABLE, + HTML_TBODY, HTML_TD, HTML_TEXTAREA, + HTML_TFOOT, HTML_TH, + HTML_THEAD, HTML_TITLE, HTML_TR, HTML_TT, HTML_U, HTML_UL, HTML_VAR, - HTML_XMP, HTML_ELEMENTS /* This must be the last entry */ } HTMLElement; @@ -157,21 +158,65 @@ must match the tables in HTMLPDTD.c! ( + Attributes definition Macros +) +*/ + +/* Define an attribute as HTML__ */ +#define HTML_ATTR(t,a) HTML_##t##_##a +#define HTML_ATTRIBUTES(t) HTML_##t##_ATTRIBUTES + +/* +( A ) */ -#define HTML_A_EFFECT 0 -#define HTML_A_HREF 1 -#define HTML_A_ID 2 -#define HTML_A_METHODS 3 -#define HTML_A_NAME 4 -#define HTML_A_PRINT 5 -#define HTML_A_REL 6 -#define HTML_A_REV 7 -#define HTML_A_SHAPE 8 -#define HTML_A_TITLE 9 -#define HTML_A_ATTRIBUTES 10 +enum _HTML_A_Attributes { + HTML_ATTR(A,ACCESSKEY) = 0, + HTML_ATTR(A,CHARSET), + HTML_ATTR(A,CLASS), + HTML_ATTR(A,COORDS), + HTML_ATTR(A,DIR), + HTML_ATTR(A,HREF), + HTML_ATTR(A,HREFLANG), + HTML_ATTR(A,ID), + HTML_ATTR(A,NAME), + HTML_ATTR(A,REL), + HTML_ATTR(A,REV), + HTML_ATTR(A,SHAPE), + HTML_ATTR(A,STYLE), + HTML_ATTR(A,TABINDEX), + HTML_ATTR(A,TARGET), + HTML_ATTR(A,TYPE), + HTML_ATTR(A,TITLE), + HTML_ATTRIBUTES(A) +}; + +/* +( + APPLET - Deprecated +) +*/ + +enum _HTML_APPLET_Attributes { + HTML_ATTR(APPLET,ALIGN) = 0, + HTML_ATTR(APPLET,ALT), + HTML_ATTR(APPLET,ARCHIVE), + HTML_ATTR(APPLET,CLASS), + HTML_ATTR(APPLET,CODE), + HTML_ATTR(APPLET,CODEBASE), + HTML_ATTR(APPLET,HEIGHT), + HTML_ATTR(APPLET,HSPACE), + HTML_ATTR(APPLET,ID), + HTML_ATTR(APPLET,NAME), + HTML_ATTR(APPLET,OBJECT), + HTML_ATTR(APPLET,STYLE), + HTML_ATTR(APPLET,TITLE), + HTML_ATTR(APPLET,VSPACE), + HTML_ATTR(APPLET,WIDTH), + HTML_ATTRIBUTES(APPLET) +}; /* ( @@ -179,16 +224,25 @@ ) */ -#define HTML_AREA_ALT 0 -#define HTML_AREA_ACCESSKEY 1 -#define HTML_AREA_COORDS 2 -#define HTML_AREA_HREF 3 -#define HTML_AREA_NOHREF 4 -#define HTML_AREA_ONBLUR 5 -#define HTML_AREA_ONFOCUS 6 -#define HTML_AREA_SHAPE 7 -#define HTML_AREA_TABINDEX 8 -#define HTML_AREA_ATTRIBUTES 9 +enum _HTML_AREA_Attributes { + HTML_ATTR(AREA,ACCESSKEY) = 0, + HTML_ATTR(AREA,ALT), + HTML_ATTR(AREA,CLASS), + HTML_ATTR(AREA,COORDS), + HTML_ATTR(AREA,DIR), + HTML_ATTR(AREA,HREF), + HTML_ATTR(AREA,ID), + HTML_ATTR(AREA,NAME), + HTML_ATTR(AREA,NOHREF), + HTML_ATTR(AREA,LANG), + HTML_ATTR(AREA,SHAPE), + HTML_ATTR(AREA,STYLE), + HTML_ATTR(AREA,TABINDEX), + HTML_ATTR(AREA,TARGET), + HTML_ATTR(AREA,TITLE), + HTML_ATTRIBUTES(AREA) +}; + /* ( @@ -196,8 +250,44 @@ ) */ -#define HTML_BASE_HREF 0 -#define HTML_BASE_ATTRIBUTES 1 +enum _HTML_BASE_Attributes { + HTML_ATTR(BASE,HREF) = 0, + HTML_ATTR(BASE,TARGET), + HTML_ATTRIBUTES(BASE) +}; + +/* +( + BDO +) +*/ + +enum _HTML_BDO_Attributes { + HTML_ATTR(BDO,CLASS) = 0, + HTML_ATTR(BDO,DIR), + HTML_ATTR(BDO,ID), + HTML_ATTR(BDO,LANG), + HTML_ATTR(BDO,STYLE), + HTML_ATTR(BDO,TITLE), + HTML_ATTRIBUTES(BDO) +}; + +/* +( + BLOCKQUOTE +) +*/ + +enum _HTML_BQ_Attributes { + HTML_ATTR(BQ,CITE) = 0, + HTML_ATTR(BQ,CLASS), + HTML_ATTR(BQ,DIR), + HTML_ATTR(BQ,ID), + HTML_ATTR(BQ,LANG), + HTML_ATTR(BQ,STYLE), + HTML_ATTR(BQ,TITLE), + HTML_ATTRIBUTES(BQ) +}; /* ( @@ -205,8 +295,113 @@ ) */ -#define HTML_BODY_BACKGROUND 0 -#define HTML_BODY_ATTRIBUTES 1 +enum _HTML_BODY_Attributes { + HTML_ATTR(BODY,ALINK) = 0, + HTML_ATTR(BODY,BACKGROUND), + HTML_ATTR(BODY,BGCOLOR), + HTML_ATTR(BODY,CLASS), + HTML_ATTR(BODY,DIR), + HTML_ATTR(BODY,ID), + HTML_ATTR(BODY,LANG), + HTML_ATTR(BODY,LINK), + HTML_ATTR(BODY,STYLE), + HTML_ATTR(BODY,TEXT), + HTML_ATTR(BODY,TITLE), + HTML_ATTR(BODY,VLINK), + HTML_ATTRIBUTES(BODY) +}; + +/* +( + BR +) +*/ + +enum _HTML_BR_Attributes { + HTML_ATTR(BR,CLASS) = 0, + HTML_ATTR(BR,CLEAR), + HTML_ATTR(BR,ID), + HTML_ATTR(BR,STYLE), + HTML_ATTR(BR,TITLE), + HTML_ATTRIBUTES(BR) +}; + +/* +( + BUTTON +) +*/ + +enum _HTML_BUTTON_Attributes { + HTML_ATTR(BUTTON,ACCESSKEY) = 0, + HTML_ATTR(BUTTON,CLASS), + HTML_ATTR(BUTTON,DIR), + HTML_ATTR(BUTTON,DISABLED), + HTML_ATTR(BUTTON,ID), + HTML_ATTR(BUTTON,LANG), + HTML_ATTR(BUTTON,NAME), + HTML_ATTR(BUTTON,STYLE), + HTML_ATTR(BUTTON,TABINDEX), + HTML_ATTR(BUTTON,TITLE), + HTML_ATTR(BUTTON,TYPE), + HTML_ATTR(BUTTON,VALUE), + HTML_ATTRIBUTES(BUTTON) +}; + +/* +( + COL +) +*/ + +enum _HTML_COL_Attributes { + HTML_ATTR(COL,CLASS) = 0, + HTML_ATTR(COL,DIR), + HTML_ATTR(COL,ID), + HTML_ATTR(COL,LANG), + HTML_ATTR(COL,SPAN), + HTML_ATTR(COL,STYLE), + HTML_ATTR(COL,TITLE), + HTML_ATTR(COL,WIDTH), + HTML_ATTRIBUTES(COL) +}; + +/* +( + DEL, INS +) +*/ + +enum _HTML_CHANGES_Attributes { + HTML_ATTR(CHANGES,CITE) = 0, + HTML_ATTR(CHANGES,CLASS), + HTML_ATTR(CHANGES,DATETIME), + HTML_ATTR(CHANGES,DIR), + HTML_ATTR(CHANGES,ID), + HTML_ATTR(CHANGES,LANG), + HTML_ATTR(CHANGES,STYLE), + HTML_ATTR(CHANGES,TITLE), + HTML_ATTRIBUTES(CHANGES) +}; + +/* +( + FONT - Deprecated +) +*/ + +enum _HTML_FONT_Attributes { + HTML_ATTR(FONT,CLASS) = 0, + HTML_ATTR(FONT,COLOR), + HTML_ATTR(FONT,DIR), + HTML_ATTR(FONT,FACE), + HTML_ATTR(FONT,ID), + HTML_ATTR(FONT,LANG), + HTML_ATTR(FONT,SIZE), + HTML_ATTR(FONT,STYLE), + HTML_ATTR(FONT,TITLE), + HTML_ATTRIBUTES(FONT) +}; /* ( @@ -214,12 +409,21 @@ ) */ -#define HTML_FORM_ACTION 0 /* WSM bug fix, added these five */ -#define HTML_FORM_ID 1 -#define HTML_FORM_INDEX 2 -#define HTML_FORM_LANG 3 -#define HTML_FORM_METHOD 4 -#define HTML_FORM_ATTRIBUTES 5 +enum _HTML_FORM_Attributes { + HTML_ATTR(FORM,ACCEPT) = 0, + HTML_ATTR(FORM,ACCEPT_CHARSET), /* { "ACCEPT-CHARSET" } */ + HTML_ATTR(FORM,ACTION), + HTML_ATTR(FORM,CLASS), + HTML_ATTR(FORM,DIR), + HTML_ATTR(FORM,ENCTYPE), + HTML_ATTR(FORM,ID), + HTML_ATTR(FORM,LANG), + HTML_ATTR(FORM,METHOD), + HTML_ATTR(FORM,STYLE), + HTML_ATTR(FORM,TARGET), + HTML_ATTR(FORM,TITLE), + HTML_ATTRIBUTES(FORM) +}; /* ( @@ -227,8 +431,22 @@ ) */ -#define HTML_FRAME_SRC 0 -#define HTML_FRAME_ATTRIBUTES 1 +enum _HTML_FRAME_Attributes { + HTML_ATTR(FRAME,CLASS) = 0, + HTML_ATTR(FRAME,FRAMEBORDER), + HTML_ATTR(FRAME,ID), + HTML_ATTR(FRAME,NAME), + HTML_ATTR(FRAME,MARGINHEIGHT), + HTML_ATTR(FRAME,MARGINWIDTH), + HTML_ATTR(FRAME,NORESIZE), + HTML_ATTR(FRAME,LONGDESC), + HTML_ATTR(FRAME,SCROLLING), + HTML_ATTR(FRAME,SRC), + HTML_ATTR(FRAME,STYLE), + HTML_ATTR(FRAME,TARGET), + HTML_ATTR(FRAME,TITLE), + HTML_ATTRIBUTES(FRAME) +}; /* ( @@ -236,67 +454,119 @@ ) */ -#define HTML_FRAMESET_COLS 0 -#define HTML_FRAMESET_ROWS 1 -#define HTML_FRAMESET_BORDER 2 -#define HTML_FRAMESET_BORDERCOLOR 3 -#define HTML_FRAMESET_FRAMEBORDER 4 -#define HTML_FRAMESET_ONBLUR 5 -#define HTML_FRAMESET_ONFOCUS 6 -#define HTML_FRAMESET_ONLOAD 7 -#define HTML_FRAMESET_ONUNLOAD 8 -#define HTML_FRAMESET_ATTRIBUTES 9 +enum _HTML_FRAMESET_Attributes { + HTML_ATTR(FRAMESET,CLASS) = 0, + HTML_ATTR(FRAMESET,COLS), + HTML_ATTR(FRAMESET,ID), + HTML_ATTR(FRAMESET,ROWS), + HTML_ATTR(FRAMESET,STYLE), + HTML_ATTR(FRAMESET,TITLE), + HTML_ATTRIBUTES(FRAMESET) +}; /* ( - FIG + Generic attributes ) */ -#define HTML_FIG_ATTRIBUTES 6 +enum _HTML_GEN_Attributes { + HTML_ATTR(GEN,CLASS) = 0, + HTML_ATTR(GEN,DIR), + HTML_ATTR(GEN,ID), + HTML_ATTR(GEN,LANG), + HTML_ATTR(GEN,STYLE), + HTML_ATTR(GEN,TITLE), + HTML_ATTRIBUTES(GEN) +}; /* ( - GEN + BLOCK ) */ -#define HTML_GEN_ATTRIBUTES 3 +enum _HTML_BLOCK_Attributes { + HTML_ATTR(BLOCK,ALIGN) = 0, + HTML_ATTR(BLOCK,CLASS), + HTML_ATTR(BLOCK,DIR), + HTML_ATTR(BLOCK,ID), + HTML_ATTR(BLOCK,LANG), + HTML_ATTR(BLOCK,STYLE), + HTML_ATTR(BLOCK,TITLE), + HTML_ATTRIBUTES(BLOCK) +}; /* ( - HTMLPLUS + HEAD ) */ -#define HTML_HTMLPLUS_ATTRIBUTES 2 +enum _HTML_HEAD_Attributes { + HTML_ATTR(HEAD,DIR) = 0, + HTML_ATTR(HEAD,LANG), + HTML_ATTR(HEAD,PROFILE), + HTML_ATTRIBUTES(HEAD) +}; /* ( - IMAGE + HR ) */ -#define HTML_IMAGE_ATTRIBUTES 5 +enum _HTML_HR_Attributes { + HTML_ATTR(HR,ALIGN) = 0, + HTML_ATTR(HR,CLASS), + HTML_ATTR(HR,DIR), + HTML_ATTR(HR,ID), + HTML_ATTR(HR,LANG), + HTML_ATTR(HR,NOSHADE), + HTML_ATTR(HR,SIZE), + HTML_ATTR(HR,STYLE), + HTML_ATTR(HR,TITLE), + HTML_ATTR(HR,WIDTH), + HTML_ATTRIBUTES(HR) +}; /* ( - CHANGED + HTML ) */ -#define HTML_CHANGED_ATTRIBUTES 2 +enum _HTML_HTML_Attributes { + HTML_ATTR(HTML,DIR) = 0, + HTML_ATTR(HTML,LANG), + HTML_ATTR(HTML,VERSION), + HTML_ATTRIBUTES(HTML) +}; /* ( - DL + IFRAME ) */ -#define HTML_DL_ID 0 -#define HTML_DL_COMPACT 1 -#define HTML_DL_INDEX 2 -#define HTML_DL_ATTRIBUTES 3 +enum _HTML_IFRAME_Attributes { + HTML_ATTR(IFRAME,ALIGN) = 0, + HTML_ATTR(IFRAME,CLASS), + HTML_ATTR(IFRAME,FRAMEBORDER), + HTML_ATTR(IFRAME,HEIGHT), + HTML_ATTR(IFRAME,ID), + HTML_ATTR(IFRAME,LONGDESC), + HTML_ATTR(IFRAME,MARGINHEIGHT), + HTML_ATTR(IFRAME,MARGINWIDTH), + HTML_ATTR(IFRAME,NAME), + HTML_ATTR(IFRAME,SCROLLING), + HTML_ATTR(IFRAME,SRC), + HTML_ATTR(IFRAME,STYLE), + HTML_ATTR(IFRAME,TARGET), + HTML_ATTR(IFRAME,TITLE), + HTML_ATTR(IFRAME,WIDTH), + HTML_ATTRIBUTES(IFRAME) +}; /* ( @@ -304,13 +574,26 @@ ) */ -#define HTML_IMG_ALIGN 0 -#define HTML_IMG_ALT 1 -#define HTML_IMG_ISMAP 2 /* Obsolete but supported */ -#define HTML_IMG_LOWSRC 3 -#define HTML_IMG_SEETHRU 4 -#define HTML_IMG_SRC 5 -#define HTML_IMG_ATTRIBUTES 6 +enum _HTML_IMG_Attributes { + HTML_ATTR(IMG,ALIGN) = 0, + HTML_ATTR(IMG,ALT), + HTML_ATTR(IMG,BORDER), + HTML_ATTR(IMG,CLASS), + HTML_ATTR(IMG,DIR), + HTML_ATTR(IMG,HEIGHT), + HTML_ATTR(IMG,HSPACE), + HTML_ATTR(IMG,ID), + HTML_ATTR(IMG,ISMAP), + HTML_ATTR(IMG,LANG), + HTML_ATTR(IMG,LONGDESC), + HTML_ATTR(IMG,SRC), + HTML_ATTR(IMG,STYLE), + HTML_ATTR(IMG,TITLE), + HTML_ATTR(IMG,USEMAP), + HTML_ATTR(IMG,VSPACE), + HTML_ATTR(IMG,WIDTH), + HTML_ATTRIBUTES(IMG) +}; /* ( @@ -318,42 +601,99 @@ ) */ -#define HTML_INPUT_ALIGN 0 -#define HTML_INPUT_CHECKED 1 -#define HTML_INPUT_DISABLED 2 -#define HTML_INPUT_ERROR 3 -#define HTML_INPUT_MAX 4 -#define HTML_INPUT_MIN 5 -#define HTML_INPUT_NAME 6 -#define HTML_INPUT_SIZE 7 -#define HTML_INPUT_SRC 8 -#define HTML_INPUT_TYPE 9 -#define HTML_INPUT_VALUE 10 -#define HTML_INPUT_ATTRIBUTES 11 +enum _HTML_INPUT_Attributes { + HTML_ATTR(INPUT,ACCEPT) = 0, + HTML_ATTR(INPUT,ACCESSKEY), + HTML_ATTR(INPUT,ALIGN), + HTML_ATTR(INPUT,ALT), + HTML_ATTR(INPUT,CHECKED), + HTML_ATTR(INPUT,CLASS), + HTML_ATTR(INPUT,DIR), + HTML_ATTR(INPUT,DISABLED), + HTML_ATTR(INPUT,ID), + HTML_ATTR(INPUT,LANG), + HTML_ATTR(INPUT,MAXLENGTH), + HTML_ATTR(INPUT,NAME), + HTML_ATTR(INPUT,READONLY), + HTML_ATTR(INPUT,SIZE), + HTML_ATTR(INPUT,SRC), + HTML_ATTR(INPUT,STYLE), + HTML_ATTR(INPUT,TABINDEX), + HTML_ATTR(INPUT,TITLE), + HTML_ATTR(INPUT,TYPE), + HTML_ATTR(INPUT,USEMAP), + HTML_ATTR(INPUT,VALUE), + HTML_ATTRIBUTES(INPUT) +}; /* ( - L ) */ -#define HTML_L_ATTRIBUTES 4 +enum _HTML_ISINDEX_Attributes { + HTML_ATTR(ISINDEX,CLASS) = 0, + HTML_ATTR(ISINDEX,DIR), + HTML_ATTR(ISINDEX,ID), + HTML_ATTR(ISINDEX,LANG), + HTML_ATTR(ISINDEX,PROMPT), + HTML_ATTR(ISINDEX,STYLE), + HTML_ATTR(ISINDEX,TITLE), + HTML_ATTRIBUTES(ISINDEX) +}; /* ( - LI ) */ -#define HTML_LI_ATTRIBUTES 4 +enum _HTML_LABEL_Attributes { + HTML_ATTR(LABEL,ACCESSKEY) = 0, + HTML_ATTR(LABEL,CLASS), + HTML_ATTR(LABEL,DIR), + HTML_ATTR(LABEL,FOR), + HTML_ATTR(LABEL,ID), + HTML_ATTR(LABEL,LANG), + HTML_ATTR(LABEL,STYLE), + HTML_ATTR(LABEL,TITLE), + HTML_ATTRIBUTES(LABEL) +}; /* ( - LIST ) */ -#define HTML_LIST_ATTRIBUTES 4 +enum _HTML_LEGEND_Attributes { + HTML_ATTR(LEGEND,ACCESSKEY) = 0, + HTML_ATTR(LEGEND,ALIGN), + HTML_ATTR(LEGEND,CLASS), + HTML_ATTR(LEGEND,DIR), + HTML_ATTR(LEGEND,ID), + HTML_ATTR(LEGEND,LANG), + HTML_ATTR(LEGEND,STYLE), + HTML_ATTR(LEGEND,TITLE), + HTML_ATTRIBUTES(LEGEND) +}; + +/* +( + LI +) +*/ + +enum _HTML_LI_Attributes { + HTML_ATTR(LI,CLASS) = 0, + HTML_ATTR(LI,COMPACT), + HTML_ATTR(LI,DIR), + HTML_ATTR(LI,ID), + HTML_ATTR(LI,LANG), + HTML_ATTR(LI,STYLE), + HTML_ATTR(LI,TITLE), + HTML_ATTR(LI,TYPE), + HTML_ATTR(LI,VALUE), + HTML_ATTRIBUTES(LI) +}; /* ( @@ -361,22 +701,40 @@ ) */ -#define HTML_LINK_CHARSET 0 -#define HTML_LINK_HREF 1 -#define HTML_LINK_HREFLANG 2 -#define HTML_LINK_MEDIA 3 -#define HTML_LINK_REL 4 -#define HTML_LINK_REV 5 -#define HTML_LINK_TYPE 6 -#define HTML_LINK_ATTRIBUTES 7 +enum _HTML_LINK_Attributes { + HTML_ATTR(LINK,CHARSET) = 0, + HTML_ATTR(LINK,CLASS), + HTML_ATTR(LINK,DIR), + HTML_ATTR(LINK,HREF), + HTML_ATTR(LINK,HREFLANG), + HTML_ATTR(LINK,ID), + HTML_ATTR(LINK,LANG), + HTML_ATTR(LINK,MEDIA), + HTML_ATTR(LINK,REL), + HTML_ATTR(LINK,REV), + HTML_ATTR(LINK,STYLE), + HTML_ATTR(LINK,TARGET), + HTML_ATTR(LINK,TITLE), + HTML_ATTR(LINK,TYPE), + HTML_ATTRIBUTES(LINK) +}; /* ( - ID + MAP ) */ -#define HTML_ID_ATTRIBUTE 1 +enum _HTML_MAP_Attributes { + HTML_ATTR(MAP,CLASS) = 0, + HTML_ATTR(MAP,DIR), + HTML_ATTR(MAP,ID), + HTML_ATTR(MAP,LANG), + HTML_ATTR(MAP,NAME), + HTML_ATTR(MAP,STYLE), + HTML_ATTR(MAP,TITLE), + HTML_ATTRIBUTES(MAP) +}; /* ( @@ -384,11 +742,15 @@ ) */ -#define HTML_META_CONTENT 0 -#define HTML_META_HTTP_EQUIV 1 -#define HTML_META_NAME 2 -#define HTML_META_SCHEME 3 -#define HTML_META_ATTRIBUTES 4 +enum _HTML_META_Attributes { + HTML_ATTR(META,CONTENT) = 0, + HTML_ATTR(META,DIR), + HTML_ATTR(META,HTTP_EQUIV), /* { "HTTP-EQUIV" ) */ + HTML_ATTR(META,LANG), + HTML_ATTR(META,NAME), + HTML_ATTR(META,SCHEME), + HTML_ATTRIBUTES(META) +}; /* ( @@ -401,32 +763,73 @@ /* ( - NOTE + OBJECT ) */ -#define HTML_NOTE_ATTRIBUTES 4 +enum _HTML_OBJECT_Attributes { + HTML_ATTR(OBJECT,ALIGN) = 0, + HTML_ATTR(OBJECT,ARCHIVE), + HTML_ATTR(OBJECT,BORDER), + HTML_ATTR(OBJECT,CLASS), + HTML_ATTR(OBJECT,CLASSID), + HTML_ATTR(OBJECT,CODEBASE), + HTML_ATTR(OBJECT,CODETYPE), + HTML_ATTR(OBJECT,DATA), + HTML_ATTR(OBJECT,DECLARE), + HTML_ATTR(OBJECT,DIR), + HTML_ATTR(OBJECT,HEIGHT), + HTML_ATTR(OBJECT,HSPACE), + HTML_ATTR(OBJECT,ID), + HTML_ATTR(OBJECT,LANG), + HTML_ATTR(OBJECT,NAME), + HTML_ATTR(OBJECT,STANDBY), + HTML_ATTR(OBJECT,STYLE), + HTML_ATTR(OBJECT,TABINDEX), + HTML_ATTR(OBJECT,TITLE), + HTML_ATTR(OBJECT,TYPE), + HTML_ATTR(OBJECT,USEMAP), + HTML_ATTR(OBJECT,VSPACE), + HTML_ATTR(OBJECT,WIDTH), + HTML_ATTRIBUTES(OBJECT) +}; /* ( - OBJECT + OL +) +*/ + +enum _HTML_OL_Attributes { + HTML_ATTR(OL,CLASS) = 0, + HTML_ATTR(OL,COMPACT), + HTML_ATTR(OL,DIR), + HTML_ATTR(OL,ID), + HTML_ATTR(OL,LANG), + HTML_ATTR(OL,START), + HTML_ATTR(OL,STYLE), + HTML_ATTR(OL,TITLE), + HTML_ATTR(OL,TYPE), + HTML_ATTRIBUTES(OL) +}; + +/* +( + OPTGROUP ) */ -#define HTML_OBJECT_ARCHIVE 0 -#define HTML_OBJECT_CLASSID 1 -#define HTML_OBJECT_CODEBASE 2 -#define HTML_OBJECT_CODETYPE 3 -#define HTML_OBJECT_DATA 4 -#define HTML_OBJECT_DECLARE 5 -#define HTML_OBJECT_HIGHT 6 -#define HTML_OBJECT_NAME 7 -#define HTML_OBJECT_STANDBY 8 -#define HTML_OBJECT_TABINDEX 9 -#define HTML_OBJECT_TYPE 10 -#define HTML_OBJECT_USEMAP 11 -#define HTML_OBJECT_WIDTH 12 -#define HTML_OBJECT_ATTRIBUTES 13 +enum _HTML_OPTGROUP_Attributes { + HTML_ATTR(OPTGROUP,CLASS) = 0, + HTML_ATTR(OPTGROUP,DISABLED), + HTML_ATTR(OPTGROUP,DIR), + HTML_ATTR(OPTGROUP,ID), + HTML_ATTR(OPTGROUP,LABEL), + HTML_ATTR(OPTGROUP,LANG), + HTML_ATTR(OPTGROUP,STYLE), + HTML_ATTR(OPTGROUP,TITLE), + HTML_ATTRIBUTES(OPTGROUP) +}; /* ( @@ -434,18 +837,66 @@ ) */ -#define HTML_OPTION_DISABLED 0 /* WSM bug fix, added these 4 */ -#define HTML_OPTION_LANG 1 -#define HTML_OPTION_SELECTED 2 -#define HTML_OPTION_ATTRIBUTES 3 +enum _HTML_OPTION_Attributes { + HTML_ATTR(OPTION,CLASS) = 0, + HTML_ATTR(OPTION,DISABLED), + HTML_ATTR(OPTION,DIR), + HTML_ATTR(OPTION,ID), + HTML_ATTR(OPTION,LABEL), + HTML_ATTR(OPTION,LANG), + HTML_ATTR(OPTION,SELECTED), + HTML_ATTR(OPTION,STYLE), + HTML_ATTR(OPTION,TITLE), + HTML_ATTR(OPTION,VALUE), + HTML_ATTRIBUTES(OPTION) +}; + +/* +( + PARAM +) +*/ + +enum _HTML_PARAM_Attributes { + HTML_ATTR(PARAM,ID) = 0, + HTML_ATTR(PARAM,NAME), + HTML_ATTR(PARAM,TYPE), + HTML_ATTR(PARAM,VALUE), + HTML_ATTR(PARAM,VALUETYPE), + HTML_ATTRIBUTES(PARAM) +}; + +/* +( + PRE +) +*/ + +enum _HTML_PRE_Attributes { + HTML_ATTR(PRE,CLASS) = 0, + HTML_ATTR(PRE,DIR), + HTML_ATTR(PRE,ID), + HTML_ATTR(PRE,LANG), + HTML_ATTR(PRE,STYLE), + HTML_ATTR(PRE,TITLE), + HTML_ATTR(PRE,WIDTH), + HTML_ATTRIBUTES(PRE) +}; /* ( - RENDER + SCRIPT ) */ -#define HTML_RENDER_ATTRIBUTES 2 +enum _HTML_SCRIPT_Attributes { + HTML_ATTR(SCRIPT,CHARSET) = 0, + HTML_ATTR(SCRIPT,DEFER), + HTML_ATTR(SCRIPT,LANGUAGE), + HTML_ATTR(SCRIPT,SRC), + HTML_ATTR(SCRIPT,TYPE), + HTML_ATTRIBUTES(SCRIPT) +}; /* ( @@ -453,20 +904,35 @@ ) */ -#define HTML_SELECT_ERROR 0 /* WSM bug fix, added these 5 */ -#define HTML_SELECT_LANG 1 -#define HTML_SELECT_MULTIPLE 2 -#define HTML_SELECT_NAME 3 -#define HTML_SELECT_SIZE 4 -#define HTML_SELECT_ATTRIBUTES 5 +enum _HTML_SELECT_Attributes { + HTML_ATTR(SELECT,CLASS) = 0, + HTML_ATTR(SELECT,DIR), + HTML_ATTR(SELECT,DISABLED), + HTML_ATTR(SELECT,ID), + HTML_ATTR(SELECT,LANG), + HTML_ATTR(SELECT,MULTIPLE), + HTML_ATTR(SELECT,NAME), + HTML_ATTR(SELECT,SIZE), + HTML_ATTR(SELECT,STYLE), + HTML_ATTR(SELECT,TABINDEX), + HTML_ATTR(SELECT,TITLE), + HTML_ATTRIBUTES(SELECT) +}; /* ( - TAB + STYLE ) */ -#define HTML_TAB_ATTRIBUTES 2 +enum _HTML_STYLE_Attributes { + HTML_ATTR(STYLE,DIR) = 0, + HTML_ATTR(STYLE,LANG), + HTML_ATTR(STYLE,MEDIA), + HTML_ATTR(STYLE,TITLE), + HTML_ATTR(STYLE,TYPE), + HTML_ATTRIBUTES(STYLE) +}; /* ( @@ -474,7 +940,44 @@ ) */ -#define HTML_TABLE_ATTRIBUTES 4 +enum _HTML_TABLE_Attributes { + HTML_ATTR(TABLE,ALIGN) = 0, + HTML_ATTR(TABLE,BGCOLOR), + HTML_ATTR(TABLE,BORDER), + HTML_ATTR(TABLE,CELLPADDING), + HTML_ATTR(TABLE,CELLSPACING), + HTML_ATTR(TABLE,CLASS), + HTML_ATTR(TABLE,DIR), + HTML_ATTR(TABLE,FRAME), + HTML_ATTR(TABLE,ID), + HTML_ATTR(TABLE,LANG), + HTML_ATTR(TABLE,RULES), + HTML_ATTR(TABLE,SUMMARY), + HTML_ATTR(TABLE,STYLE), + HTML_ATTR(TABLE,TITLE), + HTML_ATTR(TABLE,WIDTH), + HTML_ATTRIBUTES(TABLE) +}; + +/* +( + TABLE Elements +) +*/ + +enum _HTML_TELE_Attributes { + HTML_ATTR(TELE,ALIGN) = 0, + HTML_ATTR(TELE,CHAR), + HTML_ATTR(TELE,CHAROFF), + HTML_ATTR(TELE,CLASS), + HTML_ATTR(TELE,DIR), + HTML_ATTR(TELE,ID), + HTML_ATTR(TELE,LANG), + HTML_ATTR(TELE,STYLE), + HTML_ATTR(TELE,TITLE), + HTML_ATTR(TELE,VALIGN), + HTML_ATTRIBUTES(TELE) +}; /* ( @@ -482,7 +985,29 @@ ) */ -#define HTML_TD_ATTRIBUTES 4 +enum _HTML_TD_Attributes { + HTML_ATTR(TD,ABBR) = 0, + HTML_ATTR(TD,ALIGN), + HTML_ATTR(TD,AXIS), + HTML_ATTR(TD,BGCOLOR), + HTML_ATTR(TD,CHAR), + HTML_ATTR(TD,CHAROFF), + HTML_ATTR(TD,CLASS), + HTML_ATTR(TD,COLSPAN), + HTML_ATTR(TD,DIR), + HTML_ATTR(TD,ID), + HTML_ATTR(TD,HEADERS), + HTML_ATTR(TD,HEIGHT), + HTML_ATTR(TD,LANG), + HTML_ATTR(TD,NOWRAP), + HTML_ATTR(TD,ROWSPAN), + HTML_ATTR(TD,SCOPE), + HTML_ATTR(TD,STYLE), + HTML_ATTR(TD,TITLE), + HTML_ATTR(TD,VALIGN), + HTML_ATTR(TD,WIDTH), + HTML_ATTRIBUTES(TD) +}; /* ( @@ -490,21 +1015,33 @@ ) */ -#define HTML_TEXTAREA_COLS 0 -#define HTML_TEXTAREA_DISABLED 1 -#define HTML_TEXTAREA_ERROR 2 -#define HTML_TEXTAREA_LANG 3 -#define HTML_TEXTAREA_NAME 4 -#define HTML_TEXTAREA_ROWS 5 -#define HTML_TEXTAREA_ATTRIBUTES 6 +enum _HTML_TEXTAREA_Attributes { + HTML_ATTR(TEXTAREA,CLASS) = 0, + HTML_ATTR(TEXTAREA,COLS), + HTML_ATTR(TEXTAREA,DIR), + HTML_ATTR(TEXTAREA,DISABLED), + HTML_ATTR(TEXTAREA,ID), + HTML_ATTR(TEXTAREA,LANG), + HTML_ATTR(TEXTAREA,NAME), + HTML_ATTR(TEXTAREA,READONLY), + HTML_ATTR(TEXTAREA,ROWS), + HTML_ATTR(TEXTAREA,STYLE), + HTML_ATTR(TEXTAREA,TABINDEX), + HTML_ATTR(TEXTAREA,TITLE), + HTML_ATTRIBUTES(TEXTAREA) +}; /* ( - TH + TITLE ) */ -#define HTML_TH_ATTRIBUTES 4 +enum _HTML_TITLE_Attributes { + HTML_ATTR(TITLE,DIR) = 0, + HTML_ATTR(TITLE,LANG), + HTML_ATTRIBUTES(TITLE) +}; /* ( @@ -512,7 +1049,17 @@ ) */ -#define HTML_UL_ATTRIBUTES 6 +enum _HTML_UL_Attributes { + HTML_ATTR(UL,CLASS) = 0, + HTML_ATTR(UL,COMPACT), + HTML_ATTR(UL,DIR), + HTML_ATTR(UL,ID), + HTML_ATTR(UL,LANG), + HTML_ATTR(UL,STYLE), + HTML_ATTR(UL,TITLE), + HTML_ATTR(UL,TYPE), + HTML_ATTRIBUTES(UL) +}; /* . @@ -574,6 +1121,6 @@ - @(#) $Id: HTMLPDTD.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ + @(#) $Id: HTMLPDTD.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMemLog.c xdvik-22.40n/libs/libwww/HTMemLog.c --- xdvik-22.40l/libs/libwww/HTMemLog.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMemLog.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1996. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMemLog.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMemLog.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** 26 Nov 96 (EGP) started */ @@ -15,11 +15,19 @@ #include "HTMemLog.h" #include "HTTimer.h" -#ifdef WWW_MSWINDOWS -#define OPEN_FLAGS O_WRONLY|O_CREAT|O_TRUNC -#else /* WWW_MSWINDOWS */ +#ifdef O_SYNC #define OPEN_FLAGS O_WRONLY|O_CREAT|O_TRUNC|O_SYNC -#endif /* !WWW_MSWINDOWS */ +#else +#define OPEN_FLAGS O_WRONLY|O_CREAT|O_TRUNC +#endif + +#ifdef HTDEBUG + +#ifdef USE_SYSLOG +#define PRINT_BUFF_SIZE 8200 +#else /* USE_SYSLOG */ +#define PRINT_BUFF_SIZE 200 +#endif /* !USE_SYSLOG */ PRIVATE size_t LogBuffSize = 1024; /* default size is 1k */ PRIVATE int LogFd = 2; @@ -29,24 +37,45 @@ PRIVATE BOOL KeepOpen = YES; PRIVATE HTTimer * Timer = NULL; +#ifdef USE_EXCLUDES +typedef struct {char * str; int len;} StrIndexIndex; + +PRIVATE StrIndexIndex Excludes[] = {{"HTReader_read", 13}, {"HTWriter_write", 14}, {"HTEventList_loop", 16}}; + +PRIVATE int StrIndex (char * str, StrIndexIndex element[], int elements) +{ + int i; + for (i = 0; i < elements; i++) + if (!strncmp(element[i].str, str, element[i].len)) + return i + 1; + return 0; +} +#endif /* USE_EXCLUDES */ + PRIVATE int MemLogTimeout (HTTimer * timer, void * param, HTEventType type) { int ret; - - if (WWWTRACE) HTTrace("MemLog...... flushing on timeout\n"); + HTTRACE(CORE_TRACE, "MemLog...... flushing on timeout\n"); ret = HTMemLog_flush(); - -#if 0 - /* Force flush */ - if (close(LogFd) == -1 || (LogFd = open(LogName, OPEN_FLAGS, 0666)) == -1) - return HT_ERROR; -#endif - return ret; } +PRIVATE ms_t HTMemLog_addTime(void) +{ + char buff[20]; + ms_t ms = HTGetTimeInMillis(); + int len = sprintf(buff, "%lu", ms); + HTMemLog_add(buff, len); + return ms; +} + +#endif /* HTDEBUG */ + +/* ------------------------------------------------------------------------- */ + PUBLIC int HTMemLog_open (char * logName, size_t size, BOOL keepOpen) { +#ifdef HTDEBUG #ifdef USE_SYSLOG openlog(LogName, LOG_NDELAY, LOG_USER); #else /* USE_SYSLOG */ @@ -63,11 +92,13 @@ #endif /* !USE_SYSLOG */ HTTraceData_setCallback(HTMemLog_callback); Timer = HTTimer_new(NULL, MemLogTimeout, NULL, 10000, YES, YES); +#endif /* HTDEBUG */ return HT_OK; } PUBLIC int HTMemLog_flush(void) { +#ifdef HTDEBUG if (LogLen) { if (!KeepOpen) if ((LogFd = open(LogName, O_WRONLY|O_CREAT|O_APPEND, 0666)) == -1) @@ -75,13 +106,14 @@ write(LogFd, LogBuff, LogLen); LogLen = 0; } - if (!KeepOpen) - close(LogFd); + if (!KeepOpen) close(LogFd); +#endif /* HTDEBUG */ return HT_OK; } PUBLIC int HTMemLog_add(char * buf, size_t len) { +#ifdef HTDEBUG if (LogBuff) { /* ** Dump everything that won't fit in buffer @@ -99,54 +131,28 @@ return HT_OK; } return HT_ERROR; -} - -PRIVATE ms_t HTMemLog_addTime(void) -{ - char buff[20]; - ms_t ms = HTGetTimeInMillis(); - int len = sprintf(buff, "%lu", ms); - HTMemLog_add(buff, len); - return ms; +#else + return HT_OK; +#endif /* HTDEBUG */ } PUBLIC void HTMemLog_close (void) { +#ifdef HTDEBUG #ifdef USE_SYSLOG closelog(); #else /* USE_SYSLOG */ HTMemLog_flush(); - if (LogFd > 2) - close(LogFd); - if (LogBuff != NULL) - HT_FREE(LogBuff); + if (LogFd > 2) close(LogFd); + if (LogBuff != NULL) HT_FREE(LogBuff); #endif /* !USE_SYSLOG */ +#endif } -#ifdef USE_SYSLOG -#define PRINT_BUFF_SIZE 8200 -#else /* USE_SYSLOG */ -#define PRINT_BUFF_SIZE 200 -#endif /* !USE_SYSLOG */ - -#ifdef USE_EXCLUDES -typedef struct {char * str; int len;} StrIndexIndex; - -PRIVATE int StrIndex (char * str, StrIndexIndex element[], int elements) -{ - int i; - for (i = 0; i < elements; i++) - if (!strncmp(element[i].str, str, element[i].len)) - return i + 1; - return 0; -} - -PRIVATE StrIndexIndex Excludes[] = {{"HTReader_read", 13}, {"HTWriter_write", 14}, {"HTEventList_loop", 16}}; - -#endif /* USE_EXCLUDES */ PUBLIC int HTMemLog_callback (char * data, size_t len, char * fmt, va_list pArgs) { +#ifdef HTDEBUG char buff[PRINT_BUFF_SIZE]; int ret; #ifdef USE_EXCLUDES @@ -180,5 +186,8 @@ HTMemLog_add("\n", 1); #endif /* !USE_SYSLOG */ return ret; +#else + return 0; +#endif /* HTDEBUG */ } diff -Naur xdvik-22.40l/libs/libwww/HTMemLog.h xdvik-22.40n/libs/libwww/HTMemLog.h --- xdvik-22.40l/libs/libwww/HTMemLog.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMemLog.h Fri Sep 13 00:23:46 2002 @@ -51,6 +51,6 @@ - @(#) $Id: HTMemLog.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ + @(#) $Id: HTMemLog.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMemory.c xdvik-22.40n/libs/libwww/HTMemory.c --- xdvik-22.40l/libs/libwww/HTMemory.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMemory.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMemory.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMemory.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** History: ** 8 Feb 95 Written by Eric and Henrik @@ -29,7 +29,7 @@ */ PUBLIC BOOL HTMemoryCall_add (HTMemoryCallback * cbf) { - if (MEM_TRACE) HTTrace("Mem Add..... Callback %p\n", (void *) cbf); + HTTRACE(MEM_TRACE, "Mem Add..... Callback %p\n" _ (void *) cbf); if (!HTMemCall) HTMemCall = HTList_new(); return cbf ? HTList_addObject(HTMemCall, (void *) cbf) : NO; } @@ -40,7 +40,7 @@ */ PUBLIC BOOL HTMemoryCall_delete (HTMemoryCallback * cbf) { - if (MEM_TRACE) HTTrace("Mem Delete.. Callback %p\n", (void *) cbf); + HTTRACE(MEM_TRACE, "Mem Delete.. Callback %p\n" _ (void *) cbf); return (HTMemCall && cbf) ? HTList_removeObject(HTMemCall,(void*)cbf) : NO; } @@ -50,7 +50,7 @@ */ PUBLIC BOOL HTMemoryCall_deleteAll (void) { - if (MEM_TRACE) HTTrace("Mem Delete.. All Callback functions\n"); + HTTRACE(MEM_TRACE, "Mem Delete.. All Callback functions\n"); if (HTMemCall) { HTList_delete(HTMemCall); HTMemCall = NULL; @@ -70,14 +70,12 @@ if (HTMemCall) { HTMemoryCallback * pres; while ((pres = (HTMemoryCallback *) HTList_nextObject(HTMemCall))) { - if (MEM_TRACE) - HTTrace("Mem Calling. %p (size %d)\n",(void*)pres,size); + HTTRACE(MEM_TRACE, "Mem Calling. %p (size %d)\n" _ (void*)pres _ size); (*pres)(size); if ((ptr = malloc(size)) != NULL) return ptr; } } - if (MEM_TRACE) - HTTrace("Memory.... Couldn't allocate %d bytes\n", size); + HTTRACE(MEM_TRACE, "Memory.... Couldn't allocate %d bytes\n" _ size); return NULL; } @@ -93,15 +91,14 @@ HTMemoryCallback * pres; size_t total = size * nobj; while ((pres = (HTMemoryCallback *) HTList_nextObject(HTMemCall))) { - if (MEM_TRACE) HTTrace("Mem Calling. %p (size %d)\n", - (void *) pres, total); + HTTRACE(MEM_TRACE, "Mem Calling. %p (size %d)\n" _ + (void *) pres _ total); (*pres)(total); if ((ptr = calloc(nobj, size)) != NULL) return ptr; } } - if (MEM_TRACE) - HTTrace("Memory...... Couldn't allocate %d objects of size %d\n", - nobj, size); + HTTRACE(MEM_TRACE, "Memory...... Couldn't allocate %d objects of size %d\n" _ + nobj _ size); return NULL; } @@ -116,14 +113,12 @@ if (HTMemCall) { HTMemoryCallback * pres; while ((pres = (HTMemoryCallback *) HTList_nextObject(HTMemCall))) { - if (MEM_TRACE) - HTTrace("Mem Calling. %p (size %d)\n",(void*)pres,size); + HTTRACE(MEM_TRACE, "Mem Calling. %p (size %d)\n" _ (void*)pres _ size); (*pres)(size); if ((ptr = realloc(p, size)) != NULL) return ptr; } } - if (MEM_TRACE) - HTTrace("Memory...... Couldn't reallocate %d bytes\n", size); + HTTRACE(MEM_TRACE, "Memory...... Couldn't reallocate %d bytes\n" _ size); return NULL; } @@ -133,7 +128,7 @@ PUBLIC void HTMemory_free (void * ptr) { if (ptr) { - if (MEM_TRACE) HTTrace("Memory Free. %p\n", ptr); + HTTRACE(MEM_TRACE, "Memory Free. %p\n" _ ptr); free(ptr); } } @@ -166,9 +161,8 @@ { if (PExit) (*PExit)(name, file, line); - HTTrace("%s:%ld failed allocation for \"%s\" (%ld bytes).\n\ -Program aborted.\n", - file, line, name, LastAllocSize); + HTTRACE(ALL_TRACE, "%s:%ld failed allocation for \"%s\" (%ld bytes).\nProgram aborted.\n" _ + file _ line _ name _ LastAllocSize); abort(); } diff -Naur xdvik-22.40l/libs/libwww/HTMemory.h xdvik-22.40n/libs/libwww/HTMemory.h --- xdvik-22.40l/libs/libwww/HTMemory.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMemory.h Fri Sep 13 00:23:46 2002 @@ -164,6 +164,6 @@ - @(#) $Id: HTMemory.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ + @(#) $Id: HTMemory.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMerge.c xdvik-22.40n/libs/libwww/HTMerge.c --- xdvik-22.40l/libs/libwww/HTMerge.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMerge.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMerge.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMerge.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** The Merge class just is a n entry stream. Easy. The reason for having ** this stream is that we must be able to handle free and abort in an @@ -56,8 +56,7 @@ PRIVATE int HTMerge_free (HTStream * me) { if (me) { - if (STREAM_TRACE) - HTTrace("Merge Free.. Called with %d feeds\n", me->feeds); + HTTRACE(STREAM_TRACE, "Merge Free.. Called with %d feeds\n" _ me->feeds); if (--me->feeds <= 0) { (*me->target->isa->_free)(me->target); HT_FREE(me); @@ -70,8 +69,7 @@ PRIVATE int HTMerge_abort (HTStream * me, HTList * e) { if (me) { - if (STREAM_TRACE) - HTTrace("Merge Abort. Called with %d feeds\n", me->feeds); + HTTRACE(STREAM_TRACE, "Merge Abort. Called with %d feeds\n" _ me->feeds); if (--me->feeds <= 0) { (*me->target->isa->abort)(me->target, e); HT_FREE(me); @@ -99,6 +97,6 @@ me->isa = &HTMergeClass; me->target = target ? target : HTBlackHole(); me->feeds = feeds >= 1 ? feeds : 1; /* Min 1 feed */ - if (STREAM_TRACE) HTTrace("Merge....... Created stream %p\n", me); + HTTRACE(STREAM_TRACE, "Merge....... Created stream %p\n" _ me); return me; } diff -Naur xdvik-22.40l/libs/libwww/HTMerge.h xdvik-22.40n/libs/libwww/HTMerge.h --- xdvik-22.40l/libs/libwww/HTMerge.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMerge.h Fri Sep 13 00:23:46 2002 @@ -40,6 +40,6 @@ - @(#) $Id: HTMerge.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ + @(#) $Id: HTMerge.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMethod.c xdvik-22.40n/libs/libwww/HTMethod.c --- xdvik-22.40l/libs/libwww/HTMethod.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMethod.c Fri Sep 13 00:23:46 2002 @@ -3,12 +3,16 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMethod.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMethod.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** ** HISTORY: ** 6 June 95 HFN Spawned off from HTAccess. Can be extended to allow ** registration of new methods +** 15 Feb 2002 MKP Introduced methods from WebDAV protocol and +** Extension Methods. (Manuele.Kirsch_Pinheiro@inrialpes.fr +** or manuele@inf.ufrgs.br) +** */ /* Library Include files */ @@ -30,11 +34,48 @@ "OPTIONS", "LINK", "UNLINK", +#ifdef HT_DAV + "LOCK", /* new methods for */ + "UNLOCK", /* webDAV protocol */ + "PROPFIND", + "PROPPATCH", + "MKCOL", + "COPY", + "MOVE", +#endif /* HT_DAV */ + +#ifdef HT_EXT /* extension methods */ + NULL, /* METHOD_EXT_0 */ + NULL, /* METHOD_EXT_1 */ + NULL, /* METHOD_EXT_2 */ + NULL, /* METHOD_EXT_3 */ + NULL, /* METHOD_EXT_4 */ + NULL, /* METHOD_EXT_5 */ + NULL, /* METHOD_EXT_6 */ +#endif /* HT_EXT */ + NULL }; + +#ifdef HT_EXT +/* This array keeps the information about the presence of +** an entity body in each extension method +*/ +PRIVATE BOOL HTEXT_EntityMethods [] = { + NO, /* METHOD_EXT_0 */ + NO, /* METHOD_EXT_1 */ + NO, /* METHOD_EXT_2 */ + NO, /* METHOD_EXT_3 */ + NO, /* METHOD_EXT_4 */ + NO, /* METHOD_EXT_5 */ + NO /* METHOD_EXT_6 */ +}; +#endif + /* ------------------------------------------------------------------------- */ + /* Get method enum value ** --------------------- */ @@ -61,11 +102,47 @@ return METHOD_LINK; else if (!strcasecomp(name, *(method_names+10))) return METHOD_UNLINK; +#ifdef HT_DAV + else if (!strcasecomp(name, *(method_names+11))) /* WebDAV lock/unlock */ + return METHOD_LOCK; + else if (!strcasecomp(name, *(method_names+12))) + return METHOD_UNLOCK; + + else if (!strcasecomp(name, *(method_names+13))) /* other WebDAV methods */ + return METHOD_PROPFIND; + else if (!strcasecomp(name, *(method_names+14))) + return METHOD_PROPPATCH; + else if (!strcasecomp(name, *(method_names+15))) + return METHOD_MKCOL; + else if (!strcasecomp(name, *(method_names+16))) + return METHOD_COPY; + else if (!strcasecomp(name, *(method_names+17))) + return METHOD_MOVE; +#endif /* HT_DAV */ + +#ifdef HT_EXT + /* if there is no extension method set, return METHOD_INVALID */ + else if ( *(method_names+18) && !strcasecomp(name, *(method_names+18))) + return METHOD_EXT_0; + else if ( *(method_names+19) && !strcasecomp(name, *(method_names+19))) + return METHOD_EXT_1; + else if ( *(method_names+20) && !strcasecomp(name, *(method_names+20))) + return METHOD_EXT_2; + else if ( *(method_names+21) && !strcasecomp(name, *(method_names+21))) + return METHOD_EXT_3; + else if ( *(method_names+22) && !strcasecomp(name, *(method_names+22))) + return METHOD_EXT_4; + else if ( *(method_names+23) && !strcasecomp(name, *(method_names+23))) + return METHOD_EXT_5; + else if ( *(method_names+24) && !strcasecomp(name, *(method_names+24))) + return METHOD_EXT_6; +#endif } return METHOD_INVALID; } + /* Get method name ** --------------- ** Returns pointer to entry in static table in memory @@ -92,7 +169,177 @@ return *(method_names+9); else if (method == METHOD_UNLINK) return *(method_names+10); + +#ifdef HT_DAV + else if (method == METHOD_LOCK) /* webdav lock/unlock */ + return *(method_names+11); /* methods (locking) */ + else if (method == METHOD_UNLOCK) + return *(method_names+12); + else if (method == METHOD_PROPFIND) /* webdav proppatch/propfind */ + return *(method_names+13); /* methods (properties) */ + else if (method == METHOD_PROPPATCH) + return *(method_names+14); + else if (method == METHOD_MKCOL) /* webdav mkcol method */ + return *(method_names+15); /* (collencions) */ + else if (method == METHOD_COPY) + return *(method_names+16); /* webdav copy/move */ + else if (method == METHOD_MOVE) /* methods (namespace) */ + return *(method_names+17); +#endif /* HT_DAV */ + +#ifdef HT_EXT + else if (method == METHOD_EXT_0 && (*(method_names+18))) /* extension methods */ + return *(method_names+18); /* customizable for the app. */ + else if (method == METHOD_EXT_1 && (*(method_names+19))) + return *(method_names+19); + else if (method == METHOD_EXT_2 && (*(method_names+20))) /* if the method is not set */ + return *(method_names+20); /* then it will return */ + else if (method == METHOD_EXT_3 && ((*method_names+21))) /* "INVALID-METHOD" */ + return *(method_names+21); + else if (method == METHOD_EXT_4 && ((*method_names+22))) + return *(method_names+22); + else if (method == METHOD_EXT_5 && ((*method_names+23))) + return *(method_names+23); + else if (method == METHOD_EXT_6 && ((*method_names+24))) + return *(method_names+24); +#endif /* HT_EXT */ + else return *method_names; } + + +/* +** Does the method include an entity body? +*/ +PUBLIC BOOL HTMethod_hasEntity (HTMethod me) { + if (me) { + /* normal HTTP methods */ + if (me & (METHOD_PUT | METHOD_POST)) return YES; + +#ifdef HT_DAV + /* WebDAV methods */ + if (me & (METHOD_LOCK | METHOD_PROPFIND | METHOD_PROPPATCH | + METHOD_COPY | METHOD_MOVE)) return YES; +#endif + +#ifdef HT_EXT + /* extension methods */ + HTTRACE (PROT_TRACE, "HTMethod.... Has this extension method a body?\n"); + if (me == METHOD_EXT_0) return HTEXT_EntityMethods[0]; + else if (me == METHOD_EXT_1) return HTEXT_EntityMethods[1]; + else if (me == METHOD_EXT_2) return HTEXT_EntityMethods[2]; + else if (me == METHOD_EXT_3) return HTEXT_EntityMethods[3]; + else if (me == METHOD_EXT_4) return HTEXT_EntityMethods[4]; + else if (me == METHOD_EXT_5) return HTEXT_EntityMethods[5]; + else if (me == METHOD_EXT_6) return HTEXT_EntityMethods[6]; + else return (NO); +#endif + } + return (NO); +} + + + +/* +** Set an extension method: HTMethod structure has 7 methods (METHOD_EXT_0 +** to METHOD_EXT_6) that can be set by the application. +** This function set one of this extension methods. +** +** Parameters: +** HTMethod method - extension method to be set +** const char name - new name for the method +** Return: +** BOOL - YES, if the operation succeed +** - NO, if it failed, for example, if the parameter method is +** not a extension method (METHOD_EXT_0 - +** METHOD_EXT_6) +** +*/ +PUBLIC BOOL HTMethod_setExtensionMethod (HTMethod method, const char * name, BOOL hasEntity) { +#ifdef HT_EXT + if (name && *name) { + if (method == METHOD_EXT_0) { + StrAllocCopy ((char *)(*(method_names+18)), name); + HTEXT_EntityMethods[0] = hasEntity; + } + else if (method == METHOD_EXT_1) { + StrAllocCopy ((char *)(*(method_names+19)), name); + HTEXT_EntityMethods[1] = hasEntity; + } + else if (method == METHOD_EXT_2) { + StrAllocCopy ((char *)(*(method_names+20)), name); + HTEXT_EntityMethods[2] = hasEntity; + } + else if (method == METHOD_EXT_3) { + StrAllocCopy ((char *)(*(method_names+21)), name); + HTEXT_EntityMethods[3] = hasEntity; + } + else if (method == METHOD_EXT_4) { + StrAllocCopy ((char *)(*(method_names+22)), name); + HTEXT_EntityMethods[4] = hasEntity; + } + else if (method == METHOD_EXT_5) { + StrAllocCopy ((char *)(*(method_names+23)), name); + HTEXT_EntityMethods[5] = hasEntity; + } + else if (method == METHOD_EXT_6) { + StrAllocCopy ((char *)(*(method_names+24)), name); + HTEXT_EntityMethods[6] = hasEntity; + } + else return NO; + return YES; + } +#endif /* HT_EXT */ + + return NO; +} + + +/* +** Delete the extension method: this funcion unset the extension method +*/ +PUBLIC BOOL HTMethod_deleteExtensionMethod (HTMethod method) { +#ifdef HT_EXT + char *ptr = NULL; + + if ( (method == METHOD_EXT_0) && (*(method_names+18)) ) { + ptr = (char *) (*(method_names+18)); + (*(method_names+18)) = NULL; + } + else if ( (method == METHOD_EXT_1) && (*(method_names+19)) ) { + ptr = (char *) (*(method_names+19)); + (*(method_names+19)) = NULL; + } + else if ( (method == METHOD_EXT_2) && (*(method_names+20)) ) { + ptr = (char *) (*(method_names+20)); + (*(method_names+20)) = NULL; + } + else if ( (method == METHOD_EXT_3) && (*(method_names+21)) ) { + ptr = (char *) (*(method_names+21)); + (*(method_names+21)) = NULL; + } + else if ( (method == METHOD_EXT_4) && (*(method_names+22)) ) { + ptr = (char *) (*(method_names+22)); + (*(method_names+22)) = NULL; + } + else if ( (method == METHOD_EXT_5) && (*(method_names+23)) ) { + ptr = (char *) (*(method_names+23)); + (*(method_names+23)) = NULL; + } + else if ( (method == METHOD_EXT_6) && (*(method_names+24)) ) { + ptr = (char *) (*(method_names+24)); + (*(method_names+24)) = NULL; + } + + if (ptr) { + HT_FREE(ptr); + return YES; + } + +#endif /* HT_EXT */ + + return NO; +} + diff -Naur xdvik-22.40l/libs/libwww/HTMethod.h xdvik-22.40n/libs/libwww/HTMethod.h --- xdvik-22.40l/libs/libwww/HTMethod.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMethod.h Fri Sep 13 00:23:46 2002 @@ -27,6 +27,7 @@ is a part of the W3C Sample Code Library. */ + #ifndef HTMETHOD_H #define HTMETHOD_H @@ -47,6 +48,28 @@ METHOD_TRACE = 0x40, METHOD_OPTIONS = 0x80, METHOD_LINK = 0x100, + +#ifdef HT_DAV + METHOD_LOCK = 0x400, /* WebDAV Methods */ + METHOD_UNLOCK = 0x800, + + METHOD_PROPFIND = 0x1000, + METHOD_PROPPATCH = 0x2000, + METHOD_MKCOL = 0x4000, + METHOD_COPY = 0x8000, + METHOD_MOVE = 0x10000, +#endif + +#ifdef HT_EXT + METHOD_EXT_0 = 0x20000, /* Extension methods */ + METHOD_EXT_1 = 0x40000, + METHOD_EXT_2 = 0x80000, + METHOD_EXT_3 = 0x100000, + METHOD_EXT_4 = 0x200000, + METHOD_EXT_5 = 0x400000, + METHOD_EXT_6 = 0x800000, +#endif + METHOD_UNLINK = 0x200 } HTMethod; @@ -98,11 +121,35 @@ ) Does a method include an entity to be sent from the client to the server? + +If not using WebDAV functions, neither extension methods, the +HTMethod_hasEntity is not changed, because a macro is much more performant +than a function. The function is interesting only when using WebDAV (many +methods) or extension methods (in this case, a dynamic structure is +needed). */ -#define HTMethod_hasEntity(me) ((me) & (METHOD_PUT | METHOD_POST)) +extern BOOL HTMethod_hasEntity(HTMethod me); /* +( +Extension Methods +) + + +These methods have been introduced in Libwww for extension purposes. +Through these methods, application may register new methods, even libwww +unknown methods, and use them. It's recomended for applications that need +only a few new methods, that aren't yet in the libwww. The application should +register the desired methos, an before finish, it must unregister these +methods. +*/ + +extern BOOL HTMethod_setExtensionMethod (HTMethod method, const char * name, BOOL hasEntity); +extern BOOL HTMethod_deleteExtensionMethod (HTMethod method); + +/* + */ #endif /* HTMETHOD_H */ @@ -111,6 +158,6 @@ - @(#) $Id: HTMethod.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ + @(#) $Id: HTMethod.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMulpar.h xdvik-22.40n/libs/libwww/HTMulpar.h --- xdvik-22.40l/libs/libwww/HTMulpar.h Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMulpar.h Fri Sep 13 00:23:46 2002 @@ -81,7 +81,7 @@ -@(#) $Id: HTMulpar.h,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +@(#) $Id: HTMulpar.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMulti.c xdvik-22.40n/libs/libwww/HTMulti.c --- xdvik-22.40l/libs/libwww/HTMulti.c Wed Apr 18 14:23:18 2001 +++ xdvik-22.40n/libs/libwww/HTMulti.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMulti.c,v 1.1.1.1 2001/04/18 14:23:18 stefanulrich Exp $ +** @(#) $Id: HTMulti.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** History: ** March 94 AL Separated from HTFile.c because @@ -15,6 +15,7 @@ #include "WWWUtil.h" #include "WWWCore.h" #include "HTMulti.h" +#include "HTBind.h" #include "HTFile.h" #define MULTI_SUFFIX ".multi"/* Extension for scanning formats */ @@ -150,7 +151,7 @@ HTContentDescription * cd; void ** data; if (!variants) { - if (PROT_TRACE) HTTrace("Ranking..... No variants\n"); + HTTRACE(PROT_TRACE, "Ranking..... No variants\n"); return NO; } /* @@ -165,10 +166,9 @@ double clq_global = lang_value(cd->content_language, HTFormat_language()); double ceq_local = encoding_value(cd->content_encoding, HTRequest_encoding(request)); double ceq_global = encoding_value(cd->content_encoding, HTFormat_contentCoding()); - if (PROT_TRACE) - HTTrace("Qualities... Content type: %.3f, Content language: %.3f, Content encoding: %.3f\n", - HTMAX(ctq_local, ctq_global), - HTMAX(clq_local, clq_global), + HTTRACE(PROT_TRACE, "Qualities... Content type: %.3f, Content language: %.3f, Content encoding: %.3f\n" _ + HTMAX(ctq_local, ctq_global) _ + HTMAX(clq_local, clq_global) _ HTMAX(ceq_local, ceq_global)); cd->quality *= (HTMAX(ctq_local, ctq_global) * HTMAX(clq_local, clq_global) * @@ -180,22 +180,24 @@ HTArray_sort(variants, VariantSort); /* Write out the result */ +#ifdef HTDEBUG if (PROT_TRACE) { int cnt = 1; cd = (HTContentDescription *) HTArray_firstObject(variants, data); - HTTrace("Ranking.....\n"); - HTTrace("RANK QUALITY CONTENT-TYPE LANGUAGE ENCODING FILE\n"); + HTTRACE(PROT_TRACE, "Ranking.....\n"); + HTTRACE(PROT_TRACE, "RANK QUALITY CONTENT-TYPE LANGUAGE ENCODING FILE\n"); while (cd) { - HTTrace("%d. %.4f %-20.20s %-8.8s %-10.10s %s\n", - cnt++, - cd->quality, - cd->content_type ? HTAtom_name(cd->content_type) : "-", - cd->content_language?HTAtom_name(cd->content_language):"-", - cd->content_encoding?HTAtom_name(cd->content_encoding):"-", + HTTRACE(PROT_TRACE, "%d. %.4f %-20.20s %-8.8s %-10.10s %s\n" _ + cnt++ _ + cd->quality _ + cd->content_type ? HTAtom_name(cd->content_type) : "-" _ + cd->content_language?HTAtom_name(cd->content_language):"-" _ + cd->content_encoding?HTAtom_name(cd->content_encoding):"-" _ cd->filename ? cd->filename :"-"); cd = (HTContentDescription *) HTArray_nextObject(variants, data); } } +#endif /* HTDEBUG */ return YES; } @@ -326,17 +328,18 @@ dp = opendir(dirname); if (!dp) { - if (PROT_TRACE) - HTTrace("Warning..... Can't open directory %s\n", dirname); + HTTRACE(PROT_TRACE, "Warning..... Can't open directory %s\n" _ dirname); goto dir_match_failed; } matches = HTArray_new(VARIANTS); -#ifdef HT_REENTRANT +#ifdef HAVE_READDIR_R_2 while ((dirbuf = (struct dirent *) readdir_r(dp, &result))) { +#elif defined(HAVE_READDIR_R_3) + while (readdir_r(dp, &result, &dirbuf) == 0) { #else while ((dirbuf = readdir(dp))) { -#endif /* HT_REENTRANT */ +#endif /* HAVE_READDIR_R_2 */ if (!dirbuf->d_ino) continue; /* Not in use */ if (!strcmp(dirbuf->d_name,".") || !strcmp(dirbuf->d_name,"..") || @@ -401,38 +404,39 @@ if (!path || !*path) return NULL; if ((variants = dir_matches(path)) == NULL) { - if (PROT_TRACE) HTTrace("No matches.. for \"%s\"\n", path); + HTTRACE(PROT_TRACE, "No matches.. for \"%s\"\n" _ path); return NULL; } +#ifdef HTDEBUG if (PROT_TRACE) { void ** data; HTContentDescription * cd = HTArray_firstObject(variants, data); - HTTrace("Multi....... Possibilities for \"%s\"\n", path); - HTTrace(" QUALITY CONTENT-TYPE LANGUAGE ENCODING FILE\n"); + HTTRACE(PROT_TRACE, "Multi....... Possibilities for \"%s\"\n" _ path); + HTTRACE(PROT_TRACE, " QUALITY CONTENT-TYPE LANGUAGE ENCODING FILE\n"); while (cd) { - HTTrace(" %.4f %-20.20s %-8.8s %-10.10s %s\n", - cd->quality, - cd->content_type ?HTAtom_name(cd->content_type) :"-\t", - cd->content_language?HTAtom_name(cd->content_language):"-", - cd->content_encoding?HTAtom_name(cd->content_encoding):"-", + HTTRACE(PROT_TRACE, " %.4f %-20.20s %-8.8s %-10.10s %s\n" _ + cd->quality _ + cd->content_type ?HTAtom_name(cd->content_type) :"-\t" _ + cd->content_language?HTAtom_name(cd->content_language):"-" _ + cd->content_encoding?HTAtom_name(cd->content_encoding):"-" _ cd->filename ?cd->filename :"-"); cd = (HTContentDescription *) HTArray_nextObject(variants, data); } } +#endif /* HTDEBUG */ /* ** Finally get the best variant which is readable */ if (HTRank(req, variants)) { - void ** data; + void ** data = NULL; HTContentDescription * cd = HTArray_firstObject(variants, data); while (cd) { if (cd->filename) { if (access(cd->filename, R_OK) != -1) StrAllocCopy(representation, cd->filename); - else if (PROT_TRACE) - HTTrace("Multi....... `%s\' is not readable\n", + else HTTRACE(PROT_TRACE, "Multi....... `%s\' is not readable\n" _ cd->filename); } HT_FREE(cd->filename); @@ -482,8 +486,7 @@ dp = opendir(path); if (last && last!=path) *last='/'; if (!dp) { - if (PROT_TRACE) - HTTrace("Warning..... Can't open directory %s\n",path); + HTTRACE(PROT_TRACE, "Warning..... Can't open directory %s\n" _ path); return NULL; } while ((dirbuf = readdir(dp))) { @@ -508,8 +511,7 @@ HT_OUTOFMEM("get_best_welcome"); sprintf(welcome, "%s%s%s", path, last ? "" : "/", best_welcome); HT_FREE(best_welcome); - if (PROT_TRACE) - HTTrace("Welcome..... \"%s\"\n",welcome); + HTTRACE(PROT_TRACE, "Welcome..... \"%s\"\n" _ welcome); return welcome; } return NULL; @@ -552,23 +554,19 @@ } else{ char * multi = strrchr(path, MULTI_SUFFIX[0]); if (multi && !strcasecomp(multi, MULTI_SUFFIX)) { - if (PROT_TRACE) - HTTrace("Multi....... by %s suffix\n", MULTI_SUFFIX); + HTTRACE(PROT_TRACE, "Multi....... by %s suffix\n" _ MULTI_SUFFIX); if (!(new_path = HTGetBest(req, path))) { - if (PROT_TRACE) - HTTrace("Multi....... failed -- giving up\n"); + HTTRACE(PROT_TRACE, "Multi....... failed -- giving up\n"); return NULL; } path = new_path; } else { stat_status = HT_STAT(path, stat_info); if (stat_status == -1) { - if (PROT_TRACE) - HTTrace("AutoMulti... can't stat \"%s\"(errno %d)\n", - path, errno); + HTTRACE(PROT_TRACE, "AutoMulti... can't stat \"%s\"(errno %d)\n" _ + path _ errno); if (!(new_path = HTGetBest(req, path))) { - if (PROT_TRACE) - HTTrace("AutoMulti... failed -- giving up\n"); + HTTRACE(PROT_TRACE, "AutoMulti... failed -- giving up\n"); return NULL; } path = new_path; @@ -580,9 +578,8 @@ if (stat_status == -1) stat_status = HT_STAT(path, stat_info); if (stat_status == -1) { - if (PROT_TRACE) - HTTrace("Stat fails.. on \"%s\" -- giving up (errno %d)\n", - path, errno); + HTTRACE(PROT_TRACE, "Stat fails.. on \"%s\" -- giving up (errno %d)\n" _ + path _ errno); return NULL; } else { if (!new_path) { diff -Naur xdvik-22.40l/libs/libwww/HTMulti.h xdvik-22.40n/libs/libwww/HTMulti.h --- xdvik-22.40l/libs/libwww/HTMulti.h Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTMulti.h Fri Sep 13 00:23:46 2002 @@ -70,6 +70,6 @@ - @(#) $Id: HTMulti.h,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ + @(#) $Id: HTMulti.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMuxCh.c xdvik-22.40n/libs/libwww/HTMuxCh.c --- xdvik-22.40l/libs/libwww/HTMuxCh.c Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTMuxCh.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMuxCh.c,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ +** @(#) $Id: HTMuxCh.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Handles a MUX Channel with sessions and protocols ** @@ -105,13 +105,12 @@ session->sid = sid; session->pid = pid; muxch->sessions[sid] = session; - if (MUX_TRACE) - HTTrace("Mux Channel. Registered session %d on channel %p\n", - sid, muxch); + HTTRACE(MUX_TRACE, "Mux Channel. Registered session %d on channel %p\n" _ + sid _ muxch); } return session; } - if (MUX_TRACE) HTTrace("Mux Channel. Can't register new session\n"); + HTTRACE(MUX_TRACE, "Mux Channel. Can't register new session\n"); return NULL; } @@ -124,14 +123,13 @@ for (; sidsessions[sid]) && session->net == NULL && session->pid == pid) { - if (MUX_TRACE) - HTTrace("Mux Channel. Accepting session %d on channel %p\n", - sid, muxch); + HTTRACE(MUX_TRACE, "Mux Channel. Accepting session %d on channel %p\n" _ + sid _ muxch); return sid; } } } - if (MUX_TRACE) HTTrace("Mux Channel. Can't accept new session\n"); + HTTRACE(MUX_TRACE, "Mux Channel. Can't accept new session\n"); return INVSID; } @@ -147,14 +145,13 @@ session->pid = pid; session->net = net; muxch->sessions[sid] = session; - if (MUX_TRACE) - HTTrace("Mux Channel. Creating session %d on channel %p\n", - sid, muxch); + HTTRACE(MUX_TRACE, "Mux Channel. Creating session %d on channel %p\n" _ + sid _ muxch); return sid; } } } - if (MUX_TRACE) HTTrace("Mux Channel. Can't create new session\n"); + HTTRACE(MUX_TRACE, "Mux Channel. Can't create new session\n"); return INVSID; } @@ -194,9 +191,8 @@ ** to sleep. */ if (session->close == MUX_S_END) { - if (MUX_TRACE) - HTTrace("Mux Channel. Closing session %d on channel %p\n", - session->sid, muxch); + HTTRACE(MUX_TRACE, "Mux Channel. Closing session %d on channel %p\n" _ + session->sid _ muxch); muxch->sessions[session->sid] = NULL; session_delete(session); } @@ -246,8 +242,7 @@ */ PUBLIC int HTMuxSession_disposeData (HTMuxSession * me, const char * buf, int len) { - if (MUX_TRACE) - HTTrace("Mux Channel. Writing %d bytes to session %p\n", len, me); + HTTRACE(MUX_TRACE, "Mux Channel. Writing %d bytes to session %p\n" _ len _ me); /* ** There are two situations that can occur: Either we have an accepted session @@ -268,13 +263,13 @@ */ if (me->buffer && me->buffering) { if ((*me->buffer->isa->flush)(me->buffer) == HT_OK) { - if (MUX_TRACE) HTTrace("Mux Channel. Flushed buffered data\n"); + HTTRACE(MUX_TRACE, "Mux Channel. Flushed buffered data\n"); me->buffering = NO; } else if ((*me->buffer->isa->put_block)(me->buffer, buf, len) >= 0) { - if (MUX_TRACE) HTTrace("Mux Channel. Buffer accepted data\n"); + HTTRACE(MUX_TRACE, "Mux Channel. Buffer accepted data\n"); return 0; } - if (MUX_TRACE) HTTrace("Mux Channel. Can't buffer data\n"); + HTTRACE(MUX_TRACE, "Mux Channel. Can't buffer data\n"); return (-1); } @@ -284,7 +279,7 @@ ** from the stream means that we got rid of the data successfully. */ if ((status = (*sink->isa->put_block)(sink, buf, len)) >= 0) { - if (MUX_TRACE) HTTrace("Mux Channel. Stream returned %d\n", status); + HTTRACE(MUX_TRACE, "Mux Channel. Stream returned %d\n" _ status); /* ** If we get back a HT_LOADED then we have all the data we need @@ -318,10 +313,10 @@ } status = (*me->buffer->isa->put_block)(me->buffer, buf, len); if (status >= 0) { - if (MUX_TRACE) HTTrace("Mux Channel. Buffer accepted data\n"); + HTTRACE(MUX_TRACE, "Mux Channel. Buffer accepted data\n"); return 0; } - if (MUX_TRACE) HTTrace("Mux Channel. Buffer returned %d\n", status); + HTTRACE(MUX_TRACE, "Mux Channel. Buffer returned %d\n" _ status); } return (-1); } @@ -367,8 +362,7 @@ } if (!muxchs[me->hash]) muxchs[me->hash] = HTList_new(); HTList_addObject(muxchs[me->hash], (void *) me); - if (MUX_TRACE) - HTTrace("Mux Channel. %p created with hash %d\n",me, me->hash); + HTTRACE(MUX_TRACE, "Mux Channel. %p created with hash %d\n" _ me _ me->hash); return me; } return NULL; @@ -392,7 +386,7 @@ { if (me) { HTList * list = NULL; - if (MUX_TRACE) HTTrace("Mux Channel. Deleting %p\n", me); + HTTRACE(MUX_TRACE, "Mux Channel. Deleting %p\n" _ me); if (muxchs && (list = muxchs[me->hash])) { HTList_removeObject(list, (void *) me); channel_delete(me); @@ -484,7 +478,7 @@ PUTBLOCK((const char *) header, 8); break; default: - if (MUX_TRACE) HTTrace("Mux Channel. UNKNOWN OPCODE %d\n", opcode); + HTTRACE(MUX_TRACE, "Mux Channel. UNKNOWN OPCODE %d\n" _ opcode); return HT_ERROR; } diff -Naur xdvik-22.40l/libs/libwww/HTMuxCh.h xdvik-22.40n/libs/libwww/HTMuxCh.h --- xdvik-22.40l/libs/libwww/HTMuxCh.h Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTMuxCh.h Fri Sep 13 00:23:46 2002 @@ -111,6 +111,9 @@ extern BOOL HTMuxSession_setFragment (HTMuxChannel * muxch, HTMuxSessionId sid, int fragment); +extern int HTMuxSession_disposeData (HTMuxSession * me, + const char * buf, int len); + /* . Mux Protocol @@ -131,6 +134,6 @@ - @(#) $Id: HTMuxCh.h,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ + @(#) $Id: HTMuxCh.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMuxHeader.h xdvik-22.40n/libs/libwww/HTMuxHeader.h --- xdvik-22.40l/libs/libwww/HTMuxHeader.h Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTMuxHeader.h Fri Sep 13 00:23:46 2002 @@ -145,6 +145,6 @@ - @(#) $Id: HTMuxHeader.h,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ + @(#) $Id: HTMuxHeader.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTMuxTx.c xdvik-22.40n/libs/libwww/HTMuxTx.c --- xdvik-22.40l/libs/libwww/HTMuxTx.c Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTMuxTx.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTMuxTx.c,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ +** @(#) $Id: HTMuxTx.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** A buffered output MUX stream. ** @@ -122,7 +122,7 @@ PRIVATE int HTMuxBuffer_abort (HTOutputStream * me, HTList * e) { if (me->target) (*me->target->isa->abort)(me->target, e); - if (PROT_TRACE) HTTrace("MUX Tx...... ABORTING...\n"); + HTTRACE(PROT_TRACE, "MUX Tx...... ABORTING...\n"); return HT_ERROR; } diff -Naur xdvik-22.40l/libs/libwww/HTMuxTx.h xdvik-22.40n/libs/libwww/HTMuxTx.h --- xdvik-22.40l/libs/libwww/HTMuxTx.h Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTMuxTx.h Fri Sep 13 00:23:46 2002 @@ -48,6 +48,6 @@ - @(#) $Id: HTMuxTx.h,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ + @(#) $Id: HTMuxTx.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTNDir.c xdvik-22.40n/libs/libwww/HTNDir.c --- xdvik-22.40l/libs/libwww/HTNDir.c Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTNDir.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTNDir.c,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ +** @(#) $Id: HTNDir.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Creates listings for all kind of News output. ** @@ -358,8 +358,8 @@ int level2 = node2->refLevel; int level = HTMAX(level1, level2); int i; - HTNewsNode* parent1; - HTNewsNode* parent2; + HTNewsNode* parent1 = NULL; + HTNewsNode* parent2 = NULL; int diff = 0; for (i = level; i >= 0; i--) { @@ -391,7 +391,7 @@ { if (node && node->show) { HTStructured *target = dir->target; - char * escaped; + char * escaped = NULL; HTNewsDir_addLevelTags (dir, node->refLevel); /* Added by MP. */ START(HTML_LI); @@ -793,7 +793,7 @@ HTNewsDir_setRefInfo (dir); comp = NDirRefThreadSort; } else { - if (STREAM_TRACE) HTTrace("NewsListing. Invalid sortkey\n"); + HTTRACE(STREAM_TRACE, "NewsListing. Invalid sortkey\n"); return NO; } @@ -818,7 +818,7 @@ ** free the array. */ { - void ** data; + void ** data = NULL; HTNewsNode *node = (HTNewsNode *) HTArray_firstObject(array, data); while (node) { HTNewsNode_print(dir, node); diff -Naur xdvik-22.40l/libs/libwww/HTNDir.h xdvik-22.40n/libs/libwww/HTNDir.h --- xdvik-22.40l/libs/libwww/HTNDir.h Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTNDir.h Fri Sep 13 00:23:46 2002 @@ -115,6 +115,6 @@ - @(#) $Id: HTNDir.h,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ + @(#) $Id: HTNDir.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTNet.c xdvik-22.40n/libs/libwww/HTNet.c --- xdvik-22.40l/libs/libwww/HTNet.c Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTNet.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTNet.c,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ +** @(#) $Id: HTNet.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This is the implementation of the internal library multithreading ** functions. This includes an interrupt handler and a event loop. @@ -36,8 +36,6 @@ #define HT_MAX_SOCKETS 25 #endif -#define HASH_SIZE 599 - typedef struct _BeforeFilter { HTNetBefore * before; /* Filter function */ char * tmplate; /* URL template for when to call filter */ @@ -116,9 +114,8 @@ if (tmplate) StrAllocCopy(me->tmplate, tmplate); me->order = check_order(order); me->param = param; - if (CORE_TRACE) - HTTrace("Net Before.. Add %p with order %d tmplate `%s\' context %p\n", - before, me->order, tmplate ? tmplate : "", param); + HTTRACE(CORE_TRACE, "Net Before.. Add %p with order %d tmplate `%s\' context %p\n" _ + before _ me->order _ tmplate ? tmplate : "" _ param); return (HTList_addObject(list, me) && HTList_insertionSort(list, HTBeforeOrder)); } @@ -130,7 +127,7 @@ */ PUBLIC BOOL HTNetCall_deleteBefore (HTList * list, HTNetBefore * before) { - if (CORE_TRACE) HTTrace("Net Before.. Delete %p\n", before); + HTTRACE(CORE_TRACE, "Net Before.. Delete %p\n" _ before); if (list && before) { HTList * cur = list; BeforeFilter * pres; @@ -151,7 +148,7 @@ */ PUBLIC BOOL HTNetCall_deleteBeforeAll (HTList * list) { - if (CORE_TRACE) HTTrace("Net Before. Delete All filters\n"); + HTTRACE(CORE_TRACE, "Net Before. Delete All filters\n"); if (list) { HTList * cur = list; BeforeFilter * pres; @@ -183,9 +180,9 @@ while ((pres = (BeforeFilter *) HTList_nextObject(list))) { if (!pres->tmplate || (pres->tmplate && HTStrMatch(pres->tmplate, addr))) { - if (CORE_TRACE) HTTrace("Net Before.. calling %p (request %p, context %p)\n", - pres->before, - request, pres->param); + HTTRACE(CORE_TRACE, "Net Before.. calling %p (request %p, context %p)\n" _ + pres->before _ + request _ pres->param); ret = (*pres->before)(request, pres->param, mode); if (ret != HT_OK) break; @@ -202,7 +199,7 @@ } /* -** Register a AFTER filter in the list provided by the caller. +** Register an AFTER filter in the list provided by the caller. ** Several filters can be registered in which case they are called ** with the filter ordering in mind. */ @@ -219,9 +216,8 @@ me->order = check_order(order); me->param = param; me->status = status; - if (CORE_TRACE) - HTTrace("Net After... Add %p with order %d tmplate `%s\' code %d context %p\n", - after, me->order, tmplate ? tmplate : "", status, param); + HTTRACE(CORE_TRACE, "Net After... Add %p with order %d tmplate `%s\' code %d context %p\n" _ + after _ me->order _ tmplate ? tmplate : "" _ status _ param); return (HTList_addObject(list, me) && HTList_insertionSort(list, HTAfterOrder)); } @@ -233,7 +229,7 @@ */ PUBLIC BOOL HTNetCall_deleteAfter (HTList * list, HTNetAfter * after) { - if (CORE_TRACE) HTTrace("Net After... Delete %p\n", after); + HTTRACE(CORE_TRACE, "Net After... Delete %p\n" _ after); if (list && after) { HTList * cur = list; AfterFilter * pres; @@ -254,7 +250,7 @@ */ PUBLIC BOOL HTNetCall_deleteAfterStatus (HTList * list, int status) { - if (CORE_TRACE) HTTrace("Net After... Delete all with status %d\n",status); + HTTRACE(CORE_TRACE, "Net After... Delete all with status %d\n" _ status); if (list) { HTList * cur = list; AfterFilter * pres; @@ -276,7 +272,7 @@ */ PUBLIC BOOL HTNetCall_deleteAfterAll (HTList * list) { - if (CORE_TRACE) HTTrace("Net After. Delete All filters\n"); + HTTRACE(CORE_TRACE, "Net After. Delete All filters\n"); if (list) { HTList * cur = list; AfterFilter * pres; @@ -312,10 +308,9 @@ if ((pres->status == status || pres->status == HT_ALL) && (!pres->tmplate || (pres->tmplate && HTStrMatch(pres->tmplate, addr)))) { - if (CORE_TRACE) - HTTrace("Net After... calling %p (request %p, response %p, status %d, context %p)\n", - pres->after, request, response, - status, pres->param); + HTTRACE(CORE_TRACE, "Net After... calling %p (request %p, response %p, status %d, context %p)\n" _ + pres->after _ request _ response _ + status _ pres->param); ret = (*pres->after)(request, response, pres->param, status); if (ret != HT_OK) break; @@ -446,17 +441,15 @@ PUBLIC void HTNet_increaseSocket (void) { Active++; - if (CORE_TRACE) - HTTrace("Net Manager. Increasing active sockets to %d, %d persistent sockets\n", - Active, Persistent); + HTTRACE(CORE_TRACE, "Net Manager. Increasing active sockets to %d, %d persistent sockets\n" _ + Active _ Persistent); } PUBLIC void HTNet_decreaseSocket (void) { if (--Active < 0) Active = 0; - if (CORE_TRACE) - HTTrace("Net Manager. Decreasing active sockets to %d, %d persistent sockets\n", - Active, Persistent); + HTTRACE(CORE_TRACE, "Net Manager. Decreasing active sockets to %d, %d persistent sockets\n" _ + Active _ Persistent); } PUBLIC int HTNet_availableSockets (void) @@ -468,17 +461,15 @@ PUBLIC void HTNet_increasePersistentSocket (void) { Persistent++; - if (CORE_TRACE) - HTTrace("Net Manager. %d active sockets, increasing persistent sockets to %d\n", - Active, Persistent); + HTTRACE(CORE_TRACE, "Net Manager. %d active sockets, increasing persistent sockets to %d\n" _ + Active _ Persistent); } PUBLIC void HTNet_decreasePersistentSocket (void) { if (--Persistent < 0) Persistent = 0; - if (CORE_TRACE) - HTTrace("Net Manager. %d active sockets, decreasing persistent sockets to %d\n", - Active, Persistent); + HTTRACE(CORE_TRACE, "Net Manager. %d active sockets, decreasing persistent sockets to %d\n" _ + Active _ Persistent); } PUBLIC int HTNet_availablePersistentSockets (void) @@ -516,10 +507,9 @@ HTRequest * request = fe->request; int status = fe->status; if (timer != fe->timer) - HTDebugBreak(__FILE__, __LINE__, "Net timer. %p not in sync\n", timer); - if (CORE_TRACE) - HTTrace("HTNet....... Continuing calling AFTER filters %p with timer %p\n", - fe, timer); + HTDEBUGBREAK("Net timer. %p not in sync\n" _ timer); + HTTRACE(CORE_TRACE, "HTNet....... Continuing calling AFTER filters %p with timer %p\n" _ + fe _ timer); /* Delete the event context */ HT_FREE(fe); @@ -549,18 +539,17 @@ /* Create new object */ if ((me = (HTNet *) HT_CALLOC(1, sizeof(HTNet))) == NULL) HT_OUTOFMEM("HTNet_new"); - me->hash = net_hash++ % HASH_SIZE; + me->hash = net_hash++ % HT_XL_HASH_SIZE; /* Insert into hash table */ if (!NetTable) { - if ((NetTable = (HTList **) HT_CALLOC(HASH_SIZE, sizeof(HTList *))) == NULL) + if ((NetTable = (HTList **) HT_CALLOC(HT_XL_HASH_SIZE, sizeof(HTList *))) == NULL) HT_OUTOFMEM("create_object"); } if (!NetTable[me->hash]) NetTable[me->hash] = HTList_new(); HTList_addObject(NetTable[me->hash], (void *) me); HTNetCount++; - if (CORE_TRACE) - HTTrace("Net Object.. %p created with hash %d\n",me, me->hash); + HTTRACE(CORE_TRACE, "Net Object.. %p created with hash %d\n" _ me _ me->hash); return me; } @@ -577,7 +566,7 @@ int hash; if ((me = create_object()) == NULL) return NULL; hash = me->hash; - if (CORE_TRACE) HTTrace("Net Object.. Duplicated %p\n", src); + HTTRACE(CORE_TRACE, "Net Object.. Duplicated %p\n" _ src); memcpy((void *) me, src, sizeof(HTNet)); me->hash = hash; /* Carry over hash entry */ return me; @@ -588,9 +577,8 @@ PUBLIC BOOL HTNet_execute (HTNet * net, HTEventType type) { if (net && net->event.cbf && net->request) { - if (CORE_TRACE) - HTTrace("Net Object.. %p calling %p with event type %d and context %p\n", - net, net->event.cbf, type, net->event.param); + HTTRACE(CORE_TRACE, "Net Object.. %p calling %p with event type %d and context %p\n" _ + net _ net->event.cbf _ type _ net->event.param); (*(net->event.cbf))(HTNet_socket(net), net->event.param, type); return YES; } @@ -603,7 +591,7 @@ PUBLIC BOOL HTNet_start (HTNet * net) { if (net && net->event.cbf && net->request) { - if (CORE_TRACE) HTTrace("Net Object.. Launching %p\n", net); + HTTRACE(CORE_TRACE, "Net Object.. Launching %p\n" _ net); (*(net->event.cbf))(HTNet_socket(net), net->event.param, HTEvent_BEGIN); return YES; } @@ -615,18 +603,19 @@ ** This function creates a new HTNet object and assigns the socket number ** to it. This is intended to be used when you are going to listen on a ** socket using the HTDoListen() function in HTTCP.c. The function do NOT -** call any of the callback functions. +** call any of the before or after filter functions. ** Returns new object or NULL on error */ -PUBLIC HTNet * HTNet_new (HTRequest * request) +PUBLIC HTNet * HTNet_new (HTHost * host) { - HTNet * me; - if ((me = create_object()) == NULL) return NULL; - me->preemptive = HTRequest_preemptive(request); - HTNet_setEventPriority(me, HTRequest_priority(request)); - me->request = request; - HTRequest_setNet(request, me); - return me; + if (host) { + HTNet * me; + HTTRACE(CORE_TRACE, "Net Object.. Creating listen object for host %p\n" _ host); + me = create_object(); + me->host = host; + return me; + } + return NULL; } /* HTNet_newServer @@ -673,7 +662,7 @@ */ if (!(physical = HTAnchor_physical(anchor))) { char * addr = HTAnchor_address((HTAnchor *) anchor); - if (CORE_TRACE) HTTrace("Net Object.. Using default address\n"); + HTTRACE(CORE_TRACE, "Net Object.. Using default address\n"); HTAnchor_setPhysical(anchor, addr); physical = HTAnchor_physical(anchor); HT_FREE(addr); @@ -683,12 +672,12 @@ { char * access = HTParse(physical, "", PARSE_ACCESS); if ((protocol = HTProtocol_find(request, access)) == NULL) { - if (CORE_TRACE) HTTrace("Net Object.. NO PROTOCOL Object found for URI scheme `%s\'\n", access); + HTTRACE(CORE_TRACE, "Net Object.. NO PROTOCOL Object found for URI scheme `%s\'\n" _ access); HT_FREE(access); return NO; } if (!(cbf = HTProtocol_server(protocol))) { - if (CORE_TRACE) HTTrace("Net Object.. NO SERVER HANDLER for URI scheme `%s\'\n", access); + HTTRACE(CORE_TRACE, "Net Object.. NO SERVER HANDLER for URI scheme `%s\'\n" _ access); HT_FREE(access); HT_FREE(me); return NO; @@ -698,7 +687,7 @@ /* Find a transport object for this protocol */ if ((tp = HTTransport_find(request, HTProtocol_transport(protocol))) == NULL) { - if (CORE_TRACE) HTTrace("Net Object.. NO TRANSPORT found for protocol `%s\'\n", HTProtocol_name(protocol)); + HTTRACE(CORE_TRACE, "Net Object.. NO TRANSPORT found for protocol `%s\'\n" _ HTProtocol_name(protocol)); return NO; } @@ -712,14 +701,13 @@ HTRequest_setNet(request, me); /* Start the server request */ - if (CORE_TRACE) - HTTrace("Net Object.. starting SERVER request %p and net object %p\n", request, me); + HTTRACE(CORE_TRACE, "Net Object.. starting SERVER request %p and net object %p\n" _ request _ me); (*(cbf))(INVSOC, request); return YES; } -/* HTNet_new -** --------- +/* HTNet_newClient +** --------------- ** Create a new HTNet object as a new request to be handled. If we have ** more than MaxActive connections already then put this into the ** pending queue, else start the request by calling the call back @@ -764,7 +752,7 @@ */ if (!(physical = HTAnchor_physical(anchor))) { char * addr = HTAnchor_address((HTAnchor *) anchor); - if (CORE_TRACE) HTTrace("Net Object.. Using default address\n"); + HTTRACE(CORE_TRACE, "Net Object.. Using default address\n"); HTAnchor_setPhysical(anchor, addr); physical = HTAnchor_physical(anchor); HT_FREE(addr); @@ -775,12 +763,12 @@ char * proxy = HTRequest_proxy(request); char * access = HTParse(proxy ? proxy : physical, "", PARSE_ACCESS); if ((protocol = HTProtocol_find(request, access)) == NULL) { - if (CORE_TRACE) HTTrace("Net Object.. NO PROTOCOL Object found for URI scheme `%s\'\n", access); + HTTRACE(CORE_TRACE, "Net Object.. NO PROTOCOL Object found for URI scheme `%s\'\n" _ access); HT_FREE(access); return NO; } if (!(cbf = HTProtocol_client(protocol))) { - if (CORE_TRACE) HTTrace("Net Object.. NO CLIENT HANDLER for URI scheme `%s\'\n", access); + HTTRACE(CORE_TRACE, "Net Object.. NO CLIENT HANDLER for URI scheme `%s\'\n" _ access); HT_FREE(access); HT_FREE(me); return NO; @@ -791,7 +779,7 @@ /* Find a transport object for this protocol */ tp = HTTransport_find(request, HTProtocol_transport(protocol)); if (tp == NULL) { - if (CORE_TRACE) HTTrace("Net Object.. NO TRANSPORT found for protocol `%s\'\n", HTProtocol_name(protocol)); + HTTRACE(CORE_TRACE, "Net Object.. NO TRANSPORT found for protocol `%s\'\n" _ HTProtocol_name(protocol)); return NO; } @@ -815,51 +803,56 @@ ** If so then call the call back function associated with the anchor. ** We use the INVSOC as we don't have a valid socket yet! */ - if (CORE_TRACE) - HTTrace("Net Object.. starting request %p (retry=%d) with net object %p\n", - request, HTRequest_retrys(request), me); + HTTRACE(CORE_TRACE, "Net Object.. starting request %p (retry=%d) with net object %p\n" _ + request _ HTRequest_retrys(request) _ me); (*(cbf))(INVSOC, request); return YES; } -/* delete_object -** ------------- -** Deletes an HTNet object +/* +** Check whether we have any pending HTNet objects and if so +** then start the next one. ** Return YES if OK, else NO */ -PRIVATE BOOL delete_object (HTNet * net) +PRIVATE BOOL check_pending (HTNet * net) { - if (CORE_TRACE) HTTrace("Net Object.. Remove object %p\n", net); + HTTRACE(CORE_TRACE, "Net Object.. Check for pending Net objects\n"); if (net) { - /* Close socket */ /* ** As we may have a socket available we check for whether ** we can start any pending requests. We do this by asking for ** pending Host objects. If none then use the current object */ -/* (*net->input->isa->consumed)(net->input, net->header_length + net->bytes_read); - */ - HTHost_launchPending(net->host); - /* - ** Break the link to the request and free the Net object - */ - HTRequest_setNet(net->request, NULL); - HT_FREE(net); + return YES; + } + return NO; +} + +PRIVATE BOOL free_net (HTNet * net) +{ + HTTRACE(CORE_TRACE, "Net Object.. Freeing object %p\n" _ net); + if (net) { + if (net == HTRequest_net(net->request)) HTRequest_setNet(net->request, NULL); + HT_FREE(net); return YES; } return NO; } -PRIVATE BOOL remove_net (HTNet * net) +/* +** Unregister the net object from the global list +** and see if we can start a new pending request. +*/ +PRIVATE BOOL unregister_net (HTNet * net) { if (net && NetTable) { HTList * list = NetTable[net->hash]; if (list) { HTList_removeObject(list, (void *) net); - delete_object(net); + check_pending(net); HTNetCount--; return YES; } @@ -897,8 +890,7 @@ */ PUBLIC BOOL HTNet_delete (HTNet * net, int status) { - if (CORE_TRACE) - HTTrace("Net Object.. Delete %p and call AFTER filters\n", net); + HTTRACE(CORE_TRACE, "Net Object.. Delete %p and call AFTER filters\n" _ net); if (net) { HTRequest * request = net->request; @@ -912,9 +904,8 @@ HTHost_unregister (net->host, net, HTEvent_WRITE); if (status == HT_RECOVER_PIPE) { HTNet_clear(net); - if (CORE_TRACE) - HTTrace("Net Object.. Restarting request %p (retry=%d) with net object %p\n", - request, HTRequest_retrys(request), net); + HTTRACE(CORE_TRACE, "Net Object.. Restarting request %p (retry=%d) with net object %p\n" _ + request _ HTRequest_retrys(request) _ net); return YES; } HTHost_deleteNet(net->host, net, status); @@ -922,18 +913,26 @@ } /* Remove object from the table of Net Objects */ - remove_net(net); + unregister_net(net); + free_net(net); /* Call AFTER filters */ - HTNet_executeAfterAll(request, status); - return YES; + if (status != HT_IGNORE) HTNet_executeAfterAll(request, status); + + /* + ** Truely delete the HTNet object. Thanks to Mikhail Grouchinski + ** we now do this after having called the after filters so that + ** these filters can use the information in the Net object + */ + + return YES; } return NO; } PUBLIC BOOL HTNet_deleteDup (HTNet * dup) { - return dup ? remove_net(dup) : NO; + return dup ? (unregister_net(dup) && free_net(dup)) : NO; } /* HTNet_deleteAll @@ -943,16 +942,17 @@ */ PUBLIC BOOL HTNet_deleteAll (void) { - if (CORE_TRACE) - HTTrace("Net Object.. Remove all Net objects, NO filters\n"); + HTTRACE(CORE_TRACE, "Net Object.. Remove all Net objects, NO filters\n"); if (NetTable) { HTList * cur = NULL; HTNet * pres = NULL; int cnt; - for (cnt=0; cntrequest, HT_PROG_INTERRUPT, HT_MSG_NULL, NULL, NULL, NULL); - if (CORE_TRACE) HTTrace("Net Object.. Killing %p\n", net); + HTTRACE(CORE_TRACE, "Net Object.. Killing %p\n" _ net); if (net->event.cbf) { (*(net->event.cbf))(HTNet_socket(net), net->event.param, HTEvent_CLOSE); return YES; } - return remove_net(net); + return unregister_net(net) && free_net(net); } - if (CORE_TRACE) HTTrace("Net Object.. No object to kill\n"); + HTTRACE(CORE_TRACE, "Net Object.. No object to kill\n"); return NO; } @@ -1005,20 +1005,22 @@ */ PUBLIC BOOL HTNet_killAll (void) { - if (CORE_TRACE) HTTrace("Net Object.. Kill ALL Net objects!!!\n"); + HTTRACE(CORE_TRACE, "Net Object.. Kill ALL Net objects!!!\n"); if (NetTable) { HTList * cur = NULL; HTNet * pres = NULL; int cnt; - for (cnt=0; cnthost, persistent, mode); - if (CORE_TRACE) - HTTrace("Net Object.. Persistent connection set %s %s\n", - persistent ? "ON" : "OFF", + HTTRACE(CORE_TRACE, "Net Object.. Persistent connection set %s %s\n" _ + persistent ? "ON" : "OFF" _ result ? "succeeded" : "failed"); return result; } @@ -1223,7 +1224,7 @@ HTChannel_setOutput(ch, output); return output; } - if (CORE_TRACE) HTTrace("Host Object.. Can't create output stream\n"); + HTTRACE(CORE_TRACE, "Host Object.. Can't create output stream\n"); return NULL; } diff -Naur xdvik-22.40l/libs/libwww/HTNet.h xdvik-22.40n/libs/libwww/HTNet.h --- xdvik-22.40l/libs/libwww/HTNet.h Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTNet.h Fri Sep 13 00:23:46 2002 @@ -27,9 +27,9 @@ - this is just to explain the difference. When a Request object is passed to the Library , -the core creates a new HTNet object pr channel +the core creates a new HTNet object per channel used by the request. In many cases a request only uses a single -channel object but for example FTP requests use +channel object but, for example, FTP requests use at least two - one for the control connection and one for the data connection. You can find more information about the libwww pseudo thread model in the @@ -67,7 +67,7 @@ Filter functions can be registered to be called before and after a request has either been started or has terminated. The -conditions for BEFORE and AFTER filters are not the same so +conditions for BEFORE and AFTER filters are not the same, and so we maintain them independently. Filters can be registered globally or locally. The global filters are registered directly by the Net Object (this module) and the local filters are registered by the @@ -147,7 +147,7 @@ /* -You get rid of all BEFORE filters usign this function +You get rid of all BEFORE filters using this function */ extern BOOL HTNetCall_deleteBeforeAll (HTList * list); @@ -208,15 +208,15 @@ HT_TEMP_REDIRECT - The request has been temporaryly redirected and we send back the new URL + The request has been temporarily redirected and we send back the new URL HT_ALL All of above -A Protocol module can also in certain cases return a HT_IGNORE in -which case no filters are called +A Protocol module can also, in certain cases, return a HT_IGNORE +in which case no filters are called */ typedef int HTNetAfter (HTRequest * request, HTResponse * response, @@ -468,7 +468,7 @@ And you can create a plain new HTNet object using the following method: */ -extern HTNet * HTNet_new (HTRequest * request); +extern HTNet * HTNet_new (HTHost * host); /* ( @@ -779,6 +779,6 @@ - @(#) $Id: HTNet.h,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ + @(#) $Id: HTNet.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTNetMan.h xdvik-22.40n/libs/libwww/HTNetMan.h --- xdvik-22.40l/libs/libwww/HTNetMan.h Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTNetMan.h Fri Sep 13 00:23:46 2002 @@ -146,6 +146,6 @@ - @(#) $Id: HTNetMan.h,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ + @(#) $Id: HTNetMan.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTNetTxt.c xdvik-22.40n/libs/libwww/HTNetTxt.c --- xdvik-22.40l/libs/libwww/HTNetTxt.c Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTNetTxt.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTNetTxt.c,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ +** @(#) $Id: HTNetTxt.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module provides two basic streams that converts from CRLF to ** an internal C representation (\n) and from the C representation to diff -Naur xdvik-22.40l/libs/libwww/HTNetTxt.h xdvik-22.40n/libs/libwww/HTNetTxt.h --- xdvik-22.40l/libs/libwww/HTNetTxt.h Wed Apr 18 14:23:19 2001 +++ xdvik-22.40n/libs/libwww/HTNetTxt.h Fri Sep 13 00:23:46 2002 @@ -1,13 +1,13 @@ /* - W3C Sample Code Library libwww CRLF STRIPPER STREAM + + + W3C Sample Code Library libwww CRLF Stripper Stream - - - -!Network Telnet To Internal Character Text! - +! + Network Telnet To Internal Character Text +! */ /* @@ -17,15 +17,14 @@ /* -This is a filter stream suitable for taking text from a socket and -passing it into a stream which expects text in the local C -representation. It does newline conversion. As usual, pass its -output stream to it when creating it. - -This module is implemented by HTNetTxt.c, and -it is a part of the W3C -Sample Code Library. - +This is a filter stream suitable for taking text from a socket and passing +it into a stream which expects text in the local C representation. It does +newline conversion. As usual, pass its output stream to it when creating +it. + +This module is implemented by HTNetTxt.c, and it +is a part of the W3C Sample Code +Library. */ #ifndef HTNETTXT_H @@ -37,9 +36,8 @@ /* + - -@(#) $Id: HTNetTxt.h,v 1.1.1.1 2001/04/18 14:23:19 stefanulrich Exp $ - + @(#) $Id: HTNetTxt.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTNews.c xdvik-22.40n/libs/libwww/HTNews.c --- xdvik-22.40l/libs/libwww/HTNews.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTNews.c Fri Sep 13 00:23:46 2002 @@ -109,7 +109,7 @@ if (isdigit((int) *(me->buffer))) sscanf(me->buffer, "%d", &news->repcode); me->buflen = 0; news->reply = me->buffer+4; - if (PROT_TRACE) HTTrace("News Rx..... `%s\'\n", news->reply); + HTTRACE(PROT_TRACE, "News Rx..... `%s\'\n" _ news->reply); /* If 2xx code and we expect data then go into semi-transparent mode */ if (me->news->format && news->repcode/100 == 2) { @@ -149,8 +149,7 @@ } else { *(me->buffer+me->buflen++) = *b; if (me->buflen >= MAX_NEWS_LINE) { - if (PROT_TRACE) - HTTrace("News Status. Line too long - chopped\n"); + HTTRACE(PROT_TRACE, "News Status. Line too long - chopped\n"); me->junk = YES; if ((status = ScanResponse(me)) != HT_LOADED) return status; } @@ -218,7 +217,7 @@ if (me->target) ABORT_TARGET; HT_FREE(me); - if (PROT_TRACE) HTTrace("NewsStatus.. ABORTING...\n"); + HTTRACE(PROT_TRACE, "NewsStatus.. ABORTING...\n"); return HT_ERROR; } @@ -309,13 +308,12 @@ { HTStream * input = HTRequest_inputStream(request); int len = strlen(token) + (pars ? strlen(pars)+1:0) + 2; - HTChunk_clear(news->cmd); - HTChunk_ensure(news->cmd, len); + HTChunk_setSize(news->cmd, len); if (pars && *pars) sprintf(HTChunk_data(news->cmd), "%s %s%c%c", token, pars, CR, LF); else sprintf(HTChunk_data(news->cmd), "%s%c%c", token, CR, LF); - if (PROT_TRACE) HTTrace("News Tx..... %s", HTChunk_data(news->cmd)); + HTTRACE(PROT_TRACE, "News Tx..... %s" _ HTChunk_data(news->cmd)); return (*input->isa->put_block)(input, HTChunk_data(news->cmd), len); } @@ -342,8 +340,7 @@ HTNet * net = HTRequest_net(request); char * url = HTAnchor_physical(anchor); - if (PROT_TRACE) - HTTrace("NNTP........ Looking for `%s\'\n", url); + HTTRACE(PROT_TRACE, "NNTP........ Looking for `%s\'\n" _ url); if ((news = (news_info *) HT_CALLOC(1, sizeof(news_info))) == NULL) HT_OUTOFMEM("HTLoadNews"); news->cmd = HTChunk_new(128); @@ -403,17 +400,17 @@ char *newshack = NULL; /* Then we can use HTParse :-) */ StrAllocCopy(newshack, "news://"); StrAllocCat(newshack, newshost); - status = HTHost_connect(host, net, (char *) newshack, NEWS_PORT); + status = HTHost_connect(host, net, (char *) newshack); host = HTNet_host(net); HT_FREE(newshack); } else news->state = NEWS_ERROR; } else if (!strncasecomp(url, "nntp:", 5)) { news->name = HTParse(url, "", PARSE_PATH); - status = HTHost_connect(host, net, url, NEWS_PORT); + status = HTHost_connect(host, net, url); host = HTNet_host(net); } else { - if (PROT_TRACE) HTTrace("News........ Huh?"); + HTTRACE(PROT_TRACE, "News........ Huh?"); news->state = NEWS_ERROR; } if (status == HT_OK) { diff -Naur xdvik-22.40l/libs/libwww/HTNews.h xdvik-22.40n/libs/libwww/HTNews.h --- xdvik-22.40l/libs/libwww/HTNews.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTNews.h Fri Sep 13 00:23:46 2002 @@ -64,6 +64,6 @@ - @(#) $Id: HTNews.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ + @(#) $Id: HTNews.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTNewsLs.c xdvik-22.40n/libs/libwww/HTNewsLs.c --- xdvik-22.40l/libs/libwww/HTNewsLs.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTNewsLs.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTNewsLs.c,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +** @(#) $Id: HTNewsLs.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Authors ** FTLO Felix Lo @@ -19,6 +19,7 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWCore.h" +#include "HTUTree.h" #include "HTNDir.h" #include "HTNews.h" #include "HTNewsLs.h" /* Implemented here */ @@ -178,7 +179,7 @@ HTArray_delete(me->cache); } HT_FREE(me->host); - if (PROT_TRACE) HTTrace("News Cache.. Deleted cache %p\n", me); + HTTRACE(PROT_TRACE, "News Cache.. Deleted cache %p\n" _ me); HT_FREE(me); return YES; } @@ -214,8 +215,7 @@ tree = HTUTree_find(NEWS_TREE, newshost, port); HT_FREE(newshost); if (!tree) { - if (PROT_TRACE) - HTTrace("News Cache.. No information for `%s\'\n", url); + HTTRACE(PROT_TRACE, "News Cache.. No information for `%s\'\n" _ url); return NULL; } @@ -254,7 +254,7 @@ tree = HTUTree_new(NEWS_TREE, newshost, port, HTNewsCache_delete); HT_FREE(newshost); if (!tree) { - if (PROT_TRACE)HTTrace("News Cache.. Can't create tree\n"); + HTTRACE(PROT_TRACE, "News Cache.. Can't create tree\n"); return NO; } @@ -291,7 +291,7 @@ if (element) { char * title = GetNewsGroupTitle(request); HTNewsDir * dir = HTNewsDir_new(request, title, list_key, NO); - void ** data; + void ** data = NULL; char * line = (char *) HTArray_firstObject(element->cache, data); while (line) { HTNewsDir_addGroupElement(dir, line, NO); @@ -315,7 +315,7 @@ void * context, int status) { HTArray * array = (HTArray *) context; - if (PROT_TRACE) HTTrace("News Cache.. AFTER filter\n"); + HTTRACE(PROT_TRACE, "News Cache.. AFTER filter\n"); if (request && array) { char * url = HTAnchor_address((HTAnchor *) HTRequest_anchor(request)); HTNewsCache_update(request, url, array); @@ -357,8 +357,7 @@ } else { *(me->buffer+me->buflen++) = *b; if (me->buflen >= MAX_NEWS_LINE) { - if (PROT_TRACE) - HTTrace("News Dir.... Line too long - chopped\n"); + HTTRACE(PROT_TRACE, "News Dir.... Line too long - chopped\n"); *(me->buffer+me->buflen) = '\0'; me->group ? ParseGroup(me->request, me->dir, me->buffer) : ParseList(me->dir, me->buffer); @@ -396,7 +395,7 @@ PRIVATE int HTNewsList_abort (HTStream * me, HTList * e) { - if (PROT_TRACE) HTTrace("News Dir.... ABORTING...\n"); + HTTRACE(PROT_TRACE, "News Dir.... ABORTING...\n"); HTNewsList_free(me); return HT_ERROR; } diff -Naur xdvik-22.40l/libs/libwww/HTNewsLs.h xdvik-22.40n/libs/libwww/HTNewsLs.h --- xdvik-22.40l/libs/libwww/HTNewsLs.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTNewsLs.h Fri Sep 13 00:23:46 2002 @@ -53,6 +53,6 @@ - @(#) $Id: HTNewsLs.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ + @(#) $Id: HTNewsLs.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTNewsRq.c xdvik-22.40n/libs/libwww/HTNewsRq.c --- xdvik-22.40l/libs/libwww/HTNewsRq.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTNewsRq.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTNewsRq.c,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +** @(#) $Id: HTNewsRq.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module implements the output stream for MIME used for sending ** requests with or without a entity body to HTTP, NEWS, etc. @@ -84,7 +84,7 @@ /* DO FOR ALL SUB ANCHOR DESTINATION S AS WELL */ } - if (PROT_TRACE) HTTrace("News Tx..... %s", HTChunk_data(header)); + HTTRACE(PROT_TRACE, "News Tx..... %s" _ HTChunk_data(header)); return YES; } @@ -161,7 +161,7 @@ if (me->target) (*me->target->isa->abort)(me->target, e); HTChunk_delete(me->buffer); HT_FREE(me); - if (PROT_TRACE) HTTrace("NewsPost.... ABORTING...\n"); + HTTRACE(PROT_TRACE, "NewsPost.... ABORTING...\n"); return HT_ERROR; } diff -Naur xdvik-22.40l/libs/libwww/HTNewsRq.h xdvik-22.40n/libs/libwww/HTNewsRq.h --- xdvik-22.40l/libs/libwww/HTNewsRq.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTNewsRq.h Fri Sep 13 00:23:46 2002 @@ -48,7 +48,7 @@ -@(#) $Id: HTNewsRq.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +@(#) $Id: HTNewsRq.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTNoFree.c xdvik-22.40n/libs/libwww/HTNoFree.c --- xdvik-22.40l/libs/libwww/HTNoFree.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTNoFree.c Fri Sep 13 00:23:46 2002 @@ -0,0 +1,82 @@ +/* +** NO FREE STREAM +** +** (c) COPYRIGHT MIT 1995. +** Please first read the full copyright statement in the file COPYRIGH. +** @(#) $Id: HTNoFree.c,v 1.1.2.1 2002/09/13 00:23:46 stefanulrich Exp $ +** +** This stream is a throughline for all methods except FREE and ABORT +** +*/ + +/* Library include files */ +#include "wwwsys.h" +#include "HTUtils.h" +#include "HTStream.h" /* Implemented here */ + +struct _HTStream { + const HTStreamClass * isa; + HTStream * target; +}; + +/* ------------------------------------------------------------------------- */ + +PRIVATE int HTNoFreeStream_put_character (HTStream * me, char c) +{ + return (*me->target->isa->put_character)(me->target, c); +} + +PRIVATE int HTNoFreeStream_put_string (HTStream * me, const char * s) +{ + return (*me->target->isa->put_string)(me->target, s); +} + +PRIVATE int HTNoFreeStream_write (HTStream * me, const char * s, int l) +{ + return (*me->target->isa->put_block)(me->target, s, l); +} + +PRIVATE int HTNoFreeStream_flush (HTStream * me) +{ + return (*me->target->isa->flush)(me->target); +} + +PRIVATE int HTNoFreeStream_free (HTStream * me) +{ + return HT_OK; +} + +PRIVATE int HTNoFreeStream_abort (HTStream * me, HTList * e) +{ + return HT_ERROR; +} + +PRIVATE const HTStreamClass HTNoFreeStreamClass = +{ + "NoFreeStream", + HTNoFreeStream_flush, + HTNoFreeStream_free, + HTNoFreeStream_abort, + HTNoFreeStream_put_character, + HTNoFreeStream_put_string, + HTNoFreeStream_write +}; + +PUBLIC HTStream * HTNoFreeStream_new (HTStream * target) +{ + if (target) { + HTStream * me; + if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) + HT_OUTOFMEM("HTNoFree"); + me->isa = &HTNoFreeStreamClass; + me->target = target; + return me; + } + return HTErrorStream(); +} + +PUBLIC int HTNoFreeStream_delete (HTStream * me) +{ + if (me) HT_FREE(me); + return HT_OK; +} diff -Naur xdvik-22.40l/libs/libwww/HTNoFree.h xdvik-22.40n/libs/libwww/HTNoFree.h --- xdvik-22.40l/libs/libwww/HTNoFree.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTNoFree.h Fri Sep 13 00:23:46 2002 @@ -0,0 +1,48 @@ +/* + + W3C Sample Code Library libwww No Free Stream + + + + +!No Free Stream! + +*/ + +/* +** (c) COPYRIGHT MIT 1995. +** Please first read the full copyright statement in the file COPYRIGH. +*/ + +/* + +This stream is a throughline for all methods except FREE and +ABORT. This means that it can be use to put ahead of streams that you +don't want to be freed or aborted until you are redy to do it +yourself. + +This module is implemented by HTNoFree.c, and +it is a part of the W3C Sample +Code Library. + +*/ + +#ifndef _HTNOFREE_H +#define _HTNOFREE_H + +#include "HTStream.h" + +extern HTStream * HTNoFreeStream_new (HTStream * target); + +extern int HTNoFreeStream_delete (HTStream * me); + +#endif /* HTNOFREE_H */ + +/* + + + +@(#) $Id: HTNoFree.h,v 1.1.2.1 2002/09/13 00:23:46 stefanulrich Exp $ + + +*/ diff -Naur xdvik-22.40l/libs/libwww/HTPEP.c xdvik-22.40n/libs/libwww/HTPEP.c --- xdvik-22.40l/libs/libwww/HTPEP.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTPEP.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTPEP.c,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +** @(#) $Id: HTPEP.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** ** AUTHORS: @@ -19,7 +19,6 @@ #include "WWWCore.h" #include "HTPEP.h" /* Implemented here */ -#define HASH_SIZE 67 /* Arbitrary prime */ #define PEP_NAME "w3c-pep" /* Name of the PEP tree */ #define DEFAULT_PORT 80 /* Concentrate on HTTP */ @@ -59,18 +58,19 @@ HTPEPModule * pres = NULL; *hashlist = NULL; if (!name) { - if (APP_TRACE) HTTrace("PEP Engine.. Bad argument\n"); + HTTRACE(APP_TRACE, "PEP Engine.. Bad argument\n"); return NULL; } /* Find a hash for this PEP module */ { - int hash = 0; - const char * ptr; - for (ptr=name; *ptr; ptr++) - hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HASH_SIZE); + int hash; + const unsigned char * p; + for (p=name, hash=0; *p; p++) { + hash = (hash * 3 + *p) % HT_M_HASH_SIZE; + } if (!HTModules) { - if ((HTModules = (HTList **) HT_CALLOC(HASH_SIZE, + if ((HTModules = (HTList **) HT_CALLOC(HT_M_HASH_SIZE, sizeof(HTList *))) == NULL) HT_OUTOFMEM("find_module"); } @@ -110,13 +110,13 @@ /* Add the new PEP Module to the hash table */ HTList_addObject(hashlist, (void *) pres); - if (APP_TRACE) HTTrace("PEP Engine.. Created module %p\n", pres); + HTTRACE(APP_TRACE, "PEP Engine.. Created module %p\n" _ pres); } else { - if (APP_TRACE) HTTrace("PEP Engine.. Found module %p\n", pres); + HTTRACE(APP_TRACE, "PEP Engine.. Found module %p\n" _ pres); } return pres; } else { - if (APP_TRACE) HTTrace("PEP Engine.. Bad argument\n"); + HTTRACE(APP_TRACE, "PEP Engine.. Bad argument\n"); return NULL; } } @@ -126,11 +126,10 @@ if (name) { HTList * hashlist = NULL; HTPEPModule * pres = find_module(name, &hashlist); - if (APP_TRACE) - HTTrace("PEP Engine.. did %sfind %s\n", pres ? "" : "NOT ", name); + HTTRACE(APP_TRACE, "PEP Engine.. did %sfind %s\n" _ pres ? "" : "NOT " _ name); return pres; } else { - if (APP_TRACE) HTTrace("PEP Engine.. Bad augument\n"); + HTTRACE(APP_TRACE, "PEP Engine.. Bad augument\n"); } return NULL; } @@ -142,7 +141,7 @@ HTPEPModule * pres = find_module(name, &hashlist); if (pres) { HTList_removeObject(hashlist, pres); - if (APP_TRACE) HTTrace("PEP Engine.. deleted %p\n", pres); + HTTRACE(APP_TRACE, "PEP Engine.. deleted %p\n" _ pres); delete_module(pres); return YES; } @@ -155,7 +154,7 @@ if (HTModules) { int cnt; HTList * cur; - for (cnt=0; cntname, name); me->context = context; - if (APP_TRACE) HTTrace("PEP Engine.. Created element %p\n", me); + HTTRACE(APP_TRACE, "PEP Engine.. Created element %p\n" _ me); return me; } return NULL; @@ -196,7 +195,7 @@ PRIVATE BOOL HTPEP_deleteElement (HTPEPElement * me) { if (me) { - if (APP_TRACE) HTTrace("PEP Engine.. Deleted element %p\n", me); + HTTRACE(APP_TRACE, "PEP Engine.. Deleted element %p\n" _ me); HT_FREE(me->name); HT_FREE(me); return YES; @@ -211,7 +210,7 @@ PRIVATE HTList * HTPEP_newList (void) { HTList * me = HTList_new(); - if (APP_TRACE) HTTrace("PEP Engine.. Created list %p\n", me); + HTTRACE(APP_TRACE, "PEP Engine.. Created list %p\n" _ me); return me; } @@ -222,7 +221,7 @@ HTPEPElement * pres; while ((pres = (HTPEPElement *) HTList_nextObject(list))) HTPEP_deleteElement(pres); - if (APP_TRACE) HTTrace("PEP Engine.. Deleted list %p\n", list); + HTTRACE(APP_TRACE, "PEP Engine.. Deleted list %p\n" _ list); HTList_delete(list); return YES; } @@ -245,10 +244,10 @@ { HTUTree * tree; if (!url) { - if (APP_TRACE) HTTrace("PEP Engine.. Bad argument\n"); + HTTRACE(APP_TRACE, "PEP Engine.. Bad argument\n"); return NULL; } - if (APP_TRACE) HTTrace("PEP Engine.. Looking for info on `%s'\n", url); + HTTRACE(APP_TRACE, "PEP Engine.. Looking for info on `%s'\n" _ url); /* Find a URLTree for this URL (if any) */ { @@ -262,7 +261,7 @@ tree = HTUTree_find(PEP_NAME, host, port); HT_FREE(host); if (!tree) { - if (APP_TRACE) HTTrace("PEP Engine.. No information\n"); + HTTRACE(APP_TRACE, "PEP Engine.. No information\n"); return NULL; } } @@ -288,14 +287,14 @@ HTUTree * tree = NULL; HTPEPModule * module = NULL; if (!protocol || !url) { - if (APP_TRACE) HTTrace("PEP Engine.. Bad argument\n"); + HTTRACE(APP_TRACE, "PEP Engine.. Bad argument\n"); return NO; } - if (APP_TRACE) HTTrace("PEP Engine.. Adding info for `%s'\n", url); + HTTRACE(APP_TRACE, "PEP Engine.. Adding info for `%s'\n" _ url); /* Find the PEP module with this name */ if ((module = HTPEP_findModule(protocol)) == NULL) { - if (APP_TRACE) HTTrace("PEP Engine.. Module `%s\' not registered\n", + HTTRACE(APP_TRACE, "PEP Engine.. Module `%s\' not registered\n" _ protocol ? protocol : ""); return NO; } @@ -312,7 +311,7 @@ tree = HTUTree_new(PEP_NAME, host, port, HTPEP_deleteList); HT_FREE(host); if (!tree) { - if (APP_TRACE) HTTrace("PEP Engine.. Can't create tree\n"); + HTTRACE(APP_TRACE, "PEP Engine.. Can't create tree\n"); return NO; } } @@ -354,8 +353,7 @@ HTList * list = HTPEP_findList(realm, url); if (list) { HTPEPElement * pres; - if (APP_TRACE) - HTTrace("PEP Engine.. Calling BEFORE protocols %p\n", list); + HTTRACE(APP_TRACE, "PEP Engine.. Calling BEFORE protocols %p\n" _ list); while ((pres = (HTPEPElement *) HTList_nextObject(list))) { HTPEPModule * module = HTPEP_findModule(pres->name); if (module) { @@ -378,8 +376,7 @@ HTAssocList * protocols = HTResponse_protocol(response); if (protocols) { HTPEPElement * pres; - if (APP_TRACE) - HTTrace("PEP Engine.. Calling AFTER protocols %p\n", protocols); + HTTRACE(APP_TRACE, "PEP Engine.. Calling AFTER protocols %p\n" _ protocols); while ((pres = (HTPEPElement *) HTList_nextObject(protocols))) { HTPEPModule * module = HTPEP_findModule(pres->name); if (module) { diff -Naur xdvik-22.40l/libs/libwww/HTPEP.h xdvik-22.40n/libs/libwww/HTPEP.h --- xdvik-22.40l/libs/libwww/HTPEP.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTPEP.h Fri Sep 13 00:23:46 2002 @@ -177,6 +177,6 @@ - @(#) $Id: HTPEP.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ + @(#) $Id: HTPEP.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTParse.c xdvik-22.40n/libs/libwww/HTParse.c --- xdvik-22.40l/libs/libwww/HTParse.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTParse.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTParse.c,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +** @(#) $Id: HTParse.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** history: ** May 12 94 TAB added as legal char in HTCleanTelnetString @@ -356,10 +356,10 @@ char *path; char *p; if (!url || !*url) { - if (URI_TRACE) HTTrace("HTSimplify.. Nothing done\n"); + HTTRACE(URI_TRACE, "HTSimplify.. Nothing done\n"); return *url; } - if (URI_TRACE) HTTrace("HTSimplify.. `%s\' ", *url); + HTTRACE(URI_TRACE, "HTSimplify.. `%s\' " _ *url); /* Find any scheme name */ if ((path = strstr(*url, "://")) != NULL) { /* Find host name */ @@ -383,8 +383,7 @@ *ptr = TOLOWER(*ptr); ptr++; } - if (URI_TRACE) - HTTrace("into\n............ `%s'\n", *url); + HTTRACE(URI_TRACE, "into\n............ `%s'\n" _ *url); return *url; /* Doesn't need to do any more */ } if ((p = path)) { @@ -435,7 +434,7 @@ char * dest = path+3; while ((*orig++ = *dest++)); } - if (URI_TRACE) HTTrace("into\n............ `%s'\n", *url); + HTTRACE(URI_TRACE, "into\n............ `%s'\n" _ *url); return *url; } @@ -493,16 +492,15 @@ strcat(result, last_slash+1); if (!*result) strcat(result, "./"); } - if (URI_TRACE) - HTTrace("HTRelative.. `%s' expressed relative to `%s' is `%s'\n", - aName, relatedName, result); + HTTRACE(URI_TRACE, "HTRelative.. `%s' expressed relative to `%s' is `%s'\n" _ + aName _ relatedName _ result); #if 0 { char * absstr = HTParse(result, relatedName, PARSE_ALL); HTSimplify(&absstr); - HTTrace("HTRelative.. `%s' made absolute based on `%s' is `%s'\n", - result, relatedName, absstr); - if (strcmp(absstr, aName) != 0) HTTrace("THEY DIFFER!!!\n"); + HTTRACE(URI_TRACE, "HTRelative.. `%s' made absolute based on `%s' is `%s'\n" _ + result _ relatedName _ absstr); + if (strcmp(absstr, aName) != 0) HTTRACE(URI_TRACE, "THEY DIFFER!!!\n"); HT_FREE(absstr); } #endif @@ -532,11 +530,9 @@ while (*cur) { int a = TOASCII((unsigned char) *cur); if (a != 0x9 && (a < 0x20 || (a > 0x7E && a < 0xA0) || a > 0xFE)) { - if (URI_TRACE) - HTTrace("Illegal..... character in URL: \"%s\"\n",str); + HTTRACE(URI_TRACE, "Illegal..... character in URL: \"%s\"\n" _ str); *cur = 0; - if (URI_TRACE) - HTTrace("Truncated... \"%s\"\n",str); + HTTRACE(URI_TRACE, "Truncated... \"%s\"\n" _ str); return YES; } cur++; diff -Naur xdvik-22.40l/libs/libwww/HTParse.h xdvik-22.40n/libs/libwww/HTParse.h --- xdvik-22.40l/libs/libwww/HTParse.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTParse.h Fri Sep 13 00:23:46 2002 @@ -23,7 +23,7 @@ o Canonicalization of URIs o - Search a URI for illigal characters in order to prevent + Search a URI for illegal characters in order to prevent security holes @@ -200,6 +200,6 @@ - @(#) $Id: HTParse.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ + @(#) $Id: HTParse.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTPlain.c xdvik-22.40n/libs/libwww/HTPlain.c --- xdvik-22.40l/libs/libwww/HTPlain.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTPlain.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTPlain.c,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +** @(#) $Id: HTPlain.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This version of the stream object just writes to a socket. ** The socket is assumed open and left open. @@ -51,6 +51,7 @@ { if (me) { HTextImp_build(me->text, HTEXT_END); + HTextImp_delete(me->text); HT_FREE(me); } return HT_OK; @@ -60,6 +61,7 @@ { if (me) { HTextImp_build(me->text, HTEXT_ABORT); + HTextImp_delete(me->text); HT_FREE(me); } return HT_ERROR; diff -Naur xdvik-22.40l/libs/libwww/HTPlain.h xdvik-22.40n/libs/libwww/HTPlain.h --- xdvik-22.40l/libs/libwww/HTPlain.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTPlain.h Fri Sep 13 00:23:46 2002 @@ -35,7 +35,7 @@ -@(#) $Id: HTPlain.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +@(#) $Id: HTPlain.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTProfil.c xdvik-22.40n/libs/libwww/HTProfil.c --- xdvik-22.40l/libs/libwww/HTProfil.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTProfil.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTProfil.c,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +** @(#) $Id: HTProfil.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Defines a set of application profiles */ @@ -13,6 +13,8 @@ #include "WWWUtil.h" #include "WWWCore.h" #include "WWWCache.h" +#include "WWWStream.h" +#include "HTInit.h" #include "HTProfil.h" /* Implemented here */ PRIVATE HTList * converters = NULL; @@ -33,6 +35,14 @@ /* Clean up all the global preferences */ HTFormat_deleteAll(); + /* The following lists have been cleaned up by HTFormat_deleteAll */ + transfer_encodings = 0; + content_encodings = 0; + converters = 0; + + /* Remove bindings between suffixes, media types */ + HTBind_deleteAll(); + /* Terminate libwww */ HTLibTerminate(); } @@ -61,8 +71,11 @@ else HTProtocolInit(); + /* Initialize suffix bindings for local files */ + HTBind_init(); + /* Set max number of sockets we want open simultanously */ - HTNet_setMaxSocket(64); + HTNet_setMaxSocket(32); /* The persistent cache does not work in preemptive mode */ if (cache) HTCacheInit(NULL, 20); @@ -132,6 +145,8 @@ /* Do the default setup */ client_profile(AppName, AppVersion, YES, NO, NO); + /* Set up default event loop */ + HTEventInit(); /* Remember that we are loading preemptively */ preemptive = YES; } @@ -171,8 +186,11 @@ /* Register the default set of application protocol modules */ HTProtocolInit(); + /* Initialize suffix bindings for local files */ + HTBind_init(); + /* Set max number of sockets we want open simultanously */ - HTNet_setMaxSocket(64); + HTNet_setMaxSocket(32); /* Register some default set of BEFORE and AFTER filters */ HTNet_addBefore(HTRuleFilter, NULL, NULL, HT_FILTER_MIDDLE); diff -Naur xdvik-22.40l/libs/libwww/HTProfil.h xdvik-22.40n/libs/libwww/HTProfil.h --- xdvik-22.40l/libs/libwww/HTProfil.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTProfil.h Fri Sep 13 00:23:46 2002 @@ -120,7 +120,7 @@ We also have a blocking (preemptive) version of the same client interface. The difference is that this version uses traditional blocking sockets and -hence only one reques can be performed at the same time. +hence only one request can be performed at the same time. */ extern void HTProfile_newPreemptiveClient ( @@ -164,7 +164,7 @@ This is a generic profile cleanup that should be used on all the profiles above. This will clean up the memory allocated by the profile and by the Library core itself. After calling this you can not call any Library function -again. This call also superseeds the termination function for teh Library +again. This call also supersedes the termination function for the Library core, HTLibTerminate() so that you don't have to call that after calling this function. */ @@ -179,6 +179,6 @@ - @(#) $Id: HTProfil.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ + @(#) $Id: HTProfil.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTProt.c xdvik-22.40n/libs/libwww/HTProt.c --- xdvik-22.40l/libs/libwww/HTProt.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTProt.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTProt.c,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +** @(#) $Id: HTProt.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** ** HISTORY: @@ -64,7 +64,7 @@ newProt->client = client; newProt->server = server; if (!protocols) protocols = HTList_new(); - if (CORE_TRACE) HTTrace("Protocol.... Adding `%s'\n", name); + HTTRACE(CORE_TRACE, "Protocol.... Adding `%s'\n" _ name); return HTList_addObject(protocols, (void *) newProt); } return NO; @@ -80,9 +80,11 @@ HTProtocol *pres; while ((pres = (HTProtocol *) HTList_nextObject(cur))) { if (!strcmp(pres->name, name)) { + BOOL status = HTList_removeObject(protocols, (void *) pres); HT_FREE(pres->name); HT_FREE(pres->transport); - return HTList_removeObject(protocols, (void *) pres); + HT_FREE(pres); + return status; } } } diff -Naur xdvik-22.40l/libs/libwww/HTProt.h xdvik-22.40n/libs/libwww/HTProt.h --- xdvik-22.40l/libs/libwww/HTProt.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTProt.h Fri Sep 13 00:23:46 2002 @@ -1,45 +1,56 @@ + /* - - - W3C Sample Code Library libwww Protocol Class -! - The Protocol Class -! -*/ + W3C Sample Code Library libwww Protocol Class + + +!The Protocol Class! +*/ /* -** (c) COPYRIGHT MIT 1995. -** Please first read the full copyright statement in the file COPYRIGH. +** (c) COPYRIGHT MIT 1995. +** Please first read the full copyright statement in the file COPYRIGH. */ - /* -The Protocol class defines an application level protocol (HTTP, FTP, Gopher, -etc.) to be used by libwww. Please note that access to the local file system -also is considered to be an appliaction level protocol treated identically -to for example the HTTP protocol. The Protocol class does only know about -the application layer protocol and it relies on the -Transport Class to do the actualt communication -with the network, the local file system etc. The protocol class defines an -access method for botg a client and a server. A typical client application -would probably only want to use the client method and a server only the server -method. However, any application can use both which allows it to seemlessly -to change between server and client profile as needed. +The Protocol class defines an application level protocol (HTTP, FTP, +Gopher, etc.) to be used by libwww. Note that access to the local file system +also is considered to be an appliaction level protocol treated identically to +for example the HTTP protocol. -Note: The library core does not define any default application -layer protocols - they are all considered part of the application. The library -comes with a default set of protocols including the ones mentioned above -which can be initiated using the function HTProtocolInit() in -HTInit module +The Protocol class does only know about the application layer protocol and +it relies on the Transport Class to do the actualt +communication with the network, the local file system etc. The protocol class +defines an access method for both a client and a server. A typical client +application would probably only want to use the client method and a server +only the server method. However, any application can use both which allows it +to seemlessly to change between server and client profile as needed. -This module is implemented by HTProt.c, and it is -a part of the W3C Sample Code +All protocol modules are dynamically bound to an access scheme. Take for +example the address http://www.w3.org which has the access scheme +http and if we have a protocol module capable of handling HTTP then we +can make the binding between http and this module. As mentioned in the +introduction to this chapter, the Library already comes with a large set of +protocol module, including HTTP so all we have to do in this case is to +register the HTTP module to the Library as being capable of handling +http URLs. + +Libwww comes with a default set of protocols including the ones mentioned +above which can be initiated using the function HTProtocolInit() +in HTInit module + +One special case is the support for access to WAIS +databases. WAIS has its own code Library +called freeWAIS which is required in order +to directly access wais URLs. We shall not describe in describe in detail here +how this can be enabled as it is described in the WWW-WAIS gateway. + +This module is implemented by HTProt.c, and it is a +part of the W3C Sample Code Library. */ - #ifndef HTPROT_H #define HTPROT_H @@ -50,139 +61,110 @@ #include "HTAnchor.h" #include "HTEvent.h" #include "HTTrans.h" - /* An access scheme module takes as a parameter a socket (which is an invalid -socket the first time the function is called), a -request structure containing details of the request, +socket the first time the function is called), a request structure containing details of the request, and the action by which the (valid) socket was selected in the event loop. When the protocol class routine is called, the anchor element in the request is already valid (made valid by HTAccess). -. - Creation and Deletion Methods -. -( - Add an Protocol -) - -This functions registers a protocol module and binds it to a specific access -acheme (the part before the first colon in a URL). For example, the HTTP - client module is bound to http URLs. The callback function is the function -to be called for loading. -*/ -typedef int HTProtCallback (SOCKET, HTRequest *); +.Creation and Deletion Methods. + +(Add an Protocol) -extern BOOL HTProtocol_add (const char * name, - const char * transport, - HTProtocolId port, - BOOL preemptive, - HTProtCallback * client, - HTProtCallback * server); +This functions registers a protocol module and binds it to a specific +access acheme (the part before the first colon in a URL). For example, the +HTTP  client module is bound to http URLs. The callback function is the +function to be called for loading. +*/ +typedef int HTProtCallback (SOCKET, HTRequest *); +extern BOOL HTProtocol_add (const char * name, + const char * transport, + HTProtocolId port, + BOOL preemptive, + HTProtCallback * client, + HTProtCallback * server); /* -( - Delete a Protocol -) + +(Delete a Protocol) This functions deletes a registered protocol module so that it can not be used for accessing a resource anymore. */ - extern BOOL HTProtocol_delete (const char * name); - /* -( - Remove ALL Registered Protocols -) -This is the garbage collection function. It is called by -HTLibTerminate() -*/ +(Remove ALL Registered Protocols) +This is the garbage collection function. It is called by HTLibTerminate() +*/ extern BOOL HTProtocol_deleteAll (void); - /* -. - Protocol Class Methods -. -( - Find a Protocol Object -) + +.Protocol Class Methods. + +(Find a Protocol Object) You can search the list of registered protocol objects as a function of the -access acheme. If an access scheme is found then the protocol object is returned. +access acheme. If an access scheme is found then the protocol object is +returned. */ - extern HTProtocol * HTProtocol_find (HTRequest * request, const char * access); - /* -( - Get the callback functions -) -You can get the callback functions registered together with a protocol object -using the following methods. -*/ +(Get the callback functions) +You can get the callback functions registered together with a protocol +object using the following methods. +*/ extern HTProtCallback * HTProtocol_client (HTProtocol * protocol); extern HTProtCallback * HTProtocol_server (HTProtocol * protocol); - /* -( - Get the default Protocol ID -) -Each protocol is registered with a default protocol ID which is the default port number that this protocol is using. In the case of FTP it is 21, for HTTP, it is 80 and for NNTP it is 119. -*/ +(Get the default Protocol ID) +Each protocol is registered with a default protocol ID which is the default +port number that this protocol is using. In the case of FTP it is 21, for +HTTP, it is 80 and for NNTP it is 119. +*/ extern HTProtocolId HTProtocol_id (HTProtocol * protocol); - /* -( - Get the Protocol Name -) -Get the protocol name that was registered when the protocol object was created -*/ +(Get the Protocol Name) +Get the protocol name that was registered when the protocol object was +created +*/ extern const char * HTProtocol_name (HTProtocol * protocol); - /* -( - Is Access Scheme Preemptive -) + +(Is Access Scheme Preemptive) Returns YES if the implementation of the access scheme supports preemptive access only. */ - extern BOOL HTProtocol_preemptive (HTProtocol * protocol); - /* -( - Binding to the Transport Class -) - -An application protocol is registered together with a -transport protocol in order to communicate with -the thansport layer. -*/ +(Binding to the Transport Class) + +An application protocol is registered together with a transport protocol in order to communicate with the +thansport layer. +*/ extern BOOL HTProtocol_setTransport (HTProtocol * protoccol, - const char * transport); + const char * transport); extern const char * HTProtocol_transport (HTProtocol * protocol); - /* */ - #endif /* HTPROT_H */ - /* - - @(#) $Id: HTProt.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ + + + +@(#) $Id: HTProt.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTProxy.c xdvik-22.40n/libs/libwww/HTProxy.c --- xdvik-22.40l/libs/libwww/HTProxy.c Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTProxy.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTProxy.c,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ +** @(#) $Id: HTProxy.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Replaces the old env variables for gateways and proxies. However for ** backward compatibility there is a function that reads the env variables @@ -50,6 +50,7 @@ PRIVATE HTList * proxies = NULL; /* List of proxy servers */ PRIVATE HTList * gateways = NULL; /* List of gateways */ PRIVATE HTList * noproxy = NULL; /* Don't proxy on these hosts and domains */ +PRIVATE int noproxy_is_onlyproxy = 0; /* Interpret the noproxy list as an onlyproxy one */ #if 0 PRIVATE HTList * onlyproxy = NULL; /* Proxy only on these hosts and domains */ @@ -77,8 +78,7 @@ HT_OUTOFMEM("get_regex_t"); if ((status = regcomp(regex, regex_str, cflags))) { char * err_msg = get_regex_error(status, regex); - if (PROT_TRACE) - HTTrace("HTProxy..... Regular expression error: %s\n", err_msg); + HTTRACE(PROT_TRACE, "HTProxy..... Regular expression error: %s\n" _ err_msg); HT_FREE(err_msg); HT_FREE(regex); } @@ -131,9 +131,8 @@ break; /* We already have it */ } if (pres) { - if (PROT_TRACE) - HTTrace("HTProxy..... replacing for `%s\' access %s\n", - me->url, me->access); + HTTRACE(PROT_TRACE, "HTProxy..... replacing for `%s\' access %s\n" _ + me->url _ me->access); HT_FREE(pres->access); HT_FREE(pres->url); #ifdef HT_POSIX_REGEX @@ -142,9 +141,8 @@ HTList_removeObject(list, (void *) pres); HT_FREE(pres); } - if (PROT_TRACE) - HTTrace("HTProxy..... adding for `%s\' access %s\n", - me->url, me->access); + HTTRACE(PROT_TRACE, "HTProxy..... adding for `%s\' access %s\n" _ + me->url _ me->access); HTList_addObject(list, (void *) me); } return YES; @@ -200,8 +198,7 @@ while ((*ptr = TOLOWER(*ptr))) ptr++; } me->port = port; /* Port number */ - if (PROT_TRACE) - HTTrace("HTHostList.. adding `%s\' to list\n", me->host); + HTTRACE(PROT_TRACE, "HTHostList.. adding `%s\' to list\n" _ me->host); HTList_addObject(list, (void *) me); return YES; } @@ -298,7 +295,8 @@ ** handling proxy authentication */ HTNet_deleteBefore(HTAA_proxyBeforeFilter); - HTNet_deleteAfter(HTAuthFilter); + HTNet_deleteAfterStatus(HT_NO_PROXY_ACCESS); + HTNet_deleteAfterStatus(HT_PROXY_REAUTH); proxies = NULL; return YES; @@ -383,6 +381,24 @@ return NO; } +/* HTNProxy_noProxyIsOnlyProxy +** `---------------------------- +** Returns the state of the noproxy_is_onlyproxy flag +*/ +PUBLIC int HTProxy_NoProxyIsOnlyProxy (void) +{ + return noproxy_is_onlyproxy; +} + +/* HTNProxy_setNoProxyisOnlyProxy +** -------------------------- +** Sets the state of the noproxy_is_onlyproxy flag +*/ +PUBLIC void HTProxy_setNoProxyIsOnlyProxy (int value) +{ + noproxy_is_onlyproxy = value; +} + /* HTProxy_find ** ------------ ** This function evaluates the lists of registered proxies and if @@ -397,6 +413,8 @@ { char * access; char * proxy = NULL; + int no_proxy_found = 0; + if (!url || !proxies) return NULL; access = HTParse(url, "", PARSE_ACCESS); @@ -418,24 +436,22 @@ if (pres->regex) { BOOL match = regexec(pres->regex, url, 0, NULL, 0) ? NO : YES; if (match) { - if (PROT_TRACE) - HTTrace("GetProxy.... No proxy directive found: `%s\'\n", pres->host); - HT_FREE(access); - return NULL; + HTTRACE(PROT_TRACE, "GetProxy.... No proxy directive found: `%s\'\n" _ pres->host); + no_proxy_found = 1; + break; } } else #endif if (!pres->access || (pres->access && !strcmp(pres->access, access))) { - if (pres->port == port) { + if ((pres->port == 0) || (pres->port == port)) { char *np = pres->host+strlen(pres->host); char *hp = host+strlen(host); while (np>=pres->host && hp>=host && (*np--==*hp--)); if (np==pres->host-1 && (hp==host-1 || *hp=='.')) { - if (PROT_TRACE) - HTTrace("GetProxy.... No proxy directive found: `%s\'\n", pres->host); - HT_FREE(access); - return NULL; + HTTRACE(PROT_TRACE, "GetProxy.... No proxy directive found: `%s\'\n" _ pres->host); + no_proxy_found = 1; + break; } } } @@ -444,6 +460,12 @@ HT_FREE(host); } + if ((no_proxy_found && !noproxy_is_onlyproxy) + || (!no_proxy_found && noproxy_is_onlyproxy)) { + HT_FREE(access); + return NULL; + } + /* Now check if we have a proxy registered for this access method */ { HTList *cur = proxies; @@ -454,16 +476,14 @@ BOOL match = regexec(pres->regex, url, 0, NULL, 0) ? NO : YES; if (match) { StrAllocCopy(proxy, pres->url); - if (PROT_TRACE) - HTTrace("GetProxy.... Found: `%s\'\n", pres->url); + HTTRACE(PROT_TRACE, "GetProxy.... Found: `%s\'\n" _ pres->url); break; } } else #endif if (!strcmp(pres->access, access)) { StrAllocCopy(proxy, pres->url); - if (PROT_TRACE) - HTTrace("GetProxy.... Found: `%s\'\n", pres->url); + HTTRACE(PROT_TRACE, "GetProxy.... Found: `%s\'\n" _ pres->url); break; } } @@ -496,8 +516,7 @@ while ((pres = (HTProxy *) HTList_nextObject(cur)) != NULL) { if (!strcmp(pres->access, access)) { StrAllocCopy(gateway, pres->url); - if (PROT_TRACE) - HTTrace("GetGateway.. Found: `%s\'\n", pres->url); + HTTRACE(PROT_TRACE, "GetGateway.. Found: `%s\'\n" _ pres->url); break; } } @@ -524,7 +543,7 @@ NULL }; const char **access = accesslist; - if (PROT_TRACE)HTTrace("Proxy....... Looking for environment variables\n"); + HTTRACE(PROT_TRACE, "Proxy....... Looking for environment variables\n"); while (*access) { BOOL found = NO; char *gateway=NULL; diff -Naur xdvik-22.40l/libs/libwww/HTProxy.h xdvik-22.40n/libs/libwww/HTProxy.h --- xdvik-22.40l/libs/libwww/HTProxy.h Wed Apr 18 14:23:20 2001 +++ xdvik-22.40n/libs/libwww/HTProxy.h Fri Sep 13 00:23:46 2002 @@ -125,6 +125,18 @@ The remove function removes all entries in the list. This is automatically done in HTLibTerminate() +( + Inverse the meaning of the NoProxy list +) + +Allows to change the value of a flag so that the NoProxy list is interpreted +as if it were an OnlyProxy list. +*/ + +extern int HTProxy_NoProxyIsOnlyProxy (void); +extern void HTProxy_setNoProxyIsOnlyProxy (int value); + +/* . Look for a Proxy server . @@ -188,6 +200,6 @@ - @(#) $Id: HTProxy.h,v 1.1.1.1 2001/04/18 14:23:20 stefanulrich Exp $ + @(#) $Id: HTProxy.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTRDF.c xdvik-22.40n/libs/libwww/HTRDF.c --- xdvik-22.40l/libs/libwww/HTRDF.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTRDF.c Fri Sep 13 00:23:46 2002 @@ -0,0 +1,2793 @@ +/* +** RDF PARSER +** +** @(#) $Id: HTRDF.c,v 1.1.2.1 2002/09/13 00:23:46 stefanulrich Exp $ +** +** Copyright © 1995-1998 World Wide Web Consortium, (Massachusetts +** Institute of Technology, Institut National de Recherche en +** Informatique et en Automatique, Keio University). All Rights +** Reserved. This program is distributed under the W3C's Software +** Intellectual Property License. This program is distributed in the hope +** that it will be useful, but WITHOUT ANY WARRANTY; without even the +** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +** PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more +** details. +** +** This module requires expat +** +** AUTHOR: +** John Punin , +** Henrik +*/ + +#include "WWWLib.h" +#include "WWWInit.h" +#include "WWWXML.h" +#include "HTRDF.h" + +struct _HTStream { + const HTStreamClass * isa; + int state; + HTRequest * request; + HTStream * target; + HTRDF * rdfparser; +}; + +#define PUTC(t,c) (*(t)->target->isa->put_character)((t)->target, (c)) +#define PUTS(t,s) (*(t)->target->isa->put_string)((t)->target, (s)) + +struct _HTTriple { + char * m_sPredicate; + char * m_sSubject; + char * m_sObject; +}; + +struct _HTElement { + char * m_sName; + HTAssocList * m_attributes; + HTList * m_children; + char * m_sID; + char * m_sBagID; + HTList * m_vTargets; + BOOL m_bDone; + char * m_sPrefix; + char * m_sContent; +}; + +struct _HTRDFParser { + HTList * m_namespaceStack; + HTList * m_elementStack; + HTList * m_literalStack; + HTElement * m_root; + HTList * m_triples; + char * m_sSource; + HTList * m_vAllNameSpaces; + + BOOL m_bCreateBags; + BOOL m_bFetchSchemas; + + HTList * m_parseTypeStack; + HTList * m_parseElementStack; + char * m_sLiteral; + + HTList * m_vResources; + HTList * m_vResolveQueue; + HTHashtable * m_hIDtable; + int m_iReificationCounter; + + HTStream * ostream; + + HTTripleCallback_new * newTripleInstance; + void * tripleContext; +}; + +/* @@@ Should not be global but controlled by name spaces @@@ */ +PRIVATE HTRDFCallback_new * RDFInstance = NULL; +PRIVATE void * RDFInstanceContext = NULL; + +PRIVATE char * HTRDF_processContainer (HTRDF *me, HTElement *e); +PRIVATE char * HTRDF_processPredicate (HTRDF *me, HTElement *predicate, + HTElement *description, + char * sTarget, + BOOL reificate); +PRIVATE void HTRDF_processListItem (HTRDF *me,char * sID, HTElement *listitem, + int iCounter); +PRIVATE void HTRDF_checkAttributes (HTRDF *me,HTElement *Element); +PRIVATE BOOL HTRDF_expandAttributes (HTRDF *me, HTElement *parent, HTElement *ele); +PRIVATE char * HTRDF_reificate (HTRDF *me, char * sPredicate, char * sSubject, + char * sObject, char * sNodeID); +/* ------------------------------------------------------------------------- */ + +/* +** Append the markup for the given element and its attribute to the +** parser's "Literal" buffer. This buffer is filled in when parseType="Literal". +*/ +PRIVATE void addMarkupStart (HTRDF *rdfp, const char *name, const char **atts) +{ + int i=0; + + if (!rdfp || !name) return; + + StrAllocMCat(&rdfp->m_sLiteral, "<", name, NULL); + + while (atts[i]) { + StrAllocMCat(&rdfp->m_sLiteral, " ", atts[i], "=\"", atts[i+1], "\"", NULL); + i+=2; + } + + StrAllocCat(rdfp->m_sLiteral, ">"); +} + +/* +** Terminate this element's "Literal" buffer. This buffer is filled in when +** parseType="Literal". +*/ +PRIVATE void addMarkupEnd (HTRDF *rdfp, const char *name) +{ + if (!rdfp || !name) return; + + StrAllocMCat(&rdfp->m_sLiteral, "", NULL); +} + +/* ------------------------------------------------------------------------- */ + +/* +** Searches a whole list of Strings and returns true if the String is found. +*/ +PRIVATE BOOL HTList_contains (HTList *list, char * s) +{ + HTList *cur = list; + char * cs = NULL; + while ((cs = (char *) HTList_nextObject(cur))) { + if (!strcmp(cs, s)) return YES; + } + return NO; +} + +/* +** Useful function that Trims a string +** @@@ Should use HTStrip() @@@ +*/ +PRIVATE char * trim (char *s) +{ + char *p = NULL, *t = NULL; + int len = s ? strlen(s) : -1; + if (s && len > 0) { + StrAllocCopy(t, s); + p = &(s[len-1]); + while(p!=s) { + if (!isspace((int)(*p))) + break; + p--; + } + t[(int)(p-s)+1] = '\0'; + if (isspace((int) t[(int)(p-s)])) + t[(int)(p-s)] = '\0'; + } + return t; +} + +/* ------------------------------------------------------------------------- */ +/* TRIPLE of RDF */ +/* ------------------------------------------------------------------------- */ + +PUBLIC HTTriple * HTTriple_new (char * p, char * s, char * o) +{ + HTTriple * me = NULL; + if (p && s && o) { + if ((me = (HTTriple *) HT_CALLOC(1, sizeof(HTTriple))) == NULL) + HT_OUTOFMEM("HTTriple_new"); + StrAllocCopy(me->m_sPredicate, p); + StrAllocCopy(me->m_sSubject, s); + StrAllocCopy(me->m_sObject, o); + } + return me; +} + +PUBLIC BOOL HTTriple_delete (HTTriple * me) +{ + if (me) { + HT_FREE(me->m_sPredicate); + HT_FREE(me->m_sSubject); + HT_FREE(me->m_sObject); + HT_FREE(me); + return YES; + } + return NO; +} + +PUBLIC void HTTriple_print (HTTriple * me) +{ + if (me) + HTPrint("TRIPLE(%s,%s,%s)\n", me->m_sPredicate, me->m_sSubject, + me->m_sObject); +} + +PUBLIC char * HTTriple_subject (HTTriple * me) +{ + return me ? me->m_sSubject : NULL; +} + +PUBLIC char * HTTriple_predicate (HTTriple * me) +{ + return me ? me->m_sPredicate : NULL; +} + +PUBLIC char * HTTriple_object (HTTriple * me) +{ + return me ? me->m_sObject : NULL; +} + +/* ------------------------------------------------------------------------- */ +/* ELEMENT of RDF */ +/* ------------------------------------------------------------------------- */ + +PUBLIC HTElement * HTElement_new (char * sName, HTAssocList * al) +{ + HTElement * me = NULL; + if (sName) { + if ((me = (HTElement *) HT_CALLOC(1, sizeof(HTElement))) == NULL) + HT_OUTOFMEM("HTElement_new"); + StrAllocCopy(me->m_sName, sName); + me->m_attributes = al ? al : HTAssocList_new(); + me->m_children = HTList_new(); + /*me->m_nodes = HTAssocList_new();*/ /* Sirpac does not use nodes list */ + me->m_vTargets = HTList_new(); + me->m_bDone = FALSE; + } + return me; +} + +/* +** Creates a Data Element and saves the data in the Content field. +** Data Element does not have attributes +*/ +PUBLIC HTElement * HTElement_new2 (char * sContent) +{ + HTElement * me = NULL; + if (sContent) { + if ((me = (HTElement *) HT_CALLOC(1, sizeof(HTElement))) == NULL) + HT_OUTOFMEM("HTElement_new2"); + StrAllocMCopy(&me->m_sName, "[DATA: ", sContent, "]", NULL); + me->m_attributes = NULL; + me->m_children = HTList_new(); + /*me->m_nodes = HTAssocList_new();*/ + me->m_vTargets = HTList_new(); + me->m_bDone = FALSE; + StrAllocCopy(me->m_sContent, sContent); + } + return me; +} + +PUBLIC BOOL HTElement_addData (HTElement *me, char * sContent) +{ + if (me && sContent) { + int l = strlen(me->m_sName); + StrAllocCat(me->m_sContent, sContent); + me->m_sName[l-1]='\0'; + StrAllocMCat(&me->m_sName, sContent, "]", NULL); + return YES; + } + return NO; +} + +PUBLIC BOOL HTElement_delete (HTElement * me) +{ + if (me) { + HT_FREE(me->m_sName); + if (me->m_attributes) HTAssocList_delete(me->m_attributes); + if (me->m_children) HTList_delete(me->m_children); + HT_FREE(me->m_sID); + HT_FREE(me->m_sBagID); + if (me->m_vTargets) HTList_delete(me->m_vTargets); + HT_FREE(me->m_sPrefix); + HT_FREE(me->m_sContent); + HT_FREE(me); + return YES; + } + return NO; +} + +PUBLIC BOOL HTElement_addChild (HTElement * me, HTElement * element) +{ + return (me && element) ? HTList_appendObject(me->m_children, element) : NO; +} + +PUBLIC BOOL HTElement_addAttribute (HTElement * me, char * sName, char * sValue) +{ + return (me && sName && sValue) ? + HTAssocList_addObject(me->m_attributes, sName, sValue) : NO; +} + +PUBLIC BOOL HTElement_removeAttribute (HTElement * me, char * sName) +{ + return (me && sName) ? HTAssocList_removeObject(me->m_attributes, sName) : NO; +} + +PUBLIC char * HTElement_getAttribute (HTElement * me, char * sName) +{ + return (me && sName) ? HTAssocList_findObjectCaseSensitiveExact(me->m_attributes, sName) : NULL; +} + +PUBLIC char * HTElement_getAttribute2 (HTElement * me, char * sNamespace, char * sName) +{ + char * fValue = NULL; + char * fName = NULL; + if (me && sNamespace && sName) { + StrAllocMCopy(&fName, sNamespace, sName, NULL); + fValue = HTAssocList_findObjectCaseSensitiveExact(me->m_attributes, fName); + HT_FREE(fName); + } + return fValue; +} + +PUBLIC BOOL HTElement_addTarget (HTElement * me, HTElement * element) +{ + return (me && element) ? HTList_addObject(me->m_vTargets, element) : NO; +} + +PUBLIC HTElement * HTElement_target (HTElement * me) +{ + return me ? (HTElement *) HTList_lastObject(me->m_vTargets) : NULL; +} + +PUBLIC BOOL HTElement_instanceOfData (HTElement * me) +{ + return (me && me->m_sContent) ? YES : NO; +} + +/* ------------------------------------------------------------------------- */ +/* EXPAT HANDLERS */ +/* ------------------------------------------------------------------------- */ + +/* + * Called for each new element. + * Build up the document tree using an element stack + */ +PRIVATE void XML_startElement (void * userData, + const XML_Char * name, const XML_Char ** atts) +{ + HTRDF * rdfp = (HTRDF *) userData; + HTAssocList * namespaces = HTAssocList_new(); + HTAssocList * newAL = HTAssocList_new(); + int i = 0; + + /** + * The following loop tries to identify special xmlns prefix + * attributes and update the namespace stack accordingly. + * While doing all this, it builds another AttributeList instance + * which will hold the expanded names of the attributes + * (I think this approach is only useful for RDF which uses + * attributes as an abbreviated syntax for element names) + */ + if (atts) { + while (atts[i]) { + char * aName = (char * ) atts[i]; + if (!strcmp(aName, "xmlns")) { + char * aValue = (char *) atts[i+1]; + int len = aValue ? strlen(aValue) : -1; + if (len == 0 && !rdfp->m_sSource) + aValue = rdfp->m_sSource; + HTAssocList_addObject(namespaces, aName, aValue); + /* save all non-RDF schema addresses */ + if (!HTList_contains(rdfp->m_vAllNameSpaces, aValue) && + strncmp(aValue, RDFMS, strlen(RDFMS)) && + strncmp(aValue, RDFSCHEMA, strlen(RDFSCHEMA))) { + char * nname = NULL; + StrAllocCopy(nname, aValue); + HTList_addObject(rdfp->m_vAllNameSpaces, nname); + } + + /* Special case: Don't save document's own address */ + if (rdfp->m_sSource && + !strncmp(aValue, rdfp->m_sSource, strlen(rdfp->m_sSource))) { + char * nname = NULL; + StrAllocCopy(nname, aValue); + HTList_addObject(rdfp->m_vAllNameSpaces, nname); + } + } else if (!strncmp(aName, "xmlns:", 6)) { + char * aValue = (char *) atts[i+1]; + char * nName = NULL; + int len = aValue ? strlen(aValue) : -1; + if (len == 0 && !rdfp->m_sSource) + aValue = rdfp->m_sSource; + StrAllocCopy(nName, &(aName[6])); + HTAssocList_addObject(namespaces, nName, aValue); + HT_FREE(nName); + + /* Save all non-RDF schema addresses */ + if (!HTList_contains(rdfp->m_vAllNameSpaces, aValue) && + strncmp(aValue, RDFMS, strlen(RDFMS)) && + strncmp(aValue, RDFSCHEMA, strlen(RDFSCHEMA))) { + char * nname = NULL; + StrAllocCopy(nname, aValue); + HTList_addObject(rdfp->m_vAllNameSpaces, nname); + } + + /* Special case: Don't save document's own address */ + if (rdfp->m_sSource && + !strncmp(aValue, rdfp->m_sSource, strlen(rdfp->m_sSource))) { + char * nname = NULL; + StrAllocCopy(nname, aValue); + HTList_addObject(rdfp->m_vAllNameSpaces, nname); + } + } + i+=2; + } /* end of while */ + } /* end of if */ + + /* + ** Place new namespace declarations into the stack + ** (Yes, I could optimize this a bit, not it wastes space + ** if there are no xmlns definitions) + */ + HTList_addObject(rdfp->m_namespaceStack, namespaces); + + /* + ** Figure out the prefix part if it exists and + ** determine the namespace of the element accordingly + */ + { + char * sNamespace = NULL; + char * sElementName = NULL; + char * sPrefix2 = NULL; + HTElement *newElement = NULL; + char *pindex = strchr(name, ':'); + int ix = pindex ? (int) (pindex - name) : -1 ; + if (ix > 0) { + if (!(sPrefix2 = HT_MALLOC(ix+1))) + HT_OUTOFMEM("XML_startELement"); + strncpy(sPrefix2, name, ix); + sPrefix2[ix]='\0'; + sNamespace = HTRDF_namespace(rdfp, sPrefix2); + StrAllocCopy(sElementName, &(name[ix+1])); + HT_FREE(sPrefix2); + } else { + sNamespace = HTRDF_namespace(rdfp, "xmlns"); + StrAllocCopy(sElementName, name); + } + + /* + * Finally look for attributes other than the special xmlns, + * expand them, and place to the new Attribute List + */ + i = 0; + if (atts) { + while (atts[i]) { + char * aName = (char *) atts[i]; + char * sAttributeNamespace = NULL; + if (strncmp(aName, "xmlns", 5)) { + char * aValue = (char *) atts[i+1]; + char * sPrefix = NULL; + /* Expat does not have type for attributes */ + pindex = strchr(aName, ':'); + ix = pindex ? (int) (pindex - aName) : -1; + if (ix > 0) { + if (!(sPrefix = HT_MALLOC(ix+1))) + HT_OUTOFMEM("XML_startELement"); + strncpy(sPrefix, aName, ix); + sPrefix[ix] = '\0'; + sAttributeNamespace = HTRDF_namespace(rdfp, sPrefix); + aName = &(aName[ix+1]); + HT_FREE(sPrefix); + } else { + if (!sNamespace) + sAttributeNamespace = HTRDF_namespace(rdfp, "xmlns"); + else + StrAllocCopy(sAttributeNamespace, sNamespace); + } + + if (HTRDF_parseLiteral(rdfp)) { + if (!sPrefix) { + if (!(sPrefix = HT_MALLOC(8))) + HT_OUTOFMEM("XML_startELement"); + sprintf(sPrefix, "gen%d\n", i); + } + { + char * fName = NULL; + StrAllocMCopy(&fName, sPrefix, ":", aValue, NULL); + HTAssocList_addObject(newAL, fName, aValue); + HT_FREE(fName); + StrAllocMCopy(&fName, "xmlns:", sPrefix, NULL); + HTAssocList_addObject(newAL, fName, sAttributeNamespace); + HT_FREE(fName); + } + } else { + char * fName = NULL; + StrAllocMCopy(&fName, sAttributeNamespace, aName, NULL); + HTAssocList_addObject(newAL, fName, aValue); + HT_FREE(fName); + } + + HT_FREE(sAttributeNamespace); + + /* + ** This call will try to see if the user is using + ** RDF look-alike elements from another namespace + ** + ** Note: you can remove the call if you wish + */ +#if 0 + HTRDF_likeRDF (rdfp, sAttributeNamespace, aName); +#endif + + } /* end of if */ + i+=2; + } /* end of while */ + } /* end of if atts */ + + /* + * If we have parseType="Literal" set earlier, this element + * needs some additional attributes to make it stand-alone + * piece of XML + */ + if (HTRDF_parseLiteral(rdfp)) { + char * fName = NULL; + + if (!sPrefix2) { + if (sNamespace) + HTAssocList_addObject(newAL, "xmlns:gen", sNamespace); + StrAllocMCopy(&fName, "gen", sElementName, NULL); + newElement = HTElement_new(fName, newAL); + StrAllocCopy(newElement->m_sPrefix, "gen"); + HT_FREE(fName); + } else { + char * sAttributeNamespace = HTRDF_namespace(rdfp, sPrefix2); + if (sAttributeNamespace) { + StrAllocMCopy(&fName, "xmlns:", sPrefix2, NULL); + HTAssocList_addObject(newAL, fName, sAttributeNamespace); + HT_FREE(fName); + } + StrAllocMCopy(&fName, sPrefix2, ":", sElementName, NULL); + newElement = HTElement_new(fName, newAL); + HT_FREE(fName); + } + } else { + char * fName = NULL; + StrAllocMCopy(&fName, sNamespace, sElementName, NULL); + newElement = HTElement_new(fName, newAL); + HT_FREE(fName); + /* HTRDF_likeRDF (rdfp, sNamespace, sElementName); */ + } + HT_FREE(sElementName); + HT_FREE(sNamespace); + HTRDF_checkAttributes(rdfp, newElement); + + /* + ** Check parseType + */ + { + char * fName = NULL; + char * sLiteralValue = NULL; + StrAllocMCopy(&fName, RDFMS, "parseType", NULL); + sLiteralValue = HTElement_getAttribute(newElement, fName); + HT_FREE(fName); + if (sLiteralValue && strcmp(sLiteralValue, "Resource")) { + /** + * This is the management of the element where + * parseType="Literal" appears + * + * You should notice RDF V1.0 conforming implementations + * must treat other values than Literal and Resource as + * Literal. This is why the condition is !equals("Resource") + */ + + HTList_addObject(rdfp->m_parseTypeStack, sLiteralValue); + if (!HTList_isEmpty(rdfp->m_elementStack)) { + HTElement *e = (HTElement *) + HTList_lastObject(rdfp->m_elementStack); + HTElement_addChild(e, newElement); + } + HTList_addObject(rdfp->m_elementStack, newElement); + HTList_addObject(rdfp->m_parseElementStack, newElement); + HT_FREE(rdfp->m_sLiteral); + StrAllocCopy(rdfp->m_sLiteral, ""); + return; + } + + if (HTRDF_parseLiteral(rdfp)) { + /* + * This is the management of any element nested within + * a parseType="Literal" declaration + */ + /* Add the element to the parser's literal buffer */ + addMarkupStart (rdfp, name, atts); + + /* Add this literal element to the literal stack */ + if (!HTList_isEmpty(rdfp->m_literalStack)) { + HTElement *e = (HTElement *) + HTList_lastObject(rdfp->m_literalStack); + HTElement_addChild(e, newElement); + } + HTList_addObject(rdfp->m_literalStack, newElement); + + HTList_addObject(rdfp->m_elementStack, newElement); + return; + } + + /* + ** Update the containment hierarchy with the stack. + */ + if (!HTList_isEmpty(rdfp->m_elementStack)) { + HTElement *e = (HTElement *) + HTList_lastObject(rdfp->m_elementStack); + HTElement_addChild(e, newElement); + } + + /* + ** Place the new element into the stack + */ + HTList_addObject(rdfp->m_elementStack, newElement); + if (sLiteralValue && !strcmp(sLiteralValue, "Resource")) { + HTList_addObject(rdfp->m_parseTypeStack, sLiteralValue); + HTList_addObject(rdfp->m_parseElementStack, newElement); + HT_FREE(rdfp->m_sLiteral); + StrAllocCopy(rdfp->m_sLiteral, ""); + + /* + * Since parseType="Resource" implies the following + * production must match Description, let's create + * an additional Description node here in the document tree. + */ + { + char * fName = NULL; + HTElement *desc = NULL; + HTAssocList * al = HTAssocList_new (); + StrAllocMCopy(&fName, RDFMS, "Description", NULL); + desc = HTElement_new(fName, al); + HT_FREE(fName); + if (!HTList_isEmpty(rdfp->m_elementStack)) { + HTElement *e = (HTElement *) + HTList_lastObject(rdfp->m_elementStack); + HTElement_addChild(e, desc); + } + HTList_addObject(rdfp->m_elementStack, desc); + } + } /* end of if */ + } /* end of block */ + } /* end of block */ +} + +/* + * For each end of an element scope step back in the + * element and namespace stack + */ +PRIVATE void XML_endElement (void * userData, + const XML_Char * name) +{ + HTRDF * rdfp = (HTRDF *) userData; + BOOL bParseLiteral = rdfp ? HTRDF_parseLiteral(rdfp) : NO; + HTAssocList * namespaces = HTList_removeLastObject(rdfp->m_namespaceStack); + rdfp->m_root = (HTElement *) HTList_removeLastObject(rdfp->m_elementStack); + if (namespaces) HTAssocList_delete(namespaces); + + if (bParseLiteral) { + HTElement *pe = (HTElement *) + HTList_lastObject(rdfp->m_parseElementStack); + if (pe != rdfp->m_root) { + /* Terminate the literal */ + addMarkupEnd (rdfp, name); + } else { + HTElement *de = HTElement_new2(rdfp->m_sLiteral); + HTElement_addChild(pe, de); + + HT_FREE(rdfp->m_sLiteral); + StrAllocCopy(rdfp->m_sLiteral, ""); + HTList_removeLastObject(rdfp->m_parseElementStack); + HTList_removeLastObject(rdfp->m_parseTypeStack); + } + } else if (HTRDF_parseResource(rdfp)) { + /** + * If we are doing parseType="Resource" + * we need to explore whether the next element in + * the stack is the closing element in which case + * we remove it as well (remember, there's an + * extra Description element to be removed) + */ + if (!HTList_isEmpty(rdfp->m_elementStack)) { + HTElement *pe = (HTElement *) + HTList_lastObject(rdfp->m_parseElementStack); + HTElement *e = (HTElement *) + HTList_lastObject(rdfp->m_elementStack); + if (pe == e) { + e = (HTElement *) HTList_removeLastObject(rdfp->m_elementStack); + HTList_removeLastObject(rdfp->m_parseElementStack); + HTList_removeLastObject(rdfp->m_parseTypeStack); + } + } + } +} + +PRIVATE void XML_characterData (void * userData, + const XML_Char * s, int len) +{ + /* + * Place all characters as Data instance to the containment + * hierarchy with the help of the stack. + */ + HTRDF * rdfp = (HTRDF *) userData; + HTElement * e = (HTElement *) HTList_lastObject(rdfp->m_elementStack); + char * tstr = NULL; + char * str = NULL; + if (!(str = (char *) HT_MALLOC(len+1))) + HT_OUTOFMEM("XML_characterData"); + strncpy(str, s, len); + str[len]='\0'; + if (HTRDF_parseLiteral(rdfp)) { + StrAllocCat(rdfp->m_sLiteral, str); + HT_FREE(str); + return; + } + /* JUST FOR EXPAT */ + { + HTElement *lch = (HTElement *) HTList_lastObject(e->m_children); + if (lch && HTElement_instanceOfData(lch)) { + HTElement_addData(lch, str); + HT_FREE(str); + return; + } + } + /* + * Warning: this is not correct procedure according to XML spec. + * All whitespace matters! + */ + tstr = trim(str); + if (strlen(tstr) > 0) { + HTElement * de = HTElement_new2(tstr); + HTElement_addChild(e, de); + } + HT_FREE(str); HT_FREE(tstr); +} + +PRIVATE void XML_processingInstruction (void * userData, + const XML_Char * target, + const XML_Char * data) +{ + return; +} + +/* +** This is called for any characters in the XML document for +** which there is no applicable handler. This includes both +** characters that are part of markup which is of a kind that is +** not reported (comments, markup declarations), or characters +** that are part of a construct which could be reported but +** for which no handler has been supplied. The characters are passed +** exactly as they were in the XML document except that +** they will be encoded in UTF-8. Line boundaries are not normalized. +** Note that a byte order mark character is not passed to the default handler. +** If a default handler is set, internal entity references +** are not expanded. There are no guarantees about +** how characters are divided between calls to the default handler: +** for example, a comment might be split between multiple calls. +*/ +PRIVATE void XML_default (void * userData, + const XML_Char * s, int len) +{ + return; +} + +/* +** This is called for a declaration of an unparsed (NDATA) +** entity. The base argument is whatever was set by XML_SetBase. +** The entityName, systemId and notationName arguments will never be null. +** The other arguments may be. +*/ +PRIVATE void XML_unparsedEntityDecl (void * userData, + const XML_Char * entityName, + const XML_Char * base, + const XML_Char * systemId, + const XML_Char * publicId, + const XML_Char * notationName) +{ + return; +} + +/* +** This is called for a declaration of notation. +** The base argument is whatever was set by XML_SetBase. +** The notationName will never be null. The other arguments can be. +*/ +PRIVATE void XML_notationDecl (void * userData, + const XML_Char * notationName, + const XML_Char * base, + const XML_Char * systemId, + const XML_Char * publicId) +{ + return; +} + +/* +** This is called for a reference to an external parsed general entity. +** The referenced entity is not automatically parsed. +** The application can parse it immediately or later using +** XML_ExternalEntityParserCreate. +** The parser argument is the parser parsing the entity containing the reference; +** it can be passed as the parser argument to XML_ExternalEntityParserCreate. +** The systemId argument is the system identifier as specified in the entity +** declaration; it will not be null. +** The base argument is the system identifier that should be used as the base for +** resolving systemId if systemId was relative; this is set by XML_SetBase; +** it may be null. +** The publicId argument is the public identifier as specified in the entity declaration, +** or null if none was specified; the whitespace in the public identifier +** will have been normalized as required by the XML spec. +** The openEntityNames argument is a space-separated list of the names of the entities +** that are open for the parse of this entity (including the name of the referenced +** entity); this can be passed as the openEntityNames argument to +** XML_ExternalEntityParserCreate; openEntityNames is valid only until the handler +** returns, so if the referenced entity is to be parsed later, it must be copied. +** The handler should return 0 if processing should not continue because of +** a fatal error in the handling of the external entity. +** In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING +** error. +** Note that unlike other handlers the first argument is the parser, not userData. +*/ +PRIVATE int XML_externalEntityRef (XML_Parser parser, + const XML_Char * openEntityNames, + const XML_Char * base, + const XML_Char * systemId, + const XML_Char * publicId) +{ + return 0; +} + +/* +** This is called for an encoding that is unknown to the parser. +** The encodingHandlerData argument is that which was passed as the +** second argument to XML_SetUnknownEncodingHandler. +** The name argument gives the name of the encoding as specified in +** the encoding declaration. +** If the callback can provide information about the encoding, +** it must fill in the XML_Encoding structure, and return 1. +** Otherwise it must return 0. +** If info does not describe a suitable encoding, +** then the parser will return an XML_UNKNOWN_ENCODING error. +*/ +PRIVATE int XML_unknownEncoding (void * encodingHandlerData, + const XML_Char * name, + XML_Encoding * info) +{ + return 0; +} + +/* ------------------------------------------------------------------------- */ +/* HTXML STREAM HANDLERS */ +/* ------------------------------------------------------------------------- */ + +PRIVATE void rdf_setHandlers (XML_Parser me) +{ + XML_SetElementHandler(me, XML_startElement, XML_endElement); + XML_SetCharacterDataHandler(me, XML_characterData); + XML_SetProcessingInstructionHandler(me, XML_processingInstruction); + XML_SetDefaultHandler(me, XML_default); + XML_SetUnparsedEntityDeclHandler(me, XML_unparsedEntityDecl); + XML_SetNotationDeclHandler(me, XML_notationDecl); + XML_SetExternalEntityRefHandler(me, XML_externalEntityRef); + XML_SetUnknownEncodingHandler(me, XML_unknownEncoding, NULL); +} + +PRIVATE void rdf_newInstance (HTStream * me, + HTRequest * request, + HTFormat target_format, + HTStream * target_stream, + XML_Parser xmlparser, + void * context) +{ + if (me && xmlparser) { + rdf_setHandlers(xmlparser); + XML_SetUserData(xmlparser, context); + + /* Call the new RDF instance callback (if any) with this new stream */ + if (RDFInstance) + (*RDFInstance)(me, request, target_format, target_stream, context, RDFInstanceContext); + } +} + +/* ------------------------------------------------------------------------- */ +/* RDF PARSER */ +/* ------------------------------------------------------------------------- */ + +PRIVATE void visit_element_children (HTList *children) +{ + HTElement *child = NULL; + HTList *cur = children; + while ((child = (HTElement *) HTList_nextObject(cur))) { + if (!HTList_isEmpty(child->m_children)) + visit_element_children(child->m_children); + HTElement_delete(child); + } +} + +PRIVATE void delete_elements (HTRDF * me) +{ + if (me && me->m_root) { + HTElement *r = me->m_root; + if (!HTList_isEmpty(r->m_children)) + visit_element_children(r->m_children); + HTElement_delete(r); + } +} + +PRIVATE void delete_literal_elements (HTRDF * me) +{ + if (me && me->m_literalStack) { + HTList *cur = me->m_literalStack; + HTElement *e = NULL; + while ((e = (HTElement *) HTList_nextObject(cur))) { + HTElement_delete(e); + } + HTList_delete(me->m_literalStack); + } +} + + +PUBLIC HTRDF * HTRDF_new (void) +{ + HTRDF * me; + if ((me = (HTRDF *) HT_CALLOC(1, sizeof(HTRDF))) == NULL) + HT_OUTOFMEM("HTRDF_new"); + me->m_namespaceStack = HTList_new(); + me->m_elementStack = HTList_new(); + me->m_literalStack = HTList_new(); + + me->m_triples = HTList_new(); + me->m_vAllNameSpaces = HTList_new(); + + me->m_bCreateBags = FALSE; + me->m_bFetchSchemas = FALSE; + + me->m_parseTypeStack = HTList_new(); + me->m_parseElementStack = HTList_new(); + + me->m_vResources = HTList_new(); + me->m_vResolveQueue = HTList_new(); + me->m_hIDtable = HTHashtable_new(0); + + return me; +} + +PUBLIC BOOL HTRDF_delete (HTRDF * me) +{ + if (me) { + delete_elements(me); + if (me->m_namespaceStack) { + HTList *cur = me->m_namespaceStack; + HTAssocList *alist = NULL; + while ((alist = (HTAssocList *) HTList_nextObject(cur))) { + HTAssocList_delete(alist); + } + HTList_delete(me->m_namespaceStack); + } + if (me->m_elementStack) HTList_delete(me->m_elementStack); + + delete_literal_elements(me); + + me->m_root = NULL; + if (me->m_triples) { + HTList *cur = me->m_triples; + HTTriple *t = NULL; + while ((t = (HTTriple *) HTList_nextObject(cur))) { + /*HTTriple_print(t);*/ + HTTriple_delete(t); + } + HTList_delete(me->m_triples); + } + HT_FREE(me->m_sSource); + if (me->m_vAllNameSpaces) { + HTList *cur = me->m_vAllNameSpaces; + char * s = NULL; + while ((s = (char *) HTList_nextObject(cur))) { + HT_FREE(s); + } + HTList_delete(me->m_vAllNameSpaces); + } + if (me->m_parseTypeStack) + HTList_delete(me->m_parseTypeStack); + if (me->m_parseElementStack) + HTList_delete(me->m_parseElementStack); + if (me->m_vResources) + HTList_delete(me->m_vResources); + if (me->m_vResolveQueue) + HTList_delete(me->m_vResolveQueue); + if (me->m_hIDtable) + HTHashtable_delete(me->m_hIDtable); + HT_FREE(me->m_sLiteral); + HT_FREE(me); + return YES; + } + return NO; +} + +/* + * setSource method saves the name of the source document for + * later inspection if needed + */ +PUBLIC BOOL HTRDF_setSource(HTRDF *me, char * source) +{ + if (me && source) { + StrAllocCopy (me->m_sSource, source); + return YES; + } + return NO; +} + +/* + * Go through the m_vResolveQueue and assign + * direct object reference for each symbolic reference + */ +PUBLIC BOOL HTRDF_resolve (HTRDF * me) +{ + if (me) { + HTList * cur = me->m_vResolveQueue; + HTElement *e = NULL; + HTElement *e2 = NULL; + while ((e = (HTElement *) HTList_nextObject(cur))) { + char * sAbout = HTElement_getAttribute2(e, RDFMS, "about"); + char * sResource = HTElement_getAttribute2(e, RDFMS, "resource"); + char * sAboutEach = HTElement_getAttribute2(e, RDFMS, "aboutEach"); + char * sAboutEachPrefix = HTElement_getAttribute2(e, RDFMS, + "aboutEachPrefix"); + if (sAbout) { + if (sAbout[0]=='#') + sAbout = &(sAbout[1]); + e2 = (HTElement *) HTRDF_lookforNode(me, sAbout); + if (e2) + HTElement_addTarget(e, e2); + else + HTPrint("Unresolved internal reference %s\n", sAbout); + } + if (sResource) { + if (sResource[0]=='#') + sResource = &(sResource[1]); + e2 = (HTElement *) HTRDF_lookforNode(me, sResource); + if (e2) + HTElement_addTarget(e, e2); + } + + if (sAboutEach) { + sAboutEach = &(sAboutEach[1]); + e2 = (HTElement *) HTRDF_lookforNode(me, sAboutEach); + if (e2) + HTElement_addTarget(e, e2); + } + if (sAboutEachPrefix) { + HTList * curr = me->m_vResources; + HTElement *ele = NULL; + while ((ele = (HTElement *) HTList_nextObject(curr))) { + char * sA = HTElement_getAttribute2(ele, RDFMS, "about"); + if (sA && + !strncmp(sA, sAboutEachPrefix, strlen(sAboutEachPrefix))) { + HTElement_addTarget(e, ele); + } + } + } + } + HTList_delete(me->m_vResources); + me->m_vResources = HTList_new(); + return YES; + } + return NO; +} + +/** + * Check if the element e is from the namespace + * of the RDF schema by comparing only the beginning of + * the expanded element name with the canonical RDFMS + * URI + */ +PUBLIC BOOL HTRDF_isRDF(HTRDF * me, HTElement *e) +{ + return (me && e && e->m_sName) ? + (!strncmp(e->m_sName, RDFMS, strlen(RDFMS))) : NO; +} + +PUBLIC BOOL HTRDF_isRDFroot (HTRDF * me, HTElement *e) +{ + if (me && e && e->m_sName) { + int len = strlen(e->m_sName); + if (len > 3) return (HTRDF_isRDF(me, e) && !strcmp(&(e->m_sName[len-3]), "RDF")); + } + return NO; +} + +/** + * Is the element a Description + */ +PUBLIC BOOL HTRDF_isDescription (HTRDF *me, HTElement *e) +{ + if (me && e && e->m_sName) { + int len = strlen(e->m_sName); + if (len > 11) return (HTRDF_isRDF(me, e) && !strcmp(&(e->m_sName[len-11]), "Description")); + } + return NO; +} + +/* + * Is the element a ListItem + */ +PUBLIC BOOL HTRDF_isListItem (HTRDF *me, HTElement *e) +{ + if (me && e && e->m_sName) { + int len = strlen(e->m_sName); + if (len > 2) + return (HTRDF_isRDF(me, e) && (!strcmp(&(e->m_sName[len-2]), "li") || strchr(e->m_sName,'_'))); + } + return NO; +} + +/** + * Is the element a Sequence + */ +PUBLIC BOOL HTRDF_isSequence (HTRDF *me, HTElement *e) +{ + if (me && e && e->m_sName) { + int len = strlen(e->m_sName); + if (len > 3) return (HTRDF_isRDF(me, e) && !strcmp(&(e->m_sName[len-3]), "Seq")); + } + return NO; +} + +/* + * Is the element an Alternative + */ +PUBLIC BOOL HTRDF_isAlternative (HTRDF *me, HTElement *e) +{ + if (me && e && e->m_sName) { + int len = strlen(e->m_sName); + if (len > 3) return (HTRDF_isRDF(me, e) && !strcmp(&(e->m_sName[len-3]), "Alt")); + } + return NO; +} + +/* + * Is the element a Bag + */ +PUBLIC BOOL HTRDF_isBag (HTRDF *me, HTElement *e) +{ + if (me && e && e->m_sName) { + int len = strlen(e->m_sName); + if (len > 3) return (HTRDF_isRDF(me, e) && !strcmp(&(e->m_sName[len-3]), "Bag")); + } + return NO; +} + +/** + * Is the element a Container + */ +PUBLIC BOOL HTRDF_isContainer (HTRDF *me, HTElement *e) +{ + return (HTRDF_isSequence(me, e) || + HTRDF_isAlternative(me, e) || + HTRDF_isBag(me, e)); +} + +/* + * This method matches all properties but those from RDF namespace + */ +PUBLIC BOOL HTRDF_isTypedPredicate(HTRDF *me, HTElement *e) +{ + if (me && e && e->m_sName) { + int len = strlen(e->m_sName); + char * tp[] = {"predicate", "subject", "object", + "value", "type", "Property", "Statement"}; + int i; + if (HTRDF_isRDF(me, e)) { + for(i = 0; i< 7; i++) { + int ntp = strlen(tp[i]); + if (len > ntp) { + if (!strcmp(&(e->m_sName[len-ntp]), tp[i])) + return YES; + } + } + return NO; + } + if (len > 0) return YES; + } + return NO; +} + +PRIVATE void HTRDF_processListItem (HTRDF * me, char * sID, HTElement *listitem, + int iCounter) +{ + /* + * Two different cases for + * 1. LI element without content (resource available) + * 2. LI element with content (resource unavailable) + */ + char * cName = NULL; + char * sResource = HTRDF_getResource(me, listitem); + char sdig[20]; + sprintf(sdig, "_%d", iCounter); + StrAllocMCopy(&cName, RDFMS, sdig, NULL); + if (sResource) { + HTRDF_addTriple(me, cName, sID, sResource); + /* validity checking */ + if (!HTList_isEmpty(listitem->m_children)){ + HTPrint("Listitem with resource attribute can not have child nodes"); + } + StrAllocCopy(listitem->m_sID, sResource); + } else { + HTList *cur = listitem->m_children; + HTElement *n = NULL; + while ((n = (HTElement *) HTList_nextObject(cur))) { + if (HTElement_instanceOfData(n)) { + HTRDF_addTriple(me, cName, sID, n->m_sContent); + } else if (HTRDF_isDescription(me, n)) { + char * sNodeID = HTRDF_processDescription(me, n, NO, YES, NO); + HTRDF_addTriple(me, cName, sID, sNodeID); + StrAllocCopy(listitem->m_sID, sNodeID); + } else if (HTRDF_isListItem(me, n)) { + HTPrint("Can not nest list item inside list item\n"); + } else if (HTRDF_isContainer(me, n)) { + char * c = HTRDF_processContainer(me, n); + HTRDF_addTriple(me, cName, sID, n->m_sID); + HT_FREE(c); + } else if (HTRDF_isTypedPredicate(me, n)) { + char * sNodeID = HTRDF_processTypedNode(me, n); + HTRDF_addTriple(me, cName, sID, sNodeID); + HT_FREE(sNodeID); + } + } + } + HT_FREE(cName); +} + +PRIVATE char * HTRDF_processContainer(HTRDF *me, HTElement *n) +{ + char * sID = NULL; + char * tName = NULL; + char * aName = NULL; + char * sName = NULL; + char * bName = NULL; + StrAllocMCopy(&tName, RDFMS, "type", NULL); + StrAllocMCopy(&aName, RDFMS, "Alt", NULL); + StrAllocMCopy(&sName, RDFMS, "Seq", NULL); + StrAllocMCopy(&bName, RDFMS, "Bag", NULL); + + StrAllocCopy(sID, n->m_sID); + if (!sID) + sID = HTRDF_newReificationID(me); + /* + * Do the instantiation only once + */ + if (!n->m_bDone) { + if (HTRDF_isSequence(me, n)) { + HTRDF_addTriple(me, tName, sID, sName); + } else if (HTRDF_isAlternative(me, n)) { + HTRDF_addTriple(me, tName, sID, aName); + } else if (HTRDF_isBag(me, n)) { + HTRDF_addTriple(me, tName, sID, bName); + } + n->m_bDone = YES; + } + HTRDF_expandAttributes(me, n, n); + + { + HTList *cur = n->m_children; + HTElement *n2 = NULL; + int iCounter = 1; + if (HTList_isEmpty(cur) && HTRDF_isAlternative(me, n)) + HTPrint("An RDF:Alt container must have at least one list item\n"); + while ((n2 = (HTElement *) HTList_nextObject(cur))) { + if (HTRDF_isListItem(me, n2)) { + HTRDF_processListItem(me, sID, n2, iCounter); + iCounter++; + } else { + HTPrint("Can not nest %s, inside container\n", n2->m_sName); + } + } + } /* end of block */ + + HT_FREE(tName); HT_FREE(sName); HT_FREE(aName); HT_FREE(bName); + + return sID; +} +/* + * Manage the typedNode production in the RDF grammar. + * + */ +PUBLIC char * HTRDF_processTypedNode(HTRDF *me, HTElement *typedNode) +{ + char * sID = HTElement_getAttribute2(typedNode, RDFMS, "ID"); + char * sBagID = HTElement_getAttribute2(typedNode, RDFMS, "bagID"); + char * sAbout = HTElement_getAttribute2(typedNode, RDFMS, "about"); + char * sAboutEach = HTElement_getAttribute2(typedNode, RDFMS, "aboutEach"); + /*char * sAboutEachPrefix = HTElement_getAttribute2(typedNode, RDFMS, + "aboutEachPrefix");*/ + char * resource = HTElement_getAttribute2(typedNode, RDFMS, "resource"); + char * iName = NULL; + char * bName = NULL; + char * tName = NULL; + + char * sObject = NULL; + + StrAllocMCopy(&iName, RDFMS, "ID", NULL); + StrAllocMCopy(&bName, RDFMS, "bagID", NULL); + StrAllocMCopy(&tName, RDFMS, "type", NULL); + + if (resource) + HTPrint("resource attribute not allowed for a typedNode %s\n", + typedNode->m_sName); + + /* + * We are going to manage this typedNode using the processDescription + * routine later on. Before that, place all properties encoded as + * attributes to separate child nodes. + */ + { + HTAssoc * assoc; + HTAssocList *cur = typedNode->m_attributes; + char * sAttribute = NULL; + char * tValue = NULL; + char * sValue = NULL; + while((assoc= (HTAssoc *) HTList_nextObject(cur))) { + sAttribute = HTAssoc_name(assoc); + sValue = HTAssoc_value(assoc); + tValue = trim(sValue); + if (strncmp(sAttribute, RDFMS, strlen(RDFMS)) && + strncmp(sAttribute, XMLSCHEMA, strlen(XMLSCHEMA))) { + if (strlen(tValue) > 0) { + HTAssocList *newAL = HTAssocList_new(); + HTElement *newPredicate = HTElement_new(sAttribute, newAL); + HTElement *d = NULL; + HTElement_addAttribute(newPredicate, iName, + sAbout ? sAbout : sID); + HTElement_addAttribute(newPredicate, bName, sBagID); + d = HTElement_new2(tValue); + HTElement_addChild(newPredicate, d); + HTElement_addChild(typedNode, newPredicate); + } + } + HT_FREE(tValue); + } /* end of while */ + }/* end of block */ + { + if (sAbout) + StrAllocCopy(sObject, sAbout); + else if (sID) + StrAllocCopy(sObject, sID); + else + sObject = HTRDF_newReificationID(me); + StrAllocCopy(typedNode->m_sID, sObject); + + /* special case: should the typedNode have aboutEach attribute, + ** the type predicate should distribute to pointed + ** collection also -> create a child node to the typedNode + */ + if (sAboutEach && !HTList_isEmpty(typedNode->m_vTargets)) { + HTAssocList *newAL = HTAssocList_new(); + HTElement *newPredicate = HTElement_new(tName, newAL); + HTElement *d = HTElement_new2(typedNode->m_sName); + HTElement_addChild(newPredicate, d); + HTElement_addChild(typedNode, newPredicate); + } else { + HTRDF_addTriple(me, tName, sObject, typedNode->m_sName); + } + HTRDF_processDescription(me, typedNode, NO, NO, YES); + }/* end of block */ + + HT_FREE(iName); HT_FREE(bName); HT_FREE(tName); + + return sObject; +} + +/* + * Start processing an RDF/XML document instance from the + * root element rdf. + * + */ +PUBLIC BOOL HTRDF_processRDF (HTRDF *me, HTElement *e) +{ + if (me && e) { + HTList *cur = e->m_children; + HTElement *ele = NULL; + if (HTList_isEmpty(e->m_children)) { + HTPrint("Empty RDF Element\n"); + return NO; + } + while ((ele= (HTElement *) HTList_nextObject(cur))) { + if (HTRDF_isDescription(me, ele)) { + HTRDF_processDescription(me, ele, NO, me->m_bCreateBags, + me->m_bCreateBags); + } else if (HTRDF_isContainer(me, ele)) { + char * c = HTRDF_processContainer(me, ele); + HT_FREE(c); + } else if (HTRDF_isTypedPredicate(me, ele)) { + char * t = HTRDF_processTypedNode(me, ele); + HT_FREE(t); + } + } + return YES; + } + return NO; +} + +/* + * processPredicate handles all elements not defined as special + * RDF elements. + * + * predicate The predicate element itself + * description Context for the predicate + * sTarget The target resource + * reificate Should this predicate be reificated + * + * return the new ID which can be used to identify the predicate + * + */ +PRIVATE char * HTRDF_processPredicate (HTRDF * me, + HTElement * predicate, + HTElement * description, + char * sTarget, + BOOL reificate) +{ + char * sStatementID = HTElement_getAttribute2(predicate, RDFMS, "ID"); + char * nsStatementID = NULL; + char * sBagID = HTElement_getAttribute2(predicate, RDFMS, "bagID"); + char * sResource = HTRDF_getResource(me, predicate); + + /* + ** If a predicate has other attributes than rdf:ID, rdf:bagID, + ** or xmlns... -> generate new triples according to the spec. + ** (See end of Section 6) + */ + { + HTElement * place_holder = NULL; + HTAssocList * newAL = HTAssocList_new(); + char * fName = NULL; + char * aName = NULL; + + StrAllocMCopy(&fName, RDFMS, "Description", NULL); + place_holder = HTElement_new(fName, newAL); + HT_FREE(fName); + + if (HTRDF_expandAttributes(me, place_holder, predicate)) { + + /* error checking */ + if (!HTList_isEmpty(predicate->m_children)) { + HTPrint("%s must be an empty element since it uses propAttr grammar production", predicate->m_sName); + HTElement_delete(place_holder); + return NULL; + } + StrAllocMCopy(&aName, RDFMS, "about", NULL); + + /* determine the 'about' part for the new statements */ + if (sStatementID) { + HTElement *data = HTElement_new2(sStatementID); + HTElement_addAttribute(place_holder, aName, sStatementID); + + /* hack: make rdf:ID the value of the predicate */ + HTElement_addChild(predicate, data); + } else if (sResource) { + HTElement_addAttribute(place_holder, aName, sResource); + } else { + nsStatementID = HTRDF_newReificationID(me); + HTElement_addAttribute(place_holder, aName, nsStatementID); + HT_FREE(nsStatementID); + } + HT_FREE(aName); + + if (sBagID) { + StrAllocMCopy(&fName, RDFMS, "bagID", NULL); + HTElement_addAttribute(place_holder, fName, sBagID); + HT_FREE(fName); + StrAllocCopy(place_holder->m_sBagID, sBagID); + } + HTRDF_processDescription(me, place_holder, NO, NO, me->m_bCreateBags); + } else { + + /* Nothing but xmlns or RDF stuff, so we don't need new element */ + HTElement_delete(place_holder); + } + } + + /* + ** Tricky part: if the resource attribute is present for a predicate + ** AND there are no children, the value of the predicate is either + ** 1. the URI in the resource attribute OR + ** 2. the node ID of the resolved #resource attribute + */ + if (sResource && HTList_isEmpty(predicate->m_children)) { + if (!HTElement_target(predicate)) { + if (reificate) { + HT_FREE(nsStatementID); + nsStatementID = HTRDF_reificate (me, predicate->m_sName, + sTarget, sResource, + predicate->m_sID); + StrAllocCopy(predicate->m_sID, nsStatementID); + } else { + HTRDF_addTriple(me, predicate->m_sName, sTarget, sResource); + } + } else { + HTElement *target = HTElement_target(predicate); + if (reificate) { + nsStatementID = HTRDF_reificate (me, predicate->m_sName, + sTarget, + target->m_sID, + predicate->m_sID); + StrAllocCopy(predicate->m_sID, nsStatementID); + } else { + HTRDF_addTriple(me, predicate->m_sName, sTarget, target->m_sID); + } + } + if (nsStatementID && predicate->m_sID) + StrAllocCopy(nsStatementID, predicate->m_sID); + return nsStatementID; + } + + /* + ** Does this predicate make a reference somewhere using the + ** sResource attribute + */ + if (sResource && HTElement_target(predicate)) { + char * dStatementID = HTRDF_processDescription(me, + HTElement_target(predicate), + YES, NO, NO); + if (reificate) { + HT_FREE(nsStatementID); + nsStatementID = HTRDF_reificate (me, predicate->m_sName, + sTarget, dStatementID, + predicate->m_sID); + StrAllocCopy(predicate->m_sID, nsStatementID); + } else { + StrAllocCopy(nsStatementID, dStatementID); + HTRDF_addTriple(me, predicate->m_sName, sTarget, nsStatementID); + } + return nsStatementID; + } + + /* + ** Before looping through the children, let's check + ** if there are any. If not, the value of the predicate is + ** an anonymous node + */ + { + HTList *cur = predicate->m_children; + BOOL bUsedTypedNodeProduction = NO; + HTElement *n2; + if (nsStatementID && sStatementID) + StrAllocCopy(nsStatementID, sStatementID); + if (HTList_isEmpty(cur)) { + if (reificate) { + char * nr = HTRDF_newReificationID(me); + HT_FREE(nsStatementID); + nsStatementID = HTRDF_reificate (me, predicate->m_sName, + sTarget, nr, + predicate->m_sID); + HT_FREE(nr); + } else { + char * nr = HTRDF_newReificationID(me); + HTRDF_addTriple(me, predicate->m_sName, sTarget, nr); + HT_FREE(nr); + } + } + while ((n2= (HTElement *) HTList_nextObject(cur))) { + if (HTRDF_isDescription(me, n2)) { + HTElement *d2 = n2; + char * dStatementID =HTRDF_processDescription(me, d2, YES, NO, NO); + if (d2->m_sID && dStatementID && d2->m_sID != dStatementID) + StrAllocCopy(d2->m_sID, dStatementID); + + if (reificate) { + HT_FREE(nsStatementID); + nsStatementID = HTRDF_reificate (me, predicate->m_sName, + sTarget, dStatementID, + predicate->m_sID); + } else { + StrAllocCopy(nsStatementID, dStatementID); + HTRDF_addTriple(me, predicate->m_sName, sTarget, + nsStatementID); + } + } else if (HTElement_instanceOfData(n2)) { + char * tValue = NULL; + char * sValue = n2->m_sContent; + /* we've got real data */ + /* + * Only if the content is not empty PCDATA (whitespace that is) + * print the triple + */ + tValue = trim(sValue); + if (tValue && strlen(tValue) > 0) { + if (reificate) { + HT_FREE(nsStatementID); + nsStatementID = HTRDF_reificate (me, predicate->m_sName, + sTarget, tValue, + predicate->m_sID); + StrAllocCopy(predicate->m_sID, nsStatementID); + } else { + HTRDF_addTriple(me, predicate->m_sName, sTarget, tValue); + } + } + HT_FREE(tValue); + } else if (HTRDF_isContainer(me, n2)) { + HTElement *target = HTElement_target(description); + char * aboutTarget = + target ? + HTElement_getAttribute2(target, RDFMS, "about") : NULL; + char * sCollectionID = HTRDF_processContainer(me, n2); + StrAllocCopy(nsStatementID, sCollectionID); + /* Attach the collection to the current predicate */ + if (target) { + if (reificate) { + HT_FREE(nsStatementID); + nsStatementID=HTRDF_reificate (me, predicate->m_sName, + aboutTarget, + sCollectionID, + predicate->m_sID); + StrAllocCopy(predicate->m_sID, nsStatementID); + } else { + HTRDF_addTriple(me, predicate->m_sName, aboutTarget, + sCollectionID); + } + } else { + if (reificate) { + HT_FREE(nsStatementID); + nsStatementID=HTRDF_reificate (me, predicate->m_sName, + sTarget, sCollectionID, + predicate->m_sID); + StrAllocCopy(predicate->m_sID, nsStatementID); + } else { + HTRDF_addTriple(me, predicate->m_sName, sTarget, + sCollectionID); + } + } + HT_FREE(sCollectionID); + } else if (HTRDF_isTypedPredicate(me, n2)) { + if (bUsedTypedNodeProduction) { + HTPrint("Only one typedNode allowed inside a predicate (Extra typedNode: %s )\n", n2->m_sName); + } else { + bUsedTypedNodeProduction = YES; + } + HT_FREE(nsStatementID); + nsStatementID = HTRDF_processTypedNode(me, n2); + HTRDF_addTriple(me, predicate->m_sName, sTarget, nsStatementID); + } + } + return nsStatementID; + } /* end of block */ + return NULL; +} + +/* + * processDescription manages Description elements + * + * description The Description element itself + * inPredicate Is this is a nested description + * reificate Do we need to reificate + * createBag Do we create a bag container + * + * return An ID for the description + * + */ +PUBLIC char * HTRDF_processDescription (HTRDF * me, + HTElement * description, + BOOL inPredicate, + BOOL reificate, + BOOL createBag) +{ + int iChildCount = 1; + BOOL bOnce = YES; + + char * sAbout = HTElement_getAttribute2(description, RDFMS, "about"); + char * sAboutEach = HTElement_getAttribute2(description, RDFMS, "aboutEach"); + char * sAboutEachPrefix = HTElement_getAttribute2(description, RDFMS, + "aboutEachPrefix"); + char * sBagid = HTElement_getAttribute2(description, RDFMS, "bagID"); + char * sID = HTElement_getAttribute2(description, RDFMS, "ID"); + HTElement *target = HTElement_target(description); + BOOL hasTarget = HTList_isEmpty(description->m_vTargets) ? NO : YES; + BOOL targetIsContainer = NO; + char * sTargetAbout = NULL; + char * sTargetBagID = NULL; + char * sTargetID = NULL; + char * dName = NULL; + char * aName = NULL; + + /* + ** Return immediately if the description has already been managed + */ + if (description->m_bDone) return description->m_sID; + + StrAllocMCopy(&dName, RDFMS, "Description", NULL); + StrAllocMCopy(&aName, RDFMS, "about", NULL); + + /* + ** Determine what the target of the Description reference is + */ + if (hasTarget) { + char * sTargetID2 = HTElement_getAttribute2(target, RDFMS, "ID"); + sTargetAbout = HTElement_getAttribute2(target, RDFMS, "about"); + sTargetBagID = HTElement_getAttribute2(target, RDFMS, "bagID"); + if (me->m_sSource && sTargetID2) { + StrAllocMCopy(&sTargetID, me->m_sSource, sTargetID2, NULL); + } else { + StrAllocCopy(sTargetID, sTargetID2); + } + /* + * Target is collection if + * 1. it is identified with bagID attribute + * 2. it is identified with ID attribute and is a collection + */ + if (sTargetBagID && sAbout) { + targetIsContainer = !strcmp(&(sAbout[1]), sTargetBagID); + } else { + if (sTargetID && sAbout && !strcmp(&(sAbout[1]), sTargetID) && + HTRDF_isContainer(me, target)) + targetIsContainer = YES; + } + HT_FREE(sTargetID); + } + + /* + * Check if there are properties encoded using the abbreviated + * syntax + */ + HTRDF_expandAttributes(me, description, description); + + /* + * Manage the aboutEach attribute here + */ + if (sAboutEach && hasTarget) { + if (HTRDF_isContainer(me, target)) { + HTList *cur = target->m_children; + HTElement *ele = NULL; + while ((ele= (HTElement *) HTList_nextObject(cur))) { + if (HTRDF_isListItem(me, ele)) { + char * sResource = HTRDF_getResource(me, ele); + if (sResource) { + HTElement * newDescription = NULL; + HTElement * ele2; + HTList * cur2 = description->m_children; + + /* + * Manage
  • case + */ + if (sResource) { + HTAssocList *newAL = HTAssocList_new(); + newDescription = HTElement_new(dName, newAL); + HTElement_addAttribute(newDescription, aName, sResource); + } + + while ((ele2 = (HTElement *) HTList_nextObject(cur2))){ + if (newDescription) HTElement_addChild(newDescription, ele2); + } + + if (newDescription) + HTRDF_processDescription(me, newDescription, NO, NO, NO); + + /* Not needed anymore */ + HTElement_delete(newDescription); + + } else { + /** + * Otherwise we have a structured value inside
  • + * + * loop through the children of
  • + * (can be only one) + */ + HTList *cur2 = ele->m_children; + HTElement *ele2 = NULL; + while ((ele2 = (HTElement *) HTList_nextObject(cur2))) { + HTAssocList *newAL = HTAssocList_new(); + HTElement *newNode = HTElement_new(dName, newAL); + HTList *cur3 = description->m_children; + HTElement *ele3 = NULL; + /* loop through the items in the + * description with aboutEach + * and add them to the target + */ + while ((ele3 = (HTElement *) + HTList_nextObject(cur3))) { + HTElement_addChild(newNode, ele3); + } + HTElement_addTarget(newNode, ele2); + HTRDF_processDescription(me, newNode, YES, NO, NO); + } + } + } else if (HTRDF_isTypedPredicate(me, ele)) { + HTAssocList *newAL = HTAssocList_new(); + HTElement *newNode = HTElement_new(dName, newAL); + HTList *cur2 = description->m_children; + HTElement *ele2 = NULL; + while ((ele2 = (HTElement *) HTList_nextObject(cur2))) { + HTElement_addChild(newNode, ele2); + } + HTElement_addTarget(newNode, ele); + HTRDF_processDescription(me, newNode, YES, NO, NO); + } + } /* end of while */ + } else if (HTRDF_isDescription(me, target)) { + HTList *cur = target->m_children; + HTElement *ele = NULL; + while ((ele = (HTElement *) HTList_nextObject(cur))) { + HTAssocList *newAL = HTAssocList_new(); + HTElement *newNode = HTElement_new(dName, newAL); + HTList *cur2 = description->m_children; + HTElement *ele2 = NULL; + while ((ele2 = (HTElement *) HTList_nextObject(cur2))) { + HTElement_addChild(newNode, ele2); + } + HTElement_addTarget(newNode, ele); + HTRDF_processDescription(me, newNode, YES, NO, NO); + } /* end of while */ + } + + HT_FREE(dName); + HT_FREE(aName); + return NULL; + } + + /* + * Manage the aboutEachPrefix attribute here + */ + if (sAboutEachPrefix) { + if (hasTarget) { + HTList *cur = description->m_vTargets; + HTElement *target = NULL; + while ((target = (HTElement *) HTList_nextObject(cur))) { + HTList *cur2 = description->m_children; + HTElement *ele2 = NULL; + HTElement *newDescription = NULL; + HTAssocList *newAL = HTAssocList_new(); + sTargetAbout = HTElement_getAttribute2(target, RDFMS, "about"); + newDescription = HTElement_new(dName, newAL); + HTElement_addAttribute(newDescription, aName, sTargetAbout); + while ((ele2 = (HTElement *) HTList_nextObject(cur2))) { + HTElement_addChild(newDescription, ele2); + } + HTRDF_processDescription(me, newDescription, NO, NO, NO); + } + } + + HT_FREE(dName); + HT_FREE(aName); + return NULL; + } + /* + * Enumerate through the children + */ + { + HTList *cur = description->m_children; + HTElement *n = NULL; + while ((n = (HTElement *) HTList_nextObject(cur))) { + if (HTRDF_isDescription(me, n)) + HTPrint("Can not nest Description inside Description\n"); + else if (HTRDF_isListItem(me, n)) + HTPrint("Can not nest List Item inside Description\n"); + else if (HTRDF_isContainer(me, n)) + HTPrint("Can not nest Container inside Description\n"); + else if (HTRDF_isTypedPredicate(me, n)) { + char * sChildID = NULL; + if (hasTarget && targetIsContainer) { + sChildID = HTRDF_processPredicate(me, n, description, + target->m_sBagID ? + target->m_sBagID : + target->m_sID, NO); + StrAllocCopy(description->m_sID, sChildID); + createBag = NO; + } else if (hasTarget) { + sChildID = HTRDF_processPredicate(me, n, description, + target->m_sBagID ? + target->m_sBagID : + target->m_sID, reificate); + StrAllocCopy(description->m_sID, sChildID); + } else if (!hasTarget && !inPredicate) { + if (!description->m_sID) { + char * nr = HTRDF_newReificationID(me); + StrAllocCopy(description->m_sID, nr); + HT_FREE(nr); + } + if (!sAbout) { + if (sID) + sAbout = sID; + else + sAbout = description->m_sID; + } + sChildID = HTRDF_processPredicate(me, n, description, + sAbout, sBagid ? + YES : reificate); + + } else if (!hasTarget && inPredicate) { + if (!sAbout) { + if (sID) { + StrAllocCopy(description->m_sID, sID); + sAbout = sID; + } else { + if (!description->m_sID) { + char * nr = HTRDF_newReificationID(me); + StrAllocCopy(description->m_sID, nr); + HT_FREE(nr); + } + sAbout = description->m_sID; + } + } else { + if (description->m_sID != sAbout) + StrAllocCopy(description->m_sID, sAbout); + } + sChildID = HTRDF_processPredicate(me, n, description, sAbout, NO); + } + /* + * Each Description block creates also a Bag node which + * has links to all properties within the block IF + * the m_bCreateBags variable is true + */ + if (sBagid || (me->m_bCreateBags && createBag)) { + char * sNamespace = RDFMS; + if (bOnce && sChildID) { + char * tName = NULL; + char * bName = NULL; + bOnce = NO; + if (!description->m_sBagID) { + char * nr = HTRDF_newReificationID(me); + StrAllocCopy(description->m_sBagID, nr); + HT_FREE(nr); + } + if (!description->m_sID) + StrAllocCopy(description->m_sID, + description->m_sBagID); + StrAllocMCopy(&tName, sNamespace, "type", NULL); + StrAllocMCopy(&bName, sNamespace, "Bag", NULL); + HTRDF_addTriple(me, tName, description->m_sBagID, bName); + HT_FREE(tName); + HT_FREE(bName); + + } + if (sChildID) { + char * tName = NULL; + char si[20]; + sprintf(si, "%d", iChildCount); + StrAllocMCopy(&tName, sNamespace, "_", si, NULL); + HTRDF_addTriple(me, tName, description->m_sBagID, sChildID); + iChildCount++; + HT_FREE(tName); + } + } + HT_FREE(sChildID); + } + } + } /* end of block*/ + + description->m_bDone = YES; + + HT_FREE(dName); + HT_FREE(aName); + return (description->m_sID); +} + +/* + * Given an XML document (well-formed HTML, for example), + * look for a suitable element to start parsing from + * + */ +PUBLIC BOOL HTRDF_processXML (HTRDF *me, HTElement *ele) +{ + if (me && ele) { + if (HTRDF_isRDF(me, ele)) { + if (HTRDF_isRDFroot(me, ele)) { + HTRDF_processRDF(me, ele); + } else if (HTRDF_isDescription(me, ele)) { + HTRDF_processDescription(me, ele, NO, me->m_bCreateBags, + me->m_bCreateBags); + } + } else { + HTList *cur = ele->m_children; + HTElement *child = NULL; + while ((child = (HTElement *) HTList_nextObject(cur))) { + HTRDF_processXML(me, child); + } + } + + /* MISSING RECURSION */ + + return YES; + } + return NO; +} + +/* + * Return the root element pointer. This requires the parsing + * has been already done. + */ +PUBLIC HTElement * HTRDF_root (HTRDF *me) +{ + return me ? me->m_root : NULL; +} + +/* + * Return the full namespace URI for a given prefix sPrefix. + * The default namespace is identified with xmlns prefix. + * The namespace of xmlns attribute is an empty string. + */ + +PUBLIC char * HTRDF_namespace(HTRDF * me, char * sPrefix) +{ + char * nPrefix = NULL; + HTAssocList * calist; + HTList * cur = me->m_namespaceStack; + + if (!sPrefix) + StrAllocCopy(nPrefix, "xmlns"); + + while ((calist = (HTAssocList *) HTList_nextObject(cur))) { + char * sValue = HTAssocList_findObjectCaseSensitiveExact(calist, sPrefix); + if (sValue) { + StrAllocCopy(nPrefix, sValue); + return nPrefix; + } + } + /* + * Give error only if + * 1. the prefix is not from the reserved xml namespace + * 2. the prefix is not xmlns which is to look for the default + * namespace + */ + if (!strcmp(sPrefix, XMLSCHEMA)) { + StrAllocCopy(nPrefix, sPrefix); + return nPrefix; + } else if (!strcmp(sPrefix, "xmlns")) { + StrAllocCopy(nPrefix, ""); + return nPrefix; + } else + HTPrint("Unresolved Namespace prefix %s\n", sPrefix); + + StrAllocCopy(nPrefix, ""); + return nPrefix; +} + +/* + * Methods to determine whether we are parsing + * parseType="Literal" or parseType="Resource" + */ + +PUBLIC BOOL HTRDF_parseLiteral(HTRDF *me) +{ + HTElement *e = NULL; + HTList *cur = me->m_elementStack; + if (!HTList_isEmpty(me->m_elementStack)) { + while((e = (HTElement *) HTList_nextObject(cur))) { + char * sParseType = NULL; + sParseType = HTElement_getAttribute2(e, RDFMS, "parseType"); + if (sParseType) { + if (strcmp(sParseType, "Resource")) + return YES; + } + } + } + return NO; +} + +/* + * Methods to determine whether we are parsing + * parseType="Literal" or parseType="Resource" + */ + +PUBLIC BOOL HTRDF_parseResource(HTRDF *me) +{ + HTElement *e = NULL; + HTList *cur = me->m_elementStack; + if (!HTList_isEmpty(me->m_elementStack)) { + while((e = (HTElement *) HTList_nextObject(cur))) { + char * sParseType = NULL; + sParseType = HTElement_getAttribute2(e, RDFMS, "parseType"); + if (sParseType) { + if (!strcmp(sParseType, "Resource")) + return YES; + } + } + } + return NO; +} +/* + * checkAttributes goes through the attributes of element e< + * to see + * 1. if there are symbolic references to other nodes in the data model. + * in which case they must be stored for later resolving with + * resolveLater method. + * 2. if there is an identity attribute, it is registered using + * registerResource or registerID method. + * + */ + +PRIVATE void HTRDF_checkAttributes(HTRDF *me, HTElement *e) +{ + { + char * sResource = HTElement_getAttribute2(e, RDFMS, "resource"); + + if (sResource && sResource[0] == '#') + HTRDF_resolveLater(me, e); + } + { + char * sAboutEach = HTElement_getAttribute2(e, RDFMS, "aboutEach"); + + if (sAboutEach && sAboutEach[0] == '#') + HTRDF_resolveLater(me, e); + } + { + char * sAboutEachPrefix = HTElement_getAttribute2(e, RDFMS, + "aboutEachPrefix"); + + if (sAboutEachPrefix && sAboutEachPrefix[0] == '#') + HTRDF_resolveLater(me, e); + } + { + char * sAbout = HTElement_getAttribute2(e, RDFMS, "about"); + if (sAbout) { + if (sAbout[0] == '#') + HTRDF_resolveLater(me, e); + else + HTRDF_registerResource(me, e); + } + } + + { + char * sBagID = HTElement_getAttribute2(e, RDFMS, "bagID"); + + if (sBagID) { + HTRDF_registerID(me, sBagID, e); + StrAllocCopy(e->m_sBagID, sBagID); + } + } + { + char * sID = HTElement_getAttribute2(e, RDFMS, "ID"); + if (sID) { + HTRDF_registerID(me, sID, e); + StrAllocCopy(e->m_sID, sID); + } + } +} +/* + * Add the element e to the m_vResolveQueue + * to be resolved later. + */ +PUBLIC void HTRDF_resolveLater(HTRDF *me, HTElement *e) +{ + HTList_addObject(me->m_vResolveQueue, e); +} +/* + * Add an element e to the Hashtable m_hIDtable + * which stores all nodes with an ID + */ + +PUBLIC void HTRDF_registerID(HTRDF *me, char * sID, HTElement *e) +{ + if (HTHashtable_object(me->m_hIDtable, sID)) + HTPrint("Node ID %s redefined", sID); + HTHashtable_addObject(me->m_hIDtable, sID, e); +} +/* + * Add an element e to the Vector m_vResources + * which stores all nodes with an URI + */ +PUBLIC void HTRDF_registerResource(HTRDF *me, HTElement *e) +{ + HTList_addObject(me->m_vResources, e); +} + +/* + * Look for a node by name sID from the Hashtable + * m_hIDtable of all registered IDs. + */ + +PUBLIC HTElement *HTRDF_lookforNode(HTRDF *me, char * sID) +{ + if (sID) + return (HTElement *) HTHashtable_object(me->m_hIDtable, sID); + return NULL; +} + +/* +** Special method to deal with rdf:resource attribute +*/ +PUBLIC char * HTRDF_getResource(HTRDF *me, HTElement *e) +{ + char * sResource = HTElement_getAttribute2(e, RDFMS, "resource"); + if (sResource != NULL && sResource[0] == '\0') + sResource = me->m_sSource; + return sResource; +} + +/* +** Take an element ele with its parent element parent +** and evaluate all its attributes to see if they are non-RDF specific +** and non-XML specific in which case they must become children of +** the ele node. +*/ +PRIVATE BOOL HTRDF_expandAttributes (HTRDF * me, HTElement * parent, HTElement * ele) +{ + BOOL foundAbbreviation = NO; + char * sAttribute = NULL; + char * sValue = NULL; + HTAssoc * assoc; + HTAssocList * cur = ele->m_attributes; + int lxmlschema = strlen(XMLSCHEMA); + int lrdfms = strlen(RDFMS); + + while ((assoc= (HTAssoc *) HTList_nextObject(cur))) { + int latt; + sAttribute = HTAssoc_name(assoc); + sValue = HTAssoc_value(assoc); + + latt = strlen(sAttribute); + if (!strncmp(sAttribute, XMLSCHEMA, lxmlschema)) + continue; + + if (!strncmp(sAttribute, RDFMS, lrdfms) && + (sAttribute[lrdfms]!='_') && + latt > 5 && strcmp(&(sAttribute[latt-5]), "value") && + strcmp(&(sAttribute[latt-4]), "type")) + continue; + + if (strlen(sValue) > 0) { + HTAssocList * newAL = HTAssocList_new(); + HTElement * newElement = HTElement_new(sAttribute, newAL); + HTElement * newData = HTElement_new2(sValue); + HTElement_addChild(newElement, newData); + HTElement_addChild(parent, newElement); + foundAbbreviation = YES; + } + } + return foundAbbreviation; +} + +/** + * Create a new reification ID by using a name part and an + * incremental counter m_iReificationCounter. + */ +PUBLIC char * HTRDF_newReificationID (HTRDF *me) +{ + char * nsid = NULL; + char nsrc[20]; + me->m_iReificationCounter++; + sprintf(nsrc, "%d", me->m_iReificationCounter); + if (!me->m_sSource) { + StrAllocMCopy(&nsid, "genid", nsrc, NULL); + } else { + StrAllocMCopy(&nsid, me->m_sSource, "#genid", nsrc, NULL); + } + return nsid; +} + +/* + * reificate creates one new node and four new triples + * and returns the ID of the new node + */ + +PRIVATE char * HTRDF_reificate(HTRDF *me, char * sPredicate, char * sSubject, + char * sObject, char * sNodeID) +{ + char * sName = NULL; + char * pName = NULL; + char * oName = NULL; + char * tName = NULL; + char * stName = NULL; + char * tNodeID = NULL; + + if (!sNodeID) + tNodeID = HTRDF_newReificationID(me); + else + StrAllocCopy(tNodeID, sNodeID); + + StrAllocMCopy(&sName, RDFMS, "subject", NULL); + StrAllocMCopy(&pName, RDFMS, "predicate", NULL); + StrAllocMCopy(&oName, RDFMS, "object", NULL); + StrAllocMCopy(&tName, RDFMS, "type", NULL); + StrAllocMCopy(&stName, RDFMS, "Statement", NULL); + + /* + * The original statement must remain in the data model + */ + HTRDF_addTriple(me, sPredicate, sSubject, sObject); + + /* + * Do not reificate reificated properties + */ + if (strcmp(sPredicate, sName) && strcmp(sPredicate, pName) && + strcmp(sPredicate, oName) && strcmp(sPredicate, tName)) { + + /* Reificate by creating 4 new triples */ + HTRDF_addTriple(me, pName, tNodeID, sPredicate); + HTRDF_addTriple(me, sName, tNodeID, (sSubject[0]=='\0' ? me->m_sSource: sSubject)); + HTRDF_addTriple(me, oName, tNodeID, sObject); + HTRDF_addTriple(me, tName, tNodeID, stName); + } else + HT_FREE(tNodeID); + + HT_FREE(sName); + HT_FREE(pName); + HT_FREE(oName); + HT_FREE(tName); + HT_FREE(stName); + + return tNodeID; +} +/* + * Create a new triple and add it to the m_triples List + * Send the triple to the Output stream + */ + +PUBLIC void HTRDF_addTriple (HTRDF *me, char * sPredicate, char * sSubject, + char * sObject) +{ + HTTriple *t = NULL; + + /* + * If there is no subject (about=""), then use the URI/filename where + * the RDF description came from + */ + if (!sPredicate || !sSubject || !sObject) { + HTPrint("Predicate %s when subject %s and object %s \n", + sPredicate ? sPredicate : "null", + sSubject ? sSubject : "null", + sObject ? sObject : "null"); + return; + } + + if (sSubject[0]=='\0') + sSubject = me->m_sSource; + + t = HTTriple_new(sPredicate, sSubject, sObject); + + /* Call the triple callback handler (if any) with this new triple */ + if (me->newTripleInstance && t) (*(me->newTripleInstance))(me, t, me->tripleContext); + + HTList_addObject(me->m_triples, t); +} + +/* + * createBags method allows one to determine whether SiRPAC + * produces Bag instances for each Description block. + * The default setting is not to generate them. + */ + +PUBLIC void HTRDF_createBags(HTRDF *me, BOOL b) +{ + if (me) + me->m_bCreateBags = b; +} + +/* + Set output stream for RDF parser +*/ + +PUBLIC void HTRDF_setOutputStream(HTRDF *me, HTStream *ostream) +{ + if (me) + me->ostream = ostream; +} + +PUBLIC BOOL HTRDF_registerNewTripleCallback (HTRDF * me, HTTripleCallback_new * cbf, void * context) +{ + if (me) { + me->newTripleInstance = cbf; + me->tripleContext = context; + return YES; + } + return NO; +} + +PUBLIC BOOL HTRDF_registerNewParserCallback (HTRDFCallback_new * me, void * context) +{ + RDFInstance = me; + RDFInstanceContext = context; + return YES; +} + +/* ------------------------------------------------------------------------- */ +/* HTRDFTriples STREAM HANDLERS */ +/* ------------------------------------------------------------------------- */ + +PRIVATE int generate_triples(HTStream *me) +{ + HTRDF *rdfp = me ? me->rdfparser : NULL; + if (rdfp) { + + HTRDF_resolve(rdfp); + + HTRDF_processXML(rdfp, HTRDF_root(rdfp)); + + return HT_OK; + } + return HT_ERROR; +} + +PRIVATE int HTRDFTriples_flush (HTStream * me) +{ + if (me->target) + return (*me->target->isa->flush)(me->target); + return HT_OK; +} + +PRIVATE int HTRDFTriples_free (HTStream * me) +{ + int status = HT_OK; + + status = generate_triples(me); + + HTRDF_delete(me->rdfparser); + + if (me->target) { + if ((status = (*me->target->isa->_free)(me->target)) == HT_WOULD_BLOCK) + return HT_WOULD_BLOCK; + } + HTTRACE(XML_TRACE, "RDF Parser.. FREEING...\n"); + HT_FREE(me); + return status; +} + +PRIVATE int HTRDFTriples_abort (HTStream * me, HTList * e) +{ + HTTRACE(XML_TRACE, "RDF Parser.. ABORTING...\n"); + HTRDF_delete(me->rdfparser); + if (me->target) + (*me->target->isa->abort)(me->target, NULL); + HT_FREE(me); + return HT_ERROR; +} + +PRIVATE int HTRDFTriples_write (HTStream * me, const char * buf, int len) +{ + return HT_OK; +} + +PRIVATE int HTRDFTriples_putCharacter (HTStream * me, char c) +{ + return HTRDFTriples_write(me, &c, 1); +} + +PRIVATE int HTRDFTriples_putString (HTStream * me, const char * s) +{ + return HTRDFTriples_write(me, s, (int) strlen(s)); +} + +PRIVATE const HTStreamClass HTRDFTriplesClass = +{ + "rdf", + HTRDFTriples_flush, + HTRDFTriples_free, + HTRDFTriples_abort, + HTRDFTriples_putCharacter, + HTRDFTriples_putString, + HTRDFTriples_write +}; + +PRIVATE HTStream * RDFParser_new (HTRequest * request, + void * param, + HTFormat input_format, + HTFormat output_format, + HTStream * output_stream) +{ + HTStream * me = NULL; + if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) + HT_OUTOFMEM("HTRDFTriples_new"); + me->isa = &HTRDFTriplesClass; + me->state = HT_OK; + me->request = request; + me->target = output_stream ? output_stream : HTErrorStream(); + + /* Now create the RDF parser instance */ + if ((me->rdfparser = HTRDF_new()) == NULL) { + HT_FREE(me); + return HTErrorStream(); + } + + /* Set the source (I guess mostly to follow SiRPAC API) */ + { + char * uri = HTAnchor_address((HTAnchor *) HTRequest_anchor(request)); + HTRDF_setSource(me->rdfparser, uri); + HT_FREE(uri); + } + + /* Where are we putting data? */ + HTRDF_setOutputStream(me->rdfparser, me); + + /* If you want to create Bags, change it to YES */ + HTRDF_createBags(me->rdfparser, NO); + + /* Register our new XML Instance handler */ + /* @@@ THIS SHOULD BE DONE USING XML NAMESPACE SO THAT WE DON'T CONFLICT @@@ */ + HTXMLCallback_registerNew(rdf_newInstance, me->rdfparser); + + HTTRACE(XML_TRACE, "RDF Parser.. Stream created\n"); + + return me; +} + +PUBLIC HTStream * HTRDFParser_new (HTRequest * request, + void * param, + HTFormat input_format, + HTFormat output_format, + HTStream * output_stream) +{ + return HTXML_new(request, param, input_format, output_format, + RDFParser_new(request, param, input_format, output_format, output_stream)); +} + +PRIVATE void triple_newInstance (HTRDF * rdfp, HTTriple * t, void * context) +{ + if (rdfp && t) { + HTStream *ostream = rdfp->ostream; + if (ostream) { + PUTC(ostream,'('); + PUTS(ostream, t->m_sPredicate); + PUTC(ostream,','); + PUTS(ostream, t->m_sSubject); + PUTC(ostream,','); + PUTS(ostream, t->m_sObject); + PUTC(ostream,')'); + PUTC(ostream,'\n'); + } + } +} + +PUBLIC HTStream * HTRDFToTriples (HTRequest * request, + void * param, + HTFormat input_format, + HTFormat output_format, + HTStream * output_stream) +{ + HTStream * me = RDFParser_new(request, param, input_format, output_format, output_stream); + HTTRACE(XML_TRACE, "RDF Converter. To Triples\n"); + + /* Register our own tripple instance handler */ + HTRDF_registerNewTripleCallback(me->rdfparser, triple_newInstance, NULL); + + /* Create an XML parser instance and return */ + return HTXML_new(request, param, input_format, output_format, me); +} + +/* +** This function initializes the XML parser and RDF parsers +** that are used to synchronously parse a file of RDF or a +** a buffer of RDF. +** +** Parameters: +** xmlparser - MODIFIED the XML parser to create. The caller is +** responsible for free'ing this pointer. +** rdfparser - MODIFIED the RDF parser to create. The caller is +** responsible for free'ing this pointer. +** stream - MODIFIED the HTStream needed by the RDF parser. The +** caller is responsible for free'ing this pointer. +** uri - the URI created from name. It is used by the RDF parser +** when creating anonymous node names. The caller is +** responsible for freeing this pointer. +** new_triple_callback - the callback invoked when a new triple +** is created. If NULL, the default handler will be invoked. +** context - a void pointer to pass to the new_triple_callback. +** Should set NULL if no data needs to be passed to the +** callback. +** name - the file name or buffer name to be used when the RDF +** parser needs a document name +** +** Returns: +** YES if the initialization succeeds; otherwise NO is returned +** and an error message is logged. +**/ + +PRIVATE BOOL initialize_parsers(XML_Parser *xmlparser, HTRDF **rdfparser, + HTStream **stream, char **uri, HTTripleCallback_new * new_triple_callback, + void *context, const char * name) +{ + /* Create an XML parser */ +#ifdef USE_NS + *xmlparser = XML_ParserCreateNS (NULL, ':'); +#else + *xmlparser = XML_ParserCreate (NULL); +#endif /* USE_NS */ + + if (!*xmlparser) { + HTTRACE(XML_TRACE, "RDF_Parser. Could not allocate memory for XML parser.\n"); + return NO; + } + + /* We need also need RDF parser to create the triples */ + *rdfparser = HTRDF_new(); + if (!*rdfparser) { + XML_ParserFree(*xmlparser); + HTTRACE(XML_TRACE, "RDF_Parser. Could not allocate memory for RDF parser.\n"); + return NO; + } + + /* Must construct a URI from name for the parser */ + *uri = HTLocalToWWW (name, "file:"); + HTRDF_setSource(*rdfparser, *uri); + + HTRDF_createBags(*rdfparser, NO); + + if (new_triple_callback) + HTRDF_registerNewTripleCallback(*rdfparser, new_triple_callback, context); + else + HTRDF_registerNewTripleCallback(*rdfparser, triple_newInstance, context); + + rdf_setHandlers(*xmlparser); + XML_SetUserData(*xmlparser, *rdfparser); + + /* Create a stream to be used to process the triple output */ + if ((*stream = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) { + HT_FREE(*uri); + XML_ParserFree(*xmlparser); + HTRDF_delete(*rdfparser); + HTTRACE(XML_TRACE, "RDF_Parser. Could not allocate memory for HTStream.\n"); + return NO; + } + (*stream)->isa = &HTRDFTriplesClass; + (*stream)->state = HT_OK; + (*stream)->request = NULL; /* Don't have a request */ + (*stream)->target = NULL; /* Don't have another stream */ + (*stream)->rdfparser = *rdfparser; + + return YES; +} + +/* HTRDF_parseFile +** --------------- +** This function parses a file of RDF in a synchronous, non-blocking +** way. In other words, the file is not asynchronously loaded. +** +** Parameters: +** file_name the name of the file to parse +** new_triple_callback the callback that is invoked when a triple +** is created. If NULL, the default triple handler is +** invoked. +** context - a void pointer to pass to the new_triple_callback. +** Should set NULL if no data needs to be passed to the +** callback. +** Returns: +** Returns YES if the file is successfully parsed; otherwise NO is +** returned and an error message is logged. +*/ + +PUBLIC BOOL HTRDF_parseFile (const char *file_name, + HTTripleCallback_new * new_triple_callback, void *context) +{ + char buff[512]; /* the file input buffer */ + FILE *fp; + XML_Parser xmlparser; + HTRDF *rdfparser; + HTStream * stream = NULL; + char *uri = NULL; + BOOL status; + + /* Sanity check */ + if (!file_name) { + HTTRACE(XML_TRACE, "HTRDF_parseFile. file_name is NULL\n"); + return NO; + } + + /* If the file does not exist, return now */ + fp = fopen (file_name, "r"); + if (!fp) { /* annotation index file doesn't exist */ + HTTRACE(XML_TRACE, "HTRDF_parseFile. File open failed."); + return NO; + } + + /* Initialize the XML and RDF parsers */ + status = initialize_parsers(&xmlparser, &rdfparser, &stream, &uri, + new_triple_callback, context, file_name); + if (!status) { + fclose (fp); + return NO; + } + + /* + * The parsing occurs on one read buffer at a time instead of + * reading everything into memory and then parsing + */ + for (;;) { + int done; + int buff_len; + fgets(buff, sizeof(buff), fp); + if (ferror(fp)) { + HT_FREE(uri); + fclose (fp); + XML_ParserFree(xmlparser); + HTRDF_delete(rdfparser); + HT_FREE(stream); + HTTRACE(XML_TRACE, "HTRDF_parseFile. Error reading file."); + return NO; + } + done = feof(fp); + if (done) + buff_len = 0; + else + buff_len = strlen (buff); + if (! XML_Parse(xmlparser, buff, buff_len, done)) { + fprintf (stderr, "Parse error at line %d:\n%s\n", + XML_GetCurrentLineNumber(xmlparser), + XML_ErrorString(XML_GetErrorCode(xmlparser))); + HT_FREE(uri); + fclose(fp); + XML_ParserFree(xmlparser); + HTRDF_delete(rdfparser); + HT_FREE(stream); + HTTRACE(XML_TRACE, "HTRDF_parseFile. Parse error."); + return NO; + } + if (done) + break; + } + + /* The file has been parsed, generate the triples */ + generate_triples(stream); + + /* Cleanup */ + HT_FREE(uri); + fclose (fp); + XML_ParserFree(xmlparser); + HTRDF_delete(rdfparser); + HT_FREE(stream); + + return YES; +} + +/* HTRDF_parseBuffer +** --------------- +** This function parses a buffer of RDF in a synchronous, non-blocking +** way. +** +** Parameters: +** buffer the buffer to parse +** buffer_name the buffer's name. This is used by the parser +** when naming "anonymous" subjects +** buffer_len the buffer's length (number of bytes) +** new_triple_callback the callback that is invoked when a triple +** is created. If NULL, the default triple handler is +** invoked. +** context - a void pointer to pass to the new_triple_callback. +** Should set NULL if no data needs to be passed to the +** callback. +** Returns: +** Returns YES if the buffer is successfully parsed; otherwise NO is +** returned and an error message is logged. +*/ + +PUBLIC BOOL HTRDF_parseBuffer (const char *buffer, const char *buffer_name, + int buffer_len, HTTripleCallback_new * new_triple_callback, void *context) +{ + XML_Parser xmlparser; + HTRDF *rdfparser; + HTStream * stream = NULL; + char *uri; + BOOL status; + + /* Sanity checks */ + if (!buffer) { + HTTRACE(XML_TRACE, "HTRDF_parseBuffer. buffer is NULL"); + return NO; + } + if (buffer_len <= 0) { + HTTRACE(XML_TRACE, "HTRDF_parseBuffer. buffer_len is <=0"); + return NO; + } + if (!buffer_name) { + HTTRACE(XML_TRACE, "HTRDF_parseBuffer. buffer_name is NULL"); + return NO; + } + + status = initialize_parsers(&xmlparser, &rdfparser, &stream, &uri, + new_triple_callback, context, buffer_name); + if (!status) + return NO; + + if (! XML_Parse(xmlparser, buffer, buffer_len, 1)) { + fprintf(stderr, "Parse error at line %d:\n%s\n", + XML_GetCurrentLineNumber(xmlparser), + XML_ErrorString(XML_GetErrorCode(xmlparser))); + HT_FREE(uri); + XML_ParserFree(xmlparser); + HTRDF_delete(rdfparser); + HT_FREE(stream); + HTTRACE(XML_TRACE, "HTRDF_parseBuffer. Parse error."); + return NO; + } + + /* The buffer has been parsed, generate the triples */ + generate_triples(stream); + + /* Cleanup */ + HT_FREE(uri); + XML_ParserFree(xmlparser); + HTRDF_delete(rdfparser); + HT_FREE(stream); + + return YES; +} diff -Naur xdvik-22.40l/libs/libwww/HTRDF.h xdvik-22.40n/libs/libwww/HTRDF.h --- xdvik-22.40l/libs/libwww/HTRDF.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/HTRDF.h Fri Sep 13 00:23:46 2002 @@ -0,0 +1,509 @@ +/* + + W3C Sample Code Library libwww RDF Parser + + +! + RDF Parser Based on Expat and SiRPAC +! + +Written and integrated into libwww by John Punin - thanks! + +This module is implemented by HTRDF.c, and is a part +of the W3C Sample Code Library. + +This RDF parser is based on Janne Saarela's Java based +SiRPAC and +James Clark's expat XML +parser which isincluded in the libwww CVS code base where I compile is +as two libraries: libxmltok.a and libxmlparse.a. +See the external modules that libwww works with +for details. +*/ + +#ifndef HTRDF_H +#define HTRDF_H + +#include "HTHash.h" + +#define RDFMS "http://www.w3.org/1999/02/22-rdf-syntax-ns#" +#define RDFSCHEMA "http://www.w3.org/TR/WD-rdf-schema#" +#define XMLSCHEMA "xml" + +/* +. + RDF Triple Class +. +*/ + +typedef struct _HTTriple HTTriple; + +extern HTTriple * HTTriple_new (char * p, char * s, char * o); +extern BOOL HTTriple_delete (HTTriple * me); +extern void HTTriple_print (HTTriple * me); +extern char * HTTriple_subject (HTTriple * me); +extern char * HTTriple_predicate (HTTriple * me); +extern char * HTTriple_object (HTTriple * me); + +/* +. + RDF Element Class +. +*/ + +typedef struct _HTElement HTElement; + +extern HTElement * HTElement_new (char * sName, HTAssocList * al); +extern HTElement * HTElement_new2 (char * sContent); +extern BOOL HTElement_addData (HTElement *me, char * sContent); +extern BOOL HTElement_delete (HTElement * me); +extern BOOL HTElement_addChild (HTElement * me, HTElement * element); +extern BOOL HTElement_addAttribute (HTElement * me, char * sName, char * sValue); +extern BOOL HTElement_removeAttribute (HTElement * me, char * sName); +extern char * HTElement_getAttribute (HTElement * me, char * sName); +extern char * HTElement_getAttribute2 (HTElement * me, char * sNamespace, char * sName); +extern BOOL HTElement_addTarget (HTElement * me, HTElement * element); +extern HTElement * HTElement_target (HTElement * me); +extern BOOL HTElement_instanceOfData (HTElement * me); + +/* +. + RDF Parser & Compiler Definition +. + +These methods create and deletes an RDF Parser/Compiler (SIRPAC) +( + Create and Delete Parser Instance +) +*/ + +typedef struct _HTRDFParser HTRDF; + +extern HTRDF * HTRDF_new (void); +extern BOOL HTRDF_delete (HTRDF * me); + +/* +( + Callback Handler Announcing a new RDF Parser Object +) + +When a RDF parser object is created, the stream +checks to see if there are any callbacks registered which should be notified +about the new stream instance. If that is the case then this callback is +called and a pointer to the RDF parser passed along. The output stream is +the target that was originally set for the request object before the request +was issued. +*/ + +typedef void HTRDFCallback_new ( + HTStream * me, + HTRequest * request, + HTFormat target_format, + HTStream * target_stream, + HTRDF * rdfparser, + void * context); + +/* + + Register RDF Parser Creation Notification Callback + + +@@@Should be handled via XML names spaces@@@ +*/ + +extern BOOL HTRDF_registerNewParserCallback (HTRDFCallback_new *, void * context); + +/* +( + Callback Handler Announcing a new RDF Triple +) + +Handler announcing that a new triple has been generated. +*/ + +typedef void HTTripleCallback_new ( + HTRDF * rdfp, + HTTriple * t, + void * context); + +/* + + Register RDF Triple Creation Notification Callback + +*/ + +extern BOOL HTRDF_registerNewTripleCallback ( + HTRDF * me, + HTTripleCallback_new * cbf, + void * context); + +/* +( + Set Address +) + +Saves the name of the source document for later inspection if needed +*/ + +extern BOOL HTRDF_setSource (HTRDF * me, char * source); + +/* +( + Resolve Symbolic References +) + +Go through the m_vResolveQueue and assign direct object reference for each +symbolic reference +*/ + +extern BOOL HTRDF_resolve(HTRDF *me); + +/* +( + Find Suitable Start Element +) + +Given an XML document (well-formed HTML, for example), look for a suitable +element to start parsing from +*/ + +extern BOOL HTRDF_processXML(HTRDF *me, HTElement *root); + +/* +( + Return the root element pointer. +) + +This requires the parsing has been already done. +*/ + +extern HTElement * HTRDF_root(HTRDF *me); + +/* +( + Return the full namespace URI for a given prefix sPrefix. +) + +The default namespace is identified with xmlns prefix. The namespace of xmlns +attribute is an empty string. +*/ + +extern char * HTRDF_namespace (HTRDF * me, char * sPrefix); + +/* +( + Parsing Literal or Resource? +) + +Methods to determine whether we are parsing parseType="Literal" or +parseType="Resource" +*/ + +extern BOOL HTRDF_parseLiteral(HTRDF *me); +extern BOOL HTRDF_parseResource(HTRDF *me); + +/* +( + Resolve Later +) + +Add the element e to the m_vResolveQueue to be resolved later. +*/ + +extern void HTRDF_resolveLater(HTRDF *me,HTElement *e); + +/* +( + Register ID +) + +Add an element e to the Hashtable m_hIDtable which stores all nodes with +an ID +*/ + +extern void HTRDF_registerID(HTRDF *me, char * sID,HTElement *e); + +/* +( + Register Resource +) + +Add an element e to the Vector m_vResources which stores all nodes with an +URI +*/ + +extern void HTRDF_registerResource(HTRDF *me,HTElement *e); + +/* +( + Look for Node +) + +Look for a node by name sID from the Hashtable m_hIDtable of all registered +IDs. +*/ + +extern HTElement *HTRDF_lookforNode(HTRDF *me, char * sID); + +/* +( + If Element from RDF Schema? +) + +Check if the element e is from the namespace of the RDF schema by comparing +only the beginning of the expanded element name with the canonical RDFMS +URI +*/ + +extern BOOL HTRDF_isRDF(HTRDF *me, HTElement *ele); +extern BOOL HTRDF_isRDFroot(HTRDF *me, HTElement *ele); + +/* +( + Is the element a Description? +) +*/ + +extern BOOL HTRDF_isDescription(HTRDF *me, HTElement *ele); + +/* +( + Is the element a Predicate? +) + +This method matches all properties but those from RDF namespace +*/ + +extern BOOL HTRDF_isTypedPredicate(HTRDF *me, HTElement *e); + +/* +( + Is the element a Container? +) +*/ + +extern BOOL HTRDF_isContainer(HTRDF *me, HTElement *e); + +/* +( + Is the element a Bag? +) +*/ + +extern BOOL HTRDF_isBag(HTRDF *me, HTElement *e); + +/* +( + Is the element an Alternative? +) +*/ + +extern BOOL HTRDF_isAlternative(HTRDF *me, HTElement *e); + +/* +( + Is the element a Sequence? +) +*/ + +extern BOOL HTRDF_isSequence(HTRDF *me, HTElement *e); + +/* +( + Is the element a ListItem? +) +*/ + +extern BOOL HTRDF_isListItem (HTRDF *me, HTElement *e); + +/* +( + Start processing an RDF/XML document instance from the root element rdf. +) +*/ + +extern BOOL HTRDF_processRDF(HTRDF *me, HTElement *ele); + +/* + +processDescription manages Description elements + + + description + + The Description element itself + + inPredicate + + Is this is a nested description + + reificate + + Do we need to reificate + + createBag + + Do we create a bag container + + return + + An ID for the description + +*/ + +extern char * HTRDF_processDescription ( + HTRDF * me, + HTElement * description, + BOOL inPredicate, + BOOL reificate, + BOOL createBag); + +/* +( + Manage the typedNode production in the RDF grammar. +) +*/ + +extern char * HTRDF_processTypedNode(HTRDF *me, HTElement *e); + +/* +( + Special method to deal with rdf:resource attribute +) +*/ + +extern char * HTRDF_getResource(HTRDF *me,HTElement *e); + +/* +( + Create a new reification ID +) + +Using a name part and an incremental counter m_iReificationCounter. +*/ + +extern char * HTRDF_newReificationID (HTRDF *me); + +/* +( + Create a new triple +) + +and add it to the m_triples List +*/ + +extern void HTRDF_addTriple (HTRDF *me, char * sPredicate, char * sSubject, + char * sObject); + +/* +( + Create New Bag +) + +allows one to determine whether SiRPAC produces Bag instances for each +Description block. The default setting is not to generate them. +*/ + +extern void HTRDF_createBags (HTRDF *me, BOOL b); + +/* +( + Set Output Stream +) + +Set output stream for RDF parser +*/ + +extern void HTRDF_setOutputStream (HTRDF *me, HTStream *ostream); + +/* +. + RDF Converter Streams +. + +A set of converter streams using the +HTRDF Parser object +( + RDF To Triple Converter +) + +This stream converter converts an RDF stream to triples that are passed to +the application using the new triples callback +handler. The RDF object itself can be obtained using the +new RDF parser object callback +*/ + +extern HTConverter HTRDFParser_new; + +/* +( + Print RDF Triple Converter +) + +This stream converter converts an RDF stream to triples and sends them downstrem +as (predicate, subject, object). This can for example be used to +print them out to stdout etc. +*/ + +extern HTConverter HTRDFToTriples; + +/* + +( + Parse a file of RDF +) + +This function parses a file of RDF in a synchronous, non-blocking +way. In other words, the file is not asynchronously loaded. + +If new_triple_callback is NULL, the default triple handler is +invoked. The context pointer will be available in the triple +callback function. + +Returns YES if the file is successfully parsed; otherwise NO is +returned and an error message is logged. +*/ + +extern BOOL HTRDF_parseFile (const char *file_name, + HTTripleCallback_new * new_triple_callback, + void *context); + +/* +( + Parse a buffer of RDF +) + +This function parses a buffer of RDF in a synchronous, non-blocking way. + +If new_triple_callback is NULL, the default triple handler is +invoked. The context pointer will be available in the triple +callback function. + +Returns YES if the buffer is successfully parsed; otherwise NO is +returned and an error message is logged. +*/ + +extern BOOL HTRDF_parseBuffer (const char *buffer, + const char *buffer_name, + int buffer_len, + HTTripleCallback_new * new_triple_callback, + void *context); + +/* + +*/ + +#endif + +/* + + + + @(#) $Id: HTRDF.h,v 1.1.2.1 2002/09/13 00:23:46 stefanulrich Exp $ + +*/ + + + + + diff -Naur xdvik-22.40l/libs/libwww/HTReader.c xdvik-22.40n/libs/libwww/HTReader.c --- xdvik-22.40l/libs/libwww/HTReader.c Wed Apr 18 14:23:21 2001 +++ xdvik-22.40n/libs/libwww/HTReader.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTReader.c,v 1.1.1.1 2001/04/18 14:23:21 stefanulrich Exp $ +** @(#) $Id: HTReader.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** HISTORY: ** 6 June 95 HFN Written @@ -60,6 +60,7 @@ return HT_ERROR; } +#ifdef FIND_SIGNATURES /* Push data from a socket down a stream ** ------------------------------------- ** @@ -76,7 +77,7 @@ ** HT_WOULD_BLOCK if read or write would block ** HT_PAUSE if stream is paused */ -char * strnstr(char * haystack, int *pLen, char * needle) +PRIVATE char * strnstr(char * haystack, int *pLen, char * needle) { int found = 0; int need = strlen(needle); @@ -94,8 +95,7 @@ *pLen = 0; return NULL; } - -/* int DebugBufferSize = INPUT_BUFFER_SIZE; */ +#endif /* FIND_SIGNATURES */ PRIVATE int HTReader_read (HTInputStream * me) { @@ -105,12 +105,10 @@ HTRequest * request = HTNet_request(net); int status; if (!net->readStream) { - if (STREAM_TRACE) - HTTrace("Read Socket. No read stream for net object %p\n", net); + HTTRACE(STREAM_TRACE, "Read Socket. No read stream for net object %p\n" _ net); return HT_ERROR; } - /* me->b_read = me->read - me->data; */ /* Read from socket if we got rid of all the data previously read */ do { /* don't read if we have to push unwritten data from last call */ @@ -122,15 +120,15 @@ if (socerrno==EWOULDBLOCK) /* BSD */ #endif { - if (STREAM_TRACE) - HTTrace("Read Socket. WOULD BLOCK fd %d\n",soc); + HTTRACE(STREAM_TRACE, "Read Socket. WOULD BLOCK fd %d\n" _ soc); HTHost_register(host, net, HTEvent_READ); return HT_WOULD_BLOCK; #ifdef __svr4__ /* - ** In Solaris envirnoment, SIGPOLL is used to signal end of buffer for - ** /dev/audio. If your process is also doing a socket read, it will cause - ** an EINTR error. This error will cause the www library request to + ** In Solaris envirnoment, SIGPOLL is used to signal end + ** of buffer for /dev/audio. If your process is also doing + ** a socket read, it will cause an EINTR error. This + ** error will cause the www library request to ** terminate prematurly. */ } else if (socerrno == EINTR) { @@ -138,14 +136,33 @@ #endif /* __svr4__ */ #ifdef EPIPE } else if (socerrno == EPIPE) { - if (STREAM_TRACE) HTTrace("Read Socket. got EPIPE\n", soc); + HTTRACE(STREAM_TRACE, "Read Socket. got EPIPE\n" _ soc); goto socketClosed; #endif /* EPIPE */ #ifdef ECONNRESET } else if (socerrno == ECONNRESET) { - if (STREAM_TRACE) HTTrace("Read Socket. got ECONNRESET\n", soc); + HTTRACE(STREAM_TRACE, "Read Socket. got ECONNRESET\n" _ soc); goto socketClosed; #endif /* ECONNRESET */ +#ifdef _WINSOCKAPI_ /* windows */ + /* + ** JK: added new tests here, based on the following text: + ** Under BSD Unixes, if the remote peer closes its + ** connection and your program is blocking on recv(), you + ** will get a 0 back from recv(). Winsock behaves the same + ** way, except that it can also return -1, with + ** WSAGetLastError() returning WSAECONNRESET, + ** WSAECONNABORTED or WSAESHUTDOWN, to signal the + ** detectable flavors of abnormal disconnections. + ** (from the Winsock Programmer's FAQ, Warren Young) + */ + } else if (socerrno == ECONNABORTED) { + HTTRACE(STREAM_TRACE, "Read Socket. got ECONNABORTED\n" _ soc); + goto socketClosed; + } else if (socerrno == ESHUTDOWN) { + HTTRACE(STREAM_TRACE, "Read Socket. got ESHUTDOWN\n" _ soc); + goto socketClosed; +#endif /* _WINSOCKAPI */ } else { /* We have a real error */ if (request) @@ -156,15 +173,14 @@ } else if (!me->b_read) { socketClosed: - if (STREAM_TRACE) - HTTrace("Read Socket. FIN received on socket %d\n", soc); + HTTRACE(STREAM_TRACE, "Read Socket. FIN received on socket %d\n" _ soc); HTHost_unregister(host, net, HTEvent_READ); HTHost_register(host, net, HTEvent_CLOSE); return HT_CLOSED; } /* Remember how much we have read from the input socket */ - HTTraceData(me->data, me->b_read, "Reading from socket %d", soc); + HTTRACEDATA(me->data, me->b_read, "Reading from socket %d" _ soc); me->write = me->data; me->read = me->data + me->b_read; #ifdef FIND_SIGNATURES @@ -172,8 +188,7 @@ char * ptr = me->data; int len = me->b_read; while ((ptr = strnstr(ptr, &len, "HTTP/1.1 200 OK")) != NULL) { - if (STREAM_TRACE) - HTTrace("Read Socket. Signature found at 0x%x of 0x%x.\n", ptr - me->data, me->b_read); + HTTRACE(STREAM_TRACE, "Read Socket. Signature found at 0x%x of 0x%x.\n" _ ptr - me->data _ me->b_read); ptr++; len--; } @@ -189,9 +204,8 @@ } #endif /* NOT_ASCII */ - if (STREAM_TRACE) - HTTrace("Read Socket. %d bytes read from socket %d\n", - me->b_read, soc); + HTTRACE(STREAM_TRACE, "Read Socket. %d bytes read from socket %d\n" _ + me->b_read _ soc); if (request) { HTAlertCallback * cbf = HTAlert_find(HT_PROG_READ); if (HTNet_rawBytesCount(net)) @@ -207,24 +221,23 @@ if ((status = (*net->readStream->isa->put_block) (net->readStream, me->write, me->b_read)) != HT_OK) { if (status == HT_WOULD_BLOCK) { - if (STREAM_TRACE) HTTrace("Read Socket. Target WOULD BLOCK\n"); + HTTRACE(STREAM_TRACE, "Read Socket. Target WOULD BLOCK\n"); HTHost_unregister(host, net, HTEvent_READ); return HT_WOULD_BLOCK; } else if (status == HT_PAUSE) { - if (STREAM_TRACE) HTTrace("Read Socket. Target PAUSED\n"); + HTTRACE(STREAM_TRACE, "Read Socket. Target PAUSED\n"); HTHost_unregister(host, net, HTEvent_READ); return HT_PAUSE; /* CONTINUE code or stream code means data was consumed */ } else if (status == HT_CONTINUE || status > 0) { if (status == HT_CONTINUE) { - if (STREAM_TRACE) HTTrace("Read Socket. CONTINUE\n"); + HTTRACE(STREAM_TRACE, "Read Socket. CONTINUE\n"); } else - if (STREAM_TRACE) - HTTrace("Read Socket. Target returns %d\n", status); + HTTRACE(STREAM_TRACE, "Read Socket. Target returns %d\n" _ status); /* me->write = me->read; */ return status; } else { /* We have a real error */ - if (STREAM_TRACE) HTTrace("Read Socket. Target ERROR %d\n", status); + HTTRACE(STREAM_TRACE, "Read Socket. Target ERROR %d\n" _ status); return status; } } @@ -232,9 +245,8 @@ { int remaining = HTHost_remainingRead(host); if (remaining > 0) { - if (STREAM_TRACE) - HTTrace("Read Socket. DIDN'T CONSUME %d BYTES: `%s\'\n", - remaining, me->read); + HTTRACE(STREAM_TRACE, "Read Socket. DIDN'T CONSUME %d BYTES: `%s\'\n" _ + remaining _ me->read); HTHost_setConsumed(host, remaining); } } @@ -258,7 +270,7 @@ return HT_WOULD_BLOCK; net->readStream = NULL; } - if (STREAM_TRACE) HTTrace("Socket read. FREEING....\n"); + HTTRACE(STREAM_TRACE, "Socket read. FREEING....\n"); HT_FREE(me); return status; } @@ -299,7 +311,7 @@ me->isa = &HTReader; me->ch = ch; me->host = host; - if (STREAM_TRACE) HTTrace("Reader...... Created reader stream %p\n", me); + HTTRACE(STREAM_TRACE, "Reader...... Created reader stream %p\n" _ me); } return me; } diff -Naur xdvik-22.40l/libs/libwww/HTReader.h xdvik-22.40n/libs/libwww/HTReader.h --- xdvik-22.40l/libs/libwww/HTReader.h Wed Apr 18 14:23:21 2001 +++ xdvik-22.40n/libs/libwww/HTReader.h Fri Sep 13 00:23:46 2002 @@ -68,6 +68,6 @@ - @(#) $Id: HTReader.h,v 1.1.1.1 2001/04/18 14:23:21 stefanulrich Exp $ + @(#) $Id: HTReader.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTReq.h xdvik-22.40n/libs/libwww/HTReq.h --- xdvik-22.40l/libs/libwww/HTReq.h Wed Apr 18 14:23:21 2001 +++ xdvik-22.40n/libs/libwww/HTReq.h Fri Sep 13 00:23:46 2002 @@ -78,43 +78,6 @@ /* . - Issuing a Request -. - -These are the "basic request methods" provided directly by the Request -class. This is a very low level API as the caller must have set up the request -object before passing it to libwww. There are two versions: one for issuing -client requests and one for issuing server requests. You will probably most -often use the client version but libwww can in fact also deal with incoming -connections. You can find many higher level issuing functions in the -HTAccess module. If you like, you can of course -use this directly! -*/ - -extern BOOL HTLoad (HTRequest * request, BOOL recursive); -extern BOOL HTServe(HTRequest * request, BOOL recursive); - -/* -. - Killing a Request -. - -This function kills this particular request, see HTNet -module for a function that kills them all. If you know that you are -pipelining requests (typically the case for GUI browsers, robots etc.) then -it is often not enough to just kill a single request as the whole pipeline -gets affected. Therefore, in that case you MUST call the -HTHost_killPipe function instead, -*/ - -extern BOOL HTRequest_kill(HTRequest * request); - -/* - -Note that you can get to the HTHost object via the HTNet -object which you can get by calling -HTRequest_net(...). -. Creation and Deletion Methods . @@ -140,7 +103,7 @@ ) Clears all protocol specific information so that the request object can be -used for another request. It should be use with care as application specific +used for another request. It should be used with care as application specific information is not re-initialized. Returns YES if OK, else NO. */ @@ -170,6 +133,9 @@ extern HTRequest * HTRequest_dupInternal (HTRequest * src); +extern BOOL HTRequest_setInternal (HTRequest * request, BOOL mode); +extern BOOL HTRequest_internal (HTRequest * request); + /* ( Delete Object @@ -182,17 +148,110 @@ /* . - Date and Time Stamp when Request was Issued + Issuing a Request . -The start time when the request was issued may be of value to the cache -validation mechanism as described by the HTTP/1.1 specification. The value -is automatically set when creating the request headers and sending off the -request. The time is a local time. +These are the "basic request methods" provided directly by the Request +class. This is a very low level API as the caller must have set up the request +object before passing it to libwww. There are two versions: one for issuing +client requests and one for issuing server requests. You will probably most +often use the client version, but, in fact, libwww can also deal with incoming +connections. You can find many higher level issuing functions in the +HTAccess module. If you like, you can of course +use this directly! */ -extern time_t HTRequest_date (HTRequest * request); -extern BOOL HTRequest_setDate (HTRequest * request, time_t date); +extern BOOL HTLoad (HTRequest * request, BOOL recursive); +extern BOOL HTServe(HTRequest * request, BOOL recursive); + +/* +. + Killing a Request +. + +This function kills this particular request, see HTNet +module for a function that kills them all. If you know that you are +pipelining requests (typically the case for GUI browsers, robots etc.) then +it is often not enough to just kill a single request as the whole pipeline +gets affected. Therefore, in that case you MUST call the +HTHost_killPipe function instead, +*/ + +extern BOOL HTRequest_kill(HTRequest * request); + +/* + +Note that you can get to the HTHost object via the HTNet +object which you can get by calling +HTRequest_net(...). +. + Relations to Other Libwww Objects +. + +The Request object is linked to a set of other libwww objects - here's how +to get to these objects... +( + Binding to an Anchor Object +) + +Every request object has an anchor associated +with it. The anchor normally lives until the application terminates but a +request object only lives as long as the request is being serviced. If the +anchor that we have requested is a child anchor then we always load +the parent anchor; after the load jump to the location. A child anchor +is a an anchor which points to a subpart of the document (has a "#" in the +URL). +*/ + +extern void HTRequest_setAnchor (HTRequest *request, HTAnchor *anchor); +extern HTParentAnchor * HTRequest_anchor (HTRequest *request); + +extern HTChildAnchor * HTRequest_childAnchor (HTRequest * request); + +/* +( + Binding to a User Profile +) + +Each request is associated with a User profile +which contains information about the local host name, email address of the +user, news server etc. A request object is created with a default "generic +user" but can be assigned a specific user at any time. +*/ + +extern BOOL HTRequest_setUserProfile (HTRequest * request, HTUserProfile * up); +extern HTUserProfile * HTRequest_userProfile (HTRequest * request); + +/* +( + Binding to a Net Object +) + +If a request is actually going on the net then the Net +Manager is contacted to handle the request. The Net manager creates a +HTNEt object and links it to the Request object. You can get to the HTNet +object using the following functions. +*/ + +extern HTNet * HTRequest_net (HTRequest * request); +extern BOOL HTRequest_setNet (HTRequest * request, HTNet * net); + +/* + +Note that you can go from the HTNet object to the +HTHost object by calling HTNet_host(...). +( + Binding to a Response Object +) + +If a request is actually going on the net and we are getting a response back +then we also create a HTResponse object and +bind it to the request object. Once we know what to do with the response, +we may transfer the information to the anchor object. +*/ + +extern HTResponse * HTRequest_response (HTRequest * request); +extern BOOL HTRequest_setResponse (HTRequest * request, HTResponse * response); /* . @@ -221,9 +280,10 @@ . The request can be assigned an initial priority which then gets inherited -by all HTNet objects and other requests objects created as a result of this -one. You can also assign a separate priority to an indicidual HTNet object -by using the methods in the Net manager. +by all HTNet objects and other requests objects +created as a result of this one. You can also assign a separate priority +to an indicidual HTNet object by using the methods in the +Net manager. */ extern HTPriority HTRequest_priority (HTRequest * request); @@ -246,58 +306,26 @@ extern BOOL HTRequest_flush (HTRequest * me); /* -. - Binding to a User Profile -. - -Each request is associated with a User profile -which contains information about the local host name, email address of the -user, news server etc. A request object is created with a default "generic -user" but can be assigned a specific user at any time. -*/ - -extern BOOL HTRequest_setUserProfile (HTRequest * request, HTUserProfile * up); -extern HTUserProfile * HTRequest_userProfile (HTRequest * request); - -/* -. - Binding to a Net Object -. - -If a request is actually going on the net then the Net -Manager is contacted to handle the request. The Net manager creates a -HTNEt object and links it to the Request object. You can get to the HTNet -object using the following functions. -*/ - -extern HTNet * HTRequest_net (HTRequest * request); -extern BOOL HTRequest_setNet (HTRequest * request, HTNet * net); - -/* - -Note that you can go from the HTNet object to the -HTHost object by calling HTNet_host(...). -. - Binding to a Response Object -. +( + Force the Pipeline to be Flushed Immediately +) -If a request is actually going on the net and we are getting a response back -then we also create a HTResponse object and bind it to the request object. -Once we know what to do with the response, we may transfer the information -to the anchor object. +Forcing a fluch immediatly is slightly different as this can be done in +"retrospect". That is, if suddenly the application decides on performing +a flush after the request was initiated then it can use this function to +flush at a later time. */ -extern HTResponse * HTRequest_response (HTRequest * request); -extern BOOL HTRequest_setResponse (HTRequest * request, HTResponse * response); +extern int HTRequest_forceFlush (HTRequest * request); /* . - Error Object + Dealing with Request Error Messages . -Errors are like almost anything kept in lists and a error list can be associated -with a request using the following functions. In order to make life easier, -there are also some easy mapping functions to the +Errors are, like almost anything, kept in lists. An error list can be +associated with a request using the following functions. In order to make +life easier, there are also some easy mapping functions to the HTError object, so that you can add an error directly to a request object. */ @@ -376,12 +404,12 @@ Preemptive or Non-preemptive Access . -A access scheme is defined with a default for using either preemptive (blocking -I/O) or non-premitve (non-blocking I/O). This is basically a result of the +An access scheme is defined with a default for using either preemptive (blocking +I/O) or non-preemptive (non-blocking I/O). This is basically a result of the implementation of the protocol module itself. However, if non-blocking I/O is the default then some times it is nice to be able to set the mode to blocking -instead. For example when loading the first document (the home page) then -blocking can be used instead of non-blocking. +instead. For example, when loading the first document (the home page), +blocking mode can be used instead of non-blocking. */ extern void HTRequest_setPreemptive (HTRequest *request, BOOL mode); @@ -404,7 +432,7 @@ /* . - Request Preconditions + Request Preconditions (HTTP If-* Headers) . Should this request use preconditions when doing a PUT or a @@ -427,12 +455,29 @@ /* . - Handling Metainformation (RFC822 Headers) + Local MIME header Parsers +. + +MIMEParsers get their own type which is optimized for static and regex parser +strings. +*/ + +typedef struct _HTMIMEParseSet HTMIMEParseSet; +extern void HTRequest_setMIMEParseSet (HTRequest *request, + HTMIMEParseSet * parseSet, BOOL local); +extern HTMIMEParseSet * HTRequest_MIMEParseSet (HTRequest *request, + BOOL * pLocal); + +/* +. + Which Default Protocol Header Fields To Use? . -The Library supports a large set of headers that can be sent along with a -request (or a response for that matter). All headers can be either disabled -or enabled using bit flags that are defined in the following. +Libwww supports a large set of headers that can be sent along with a request +(or a response for that matter). All headers can be either disabled or enabled +using bit flags that are defined in the following. See also the +section on how to extend the default set of supported header +fields. ( General HTTP Header Mask ) @@ -452,11 +497,13 @@ HT_G_MESSAGE_ID = 0x20, HT_G_MIME = 0x40, HT_G_TRAILER = 0x80, - HT_G_TRANSFER = 0x100 + HT_G_TRANSFER = 0x100, + HT_G_EXTRA_HEADERS = 0x200 } HTGnHd; #define DEFAULT_GENERAL_HEADERS \ - HT_G_CONNECTION + HT_G_CC + HT_G_TRANSFER + HT_G_TRAILER + HT_G_CONNECTION + HT_G_CC + HT_G_TRANSFER + HT_G_TRAILER + \ + HT_G_EXTRA_HEADERS extern void HTRequest_setGnHd (HTRequest *request, HTGnHd gnhd); extern void HTRequest_addGnHd (HTRequest *request, HTGnHd gnhd); @@ -567,7 +614,7 @@ HT_E_VERSION = 0x20000 } HTEnHd; -#define DEFAULT_ENTITY_HEADERS 0xFFFF /* all */ +#define DEFAULT_ENTITY_HEADERS 0xFFFFFFFF /* all */ extern void HTRequest_setEnHd (HTRequest *request, HTEnHd enhd); extern void HTRequest_addEnHd (HTRequest *request, HTEnHd enhd); @@ -575,22 +622,67 @@ /* . - Local MIME header Parsers + Extending The Default Set Of Header Fields . -MIMEParsers get their own type which is optimized for static and regex parser -strings. +See also how to set up default header fields. There +are three ways to extend the set of headers that are sent in a request: + + o + A simple association list + o + A stream oriented approach where the stream (called + a generator) has direct access to the outgoing stream. That is, it can + add any header it likes. + o + HTTP extension mechanism which + is a much better way for handling extensions. + +( + 1) Simple Association List +) + +Add the (name, value) and it will be converted into MIME header format as +name: value. Do NOT add CRLF line termination - this is done by +the HTTP header generator stream */ -typedef struct _HTMIMEParseSet HTMIMEParseSet; -extern void HTRequest_setMIMEParseSet (HTRequest *request, - HTMIMEParseSet * parseSet, BOOL local); -extern HTMIMEParseSet * HTRequest_MIMEParseSet (HTRequest *request, - BOOL * pLocal); +extern BOOL HTRequest_addExtraHeader (HTRequest * request, + char * token, char * value); +extern HTAssocList * HTRequest_extraHeader (HTRequest * request); +extern BOOL HTRequest_deleteExtraHeaderAll (HTRequest * request); + +/* +( + 2) Stream Oriented Header Generators +) + +Extra header information can be send along with a request using +header generators. The text is sent as is so +it must be preformatted with CRLF line terminators. You can also +register MIME header parsers using the HTHeader +module. +*/ + +extern void HTRequest_setGenerator (HTRequest *request, HTList *gens, + BOOL override); +extern HTList * HTRequest_generator (HTRequest *request, BOOL *override); + +/* +( + 3) HTTP Extension Framework +) + +These association lists contain the information that we are to send as HTTP +Extension Framework. This is not done yet but you can find some hints in +the PEP module +*/ + +/* TBD */ /* . - Accept Headers + User And Application Preferences Using Accept Headers . The Accept family of headers is an important part of HTTP handling the format @@ -671,7 +763,7 @@ The Library has two concepts of caching: in memory and on file. When loading a document, this flag can be set in order to define who can give a response -to the request. The mempory buffer is considered to be equivalent to a history +to the request. The memory buffer is considered to be equivalent to a history buffer. That is, it doesn't not follow the same expiration mechanism that is characteristic for a persistent file cache. @@ -693,6 +785,23 @@ extern HTReload HTRequest_reloadMode (HTRequest *request); /* +. + Default PUT name +. + +When publishing to a server which doesn't accept a URL ending in "/", e.g, +the default Overview, index page, you can use +HTRequest_setAltPutName to setup the intended URL. If this +variable is defined, it'll be used during the cache lookup and update +operationsm, so that cache-wise, it will look as if we had published +only to "/". +*/ + +extern char * HTRequest_defaultPutName (HTRequest * me); +extern BOOL HTRequest_setDefaultPutName (HTRequest * me, char * name); +extern BOOL HTRequest_deleteDefaultPutName (HTRequest * me); + +/* ( HTTP Cache Control Directives ) @@ -710,9 +819,23 @@ extern HTAssocList * HTRequest_cacheControl (HTRequest * request); /* -( +. + Date and Time Stamp when Request was Issued +. + +The start time when the request was issued may be of value to the cache +validation mechanism as described by the HTTP/1.1 specification. The value +is automatically set when creating the request headers and sending off the +request. The time is a local time. +*/ + +extern time_t HTRequest_date (HTRequest * request); +extern BOOL HTRequest_setDate (HTRequest * request, time_t date); + +/* +. HTTP Expect Directives -) +. The Expect request-header field is used to indicate that particular server behaviors are required by the client. A server that does not understand or @@ -726,9 +849,9 @@ extern HTAssocList * HTRequest_expect (HTRequest * me); /* -( +. Partial Requests and Range Retrievals -) +. Libwww can issue range requests in case we have already obtained a part of the entity body. Since all HTTP entities are represented in HTTP messages @@ -793,57 +916,6 @@ /* . - HTTP Extensions (PEP) -. - -HTTP can be extended in several ways but traditionally it has been by using -new headers. Here we present a new idea which provides a framework for describing -extensions and their scope. This is only an idea an may be modified later! -The implementation of the extensions can be found in the -PEP module -( - Protocol -) - -This association list is a list of the extension directives that are to be -sent as part of the request. -*/ - -extern BOOL HTRequest_addProtocol (HTRequest * request, - char * token, char * value); -extern BOOL HTRequest_deleteProtocolAll (HTRequest * request); -extern HTAssocList * HTRequest_Protocol (HTRequest * request); - -/* -( - Protocol Info -) - -This association list is a list of the extension directives that are to be -sent as part of the request. -*/ - -extern BOOL HTRequest_addProtocolInfo (HTRequest * request, - char * token, char * value); -extern BOOL HTRequest_deleteProtocolInfoAll (HTRequest * request); -extern HTAssocList * HTRequest_ProtocolInfo (HTRequest * request); - -/* -( - Protocol Request -) - -This association list is a list of the extension directives that are to be -sent as part of the request. -*/ - -extern BOOL HTRequest_addProtocolRequest (HTRequest * request, - char * token, char * value); -extern BOOL HTRequest_deleteProtocolRequestAll (HTRequest * request); -extern HTAssocList * HTRequest_ProtocolRequest (HTRequest * request); - -/* -. HTTP Referer Field . @@ -857,23 +929,7 @@ /* . - Extra Headers -. - -Extra header information can be send along with a request using this variable. -The text is sent as is so it must be preformatted with - line terminators. This will get changed at some -point so that you can register a header together with a handler in the MIME -parser. -*/ - -extern void HTRequest_setGenerator (HTRequest *request, HTList *gens, - BOOL override); -extern HTList * HTRequest_generator (HTRequest *request, BOOL *override); - -/* -. - BEFORE and AFTER Filters + Local BEFORE and AFTER Filters . The request object may have it's own before and after @@ -954,7 +1010,7 @@ /* . - Sending data to the Network + Sending data from App to Network . Multiple Request objects can be connected in order to create a @@ -1013,7 +1069,7 @@ /* ( - Is This Request part of a Post Web? + Is This Request part of a Post Web? (Deprecated) ) Check to see if this request object is part of a Post Web. @@ -1051,19 +1107,12 @@ /* ( - Has Output Stream been Connected to Channel? + Default Output Stream Format ) -Has output stream been connected to the channel? If not then we must free -it explicitly when deleting the request object -*/ -extern void HTRequest_setOutputConnected (HTRequest * request, BOOL mode); -extern BOOL HTRequest_outputConnected (HTRequest * request); - -/* - -The desired format of the output stream. This can be used to get unconverted -data etc. from the library. If NULL, then +The desired format of the output stream. This is used in the +stream stack builder to determine which stream +to plug in to deal with the data. If NULL, then WWW_PRESENT is default value. */ @@ -1072,7 +1121,18 @@ /* ( - Debug Stream + Has Output Stream been Connected to Channel? (Deprecated) +) + +Has output stream been connected to the channel? If not then we must free +it explicitly when deleting the request object +*/ +extern void HTRequest_setOutputConnected (HTRequest * request, BOOL mode); +extern BOOL HTRequest_outputConnected (HTRequest * request); + +/* +( + Default Debug Stream ) All object bodies sent from the server with status codes different from @@ -1086,6 +1146,9 @@ extern HTStream *HTRequest_debugStream (HTRequest *request); /* +( + Default Debug Stream Format +) The desired format of the error stream. This can be used to get unconverted data etc. from the library. The default value if WWW_HTML as @@ -1123,24 +1186,6 @@ /* . - Binding to an Anchor Object -. - -Every request object has an anchor associated -with it. The anchor normally lives until the application terminates but a -request object only lives as long as the request is being serviced. If the -anchor that we have requested is infact a child anchor then we always load -the parent anchor and then after the load jump to the location. A child anchor -is a an anchor which points to a subpart of the document (has a "#" in the -URL). -*/ -extern void HTRequest_setAnchor (HTRequest *request, HTAnchor *anchor); -extern HTParentAnchor * HTRequest_anchor (HTRequest *request); - -extern HTChildAnchor * HTRequest_childAnchor (HTRequest * request); - -/* -. Should we Issue a full HTTP Request-URI? . @@ -1154,14 +1199,15 @@ /* . - Proxy URL + Handling Proxies . In case we are using a proxy for this requst then we can register it together with the request object. That way we can find the proxy and look for authentication information, for example in the Authentication filter. The string is freed by -the Request object on deletion. +the Request object on deletion. This is normally handled automatically by +the proxy and gateway module */ extern BOOL HTRequest_setProxy (HTRequest * request, const char * proxy); @@ -1170,7 +1216,49 @@ /* . - Enity Bytes Read or Written in a Request +Message Body Manipulation +. + +An application may use these functions to set and manipulate the request +message body. This message body is specially indicate for methods that use +small XML message bodies. Once the application defines it, this message body +will be send just after the headers. It does not use +"Expect: 100-continue" header, and the application +should not try to use both. It's important to remark that +"Expect: 100-continue" header is a very importante feature defined in HTTP. +It's prevents that, for example, the server must read many unnecessary bytes +from request body. Using "Expect: 100-continue" header, your application +safes time and network (see +RFC2616, section 8.2.3). +Please, if possible, use always HTRequest Entity and entity callback, leave +this only for small XML bodies in extension methods (see +HTMethod), and when using it, be very +careful! + +When using a message body, the application may define its length and +format. If the message body is set and its length is also set and it greater +than 0, a Content-Lenght header will be added to the request. Similarly, if +the message body and its type are set, a Content-Type header will be added +to the request too. Otherwise, those headers will not be included. + +Note: The caller should free the string returned by +HTRequest_messageBody function! +*/ + +extern BOOL HTRequest_setMessageBody (HTRequest * request, const char * body); +extern BOOL HTRequest_deleteMessageBody (HTRequest * request); +extern char * HTRequest_messageBody (HTRequest * request); + +extern BOOL HTRequest_setMessageBodyLength (HTRequest * request, long int length); +extern long int HTRequest_messageBodyLength (HTRequest * request); + +extern BOOL HTRequest_setMessageBodyFormat (HTRequest * request, HTFormat format); +extern HTFormat HTRequest_messageBodyFormat (HTRequest * request); + +/* + +. + Bytes Read or Written in a Request . This function returns the bytes read in the current request. For a deeper @@ -1192,20 +1280,6 @@ extern long HTRequest_bytesWritten (HTRequest * request); /* -. - Internal Request Objects -. - -The library may under certain circumstances create its own Request objects. -These are all handled internal and does not show up on the application side -at all. -*/ - -extern BOOL HTRequest_setInternal (HTRequest * request, BOOL mode); -extern BOOL HTRequest_internal (HTRequest * request); -extern int HTRequest_forceFlush (HTRequest * request); - -/* */ #endif /* HTREQ_H */ @@ -1214,6 +1288,6 @@ - @(#) $Id: HTReq.h,v 1.1.1.1 2001/04/18 14:23:21 stefanulrich Exp $ + @(#) $Id: HTReq.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTReqMan.c xdvik-22.40n/libs/libwww/HTReqMan.c --- xdvik-22.40l/libs/libwww/HTReqMan.c Wed Apr 18 14:23:21 2001 +++ xdvik-22.40n/libs/libwww/HTReqMan.c Fri Sep 13 00:23:46 2002 @@ -3,13 +3,15 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTReqMan.c,v 1.1.1.1 2001/04/18 14:23:21 stefanulrich Exp $ +** @(#) $Id: HTReqMan.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Authors ** TBL Tim Berners-Lee timbl@w3.org ** JFG Jean-Francois Groff jfg@dxcern.cern.ch ** DD Denis DeLaRoca (310) 825-4580 ** HFN Henrik Frystyk, frystyk@w3.org +** Contribution +** MKP Manuele Kirsch, Manuele.Kirsch_Pinheiro@inrialpes.fr or manuele@inf.ufrgs.br ** History ** 8 Jun 92 Telnet hopping prohibited as telnet is not secure TBL ** 26 Jun 92 When over DECnet, suppressed FTP, Gopher and News. JFG @@ -22,6 +24,7 @@ ** 09 May 94 logfile renamed to HTlogfile to avoid clash with WAIS ** 8 Jul 94 Insulate free() from _free structure element. ** 02 Sep 95 Rewritten and spawned from HTAccess.c, HFN +** 14 Fev 02 Message body added to HTRequest */ #if !defined(HT_DIRECT_WAIS) && !defined(HT_DEFAULT_WAIS_GATEWAY) @@ -32,6 +35,7 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "HTParse.h" +#include "HTNoFree.h" #include "HTAlert.h" #include "HTError.h" #include "HTNetMan.h" @@ -65,6 +69,9 @@ /* Force Reload */ me->reload = HT_CACHE_OK; + /* no default PUT name */ + me->default_put_name = NULL; + /* Set the default user profile */ me->userprofile = HTLib_userProfile(); @@ -87,7 +94,15 @@ /* Content negotiation */ me->ContentNegotiation = YES; /* Do this by default */ - if (CORE_TRACE) HTTrace("Request..... Created %p\n", me); +#ifdef HT_EXT + /* Message Body */ + me->messageBody = NULL; /* MKP: default value is NULL - no message body set */ + me->messageBodyLength = -1; /* MKP: default value is -1 */ + me->messageBodyFormat = NULL; /* MKP: default value is NULL */ +#endif + + + HTTRACE(CORE_TRACE, "Request..... Created %p\n" _ me); return me; } @@ -106,10 +121,20 @@ me->realm = NULL; me->credentials = NULL; me->connected = NO; + if (me->default_put_name) + HTRequest_deleteDefaultPutName (me); if (me->response) { HTResponse_delete(me->response); me->response = NULL; } + +#ifdef HT_EXT + if (me->messageBody) /* MKP: clear message body */ + HTRequest_deleteMessageBody(me); + me->messageBodyFormat = NULL; + me->messageBodyLength = -1; +#endif + return YES; } return NO; @@ -127,7 +152,7 @@ if ((me = (HTRequest *) HT_MALLOC(sizeof(HTRequest))) == NULL) HT_OUTOFMEM("HTRequest_dup"); memcpy(me, src, sizeof(HTRequest)); - if (CORE_TRACE) HTTrace("Request..... Duplicated %p to %p\n", src, me); + HTTRACE(CORE_TRACE, "Request..... Duplicated %p to %p\n" _ src _ me); return me; } @@ -153,17 +178,36 @@ PUBLIC void HTRequest_delete (HTRequest * me) { if (me) { - if (CORE_TRACE) HTTrace("Request..... Delete %p\n", me); + HTTRACE(CORE_TRACE, "Request..... Delete %p\n" _ me); if (me->net) HTNet_setRequest(me->net, NULL); + /* + ** Make sure we don't delete the same stream twice, when the output + ** stream and the debug stream are the same. + */ + if (me->orig_output_stream == me->orig_debug_stream) + { + me->orig_debug_stream = NULL; + } + /* Should we delete the output stream? */ - if (!me->connected && me->output_stream) { - if (CORE_TRACE) - HTTrace("Request..... Deleting dangling output stream\n"); - (*me->output_stream->isa->_free)(me->output_stream); + if (me->orig_output_stream) { + HTTRACE(CORE_TRACE, "Request..... Deleting dangling output stream\n"); + (*me->orig_output_stream->isa->_free)(me->orig_output_stream); + me->orig_output_stream = NULL; + HTNoFreeStream_delete(me->output_stream); me->output_stream = NULL; } + /* Should we delete the debug stream? */ + if (me->orig_debug_stream) { + HTTRACE(CORE_TRACE, "Request..... Deleting dangling debug stream\n"); + (*me->orig_debug_stream->isa->_free)(me->orig_debug_stream); + me->orig_debug_stream = NULL; + HTNoFreeStream_delete(me->debug_stream); + me->debug_stream = NULL; + } + /* Clean up the error stack */ if (me->error_stack) HTError_deleteAll(me->error_stack); @@ -171,6 +215,10 @@ if (me->afters) HTNetCall_deleteAfterAll(me->afters); if (me->befores) HTNetCall_deleteBeforeAll(me->befores); + /* default PUT name */ + if (me->default_put_name) + HTRequest_deleteDefaultPutName (me); + /* Access Authentication */ HT_FREE(me->realm); if (me->credentials) HTAssocList_delete(me->credentials); @@ -191,14 +239,22 @@ /* Proxy information */ HT_FREE(me->proxy); - /* PEP Information */ - if (me->protocol) HTAssocList_delete(me->protocol); - if (me->protocol_request) HTAssocList_delete(me->protocol_request); - if (me->protocol_info) HTAssocList_delete(me->protocol_info); + /* Extra header fields */ + if (me->extra_headers) HTAssocList_delete(me->extra_headers); + + /* HTTP Extension Information */ + if (me->optional) HTAssocList_delete(me->optional); + if (me->mandatory) HTAssocList_delete(me->mandatory); /* Any response object */ if (me->response) HTResponse_delete(me->response); +#ifdef HT_EXT + if (me->messageBody) HTRequest_deleteMessageBody(me); /* MKP: clear message body*/ + me->messageBodyFormat = NULL; + me->messageBodyLength = -1; +#endif + HT_FREE(me); } } @@ -349,6 +405,7 @@ PUBLIC BOOL HTRequest_setResponse (HTRequest * me, HTResponse * response) { if (me) { + if (me->response) HTResponse_delete(me->response); me->response = response; return YES; } @@ -753,6 +810,39 @@ return me ? me->reload : HT_CACHE_OK; } +/* Default name to use when publishing to a "/" URL +** ---------------------------- +*/ +PUBLIC char * HTRequest_defaultPutName (HTRequest * me) +{ + if (me) + return (me->default_put_name); + return NULL; +} + + +PUBLIC BOOL HTRequest_setDefaultPutName (HTRequest * me, char * name) +{ + if (me && name) { + if (me->default_put_name) + HTRequest_deleteDefaultPutName (me); + StrAllocCopy (me->default_put_name, name); + return YES; + } + return NO; +} + +PUBLIC BOOL HTRequest_deleteDefaultPutName (HTRequest * me) +{ + if (me && me->default_put_name) { + HT_FREE (me->default_put_name); + me->default_put_name = NULL; + return YES; + } + return NO; +} + + /* ** Cache control directives. The cache control can be initiated by both ** the server and the client which is the reason for keeping two lists @@ -813,7 +903,7 @@ } /* -** Connection directives. The connection directies can be initiated by +** Connection directives. The connection directives can be initiated by ** both the server and the client which is the reason for keeping two ** lists */ @@ -925,87 +1015,84 @@ } /* -** PEP Protocol header +** New header fields as association list */ -PUBLIC BOOL HTRequest_addProtocol (HTRequest * me, - char * token, char * value) +PUBLIC BOOL HTRequest_addExtraHeader (HTRequest * me, + char * token, char * value) { - if (me) { - if (!me->protocol) me->protocol = HTAssocList_new(); - return HTAssocList_addObject(me->protocol, token,value); + if (me && token) { + if (!me->extra_headers) me->extra_headers = HTAssocList_new(); + return HTAssocList_addObject(me->extra_headers, token, value); } return NO; } -PUBLIC BOOL HTRequest_deleteProtocolAll (HTRequest * me) +PUBLIC HTAssocList * HTRequest_extraHeader (HTRequest * me) { - if (me && me->protocol) { - HTAssocList_delete(me->protocol); - me->protocol = NULL; - return YES; - } - return NO; + return (me ? me->extra_headers : NULL); } -PUBLIC HTAssocList * HTRequest_protocol (HTRequest * me) +PUBLIC BOOL HTRequest_deleteExtraHeaderAll (HTRequest * me) { - return (me ? me->protocol : NULL); + if (me && me->extra_headers) { + HTAssocList_delete(me->extra_headers); + me->extra_headers = NULL; + return YES; + } + return NO; } /* -** PEP Protocol Info header +** HTTP Extension Framework */ -PUBLIC BOOL HTRequest_addProtocolInfo (HTRequest * me, - char * token, char * value) +PUBLIC BOOL HTRequest_addOptional (HTRequest * me, + char * token, char * value) { if (me) { - if (!me->protocol_info) me->protocol_info = HTAssocList_new(); - return HTAssocList_addObject(me->protocol_info, token,value); + if (!me->optional) me->optional = HTAssocList_new(); + return HTAssocList_addObject(me->optional, token,value); } return NO; } -PUBLIC BOOL HTRequest_deleteProtocolInfoAll (HTRequest * me) +PUBLIC HTAssocList * HTRequest_optional (HTRequest * me) { - if (me && me->protocol_info) { - HTAssocList_delete(me->protocol_info); - me->protocol_info = NULL; - return YES; - } - return NO; + return (me ? me->optional : NULL); } -PUBLIC HTAssocList * HTRequest_protocolInfo (HTRequest * me) +PUBLIC BOOL HTRequest_deleteOptionalAll (HTRequest * me) { - return (me ? me->protocol_info : NULL); + if (me && me->optional) { + HTAssocList_delete(me->optional); + me->optional = NULL; + return YES; + } + return NO; } -/* -** PEP Protocol request header -*/ -PUBLIC BOOL HTRequest_addProtocolRequest (HTRequest * me, - char * token, char * value) +PUBLIC BOOL HTRequest_addMandatory (HTRequest * me, + char * token, char * value) { if (me) { - if (!me->protocol_request) me->protocol_request = HTAssocList_new(); - return HTAssocList_addObject(me->protocol_request, token,value); + if (!me->mandatory) me->mandatory = HTAssocList_new(); + return HTAssocList_addObject(me->mandatory, token,value); } return NO; } -PUBLIC BOOL HTRequest_deleteProtocolRequestAll (HTRequest * me) +PUBLIC HTAssocList * HTRequest_mandatory (HTRequest * me) { - if (me && me->protocol_request) { - HTAssocList_delete(me->protocol_request); - me->protocol_request = NULL; - return YES; - } - return NO; + return (me ? me->mandatory : NULL); } -PUBLIC HTAssocList * HTRequest_protocolRequest (HTRequest * me) +PUBLIC BOOL HTRequest_deleteMandatoryAll (HTRequest * me) { - return (me ? me->protocol_request : NULL); + if (me && me->mandatory) { + HTAssocList_delete(me->mandatory); + me->mandatory = NULL; + return YES; + } + return NO; } /* @@ -1048,7 +1135,14 @@ */ PUBLIC void HTRequest_setOutputStream (HTRequest * me, HTStream *output) { - if (me) me->output_stream = output; + if (me) { + if (output) { + me->output_stream = HTNoFreeStream_new(output); + me->orig_output_stream = output; + } else { + me->output_stream = output; + } + } } PUBLIC HTStream *HTRequest_outputStream (HTRequest * me) @@ -1074,7 +1168,12 @@ */ PUBLIC void HTRequest_setDebugStream (HTRequest * me, HTStream *debug) { - if (me) me->debug_stream = debug; + if (debug) { + me->debug_stream = HTNoFreeStream_new(debug); + me->orig_debug_stream = debug; + } else { + me->debug_stream = debug; + } } PUBLIC HTStream *HTRequest_debugStream (HTRequest * me) @@ -1363,17 +1462,15 @@ if (!src->mainDestination) { src->mainDestination = dest; src->destRequests = 1; - if (CORE_TRACE) - HTTrace("POSTWeb..... Adding dest %p to src %p\n", - dest, src); + HTTRACE(CORE_TRACE, "POSTWeb..... Adding dest %p to src %p\n" _ + dest _ src); return YES; } else { if (!src->destinations) src->destinations = HTList_new(); if (HTList_addObject(src->destinations, (void *) dest)==YES) { src->destRequests++; - if (CORE_TRACE) - HTTrace("POSTWeb..... Adding dest %p to src %p\n", - dest, src); + HTTRACE(CORE_TRACE, "POSTWeb..... Adding dest %p to src %p\n" _ + dest _ src); return YES; } } @@ -1405,13 +1502,11 @@ } if (found) { if (dest->internal) HTRequest_delete(dest); - if (CORE_TRACE) - HTTrace("POSTWeb..... Deleting dest %p from src %p\n", - dest, src); + HTTRACE(CORE_TRACE, "POSTWeb..... Deleting dest %p from src %p\n" _ + dest _ src); } if (src->destRequests <= 0) { - if (CORE_TRACE) - HTTrace("POSTWeb..... terminated\n"); + HTTRACE(CORE_TRACE, "POSTWeb..... terminated\n"); if (src->internal) HTRequest_delete(src); } } @@ -1429,8 +1524,7 @@ if (source) { if (source->destStreams == source->destRequests) { HTNet * net = source->net; - if (CORE_TRACE) - HTTrace("POSTWeb..... All destinations are ready!\n"); + HTTRACE(CORE_TRACE, "POSTWeb..... All destinations are ready!\n"); if (net) /* Might already have finished */ HTEvent_register(HTNet_socket(net), HTEvent_READ, &net->event); return YES; @@ -1462,13 +1556,11 @@ (*source->output_stream->isa->_free)(source->output_stream); source->output_stream = pipe ? pipe : dest->input_stream; - if (CORE_TRACE) - HTTrace("POSTWeb..... Linking dest %p to src %p\n", - dest, source); + HTTRACE(CORE_TRACE, "POSTWeb..... Linking dest %p to src %p\n" _ + dest _ source); if (++source->destStreams == source->destRequests) { HTNet *net = source->net; - if (CORE_TRACE) - HTTrace("POSTWeb..... All destinations ready!\n"); + HTTRACE(CORE_TRACE, "POSTWeb..... All destinations ready!\n"); if (net) /* Might already have finished */ HTEvent_register(HTNet_socket(net), HTEvent_READ, &net->event); return YES; @@ -1500,9 +1592,8 @@ } if (found) { src->destStreams--; - if (CORE_TRACE) - HTTrace("POSTWeb..... Unlinking dest %p from src %p\n", - dest, src); + HTTRACE(CORE_TRACE, "POSTWeb..... Unlinking dest %p from src %p\n" _ + dest _ src); return YES; } } @@ -1547,7 +1638,7 @@ { if (me && me->source) { HTRequest *source = me->source; - if (CORE_TRACE) HTTrace("POSTWeb..... Killing\n"); + HTTRACE(CORE_TRACE, "POSTWeb..... Killing\n"); /* ** Kill source. The stream tree is now freed so we have to build @@ -1596,7 +1687,7 @@ PUBLIC BOOL HTLoad (HTRequest * me, BOOL recursive) { if (!me || !me->anchor) { - if (CORE_TRACE) HTTrace("Load Start.. Bad argument\n"); + HTTRACE(CORE_TRACE, "Load Start.. Bad argument\n"); return NO; } @@ -1631,7 +1722,7 @@ PUBLIC BOOL HTServe (HTRequest * me, BOOL recursive) { if (!me || !me->anchor) { - if (CORE_TRACE) HTTrace("Serve Start. Bad argument\n"); + HTTRACE(CORE_TRACE, "Serve Start. Bad argument\n"); return NO; } @@ -1653,3 +1744,117 @@ /* Now start the Net Manager */ return HTNet_newServer(me); } + + + +/* --------------------------------------------------------------------------*/ +/* Message Body */ +/* --------------------------------------------------------------------------*/ + +/* +** This function sets the request's message body +*/ +PUBLIC BOOL HTRequest_setMessageBody (HTRequest * request, const char * body) { +#ifdef HT_EXT + + if (request && body && *body){ + StrAllocCopy (request->messageBody,body); + return YES; + } +#endif /* HT_EXT */ + return NO; +} + +/* +** This function deletes the message body, freeing the string and +** setting it to NULL. +*/ +PUBLIC BOOL HTRequest_deleteMessageBody (HTRequest * request) { +#ifdef HT_EXT + if (request && request->messageBody) { + HT_FREE (request->messageBody); + request->messageBody = NULL; + return YES; + } +#endif /* HT_EXT */ + return NO; +} + +/* +** This function creates a copy of the message body +*/ +PUBLIC char * HTRequest_messageBody (HTRequest * request) { + char * bodycopy = NULL; + +#ifdef HT_EXT + if (request && request->messageBody && *(request->messageBody)) + StrAllocCopy(bodycopy,request->messageBody); +#endif /* HT_EXT */ + + return bodycopy; +} + + +/* +** This function sets the length of the body. This length will be +** used to set Content-Length header. +** Note: length should be greater than 0, and the Content-Length +** header will be created only if there is a message Body. +*/ +PUBLIC BOOL HTRequest_setMessageBodyLength (HTRequest * request, long int length) { +#ifdef HT_EXT + if (request && length > 0) { + request->messageBodyLength = length; + return YES; + } +#endif /* HT_EXT */ + + return NO; +} + + +/* +** This function returns the message body length, +** or -1 if it is not set. +*/ +PUBLIC long int HTRequest_messageBodyLength (HTRequest * request) { +#ifdef HT_EXT + return (request && (request->messageBody && request->messageBodyLength))? + request->messageBodyLength:-1; +#else + return -1; +#endif +} + + +/* +** This function sets the format of the message body to be used +** in the Content-Type header. +** Note: the Content-Type header will be created only if there is a +** message body set. +*/ +PUBLIC BOOL HTRequest_setMessageBodyFormat (HTRequest * request, HTFormat format) { + +#ifdef HT_EXT + if (request && format) { + request->messageBodyFormat = format; + return YES; + } +#endif /*HT_EXT*/ + return NO; +} + + +/* +** This function returns the format of the message body, or +** NULL if it is not set. +*/ +PUBLIC HTFormat HTRequest_messageBodyFormat (HTRequest * request) { +#ifdef HT_EXT + if (request && request->messageBodyFormat) + return request->messageBodyFormat; + else +#endif /*HT_EXT*/ + return NULL; +} + diff -Naur xdvik-22.40l/libs/libwww/HTReqMan.h xdvik-22.40n/libs/libwww/HTReqMan.h --- xdvik-22.40l/libs/libwww/HTReqMan.h Wed Apr 18 14:23:21 2001 +++ xdvik-22.40n/libs/libwww/HTReqMan.h Fri Sep 13 00:23:46 2002 @@ -62,6 +62,21 @@ /* ( +Message body +) + +A request message body indicated for XML bodies. It is used for extension +methods. See HTReq.html for details. +*/ + +#ifdef HT_EXT + char * messageBody; + long int messageBodyLength; + HTFormat messageBodyFormat; +#endif + +/* +( User Profile ) @@ -157,9 +172,6 @@ HTRqHd RequestMask; HTEnHd EntityMask; - HTList * generators; - BOOL gens_local; - /* ( Local MIME Header Parsers @@ -225,6 +237,16 @@ /* ( + Default PUT name +) + +Stores the default name when publishing to a "/" URL. +*/ + + char * default_put_name; + +/* +( Byte Ranges ) @@ -273,16 +295,43 @@ /* ( - Protocol Extension Protocol (PEP) Information + Request Header Extensibility ) -These association lists contain the information that we are to send as PEP -headers in the request. + + + 1) Simple Association List + + +Add the (name, value) and it will be converted into MIME header format as +name: value. DO NOT ADD CRLF line termination - this is done +by the HTTP header generator stream +*/ + + HTAssocList * extra_headers; + +/* + + 2) Stream Oriented Header Generators + + +A generator is a stream with direct access to the output stream +*/ + + HTList * generators; + BOOL gens_local; + +/* + + 4) HTTP Extension Framework + + +These association lists contain the information that we are to send as +HTTP Extension Framework. */ - HTAssocList * protocol; - HTAssocList * protocol_info; - HTAssocList * protocol_request; + HTAssocList * mandatory; + HTAssocList * optional; /* ( @@ -302,10 +351,12 @@ */ HTStream * output_stream; + HTStream * orig_output_stream; HTFormat output_format; BOOL connected; - HTStream* debug_stream; + HTStream * debug_stream; + HTStream * orig_debug_stream; HTFormat debug_format; /* @@ -336,7 +387,7 @@ /* ( - PostWeb Information + PostWeb Information (Not used anymore - don't use!) ) */ @@ -393,6 +444,6 @@ - @(#) $Id: HTReqMan.h,v 1.1.1.1 2001/04/18 14:23:21 stefanulrich Exp $ + @(#) $Id: HTReqMan.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTResMan.h xdvik-22.40n/libs/libwww/HTResMan.h --- xdvik-22.40l/libs/libwww/HTResMan.h Wed Apr 18 14:23:21 2001 +++ xdvik-22.40n/libs/libwww/HTResMan.h Fri Sep 13 00:23:46 2002 @@ -226,6 +226,14 @@ HTAssocList * headers; /* + +The reason string furnished by the server, as some servers may send +useful custom information in it +*/ + + char * reason; /* JK: HTTP reason string */ + +/* */ }; /* End of definition of HTResponse */ @@ -241,6 +249,6 @@ - @(#) $Id: HTResMan.h,v 1.1.1.1 2001/04/18 14:23:21 stefanulrich Exp $ + @(#) $Id: HTResMan.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTResponse.c xdvik-22.40n/libs/libwww/HTResponse.c --- xdvik-22.40l/libs/libwww/HTResponse.c Wed Apr 18 14:23:21 2001 +++ xdvik-22.40n/libs/libwww/HTResponse.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTResponse.c,v 1.1.1.1 2001/04/18 14:23:21 stefanulrich Exp $ +** @(#) $Id: HTResponse.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Authors ** HFN Henrik Frystyk, frystyk@w3.org @@ -37,14 +37,14 @@ /* By default a response is not cachable */ me->cachable = NO; - if (CORE_TRACE) HTTrace("Response.... Created %p\n", me); + HTTRACE(CORE_TRACE, "Response.... Created %p\n" _ me); return me; } PUBLIC BOOL HTResponse_delete (HTResponse * me) { if (me) { - if (CORE_TRACE) HTTrace("Response.... Delete %p\n", me); + HTTRACE(CORE_TRACE, "Response.... Delete %p\n" _ me); /* Access Authentication */ HT_FREE(me->realm); @@ -91,6 +91,9 @@ if (me->headers) HTAssocList_delete(me->headers); } + /* HTTP reason string */ + if (me->reason) HT_FREE (me->reason); + HT_FREE(me); return YES; } @@ -664,5 +667,23 @@ return headers; } +/* +** HTTP reason string +*/ +PUBLIC char * HTResponse_reason (HTResponse * me) +{ + if (me) { + return me->reason; + } + return NULL; +} +PUBLIC BOOL HTResponse_setReason (HTResponse * me, char * reason) +{ + if (me && reason && *reason) { + StrAllocCopy(me->reason, reason); + return YES; + } + return NO; +} diff -Naur xdvik-22.40l/libs/libwww/HTResponse.h xdvik-22.40n/libs/libwww/HTResponse.h --- xdvik-22.40l/libs/libwww/HTResponse.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTResponse.h Fri Sep 13 00:23:46 2002 @@ -17,11 +17,23 @@ The response object is created as a placeholder for the response received by the remote server. All filters can then use the information passed in -the response and act appropriately. The response objetc is deleted automatically +the response and act appropriately. The response object is deleted automatically when the corresponding request object is deleted. We try and do some fancy tricks in order to do lazy parsing and reusing parsed values so that we can optimize the code. +The Response object is created automatically when we start to receive +metainformation (for example MIME headers) and is +linked to the Request object. The +Response object is also deleted automatically when the corresponding request +object is deleted but it can of course be deleted before if this is +desired. + +Note that if you are using non-blocking sockets then libwww +behaves asynchronously as you may issue multiple requests and get back the +responses in the order they appear on the net interface. + + This module is implemented by HTResponse.c, and it is a part of the W3C Sample Code Library. @@ -225,9 +237,10 @@ */ typedef enum _HTCachable { - HT_NO_CACHE = 0, - HT_CACHE_ALL = 1, - HT_CACHE_ETAG= 2 + HT_NO_CACHE = 0, + HT_CACHE_ALL = 1, + HT_CACHE_ETAG = 2, + HT_CACHE_NOT_MODIFIED = 3 } HTCachable; extern HTCachable HTResponse_isCachable (HTResponse * me); @@ -420,6 +433,19 @@ extern HTAssocList * HTResponse_handOverHeader (HTResponse * me); /* + +( + The HTTP reason string +) +The string returned in the HTTP status line. Some servers send custom +info in this string and applications may want to show it. +*/ + +extern char * HTResponse_reason (HTResponse * me); +extern BOOL HTResponse_setReason (HTResponse * me, char * reason); + +/* + */ #endif /* HTRESPONSE_H */ @@ -428,6 +454,6 @@ - @(#) $Id: HTResponse.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTResponse.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTRules.c xdvik-22.40n/libs/libwww/HTRules.c --- xdvik-22.40l/libs/libwww/HTRules.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTRules.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTRules.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTRules.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module manages rule files in the Library ** @@ -30,6 +30,7 @@ /* Library include files */ #include "WWWLib.h" +#include "WWWFile.h" #include "HTProxy.h" #include "HTRules.h" /* Implemented here */ @@ -102,11 +103,10 @@ char *ptr = strchr(replace, '*'); StrAllocCopy(me->replace, replace); me->insert = ptr ? ptr-replace : -1; - if (APP_TRACE) - HTTrace("Rule Add.... For `%s\' op %d `%s\'\n", - pattern, op, replace); + HTTRACE(APP_TRACE, "Rule Add.... For `%s\' op %d `%s\'\n" _ + pattern _ op _ replace); } else { - if (APP_TRACE) HTTrace("Rule Add.... For `%s\' op %d\n", pattern, op); + HTTRACE(APP_TRACE, "Rule Add.... For `%s\' op %d\n" _ pattern _ op); } return HTList_appendObject(list, (void *) me); } @@ -147,7 +147,7 @@ HTRule * pres; char * replace = NULL; if (!token || !list) return NULL; - if (APP_TRACE) HTTrace("Check rules. for `%s\'\n", token); + HTTRACE(APP_TRACE, "Check rules. for `%s\'\n" _ token); while ((pres = (HTRule *) HTList_nextObject(list))) { char * rest = ignore_case ? HTStrCaseMatch(pres->pattern, token) : HTStrMatch(pres->pattern, token); @@ -172,8 +172,7 @@ } if (pres->op == HT_Pass) { - if (APP_TRACE) - HTTrace("............ map into `%s'\n", replace); + HTTRACE(APP_TRACE, "............ map into `%s'\n" _ replace); return replace; } break; @@ -181,7 +180,7 @@ case HT_Fail: default: - if (APP_TRACE) HTTrace("............ FAIL `%s'\n", token); + HTTRACE(APP_TRACE, "............ FAIL `%s'\n" _ token); return NULL; } } @@ -205,14 +204,13 @@ if ((ptr = strchr(config, '#'))) *ptr = '\0'; StrAllocCopy(line, config); /* Get our own copy */ ptr = line; - if (APP_TRACE) HTTrace("Rule Parse.. `%s\'\n", config ? config : ""); + HTTRACE(APP_TRACE, "Rule Parse.. `%s\'\n" _ config ? config : ""); if ((word1 = HTNextField(&ptr)) == NULL) { /* Empty line */ HT_FREE(line); return YES; } if ((word2 = HTNextField(&ptr)) == NULL) { - if (APP_TRACE) - HTTrace("Rule Parse.. Insufficient operands: `%s\'\n",line); + HTTRACE(APP_TRACE, "Rule Parse.. Insufficient operands: `%s\'\n" _ line); HT_FREE(line); return NO; } @@ -266,8 +264,7 @@ : 0==strcasecomp(word1, "fail") ? HT_Fail : HT_Invalid; if (op == HT_Invalid) { - if (APP_TRACE) - HTTrace("Rule Parse.. Bad or unknown: `%s'\n", config); + HTTRACE(APP_TRACE, "Rule Parse.. Bad or unknown: `%s'\n" _ config); } else HTRule_add(list, op, word2, word3); } @@ -346,7 +343,7 @@ { if (me) { int status = HTRule_flush(me); - if (APP_TRACE) HTTrace("Rules....... FREEING....\n"); + HTTRACE(APP_TRACE, "Rules....... FREEING....\n"); HTChunk_delete(me->buffer); HT_FREE(me); return status; @@ -358,7 +355,7 @@ { if (me) { int status = HT_ERROR; - if (APP_TRACE) HTTrace("Rules....... ABORTING...\n"); + HTTRACE(APP_TRACE, "Rules....... ABORTING...\n"); HTChunk_delete(me->buffer); HT_FREE(me); return status; @@ -398,7 +395,7 @@ if ((cbf && (*cbf)(request,HT_A_CONFIRM, HT_MSG_RULES, NULL,NULL,NULL))) { #endif HTStream * me; - if (WWWTRACE) HTTrace("Rule file... Parser object created\n"); + HTTRACE(APP_TRACE, "Rule file... Parser object created\n"); if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) HT_OUTOFMEM("HTRules"); me->isa = &HTRuleClass; @@ -425,7 +422,7 @@ { if (request) { HTStream * me; - if (WWWTRACE) HTTrace("Rule file... Automatic parser object created\n"); + HTTRACE(APP_TRACE, "Rule file... Automatic parser object created\n"); if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) HT_OUTOFMEM("HTRules"); me->isa = &HTRuleClass; diff -Naur xdvik-22.40l/libs/libwww/HTRules.h xdvik-22.40n/libs/libwww/HTRules.h --- xdvik-22.40l/libs/libwww/HTRules.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTRules.h Fri Sep 13 00:23:46 2002 @@ -144,6 +144,6 @@ - @(#) $Id: HTRules.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTRules.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTSChunk.c xdvik-22.40n/libs/libwww/HTSChunk.c --- xdvik-22.40l/libs/libwww/HTSChunk.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTSChunk.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTSChunk.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTSChunk.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This stream converts a stream to a chunk object. */ @@ -41,7 +41,7 @@ */ PRIVATE int HTSC_free (HTStream * me) { - if (STREAM_TRACE) HTTrace("Chunkstream. FREEING...\n"); + HTTRACE(STREAM_TRACE, "Chunkstream. FREEING...\n"); HT_FREE(me); return HT_OK; } @@ -51,7 +51,7 @@ */ PRIVATE int HTSC_abort (HTStream * me, HTList * errorlist) { - if (STREAM_TRACE) HTTrace("Chunkstream. ABORTING...\n"); + HTTRACE(STREAM_TRACE, "Chunkstream. ABORTING...\n"); HT_FREE(me); return HT_ERROR; } @@ -126,9 +126,8 @@ me->chunk = *chunk = HTChunk_new(me->max_size > 0 ? HTMIN(me->max_size, HT_MAXGROWSIZE) : HT_MAXGROWSIZE); - if (STREAM_TRACE) - HTTrace("ChunkStream. Chunk %p created with max size %d\n", - me->chunk, me->max_size); + HTTRACE(STREAM_TRACE, "ChunkStream. Chunk %p created with max size %d\n" _ + me->chunk _ me->max_size); return me; } return HTErrorStream(); diff -Naur xdvik-22.40l/libs/libwww/HTSChunk.h xdvik-22.40n/libs/libwww/HTSChunk.h --- xdvik-22.40l/libs/libwww/HTSChunk.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTSChunk.h Fri Sep 13 00:23:46 2002 @@ -50,6 +50,6 @@ - @(#) $Id: HTSChunk.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTSChunk.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTSQL.c xdvik-22.40n/libs/libwww/HTSQL.c --- xdvik-22.40l/libs/libwww/HTSQL.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTSQL.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTSQL.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTSQL.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module interacts with the MYSQL C client library to perform ** SQL operations. It is not intended as a complete SQL API but handles @@ -157,8 +157,7 @@ { HTSQL * me = NULL; if (!host || !user || !pw) { - if (SQL_TRACE) - HTTrace("SQL new..... Missing host, user, or password\n"); + HTTRACE(SQL_TRACE, "SQL new..... Missing host, user, or password\n"); return NULL; } if ((me = (HTSQL *) HT_CALLOC(1, sizeof(HTSQL))) == NULL) @@ -182,14 +181,12 @@ PUBLIC BOOL HTSQL_connect (HTSQL * me) { if (me && me->host) { - if (SQL_TRACE) - HTTrace("SQL connect. Open a link to server `%s\'\n", me->host); + HTTRACE(SQL_TRACE, "SQL connect. Open a link to server `%s\'\n" _ me->host); if ((me->psvr = mysql_connect(&(me->server), me->host, me->user ? me->user : "", me->password ? me->password : "")) == NULL) { - if (SQL_TRACE) - HTTrace("SQL connect. `%s\' errno %d\n", - mysql_error(&me->server), mysql_errno(&me->server)); + HTTRACE(SQL_TRACE, "SQL connect. `%s\' errno %d\n" _ + mysql_error(&me->server) _ mysql_errno(&me->server)); return NO; } return YES; @@ -205,8 +202,7 @@ PUBLIC BOOL HTSQL_close (HTSQL * me) { if (me && me->psvr) { - if (SQL_TRACE) - HTTrace("SQL close... Link to host `%s\'\n", me->host); + HTTRACE(SQL_TRACE, "SQL close... Link to host `%s\'\n" _ me->host); mysql_close(me->psvr); me->psvr = NULL; me->db = NULL; @@ -235,19 +231,18 @@ { BOOL created = NO; if (me && me->psvr && db) { - if (SQL_TRACE) - HTTrace("SQL select.. Database `%s\'\n", db); + HTTRACE(SQL_TRACE, "SQL select.. Database `%s\'\n" _ db); me->db = NULL; if (mysql_select_db(me->psvr, db) < 0) { int err = mysql_errno(me->psvr); - if (SQL_TRACE) HTTrace("SQL select.. `%s\', errno %d\n", - mysql_error(me->psvr), err); + HTTRACE(SQL_TRACE, "SQL select.. `%s\', errno %d\n" _ + mysql_error(me->psvr) _ err); /* If the database couldn't be found then create a new one */ if (err == 1049) { if (mysql_create_db(me->psvr, db) < 0) { - if (SQL_TRACE) HTTrace("SQL error... `%s\', errno %d\n", - mysql_error(me->psvr), err); + HTTRACE(SQL_TRACE, "SQL error... `%s\', errno %d\n" _ + mysql_error(me->psvr) _ err); return NO; } created = YES; @@ -258,8 +253,8 @@ if (created) { if (mysql_select_db(me->psvr, db) < 0) { int err = mysql_errno(me->psvr); - if (SQL_TRACE) HTTrace("SQL select.. `%s\', errno %d\n", - mysql_error(me->psvr), err); + HTTRACE(SQL_TRACE, "SQL select.. `%s\', errno %d\n" _ + mysql_error(me->psvr) _ err); return NO; } } @@ -273,14 +268,12 @@ PUBLIC BOOL HTSQL_query (HTSQL * me, const char * query) { - if (SQL_TRACE) - HTTrace("SQL query... `%s\'\n", query ? query : ""); + HTTRACE(SQL_TRACE, "SQL query... `%s\'\n" _ query ? query : ""); if (me && me->psvr && query) { if (mysql_query(me->psvr, query) < 0) { int status = mysql_errno(me->psvr); - if (SQL_TRACE) - HTTrace("SQL query... `%s\' on query `%s\' with errno %d\n", - mysql_error(me->psvr), query, status); + HTTRACE(SQL_TRACE, "SQL query... `%s\' on query `%s\' with errno %d\n" _ + mysql_error(me->psvr) _ query _ status); /* Check to see if we should try and reconnect */ if (status==CR_SERVER_GONE_ERROR || status==CR_SERVER_LOST) { @@ -312,9 +305,8 @@ if (me && me->psvr) { if ((result = mysql_store_result(me->psvr)) == NULL) { int status = mysql_errno(me->psvr); - if (SQL_TRACE) - HTTrace("SQL store... `%s\' with errno %d\n", - mysql_error(me->psvr), status); + HTTRACE(SQL_TRACE, "SQL store... `%s\' with errno %d\n" _ + mysql_error(me->psvr) _ status); } } return result; diff -Naur xdvik-22.40l/libs/libwww/HTSQL.h xdvik-22.40n/libs/libwww/HTSQL.h --- xdvik-22.40l/libs/libwww/HTSQL.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTSQL.h Fri Sep 13 00:23:46 2002 @@ -182,6 +182,6 @@ - @(#) $Id: HTSQL.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTSQL.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTSQLLog.c xdvik-22.40n/libs/libwww/HTSQLLog.c --- xdvik-22.40l/libs/libwww/HTSQLLog.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTSQLLog.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTSQLLog.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTSQLLog.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module contains a simple SQL based logging mechanism for requests ** and anything else you want to log @@ -198,8 +198,7 @@ { HTSQLLog * me = NULL; if (!host || !user || !pw || !db) { - if (SQL_TRACE) - HTTrace("SQLLog...... Missing SQLLog host, user, password, or db\n"); + HTTRACE(SQL_TRACE, "SQLLog...... Missing SQLLog host, user, password, or db\n"); return NULL; } if ((me = (HTSQLLog *) HT_CALLOC(1, sizeof(HTSQLLog))) == NULL) diff -Naur xdvik-22.40l/libs/libwww/HTSQLLog.h xdvik-22.40n/libs/libwww/HTSQLLog.h --- xdvik-22.40l/libs/libwww/HTSQLLog.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTSQLLog.h Fri Sep 13 00:23:46 2002 @@ -128,6 +128,6 @@ - @(#) $Id: HTSQLLog.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTSQLLog.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTSocket.c xdvik-22.40n/libs/libwww/HTSocket.c --- xdvik-22.40l/libs/libwww/HTSocket.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTSocket.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTSocket.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTSocket.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** ** HISTORY: @@ -34,8 +34,7 @@ /* This is the context structure for the this module */ typedef struct _raw_info { RawState state; /* Current State of the connection */ - HTNet * listen; - HTNet * accepted; + HTNet * net; HTRequest * request; } raw_info; @@ -51,11 +50,10 @@ PRIVATE int RawCleanup (HTRequest * request, int status) { - HTNet * listen = HTRequest_net(request); - raw_info * raw = (raw_info *) HTNet_context(listen); + HTNet * net = HTRequest_net(request); + raw_info * raw = (raw_info *) HTNet_context(net); - if (PROT_TRACE) - HTTrace("Raw clean... Called with status %d, net %p\n", status, raw->accepted); + HTTRACE(PROT_TRACE, "Raw clean... Called with status %d, net %p\n" _ status _ net); if (status == HT_INTERRUPTED) { HTAlertCallback * cbf = HTAlert_find(HT_PROG_INTERRUPT); @@ -67,13 +65,8 @@ HT_MSG_NULL, NULL, NULL, NULL); } - /* Delete both of the Net objects */ - if (raw->accepted) { - HTNet_deleteDup(listen); - HTNet_delete(raw->accepted, status); - } else { - HTNet_delete(listen, HT_ERROR); - } + /* Delete the Net object */ + HTNet_delete(net, HT_ERROR); HT_FREE(raw); return YES; @@ -95,28 +88,31 @@ { raw_info * raw; /* Specific protocol information */ HTNet * net = HTRequest_net(request); - if (PROT_TRACE) HTTrace("Load socket. Setting up socket for accept\n"); + HTTRACE(PROT_TRACE, "Load socket. Setting up socket for accept\n"); if ((raw = (raw_info *) HT_CALLOC(1, sizeof(raw_info))) == NULL) HT_OUTOFMEM("HTLoadSocket"); raw->state = RAW_BEGIN; - raw->listen = net; + raw->net = net; raw->request = request; HTNet_setContext(net, raw); HTNet_setEventCallback(net, SocketEvent); HTNet_setEventParam(net, raw); + /* Start listening on a socket */ + if (HTHost_listen(NULL, net, HTAnchor_physical(HTRequest_anchor(request))) == HT_ERROR) + return SocketEvent(soc, raw, HTEvent_CLOSE); + /* Get it started - ops is ignored */ return SocketEvent(soc, raw, HTEvent_BEGIN); } PRIVATE int SocketEvent (SOCKET soc, void * pVoid, HTEventType type) { - raw_info * raw = (raw_info *)pVoid; + raw_info * raw = (raw_info *) pVoid; int status = HT_ERROR; - HTNet * listen = raw->listen; - HTRequest * request = HTNet_request(listen); - HTParentAnchor * anchor = HTRequest_anchor(request); - HTHost * host = HTNet_host(listen); + HTNet * net = raw->net; + HTRequest * request = raw->request; + HTHost * host = HTNet_host(net); /* ** Check whether we have been interrupted or timed out @@ -140,8 +136,8 @@ while (1) { switch(raw->state) { case RAW_BEGIN: - status = HTHost_accept(host, listen, &raw->accepted, HTAnchor_physical(anchor), RAW_PORT); - host = HTNet_host(listen); + status = HTHost_accept(host, net, NULL); + host = HTNet_host(net); if (status == HT_OK) { raw->state = RAW_NEED_STREAM; } else if (status == HT_WOULD_BLOCK || status == HT_PENDING) { @@ -162,7 +158,7 @@ HTRequest_outputFormat(request), HTRequest_outputStream(request), request, YES); - HTNet_setReadStream(raw->accepted, in_stream); + HTNet_setReadStream(net, in_stream); HTRequest_setOutputConnected(request, YES); raw->state = RAW_READ; @@ -170,7 +166,7 @@ } case RAW_READ: - status = HTHost_read(host, raw->accepted); + status = HTHost_read(host, net); if (status == HT_WOULD_BLOCK) return HT_OK; else if (status==HT_CLOSED) @@ -190,7 +186,7 @@ break; default: - HTDebugBreak(__FILE__, __LINE__, "Bad raw state %d\n", raw->state); + HTDEBUGBREAK("Bad raw state %d\n" _ raw->state); } } return HT_OK; diff -Naur xdvik-22.40l/libs/libwww/HTSocket.h xdvik-22.40n/libs/libwww/HTSocket.h --- xdvik-22.40l/libs/libwww/HTSocket.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTSocket.h Fri Sep 13 00:23:46 2002 @@ -48,6 +48,6 @@ - @(#) $Id: HTSocket.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTSocket.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTStream.c xdvik-22.40n/libs/libwww/HTStream.c --- xdvik-22.40l/libs/libwww/HTStream.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTStream.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTStream.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTStream.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This version of the stream object just writes to a C file. ** The file is assumed open and left open. diff -Naur xdvik-22.40l/libs/libwww/HTStream.h xdvik-22.40n/libs/libwww/HTStream.h --- xdvik-22.40l/libs/libwww/HTStream.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTStream.h Fri Sep 13 00:23:46 2002 @@ -161,6 +161,6 @@ - @(#) $Id: HTStream.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTStream.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTString.c xdvik-22.40n/libs/libwww/HTString.c --- xdvik-22.40l/libs/libwww/HTString.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTString.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTString.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTString.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Original version came with listserv implementation. ** Version TBL Oct 91 replaces one which modified the strings. @@ -59,7 +59,7 @@ /* ** strcasestr(s1,s2) -- like strstr(s1,s2) but case-insensitive. */ -PUBLIC char * strcasestr (char * s1, char * s2) +PUBLIC char * HTStrCaseStr (char * s1, char * s2) { char * ptr = s1; @@ -80,7 +80,31 @@ return NULL; } +/* +** tailcomp(s1,s2) -- like strcmp(s1,s2) but match s1 with the tail of s2 +** (used for cookie domain comparison) +*/ +PUBLIC int tailcomp(const char * s1, const char * s2) +{ + int l1 = strlen(s1); + int l2 = strlen(s2); + + if (l1 < l2) + s2 += (l2 - l1); + + return strcmp(s1, s2); +} + +PUBLIC int tailcasecomp(const char * s1, const char * s2) +{ + int l1 = strlen(s1); + int l2 = strlen(s2); + if (l1 < l2) + s2 += (l2 - l1); + + return strcasecomp(s1, s2); +} /* Allocate a new copy of a string, and returns it */ diff -Naur xdvik-22.40l/libs/libwww/HTString.h xdvik-22.40n/libs/libwww/HTString.h --- xdvik-22.40l/libs/libwww/HTString.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTString.h Fri Sep 13 00:23:46 2002 @@ -74,6 +74,17 @@ /* . + Tail String Comparison +. + +Like strcmp, but match the tail of s2 (used for cookie domain comparison) +*/ + +extern int tailcomp(const char * s1, const char * s2); +extern int tailcasecomp(const char * s1, const char * s2); + +/* +. String Comparison with Wild Card Match . @@ -107,7 +118,7 @@ This works like strstr() but is not case-sensitive. */ -extern char * strcasestr (char * s1, char * s2); +extern char * HTStrCaseStr (char * s1, char * s2); /* . @@ -129,6 +140,6 @@ - @(#) $Id: HTString.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTString.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTStruct.h xdvik-22.40n/libs/libwww/HTStruct.h --- xdvik-22.40l/libs/libwww/HTStruct.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTStruct.h Fri Sep 13 00:23:46 2002 @@ -90,6 +90,6 @@ - @(#) $Id: HTStruct.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTStruct.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTStyle.c xdvik-22.40n/libs/libwww/HTStyle.c --- xdvik-22.40l/libs/libwww/HTStyle.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTStyle.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTStyle.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTStyle.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Styles allow the translation between a logical property ** of a piece of text and its physical representation. @@ -105,9 +105,8 @@ while ((pres = (HTStyle *) HTList_nextObject(cur))) { if (!strcasecomp(pres->name, name)) return pres; } - if (SGML_TRACE) - HTTrace("StyleSheet.. No style named `%s' in stylesheet `%s'\n", - name, me->name); + HTTRACE(SGML_TRACE, "StyleSheet.. No style named `%s' in stylesheet `%s'\n" _ + name _ me->name); } return NULL; } @@ -120,9 +119,8 @@ while ((pres = (HTStyle *) HTList_nextObject(cur))) { if (pres->element==element) return pres; } - if (SGML_TRACE) - HTTrace("StyleSheet.. No style for element %d in stylesheet `%s'\n", - element, me->name); + HTTRACE(SGML_TRACE, "StyleSheet.. No style for element %d in stylesheet `%s'\n" _ + element _ me->name); } return NULL; } diff -Naur xdvik-22.40l/libs/libwww/HTStyle.h xdvik-22.40n/libs/libwww/HTStyle.h --- xdvik-22.40l/libs/libwww/HTStyle.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTStyle.h Fri Sep 13 00:23:46 2002 @@ -88,6 +88,6 @@ - @(#) $Id: HTStyle.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTStyle.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTCP.c xdvik-22.40n/libs/libwww/HTTCP.c --- xdvik-22.40l/libs/libwww/HTTCP.c Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTTCP.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTCP.c,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ +** @(#) $Id: HTTCP.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This code is in common between client and server sides. ** @@ -36,18 +36,26 @@ #endif /* VMS */ /* Macros and other defines */ -/* x seconds penalty on a multi-homed host if IP-address is down */ -#define TCP_PENALTY 1200 +/* x ms penalty on a multi-homed host if IP-address is unreachable */ +#define TCP_DELAY 30000 -/* x seconds penalty on a multi-homed host if IP-address is timed out */ -#define TCP_DELAY 600 +/* x ms penalty on a multi-homed host if IP-address is down for unknown reason */ +#define TCP_PENALTY 60000 -/* imperical study in socket call error codes +/* empirical study in socket call error codes + yovavm@contact.com : added handling for WSAEINVAL error code (Windows) + "When calling connect() in the second time, after the first call to + connect() returned WSAEWOULDBLOCK, an error of WSAEINVAL is returned. + It happens often on WinNT & Win95, and rarely on Win2K & Win98, where in + most cases the second call to connect() returns WSAEISCON (10056). + jose@w3.org : didn't add that test for Unix, as the connect() doc (Linux + and Solaris) says it's not needed. */ #ifdef _WINSOCKAPI_ /* windows */ #define NETCALL_ERROR(ret) (ret == SOCKET_ERROR) #define NETCALL_DEADSOCKET(err) (err == WSAEBADF) #define NETCALL_WOULDBLOCK(err) (err == WSAEWOULDBLOCK) +#define NETCALL_INVAL(err) (err == WSAEINVAL) #else /* _WINSOCKAPI_ unix */ #define NETCALL_ERROR(ret) (ret < 0) #define NETCALL_DEADSOCKET(err) (err == EBADF) @@ -67,31 +75,38 @@ #endif /* !EALREADY */ #endif /* !(EAGAIN && EALREADY) */ #endif /* !_WINSOCKAPI_ done */ + +#if defined(__svr4__) || defined (_WINSOCKAPI_) +#define HT_HOSTUNREACHABLE(e) ((e)==ECONNREFUSED || (e)==ETIMEDOUT || \ + (e)==ENETUNREACH || (e)==EHOSTUNREACH || \ + (e)==EHOSTDOWN) +#else +#define HT_HOSTUNREACHABLE(e) ((e)==ECONNREFUSED || (e)==ETIMEDOUT || \ + (e)==ENETUNREACH || (e)==EHOSTUNREACH || \ + (e)==EHOSTDOWN || (e)==EINVAL) +#endif + /* ------------------------------------------------------------------------- */ /* CONNECTION ESTABLISHMENT MANAGEMENT */ /* ------------------------------------------------------------------------- */ /* _makeSocket - create a socket, if !preemptive, set FIONBIO - * returns 1: blocking - * 0: non-blocking - * -1: creation error - */ -PRIVATE int _makeSocket(HTHost * host, HTRequest * request, int preemptive, HTTransport * transport) +** returns sockfd or INVSOC if error +*/ +PRIVATE int _makeSocket (HTHost * host, HTRequest * request, int preemptive) { int status = 1; - SOCKET sockfd; + SOCKET sockfd = INVSOC; #ifdef DECNET if ((sockfd=socket(AF_DECnet, SOCK_STREAM, 0))==INVSOC) #else if ((sockfd=socket(AF_INET, SOCK_STREAM,IPPROTO_TCP))==INVSOC) #endif - { - HTRequest_addSystemError(request, ERR_FATAL, socerrno, - NO, "socket"); - host->tcpstate = TCP_ERROR; - return -1; - } - if (PROT_TRACE) HTTrace("Socket...... Created %d\n", sockfd); + { + HTRequest_addSystemError(request, ERR_FATAL, socerrno, NO, "socket"); + return INVSOC; + } + HTTRACE(PROT_TRACE, "Socket...... Created %d\n" _ sockfd); /* Increase the number of sockets by one */ HTNet_increaseSocket(); @@ -106,11 +121,10 @@ status = setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *) &disable, sizeof(int)); if (status == -1) { - if (PROT_TRACE) - HTTrace("Socket...... Could not disable Nagle's algorithm - error %d\n", + HTTRACE(PROT_TRACE, "Socket...... Could not disable Nagle's algorithm - error %d\n" _ sockfd); } else { - if (PROT_TRACE) HTTrace("Socket...... Turned off Nagle's algorithm\n"); + HTTRACE(PROT_TRACE, "Socket...... Turned off Nagle's algorithm\n"); } } #endif @@ -152,20 +166,26 @@ } #endif /* !VMS */ #endif /* !_WINSOCKAPI_ */ - if (PROT_TRACE) - HTTrace("Socket...... %slocking socket\n", status == -1 ? "B" : "Non-b"); + HTTRACE(PROT_TRACE, "Socket...... %slocking socket\n" _ status == -1 ? "B" : "Non-b"); } else - if (PROT_TRACE) HTTrace("Socket...... Blocking socket\n"); + HTTRACE(PROT_TRACE, "Socket...... Blocking socket\n"); - /* - ** Associate the channel with the host and create an input and and output stream - ** for this host/channel - */ - HTHost_setChannel(host, HTChannel_new(sockfd, NULL, YES)); - HTHost_getInput(host, transport, NULL, 0); - HTHost_getOutput(host, transport, NULL, 0); + return sockfd; +} - return status == -1 ? 1 : 0; +/* +** Associate the channel with the host and create an input and and output stream +** for this host/channel +*/ +PRIVATE BOOL createChannelAndTransportStreams (HTHost * host, SOCKET sockfd, HTTransport * trans) +{ + if (host && sockfd!=INVSOC && trans) { + HTHost_setChannel(host, HTChannel_new(sockfd, NULL, YES)); + HTHost_getInput(host, trans, NULL, 0); + HTHost_getOutput(host, trans, NULL, 0); + return YES; + } + return NO; } /* HTDoConnect() @@ -177,17 +197,17 @@ ** HT_OK if connected ** HT_WOULD_BLOCK if operation would have blocked */ -PUBLIC int HTDoConnect (HTNet * net, char * url, u_short default_port) +PUBLIC int HTDoConnect (HTNet * net) { - HTHost * me = HTNet_host(net); + HTHost * host = HTNet_host(net); HTRequest * request = HTNet_request(net); + char * hostname = HTHost_name(host); int preemptive = net->preemptive; int status = HT_OK; - char * hostname = HTHost_name(me); /* Jump into the state machine */ while (1) { - switch (me->tcpstate) { + switch (host->tcpstate) { case TCP_BEGIN: { /* @@ -195,15 +215,15 @@ ** host is idle then we can start the request right away, ** otherwise we must wait until it is free. */ - if ((status = HTHost_addNet(net->host, net)) == HT_PENDING) - if (PROT_TRACE) HTTrace("HTDoConnect. Pending...\n"); + if ((status = HTHost_addNet(host, net)) == HT_PENDING) + HTTRACE(PROT_TRACE, "HTDoConnect. Pending...\n"); /* ** If we are pending then return here, otherwise go to next state ** which is setting up a channel */ - me->tcpstate = TCP_CHANNEL; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_CHANNEL.\n", me); + host->tcpstate = TCP_CHANNEL; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_CHANNEL.\n" _ host); if (status == HT_PENDING) return HT_PENDING; } break; @@ -215,61 +235,90 @@ ** test it - otherwise we must around DNS to get the name ** Resolved */ - if (HTHost_channel(me) == NULL) { - me->tcpstate = TCP_DNS; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_DNS.\n", me); + if (HTHost_channel(host) == NULL) { + host->tcpstate = TCP_DNS; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_DNS.\n" _ host); } else { /* ** There is now one more using the channel */ - HTChannel_upSemaphore(me->channel); + HTChannel_upSemaphore(host->channel); /* ** We are now all set and can jump to connected mode */ - me->tcpstate = TCP_CONNECTED; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_CONNECTED.\n", me); + host->tcpstate = TCP_CONNECTED; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_CONNECTED.\n" _ host); } - hostname = HTHost_name(me); + hostname = HTHost_name(host); break; case TCP_DNS: - if ((status = HTParseInet(me, hostname, request)) < 0) { - if (PROT_TRACE) HTTrace("HTDoConnect. Can't locate `%s\'\n", hostname); + if ((status = HTParseInet(host, hostname, request)) < 0) { + HTTRACE(PROT_TRACE, "HTDoConnect. Can't locate `%s\'\n" _ hostname); HTRequest_addError(request, ERR_FATAL, NO, HTERR_NO_REMOTE_HOST, (void *) hostname, strlen(hostname), "HTDoConnect"); - me->tcpstate = TCP_DNS_ERROR; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_ERROR.\n", me); + host->tcpstate = TCP_DNS_ERROR; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_ERROR.\n" _ host); break; } - if (!HTHost_retry(me) && status > 1) /* If multiple homes */ - HTHost_setRetry(me, status); - me->tcpstate = TCP_NEED_SOCKET; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_NEED_SOCKET.\n", me); + if (!HTHost_retry(host) && status > 1) /* If multiple homes */ + HTHost_setRetry(host, status); + host->tcpstate = TCP_NEED_SOCKET; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_NEED_SOCKET.\n" _ host); break; - case TCP_NEED_SOCKET: - if (_makeSocket(me, request, preemptive, net->transport) == -1) + case TCP_NEED_SOCKET: + { + SOCKET sockfd; + + /* Create a new socket */ + if ((sockfd = _makeSocket(host, request, preemptive)) == INVSOC) { + host->tcpstate = TCP_ERROR; break; + } + + /* Create channnel and streams */ + createChannelAndTransportStreams (host, sockfd, net->transport); /* If multi-homed host then start timer on connection */ - if (HTHost_retry(me)) me->connecttime = HTGetTimeInMillis(); + if (HTHost_retry(host)) host->connecttime = HTGetTimeInMillis(); - /* Progress */ + /* Progress notification */ { HTAlertCallback *cbf = HTAlert_find(HT_PROG_CONNECT); if (cbf) (*cbf)(request, HT_PROG_CONNECT, HT_MSG_NULL, NULL, hostname, NULL); } - me->tcpstate = TCP_NEED_CONNECT; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_NEED_CONNECT.\n", me); + host->tcpstate = TCP_NEED_CONNECT; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_NEED_CONNECT.\n" _ host); break; - case TCP_NEED_CONNECT: - status = connect(HTChannel_socket(me->channel), (struct sockaddr *) &me->sock_addr, - sizeof(me->sock_addr)); + } + + case TCP_NEED_CONNECT: +#ifdef _WINSOCKAPI_ + /* 2000/08/02 Jens Meggers (jens@meggers.com): + ** In HTDoConnect(), the connect command is done before the + ** WSAAsyncSelect() that is called when + ** HTHost_register(host, net, HTEvent_CONNECT); is executed. + ** Although that is in line with the WinSock2 and Microsoft + ** documentation, it does _not_ work all the time. I have done + ** extensive tests on Win2000 and Win 4.0 SP5. In very rare cases, + ** the connect is finished between the connect() command itself and + ** the WSAAsyncSelect(). In this unlikely case, WinSock does not + ** (always) send the FD_CONNECT message. As a result, when using + ** the Async mode, the event loop hangs because there is no + ** timeout procedure registered for FD_CONNECT. + ** JK: what happens if status returns an error? Do we have to + ** unregister the HTEvent_CONNECT event then? + */ + HTHost_register(host, net, HTEvent_CONNECT); +#endif /* _WINSOCKAPI_ */ + status = connect(HTChannel_socket(host->channel), (struct sockaddr *) &host->sock_addr, + sizeof(host->sock_addr)); /* * According to the Sun man page for connect: * EINPROGRESS The socket is non-blocking and the con- @@ -292,108 +341,117 @@ { if (NETCALL_WOULDBLOCK(socerrno)) { - if (PROT_TRACE) HTTrace("HTDoConnect. WOULD BLOCK `%s'\n", hostname); - HTHost_register(me, net, HTEvent_CONNECT); + HTTRACE(PROT_TRACE, "HTDoConnect. WOULD BLOCK `%s'\n" _ hostname); +#ifndef _WINSOCKAPI_ + + HTHost_register(host, net, HTEvent_CONNECT); +#endif /* _WINSOCKAPI_ */ return HT_WOULD_BLOCK; } +#ifdef _WINSOCKAPI_ + /* + * yovavm@contact.com + * + * According to Microsoft docs, the error code WSAEALREADY is + * described as: + * "A nonblocking connect call is in progress on the specified + * socket. Note In order to preserve backward compatibility, + * this error is reported as WSAEINVAL to Windows Sockets 1.1 + * applications that link to either Winsock.dll or + * Wsock32.dll." + */ + if (NETCALL_INVAL(socerrno)) { + host->tcpstate = TCP_CONNECTED; + HTTRACE(PROT_TRACE, "Connection to HTHost %p is already in progress.\n" _ host); + break; + } +#endif /* _WINSOCKAPI_ */ + if (socerrno == EISCONN) { - me->tcpstate = TCP_CONNECTED; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_CONNECTED.\n", me); + host->tcpstate = TCP_CONNECTED; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_CONNECTED.\n" _ host); break; } if (NETCALL_DEADSOCKET(socerrno)) /* We lost the socket */ { - me->tcpstate = TCP_NEED_SOCKET; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_NEED_SOCKET.\n", me); + host->tcpstate = TCP_NEED_SOCKET; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_NEED_SOCKET.\n" _ host); break; } - if (HTHost_retry(me)) { - me->connecttime -= HTGetTimeInMillis(); + if (HTHost_retry(host)) { + host->connecttime = HTGetTimeInMillis() - host->connecttime; /* Added EINVAL `invalid argument' as this is what I get back from a non-blocking connect where I should get `connection refused' on BSD. SVR4 gives SIG_PIPE */ -#if defined(__svr4__) || defined (_WINSOCKAPI_) - if (socerrno==ECONNREFUSED || socerrno==ETIMEDOUT || - socerrno==ENETUNREACH || socerrno==EHOSTUNREACH || - socerrno==EHOSTDOWN) -#else - if (socerrno==ECONNREFUSED || socerrno==ETIMEDOUT || - socerrno==ENETUNREACH || socerrno==EHOSTUNREACH || - socerrno==EHOSTDOWN || socerrno==EINVAL) -#endif - me->connecttime += TCP_DELAY; + if (HT_HOSTUNREACHABLE(socerrno)) + host->connecttime += TCP_DELAY; else - me->connecttime += TCP_PENALTY; - HTDNS_updateWeigths(me->dns, HTHost_home(me), me->connecttime); + host->connecttime += TCP_PENALTY; + HTDNS_updateWeigths(host->dns, HTHost_home(host), host->connecttime); } - me->tcpstate = TCP_ERROR; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_ERROR.\n", me); + host->tcpstate = TCP_ERROR; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_ERROR.\n" _ host); } else { - me->tcpstate = TCP_CONNECTED; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_CONNECTED.\n", me); + host->tcpstate = TCP_CONNECTED; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_CONNECTED.\n" _ host); } break; case TCP_CONNECTED: - HTHost_unregister(me, net, HTEvent_CONNECT); - if (HTHost_retry(me)) { - me->connecttime -= HTGetTimeInMillis(); - HTDNS_updateWeigths(me->dns, HTHost_home(me), me->connecttime); - } - HTHost_setRetry(me, 0); - me->tcpstate = TCP_IN_USE; - if (PROT_TRACE) HTTrace("HTHost %p connected.\n", me); + HTHost_unregister(host, net, HTEvent_CONNECT); + if (HTHost_retry(host)) { + host->connecttime = HTGetTimeInMillis() - host->connecttime; + HTDNS_updateWeigths(host->dns, HTHost_home(host), host->connecttime); + } + HTHost_setRetry(host, 0); + host->tcpstate = TCP_IN_USE; + HTTRACE(PROT_TRACE, "HTHost %p connected.\n" _ host); return HT_OK; break; - /* once a host is connected, subsequent connections are immediately OK */ + /* Once a host is connected, subsequent connections are immediately OK */ case TCP_IN_USE: - if ((status = HTHost_addNet(net->host, net)) == HT_PENDING) { - if (PROT_TRACE) HTTrace("HTDoConnect. Pending...\n"); + if ((status = HTHost_addNet(host, net)) == HT_PENDING) { + HTTRACE(PROT_TRACE, "HTDoConnect. Pending...\n"); return HT_PENDING; } - HTChannel_upSemaphore(me->channel); + HTChannel_upSemaphore(host->channel); return HT_OK; case TCP_DNS_ERROR: - HTHost_setRetry(me, 0); - me->tcpstate = TCP_BEGIN; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_BEGIN.\n", me); - return HT_ERROR; + HTHost_setRetry(host, 0); + host->tcpstate = TCP_BEGIN; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_BEGIN.\n" _ host); + return HT_NO_HOST; break; case TCP_NEED_BIND: case TCP_NEED_LISTEN: case TCP_ERROR: - if (HTChannel_socket(me->channel) != INVSOC) { - /* HTEvent_unregister(HTChannel_socket(me->channel), (SockOps) FD_ALL); */ - NETCLOSE(HTChannel_socket(me->channel)); - /* HTChannel_setSocket(me->channel, INVSOC); */ -#if 1 /* @@@ */ - if (HTHost_isPersistent(me)) { /* Inherited socket */ - HTHost_setPersistent(me, NO, HT_TP_SINGLE); - me->tcpstate = TCP_NEED_SOCKET; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_NEED_SOCKET.\n", me); + if (HTChannel_socket(host->channel) != INVSOC) { + NETCLOSE(HTChannel_socket(host->channel)); + if (HTHost_isPersistent(host)) { /* Inherited socket */ + HTHost_setPersistent(host, NO, HT_TP_SINGLE); + host->tcpstate = TCP_NEED_SOCKET; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_NEED_SOCKET.\n" _ host); break; } -#endif } /* Do we have more homes to try? */ - HTHost_decreaseRetry(me); - if (HTHost_retry(me) > 0) { - HTRequest_addSystemError(request, ERR_NON_FATAL, socerrno, NO, - "connect"); - me->tcpstate = TCP_DNS; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_DNS.\n", me); + HTHost_decreaseRetry(host); + if (HT_HOSTUNREACHABLE(socerrno) && HTHost_retry(host) > 0) { + HTRequest_addSystemError(request, ERR_NON_FATAL, socerrno, NO,"connect"); + host->tcpstate = TCP_DNS; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_DNS.\n" _ host); break; } - HTRequest_addSystemError(request, ERR_FATAL,socerrno,NO,"connect"); + HTRequest_addSystemError(request, ERR_FATAL, socerrno, NO, "connect"); HTDNS_delete(hostname); - HTHost_setRetry(me, 0); - me->tcpstate = TCP_BEGIN; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_BEGIN.\n", me); + HTHost_setRetry(host, 0); + host->tcpstate = TCP_BEGIN; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_BEGIN.\n" _ host); return HT_ERROR; break; } @@ -409,48 +467,36 @@ ** HT_OK if connected ** HT_WOULD_BLOCK if operation would have blocked */ -PUBLIC int HTDoAccept (HTNet * net, HTNet ** accepted) +PUBLIC int HTDoAccept (HTNet * listening, HTNet * accepting) { - HTHost * me = HTNet_host(net); + HTHost * host = HTNet_host(listening); + HTRequest * request = HTNet_request(accepting); + int size = sizeof(host->sock_addr); int status; - int size = sizeof(net->host->sock_addr); - HTRequest * request = HTNet_request(net); - if (!request || HTNet_socket(net)==INVSOC) { - if (PROT_TRACE) HTTrace("HTDoAccept.. Invalid socket\n"); + if (!request || HTNet_socket(listening)==INVSOC) { + HTTRACE(PROT_TRACE, "HTDoAccept.. Invalid socket\n"); return HT_ERROR; } - /* Progress report */ - { - HTAlertCallback *cbf = HTAlert_find(HT_PROG_ACCEPT); - if (cbf) (*cbf)(request, HT_PROG_ACCEPT, HT_MSG_NULL,NULL, NULL, NULL); - } - status = accept(HTNet_socket(net), (struct sockaddr *) &net->host->sock_addr, &size); + status = accept(HTNet_socket(listening), (struct sockaddr *) &host->sock_addr, &size); if (NETCALL_ERROR(status)) { if (NETCALL_WOULDBLOCK(socerrno)) { - if (PROT_TRACE) - HTTrace("HTDoAccept.. WOULD BLOCK %d\n", HTNet_socket(net)); - HTHost_register(me, net, HTEvent_ACCEPT); + HTTRACE(PROT_TRACE, "HTDoAccept.. WOULD BLOCK %d\n" _ HTNet_socket(listening)); + HTHost_register(host, listening, HTEvent_ACCEPT); return HT_WOULD_BLOCK; } HTRequest_addSystemError(request, ERR_WARN, socerrno, YES, "accept"); - if (PROT_TRACE) HTTrace("HTDoAccept.. Accept failed\n"); + HTTRACE(PROT_TRACE, "HTDoAccept.. Accept failed\n"); return HT_ERROR; } - if (PROT_TRACE) HTTrace("Accepted.... socket %d\n", status); + HTTRACE(PROT_TRACE, "Accepted.... socket %d\n" _ status); - /* - ** If accepted is the same as the net obejct then reuse it, else create - ** a new object and leave the original alone - */ - if (*accepted == net) - HTDoClose(net); - else - *accepted = HTNet_dup(net); - HTNet_setSocket(*accepted, status); + /* Remember the new socket we got and close the old one */ + NETCLOSE(HTNet_socket(accepting)); + HTNet_setSocket(accepting, status); return HT_OK; } @@ -458,23 +504,21 @@ /* HTDoListen ** ---------- -** Listens on the specified port. 0 means that we chose it here -** If master==INVSOC then we listen on all local interfaces (using a -** wildcard). If !INVSOC then use this as the local interface +** Listens on the specified port. ** returns HT_ERROR Error has occured or interrupted ** HT_OK if connected */ -PUBLIC int HTDoListen (HTNet * net, u_short port, SOCKET master, int backlog) +PUBLIC int HTDoListen (HTNet * listening, HTNet * accepting, int backlog) { - HTHost * me = HTNet_host(net); - HTRequest * request = HTNet_request(net); - int preemptive = net->preemptive; + HTHost * host = HTNet_host(listening); + HTRequest * request = HTNet_request(listening); + int preemptive = listening->preemptive; int status = HT_OK; - char * hostname = HTHost_name(me); + char * hostname = HTHost_name(host); /* Jump into the state machine */ while (1) { - switch (me->tcpstate) { + switch (host->tcpstate) { case TCP_BEGIN: { /* @@ -482,15 +526,15 @@ ** host is idle then we can start the request right away, ** otherwise we must wait until it is free. */ - if ((status = HTHost_addNet(net->host, net)) == HT_PENDING) - if (PROT_TRACE) HTTrace("HTDoListen.. Pending...\n"); + if ((status = HTHost_addNet(host, accepting)) == HT_PENDING) + HTTRACE(PROT_TRACE, "HTDoListen.. Pending...\n"); /* ** If we are pending then return here, otherwise go to next state ** which is setting up a channel */ - me->tcpstate = TCP_CHANNEL; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_CHANNEL.\n", me); + host->tcpstate = TCP_CHANNEL; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_CHANNEL.\n" _ host); if (status == HT_PENDING) return HT_PENDING; } break; @@ -499,98 +543,106 @@ /* ** The next state depends on whether we have a connection or not. */ - if (HTHost_channel(me) == NULL) { - me->tcpstate = TCP_NEED_SOCKET; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_SOCKET.\n", me); + if (HTHost_channel(host) == NULL) { + host->tcpstate = TCP_NEED_SOCKET; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_SOCKET.\n" _ host); } else { /* ** There is now one more using the channel */ - HTChannel_upSemaphore(me->channel); + HTChannel_upSemaphore(host->channel); /* ** We are now all set and can jump to connected mode */ - me->tcpstate = TCP_CONNECTED; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_CONNECTED.\n", me); + host->tcpstate = TCP_CONNECTED; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_CONNECTED.\n" _ host); } - hostname = HTHost_name(me); + hostname = HTHost_name(host); break; case TCP_NEED_SOCKET: - if (_makeSocket(me, request, preemptive, net->transport) == -1) + { + SOCKET sockfd; + + /* Create a new socket */ + if ((sockfd = _makeSocket(host, request, preemptive)) == INVSOC) { + host->tcpstate = TCP_ERROR; break; + } - /* Progress */ + /* Create channnel and streams */ + createChannelAndTransportStreams (host, sockfd, accepting->transport); + + /* Progress nofitication */ { HTAlertCallback *cbf = HTAlert_find(HT_PROG_ACCEPT); if (cbf) (*cbf)(request, HT_PROG_ACCEPT, HT_MSG_NULL, NULL, hostname, NULL); } - me->tcpstate = TCP_NEED_BIND; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_NEED_BIND\n", me); + host->tcpstate = TCP_NEED_BIND; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_NEED_BIND\n" _ host); break; + } case TCP_NEED_BIND: - if (PROT_TRACE) HTTrace("Socket...... Binding socket %d\n", HTNet_socket(net)); - status = bind(HTNet_socket(net), (struct sockaddr *) &me->sock_addr, - sizeof(me->sock_addr)); + HTTRACE(PROT_TRACE, "Socket...... Binding socket %d\n" _ HTNet_socket(listening)); + status = bind(HTNet_socket(listening), (struct sockaddr *) &host->sock_addr, + sizeof(host->sock_addr)); if (NETCALL_ERROR(status)) { - if (PROT_TRACE) HTTrace("Socket...... Bind failed %d\n", socerrno); - me->tcpstate = TCP_ERROR; + HTTRACE(PROT_TRACE, "Socket...... Bind failed %d\n" _ socerrno); + host->tcpstate = TCP_ERROR; } else { - if (PROT_TRACE) HTTrace("Socket...... Starting listening on socket %d\n", HTNet_socket(net)); - me->tcpstate = TCP_NEED_LISTEN; + HTTRACE(PROT_TRACE, "Socket...... Starting listening on socket %d\n" _ HTNet_socket(listening)); + host->tcpstate = TCP_NEED_LISTEN; } break; case TCP_NEED_LISTEN: - status = listen(HTNet_socket(net), backlog); + status = listen(HTNet_socket(listening), backlog); if (NETCALL_ERROR(status)) - me->tcpstate = TCP_ERROR; + host->tcpstate = TCP_ERROR; else - me->tcpstate = TCP_CONNECTED; + host->tcpstate = TCP_CONNECTED; break; case TCP_CONNECTED: - HTHost_unregister(me, net, HTEvent_ACCEPT); - HTHost_setRetry(me, 0); - me->tcpstate = TCP_IN_USE; - if (PROT_TRACE) HTTrace("HTHost %p listening.\n", me); + HTHost_unregister(host, listening, HTEvent_ACCEPT); + HTHost_setRetry(host, 0); + host->tcpstate = TCP_IN_USE; + HTTRACE(PROT_TRACE, "HTHost %p listening.\n" _ host); return HT_OK; break; /* once a host is connected, subsequent connections are immediately OK */ case TCP_IN_USE: - if ((status = HTHost_addNet(net->host, net)) == HT_PENDING) { - if (PROT_TRACE) HTTrace("HTDoListen.. Pending...\n"); + if ((status = HTHost_addNet(host, accepting)) == HT_PENDING) { + HTTRACE(PROT_TRACE, "HTDoListen.. Pending...\n"); return HT_PENDING; } - HTChannel_upSemaphore(me->channel); + HTChannel_upSemaphore(host->channel); return HT_OK; case TCP_NEED_CONNECT: case TCP_DNS: case TCP_DNS_ERROR: case TCP_ERROR: - if (HTChannel_socket(me->channel) != INVSOC) { - NETCLOSE(HTChannel_socket(me->channel)); -#if 1 /* @@@ */ - if (HTHost_isPersistent(me)) { /* Inherited socket */ - HTHost_setPersistent(me, NO, HT_TP_SINGLE); - me->tcpstate = TCP_NEED_SOCKET; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_NEED_SOCKET.\n", me); + if (HTChannel_socket(host->channel) != INVSOC) { + NETCLOSE(HTChannel_socket(host->channel)); + if (HTHost_isPersistent(host)) { /* Inherited socket */ + HTHost_setPersistent(host, NO, HT_TP_SINGLE); + host->tcpstate = TCP_NEED_SOCKET; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_NEED_SOCKET.\n" _ host); break; } -#endif } HTRequest_addSystemError(request, ERR_FATAL, socerrno, NO, "accept"); - HTHost_setRetry(me, 0); - me->tcpstate = TCP_BEGIN; - if (PROT_TRACE) HTTrace("HTHost %p going to state TCP_BEGIN.\n", me); + HTHost_setRetry(host, 0); + host->tcpstate = TCP_BEGIN; + HTTRACE(PROT_TRACE, "HTHost %p going to state TCP_BEGIN.\n" _ host); return HT_ERROR; break; } @@ -611,7 +663,7 @@ { int status = -1; if (net && HTNet_socket(net) != INVSOC) { - if (PROT_TRACE) HTTrace("HTDoClose... Close %d\n", HTNet_socket(net)); + HTTRACE(PROT_TRACE, "HTDoClose... Close %d\n" _ HTNet_socket(net)); status = NETCLOSE(HTNet_socket(net)); /* HTEvent_unregister(HTNet_socket(net), (SockOps) FD_ALL); */ HTNet_decreaseSocket(); @@ -625,7 +677,7 @@ HTHost_launchPending(net->host); } else - if (PROT_TRACE) HTTrace("HTDoClose... No pending requests\n"); + HTTRACE(PROT_TRACE, "HTDoClose... No pending requests\n"); return status < 0 ? HT_ERROR : HT_OK; } diff -Naur xdvik-22.40l/libs/libwww/HTTCP.h xdvik-22.40n/libs/libwww/HTTCP.h --- xdvik-22.40l/libs/libwww/HTTCP.h Wed Apr 18 14:23:22 2001 +++ xdvik-22.40n/libs/libwww/HTTCP.h Fri Sep 13 00:23:46 2002 @@ -44,7 +44,7 @@ the calculated weights in the DNS object. */ -extern int HTDoConnect (HTNet * net, char * url, u_short default_port); +extern int HTDoConnect (HTNet * net); /* . @@ -63,23 +63,22 @@ the original socket and replaces it wik the accepted one. This is a quick way of accepting a single connection. */ -extern int HTDoAccept (HTNet * net, HTNet ** accepted); + +extern int HTDoAccept (HTNet * listen, HTNet * accept); /* . Listen on a Socket . -Listens on the specified port. Passing port 0 means that we -don't care and a temporary one will be assigned. If -master==INVSOC then we listen on all local interfaces (using -a wildcard). If INVSOC is not NULL then -use this as the local interface. backlog is the number of -connections that can be queued on the socket - you can use -HT_BACKLOG for a platform dependent value (typically 5 on BSD -and 32 on SVR4). Returns HT_ERROR or HT_OK. +Listens on the specified port described in the Net +object. backlog is the number of connections that can be +queued on the socket - you can use HT_BACKLOG for a +platform dependent value (typically 5 on BSD and 32 on SVR4). Returns +HT_ERROR or HT_OK. */ -extern int HTDoListen (HTNet * net, u_short port, SOCKET master, int backlog); + +extern int HTDoListen (HTNet * net, HTNet * accept, int backlog); /* . @@ -100,6 +99,6 @@ - @(#) $Id: HTTCP.h,v 1.1.1.1 2001/04/18 14:23:22 stefanulrich Exp $ + @(#) $Id: HTTCP.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTChunk.c xdvik-22.40n/libs/libwww/HTTChunk.c --- xdvik-22.40l/libs/libwww/HTTChunk.c Wed Apr 18 14:23:23 2001 +++ xdvik-22.40n/libs/libwww/HTTChunk.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTChunk.c,v 1.1.1.1 2001/04/18 14:23:23 stefanulrich Exp $ +** @(#) $Id: HTTChunk.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This stream parses a chunked transfer encoding using multiple chunks. ** @@ -50,9 +50,9 @@ if (line) { char *errstr = NULL; me->left = strtol(line, &errstr, 16); /* hex! */ - if (STREAM_TRACE) HTTrace("Chunked..... `%s\' chunk size: %X\n", line, me->left); + HTTRACE(STREAM_TRACE, "Chunked..... `%s\' chunk size: %X\n" _ line _ me->left); if (errstr == line) - HTDebugBreak(__FILE__, __LINE__, "Chunk decoder received illigal chunk size: `%s\'\n", line); + HTDEBUGBREAK("Chunk decoder received illigal chunk size: `%s\'\n" _ line); if (me->left > 0) { me->total += me->left; @@ -160,7 +160,7 @@ if ((status = (*me->target->isa->_free)(me->target)) == HT_WOULD_BLOCK) return HT_WOULD_BLOCK; } - if (PROT_TRACE) HTTrace("Chunked..... FREEING....\n"); + HTTRACE(PROT_TRACE, "Chunked..... FREEING....\n"); HTChunk_delete(me->buf); HT_FREE(me); return status; @@ -170,7 +170,7 @@ { int status = HT_ERROR; if (me->target) status = (*me->target->isa->abort)(me->target, e); - if (PROT_TRACE) HTTrace("Chunked..... ABORTING...\n"); + HTTRACE(PROT_TRACE, "Chunked..... ABORTING...\n"); HTChunk_delete(me->buf); HT_FREE(me); return status; @@ -207,7 +207,7 @@ /* Adjust information in anchor */ HTAnchor_setLength(anchor, -1); - if (STREAM_TRACE) HTTrace("Chunked..... Decoder stream created\n"); + HTTRACE(STREAM_TRACE, "Chunked..... Decoder stream created\n"); return me; } @@ -231,7 +231,7 @@ } me->total += l; PUTBLOCK(chunky, (int) strlen(chunky)); - if (STREAM_TRACE) HTTrace("Chunked..... chunk size 0x%X\n", l); + HTTRACE(STREAM_TRACE, "Chunked..... chunk size 0x%X\n" _ l); if (l > 0) return PUTBLOCK(b, l); /* Here we should provide a footer */ @@ -279,7 +279,7 @@ { int status = HT_ERROR; if (me->target) status = (*me->target->isa->_free)(me->target); - if (PROT_TRACE) HTTrace("Chunked..... ABORTING...\n"); + HTTRACE(PROT_TRACE, "Chunked..... ABORTING...\n"); HT_FREE(me); return status; } @@ -316,7 +316,7 @@ HTChunk_ensure(me->buf, length); } - if (STREAM_TRACE) HTTrace("Chunked..... Encoder stream created\n"); + HTTRACE(STREAM_TRACE, "Chunked..... Encoder stream created\n"); return me; } diff -Naur xdvik-22.40l/libs/libwww/HTTChunk.h xdvik-22.40n/libs/libwww/HTTChunk.h --- xdvik-22.40l/libs/libwww/HTTChunk.h Wed Apr 18 14:23:23 2001 +++ xdvik-22.40n/libs/libwww/HTTChunk.h Fri Sep 13 00:23:46 2002 @@ -54,6 +54,6 @@ - @(#) $Id: HTTChunk.h,v 1.1.1.1 2001/04/18 14:23:23 stefanulrich Exp $ + @(#) $Id: HTTChunk.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTP.c xdvik-22.40n/libs/libwww/HTTP.c --- xdvik-22.40l/libs/libwww/HTTP.c Wed Apr 18 14:23:23 2001 +++ xdvik-22.40n/libs/libwww/HTTP.c Fri Sep 13 00:23:46 2002 @@ -3,9 +3,9 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTP.c,v 1.1.1.1 2001/04/18 14:23:23 stefanulrich Exp $ +** @(#) $Id: HTTP.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** -** This module implments the HTTP protocol as a state machine +** This module implements the HTTP protocol as a state machine ** ** History: ** < May 24 94 ?? Unknown - but obviously written @@ -13,6 +13,11 @@ ** Forward, redirection, error handling and referer field ** 8 Jul 94 FM Insulate free() from _free structure element. ** Jul 94 HFN Written on top of HTTP.c, Henrik Frystyk +** Fev 02 MKP WebDAV status codes, Manuele Kirsch Pinheiro +** (Manuele.Kirsch_Pinheiro@inrialpes.fr) +** Mar 29 MKP Correcting WebDAV's 207 Multi-Status status code, that +** was returning HT_LOADED (200), and the right code is +** HT_MULTI_STATUS (207). ** */ @@ -20,10 +25,10 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWCore.h" -#include "WWWMIME.h" -#include "WWWStream.h" -#include "WWWTrans.h" +#include "HTHeader.h" +#include "HTMIMERq.h" #include "HTReqMan.h" +#include "HTNetMan.h" #include "HTTPUtil.h" #include "HTTPReq.h" #include "HTTP.h" /* Implements */ @@ -39,8 +44,8 @@ #define FREE_TARGET (*me->target->isa->_free)(me->target) #define ABORT_TARGET (*me->target->isa->abort)(me->target, e) -#define HTTP_DUMP -#ifdef HTTP_DUMP +#ifdef HTDEBUG +#include "WWWStream.h" #define HTTP_OUTPUT "w3chttp.out" PRIVATE FILE * htfp = NULL; #endif @@ -68,6 +73,7 @@ HTRequest * request; HTTimer * timer; BOOL usedTimer; + BOOL repetitive_writing; } http_info; #define MAX_STATUS_LEN 100 /* Max nb of chars to check StatusLine */ @@ -96,9 +102,11 @@ /* How long to wait before writing the body in PUT and POST requests */ #define DEFAULT_FIRST_WRITE_DELAY 2000 #define DEFAULT_SECOND_WRITE_DELAY 3000 +#define DEFAULT_REPEAT_WRITE 30 PRIVATE ms_t HTFirstWriteDelay = DEFAULT_FIRST_WRITE_DELAY; PRIVATE ms_t HTSecondWriteDelay = DEFAULT_SECOND_WRITE_DELAY; +PRIVATE ms_t HTRepeatWrite = DEFAULT_REPEAT_WRITE; #ifdef HT_NO_PIPELINING PRIVATE HTTPConnectionMode ConnectionMode = HTTP_11_NO_PIPELINING; @@ -129,8 +137,7 @@ http_info * http = (http_info *) HTNet_context(net); HTStream * input = HTRequest_inputStream(req); - if (PROT_TRACE) - HTTrace("HTTP Clean.. Called with status %d, net %p\n", status, net); + HTTRACE(PROT_TRACE, "HTTP Clean.. Called with status %d, net %p\n" _ status _ net); if (status == HT_INTERRUPTED) { HTAlertCallback * cbf = HTAlert_find(HT_PROG_INTERRUPT); @@ -144,19 +151,22 @@ /* Free stream with data TO network */ if (input) { - if (status==HT_INTERRUPTED || status==HT_RECOVER_PIPE || status==HT_TIMEOUT) - (*input->isa->abort)(input, NULL); - else - (*input->isa->_free)(input); + if (input->isa) { + if (status==HT_INTERRUPTED || status==HT_RECOVER_PIPE || status==HT_TIMEOUT) + (*input->isa->abort)(input, NULL); + else + (*input->isa->_free)(input); + } HTRequest_setInputStream(req, NULL); } /* ** Remove if we have registered an upload function as a callback */ - if (http->timer) { + if (http && http->timer) { HTTimer_delete(http->timer); http->timer = NULL; + http->lock = NO; } /* @@ -184,6 +194,7 @@ me->reason, (int) strlen(me->reason), "HTTPInformation"); #endif + http->result = HT_CONTINUE; return YES; break; @@ -196,8 +207,24 @@ "HTTPInformation"); http->next = HTTP_OK; http->result = HT_UPGRADE; + return YES; break; +#ifdef HT_DAV + case 102: /* 102 Processing */ + /* + ** MKP: 102 Processing indicates that the server is processing the + ** request, and a final response will be sent later. So the client + ** should wait for this final response. + ** MKP: I'm not sure that it will work. Any suggestion?? + */ + http->result = HT_CONTINUE; + http->next = HTTP_CONNECTED; + return YES; + break; +#endif + + default: HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_BAD_REPLY, (void *) me->buffer, me->buflen, "HTTPNextState"); @@ -279,7 +306,11 @@ me->reason, (int) strlen(me->reason), "HTTPNextState"); http->next = HTTP_OK; +#ifdef HT_DAV /* WebDAV : Multistatus status code */ + http->result = HT_MULTI_STATUS; +#else http->result = HT_PARTIAL_CONTENT; +#endif break; default: @@ -500,6 +531,29 @@ http->result = -419; break; +#ifdef HT_DAV + case 422: /* WebDAV Unprocessable Entity */ + HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_UNPROCESSABLE, + me->reason, (int) strlen(me->reason), "HTTPNextState"); + http->next = HTTP_ERROR; + http->result = HT_UNPROCESSABLE; + break; + + case 423: /* WebDAV Locked */ + HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_LOCKED, + me->reason, (int) strlen(me->reason), "HTTPNextState"); + http->next = HTTP_ERROR; + http->result = HT_LOCKED; + break; + + case 424: /* WebDAV Failed Dependency */ + HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_FAILED_DEPENDENCY, + me->reason, (int) strlen(me->reason), "HTTPNextState"); + http->next = HTTP_ERROR; + http->result = HT_FAILED_DEPENDENCY; + break; +#endif + default: HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_BAD_REQUEST, me->reason, (int) strlen(me->reason), "HTTPNextState"); @@ -565,6 +619,15 @@ http->result = HT_BAD_VERSION; break; +#ifdef HT_DAV + case 507: /* WebDAV Insufficient Storage */ + HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_INSUFFICIENT_STORAGE, + me->reason, (int) strlen(me->reason), "HTTPNextState"); + http->next = HTTP_ERROR; + http->result = HT_INSUFFICIENT_STORAGE; + break; +#endif + default: /* bad number */ HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_INTERNAL, me->reason, (int) strlen(me->reason), "HTTPNextState"); @@ -630,9 +693,15 @@ me->http->next = HTTP_OK; if ((status = PUTBLOCK(me->buffer, me->buflen)) == HT_OK) me->transparent = YES; - HTHost_setVersion(host, HTTP_09); + /* JK: in 2000, we don't expect many HTTP/0.9 servers to remain. + I removed this line which made the backward change as most of + the time we fall here more due to a network or server problem, + rather than because we are accessing an old server. */ + /* HTHost_setVersion(host, HTTP_09); */ if (length > 0) HTHost_setConsumed(host, length); - return status; + HTTRACE(PROT_TRACE, "HTTP Status. `%s\' is probably a broken 1.0 server that doesn't understand HEAD\n" _ + HTHost_name(host)); + return HT_ERROR; } else { HTResponse * response = HTRequest_response(request); char * ptr = me->buffer+5; /* Skip the HTTP part */ @@ -646,34 +715,38 @@ } /* Here we want to find out when to use persistent connection */ - if (major > 1) { - if (PROT_TRACE)HTTrace("HTTP Status. Major version number is %d\n", major); + if (major > 1 && major < 100) { + HTTRACE(PROT_TRACE, "HTTP Status. Major version number is %d\n" _ major); me->target = HTErrorStream(); me->status = 9999; HTTPNextState(me); /* Get next state */ return HT_ERROR; } else if (minor <= 0) { - if (PROT_TRACE)HTTrace("HTTP Status. This is an HTTP/1.0 server\n"); + if (major > 100) { + HTTRACE(PROT_TRACE, "HTTP Status. This is a *BROKEN* HTTP/1.0 server\n"); + me->status = 200; + } else { + HTTRACE(PROT_TRACE, "HTTP Status. This is an HTTP/1.0 server\n"); + me->status = atoi(HTNextField(&ptr)); + } HTHost_setVersion(host, HTTP_10); } else { /* 1.x, x>0 family */ HTHost_setVersion(host, HTTP_11); /* Best we can do */ if (ConnectionMode & HTTP_11_NO_PIPELINING) { - if (PROT_TRACE) - HTTrace("HTTP........ Mode is HTTP/1.1 with NO PIPELINING\n"); + HTTRACE(PROT_TRACE, "HTTP........ Mode is HTTP/1.1 with NO PIPELINING\n"); HTNet_setPersistent(net, YES, HT_TP_SINGLE); } else if (ConnectionMode & HTTP_11_MUX) { - if (PROT_TRACE) - HTTrace("HTTP........ Mode is HTTP/1.1 with MUXING\n"); + HTTRACE(PROT_TRACE, "HTTP........ Mode is HTTP/1.1 with MUXING\n"); HTNet_setPersistent(net, YES, HT_TP_INTERLEAVE); } else if (ConnectionMode & HTTP_FORCE_10) { - if (PROT_TRACE) HTTrace("HTTP........ Mode is FORCE HTTP/1.0\n"); + HTTRACE(PROT_TRACE, "HTTP........ Mode is FORCE HTTP/1.0\n"); HTHost_setVersion(host, HTTP_10); HTNet_setPersistent(net, NO, HT_TP_SINGLE); } else HTNet_setPersistent(net, YES, HT_TP_PIPELINE); + me->status = atoi(HTNextField(&ptr)); } - me->status = atoi(HTNextField(&ptr)); me->reason = ptr; if ((ptr = strchr(me->reason, '\r')) != NULL) /* Strip \r and \n */ *ptr = '\0'; @@ -687,18 +760,33 @@ */ if (me->status/100 == 1) { if (HTTPInformation(me) == YES) { - me->buflen = 0; - me->state = EOL_BEGIN; - if (me->info_target) (*me->info_target->isa->_free)(me->info_target); - me->info_target = HTStreamStack(WWW_MIME_CONT, - HTRequest_debugFormat(request), - HTRequest_debugStream(request), - request, NO); - if (length > 0) HTHost_setConsumed(host, length); - return HT_OK; + if (me->status==100) { + me->buflen = 0; + me->state = EOL_BEGIN; + if (me->info_target) (*me->info_target->isa->_free)(me->info_target); + me->info_target = HTStreamStack(WWW_MIME_CONT, + HTRequest_debugFormat(request), + HTRequest_debugStream(request), + request, NO); + if (length > 0) HTHost_setConsumed(host, length); + return HT_OK; + } else if (me->status==101) { + if (me->info_target) (*me->info_target->isa->_free)(me->info_target); + me->target = HTStreamStack(WWW_MIME_UPGRADE, + HTRequest_outputFormat(request), + HTRequest_outputStream(request), + request, NO); + if (length > 0) HTHost_setConsumed(host, length); + me->transparent = YES; + return HT_OK; + } } } + /* 2000/Oct/27 JK: copying the current reason info into the + response object. */ + HTResponse_setReason (response, me->reason); + /* ** As we are getting fresh metainformation in the HTTP response, ** we clear the old metainfomation in order not to mix it with the new @@ -706,7 +794,12 @@ ** like. The TRACE and OPTIONS method just adds to the current ** metainformation so in that case we don't clear the anchor. */ +#ifdef HT_DAV + if (me->status==200 || me->status==203 || + me->status==207 || me->status==300) { +#else if (me->status==200 || me->status==203 || me->status==300) { +#endif /* ** 200, 203 and 300 are all fully cacheable responses. No byte ** ranges or anything else make life hard in this case. @@ -717,6 +810,12 @@ HTRequest_outputFormat(request), HTRequest_outputStream(request), request, NO); + } else if (me->status==204) { + HTResponse_setCachable(response, HT_CACHE_ALL); + me->target = HTStreamStack(WWW_MIME_HEAD, + HTRequest_debugFormat(request), + HTRequest_debugStream(request), + request, NO); } else if (me->status==206) { /* ** We got a partial response and now we must check whether @@ -739,14 +838,15 @@ HTRequest_outputStream(request), request, NO); } - } else if (me->status==204 || me->status==304) { - HTResponse_setCachable(response, HT_CACHE_ALL); + } else if (me->status==304) { + HTResponse_setCachable(response, HT_CACHE_NOT_MODIFIED); me->target = HTStreamStack(WWW_MIME_HEAD, HTRequest_debugFormat(request), HTRequest_debugStream(request), request, NO); } else if (HTRequest_debugStream(request)) { - if (me->status == 201) HTResponse_setCachable(response, HT_CACHE_ETAG); + HTResponse_setCachable(response, + (me->status == 201) ? HT_CACHE_ETAG : HT_NO_CACHE); me->target = HTStreamStack(WWW_MIME, HTRequest_debugFormat(request), HTRequest_debugStream(request), @@ -756,7 +856,8 @@ ** We still need to parse the MIME part in order to find any ** valuable meta information which is needed from the response. */ - if (me->status == 201) HTResponse_setCachable(response, HT_CACHE_ETAG); + HTResponse_setCachable(response, + (me->status == 201) ? HT_CACHE_ETAG : HT_NO_CACHE); me->target = HTStreamStack(WWW_MIME, HTRequest_debugFormat(request), HTRequest_debugStream(request), @@ -855,8 +956,7 @@ if (me->target) ABORT_TARGET; HT_FREE(me); - if (PROT_TRACE) - HTTrace("HTTPStatus.. ABORTING...\n"); + HTTRACE(PROT_TRACE, "HTTPStatus.. ABORTING...\n"); return HT_ERROR; } @@ -922,7 +1022,7 @@ ** This is actually state HTTP_BEGIN, but it can't be in the state ** machine as we need the structure first. */ - if (PROT_TRACE) HTTrace("HTTP........ Looking for `%s\'\n", + HTTRACE(PROT_TRACE, "HTTP........ Looking for `%s\'\n" _ HTAnchor_physical(anchor)); if ((http = (http_info *) HT_CALLOC(1, sizeof(http_info))) == NULL) HT_OUTOFMEM("HTLoadHTTP"); @@ -940,22 +1040,35 @@ http_info * http = (http_info *) param; HTStream * input = HTRequest_inputStream(http->request); HTPostCallback * pcbf = HTRequest_postCallback(http->request); + int status = HT_ERROR; http->usedTimer = YES; if (timer != http->timer) - HTDebugBreak(__FILE__, __LINE__, "HTTP timer %p not in sync\n", timer); - if (PROT_TRACE) HTTrace("Uploading... Flushing %p with timer %p\n", http, timer); + HTDEBUGBREAK("HTTP timer %p not in sync\n" _ timer); + HTTRACE(PROT_TRACE, "Uploading... Flushing %p with timer %p\n" _ http _ timer); /* - ** We ignore the return code here which we shouldn't!!! + ** Call the callback that will provide the data to save + ** If the callback returns HT_OK then call it again until + ** it returns something else than HT_OK. */ - if (http && input && pcbf) (*pcbf)(http->request, input); + if (http && input && pcbf) { + status = (*pcbf)(http->request, input); + HTTRACE(PROT_TRACE, "Uploading... Callback returned %d\n" _ status); + } /* - ** Delete the timer but remember that we have used it + ** If the callback returned something else than HT_OK then delete + ** the timer, otherwise update it to a much shorter expiration + ** time so that we can write some more data to the net. */ - http->timer = NULL; - + if (status != HT_OK) { + HTTimer_delete(http->timer); + http->timer = NULL; + } else if (!http->repetitive_writing) { + http->timer = HTTimer_new(NULL, FlushPutEvent, http, HTRepeatWrite, YES, YES); + http->repetitive_writing = YES; + } return HT_OK; } @@ -975,9 +1088,23 @@ http->next = HTTP_OK; http->result = HT_ERROR; } else if (type == HTEvent_CLOSE) { - HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED, - NULL, 0, "HTLoadHTTP"); - HTTPCleanup(request, HT_INTERRUPTED); + long read_len = HTNet_bytesRead(net); + long doc_len = HTAnchor_length(anchor); + + /* + ** It is OK to get a close if a) we don't pipeline and b) + ** we have the expected amount of data, and c) we haven't + ** recieved a 100 Continue code. In case we don't + ** know how much data to expect, we must accept it asis. + */ + if (HTHost_numberOfOutstandingNetObjects(host) == 1 && + http->result != HT_CONTINUE && (doc_len<0 || doc_len==read_len)) { + HTTPCleanup(request, http->result); /* Raffaele Sena: was HT_LOADED */ + } else { + HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED, + NULL, 0, "HTLoadHTTP"); + HTTPCleanup(request, HT_INTERRUPTED); + } return HT_OK; } else if (type == HTEvent_TIMEOUT) { HTRequest_addError(request, ERR_FATAL, NO, HTERR_TIME_OUT, @@ -997,7 +1124,7 @@ while (1) { switch (http->state) { case HTTP_BEGIN: - status = HTHost_connect(host, net, HTAnchor_physical(anchor), HTTP_PORT); + status = HTHost_connect(host, net, HTAnchor_physical(anchor)); host = HTNet_host(net); if (status == HT_OK) { @@ -1009,8 +1136,11 @@ { char * s_class = HTHost_class(host); if (!s_class) { - if (HTRequest_proxy(request) == NULL) - HTRequest_addConnection(request, "Keep-Alive", ""); + if (HTRequest_proxy(request) == NULL) { + HTAssocList * alist = HTRequest_connection(request); + if (!(alist && HTAssocList_findObject(alist, "close"))) + HTRequest_addConnection(request, "Keep-Alive", ""); + } HTHost_setClass(host, "http"); } else if (strcasecomp(s_class, "http")) { HTRequest_addError(request, ERR_FATAL, NO, HTERR_CLASS, @@ -1021,15 +1151,15 @@ } if (ConnectionMode & HTTP_11_NO_PIPELINING) { - if (PROT_TRACE) HTTrace("HTTP........ Mode is HTTP/1.1 WITH NO PIPELINING\n"); + HTTRACE(PROT_TRACE, "HTTP........ Mode is HTTP/1.1 WITH NO PIPELINING\n"); HTRequest_setFlush(request, YES); } else if (ConnectionMode & HTTP_FORCE_10) { - if (PROT_TRACE) HTTrace("HTTP........ Mode is FORCE HTTP/1.0\n"); + HTTRACE(PROT_TRACE, "HTTP........ Mode is FORCE HTTP/1.0\n"); HTHost_setVersion(host, HTTP_10); } if (HTNet_preemptive(net)) { - if (PROT_TRACE) HTTrace("HTTP........ Force flush on preemptive load\n"); + HTTRACE(PROT_TRACE, "HTTP........ Force flush on preemptive load\n"); HTRequest_setFlush(request, YES); } @@ -1037,6 +1167,9 @@ http->state = HTTP_NEED_STREAM; } else if (status == HT_WOULD_BLOCK || status == HT_PENDING) { return HT_OK; + } else if (status == HT_NO_HOST) { + http->result = HT_NO_HOST; + http->state = HTTP_ERROR; } else http->state = HTTP_ERROR; /* Error or interrupt */ break; @@ -1053,13 +1186,23 @@ ** during a recovery, we might keep the same HTNet object. ** if so, reuse it's read stream */ - HTStream * me = HTNet_readStream( net ); + HTStream * me = HTNet_readStream( net ); if ( me == NULL ) { - me=HTStreamStack(WWW_HTTP, - HTRequest_outputFormat(request), - HTRequest_outputStream(request), - request, YES); - HTNet_setReadStream(net, me); + me = HTStreamStack(WWW_HTTP, + HTRequest_outputFormat(request), + HTRequest_outputStream(request), + request, YES); +#ifdef HTDEBUG + if (PROT_TRACE) { + if (!htfp) htfp = fopen(HTTP_OUTPUT, "ab"); + if (htfp) { + me = HTTee(me, HTFWriter_new(request, htfp, YES), NULL); + HTTRACE(PROT_TRACE, "HTTP........ Dumping response to `%s\'\n" _ HTTP_OUTPUT); + } + } +#endif /* HTDEBUG */ + + HTNet_setReadStream(net, me); } HTRequest_setOutputConnected(request, YES); } @@ -1074,16 +1217,16 @@ int version = HTHost_version(host); HTStream * app = NULL; -#ifdef HTTP_DUMP +#ifdef HTDEBUG if (PROT_TRACE) { if (!htfp) htfp = fopen(HTTP_OUTPUT, "ab"); if (htfp) { output = (HTOutputStream *) HTTee((HTStream *) output, HTFWriter_new(request, htfp, YES), NULL); - HTTrace("HTTP........ Dumping request to `%s\'\n", HTTP_OUTPUT); + HTTRACE(PROT_TRACE, "HTTP........ Dumping request to `%s\'\n" _ HTTP_OUTPUT); } } -#endif /* HTTP_DUMP */ +#endif /* HTDEBUG */ app = HTMethod_hasEntity(HTRequest_method(request)) ? HTMIMERequest_new(request, HTTPRequest_new(request, (HTStream *) output, NO, @@ -1119,29 +1262,36 @@ ** Check to see if we are uploading something or just a normal ** GET kind of thing. */ - if (pcbf) { - if (http->lock == NO) { - int retrys = HTRequest_retrys(request); - ms_t delay = retrys > 3 ? HTSecondWriteDelay : HTFirstWriteDelay; - if (!http->timer && !http->usedTimer) { - http->timer = HTTimer_new(NULL, FlushPutEvent, + + /* + ** JK: don't continue sending things thru the network + ** if the flush resulted in an error or if the connection + ** is closed + */ + if ((status != HT_ERROR) && status != HT_CLOSED) { + if (pcbf) { + if (http->lock == NO) { + int retrys = HTRequest_retrys(request); + ms_t delay = retrys > 3 ? HTSecondWriteDelay : HTFirstWriteDelay; + if (!http->timer && !http->usedTimer) { + http->timer = HTTimer_new(NULL, FlushPutEvent, http, delay, YES, NO); - if (PROT_TRACE) - HTTrace("Uploading... Holding %p for %lu ms using time %p\n", - http, delay, http->timer); - HTHost_register(host, net, HTEvent_READ); + HTTRACE(PROT_TRACE, "Uploading... Holding %p for %lu ms using time %p\n" _ + http _ delay _ http->timer); + HTHost_register(host, net, HTEvent_READ); + } + http->lock = YES; } - http->lock = YES; - } - type = HTEvent_READ; - } else { + type = HTEvent_READ; + } else { - /* - ** Check to see if we can start a new request - ** pending in the host object. - */ - HTHost_launchPending(host); - type = HTEvent_READ; + /* + ** Check to see if we can start a new request + ** pending in the host object. + */ + HTHost_launchPending(host); + type = HTEvent_READ; + } } /* Now check the status code */ @@ -1161,7 +1311,7 @@ if (status == HT_WOULD_BLOCK) return HT_OK; else if (status == HT_CONTINUE) { - if (PROT_TRACE) HTTrace("HTTP........ Continuing\n"); + HTTRACE(PROT_TRACE, "HTTP........ Continuing\n"); http->lock = NO; continue; } else if (status==HT_LOADED) @@ -1192,7 +1342,18 @@ if (HTHost_isPersistent(host) && !HTHost_closeNotification(host)) { if (host == NULL) return HT_ERROR; HTRequest_setFlush(request, YES); - HTHost_recoverPipe(host); + + /* + ** If we already have recovered more than we want and + ** this call returns NO then simply kill the pipe. + ** Otherwise we may loop forever. + */ + if (HTHost_recoverPipe(host) != YES) { + HTRequest_addError(request, ERR_FATAL, NO, HTERR_BAD_REPLY, + NULL, 0, "HTTPEvent"); + http->state = HTTP_KILL_PIPE; + break; + } return HT_OK; } else http->state = HTTP_OK; @@ -1211,7 +1372,7 @@ break; default: - HTDebugBreak(__FILE__, __LINE__, "Bad http state %d\n", http->state); + HTDEBUGBREAK("Bad http state %d\n" _ http->state); } } /* End of while(1) */ } diff -Naur xdvik-22.40l/libs/libwww/HTTP.h xdvik-22.40n/libs/libwww/HTTP.h --- xdvik-22.40l/libs/libwww/HTTP.h Wed Apr 18 14:23:23 2001 +++ xdvik-22.40n/libs/libwww/HTTP.h Fri Sep 13 00:23:46 2002 @@ -1,4 +1,4 @@ -/* +/* W3C Sample Code Library libwww HTTP Client @@ -89,6 +89,6 @@ - @(#) $Id: HTTP.h,v 1.1.1.1 2001/04/18 14:23:23 stefanulrich Exp $ + @(#) $Id: HTTP.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTPGen.c xdvik-22.40n/libs/libwww/HTTPGen.c --- xdvik-22.40l/libs/libwww/HTTPGen.c Wed Apr 18 14:23:23 2001 +++ xdvik-22.40n/libs/libwww/HTTPGen.c Fri Sep 13 00:23:46 2002 @@ -3,21 +3,25 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTPGen.c,v 1.1.1.1 2001/04/18 14:23:23 stefanulrich Exp $ +** @(#) $Id: HTTPGen.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module implements the output stream for General HTTP headers ** ** History: ** Jan 96 HFN Written +** Fev 02 MKP Added message body and Content-Type/Content-Length +** headers only if this message body is set. +** Mar 08 MKP Bug fix: avoid overflow in linebuf array (at method +** HTTPGenMake, line 218. */ /* Library Includes */ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWCore.h" -#include "WWWMIME.h" -#include "WWWTrans.h" +#include "HTHeader.h" #include "HTTPUtil.h" +#include "HTFormat.h" #include "HTTPReq.h" /* Implements */ #define MIME_VERSION "MIME/1.0" @@ -26,6 +30,8 @@ #define PUTS(s) (*me->target->isa->put_string)(me->target, s) #define PUTBLOCK(b, l) (*me->target->isa->put_block)(me->target, b, l) +#define LINEBUF_LENGTH 256 + struct _HTStream { const HTStreamClass * isa; HTStream * target; @@ -45,7 +51,7 @@ */ PRIVATE int HTTPGenMake (HTStream * me, HTRequest * request) { - char linebuf[256]; /* @@@ */ + char linebuf[LINEBUF_LENGTH]; /* @@@ */ char crlf[3]; HTGnHd gen_mask = HTRequest_gnHd(request); *crlf = CR; *(crlf+1) = LF; *(crlf+2) = '\0'; @@ -123,29 +129,109 @@ PUTBLOCK(linebuf, (int) strlen(linebuf)); } - /* Put out extra information if any */ + /* Put out any extra association values as headers (if any) */ + if (gen_mask & HT_G_EXTRA_HEADERS) { + HTAssocList * cur = HTRequest_extraHeader(request); + if (cur) { + HTAssoc * pres; + while ((pres = (HTAssoc *) HTAssocList_nextObject(cur))) { + char * name = HTAssoc_name(pres); + char * value = HTAssoc_value(pres); + if (name && *name) { + char * ptr = name; + while (*ptr) { + if (isspace(*ptr)) *ptr='_'; + ptr++; + } + PUTS(name); + PUTS(": "); + if (value) { + ptr = value; + while (*ptr) { + if (isspace(*ptr)) *ptr=' '; + ptr++; + } + PUTS(value); + } + PUTBLOCK(crlf, 2); + } + } + } + } + + /* Put out extra information based on streams (if any) */ { HTList * list; BOOL override; if ((list = HTRequest_generator(request, &override))) { HTList *local = list; HTPostCallback *pres; - if (STREAM_TRACE) HTTrace("HTTPGen..... Extra local\n"); + HTTRACE(STREAM_TRACE, "HTTPGen..... Extra local\n"); while ((pres = (HTPostCallback *) HTList_nextObject(local))) (*pres)(request, me->target); } else if (!override && (list = HTHeader_generator())) { HTList *global = list; HTPostCallback *pres; - if (STREAM_TRACE) HTTrace("HTTPGen..... Extra global\n"); + HTTRACE(STREAM_TRACE, "HTTPGen..... Extra global\n"); while ((pres = (HTPostCallback *) HTList_nextObject(global))) (*pres)(request, me->target); } } + +/* @@@ MKP: set here Content-Type and Content-Length only if : +** @@@ - the method has not an entity +** @@@ - the message body is set +*/ +#ifdef HT_EXT + if (!HTMethod_hasEntity(HTRequest_method(request))) + { + char * body = HTRequest_messageBody (request); + HTFormat bodyFormat = HTRequest_messageBodyFormat(request); + long int bodyLength = HTRequest_messageBodyLength(request); + + + if (body && *body) { + if ( bodyLength>0 ) { + HTTRACE(STREAM_TRACE, "HTTPGen..... Adding Content-Length \n"); + sprintf (linebuf,"Content-Length: %ld%c%c", bodyLength, CR,LF); + PUTBLOCK(linebuf, (int) strlen(linebuf)); + } + if ( bodyFormat != NULL ) { + HTTRACE(STREAM_TRACE, "HTTPGen..... Adding Content-Type \n"); + PUTS ("Content-Type: "); + PUTS (HTAtom_name(bodyFormat)); + PUTBLOCK(crlf,2); + } + HT_FREE (body); + } + } +#endif + + + /* Check to see if we are done */ if (me->endHeader) { sprintf(linebuf, "%c%c", CR, LF); /* Blank line means "end" */ PUTBLOCK(linebuf, (int) strlen(linebuf)); } - if (PROT_TRACE)HTTrace("HTTP........ Generating General Headers\n"); + + +/* @@@ MKP: copy message body to the stream only if : +** @@@ - the method has not an entity +** @@@ - the message body is set +*/ +#ifdef HT_EXT + if (!HTMethod_hasEntity(HTRequest_method(request))) + { + char * body = HTRequest_messageBody (request); + if (body && *body) { + HTTRACE(STREAM_TRACE, "HTTPGen..... Adding message body \n"); + PUTBLOCK (body, (int) strlen (body)); + HT_FREE (body); + } + } +#endif + + HTTRACE(PROT_TRACE, "HTTP........ Generating General Headers\n"); return HT_OK; } @@ -195,7 +281,7 @@ PRIVATE int HTTPGen_abort (HTStream * me, HTList * e) { - if (PROT_TRACE) HTTrace("HTTPGen..... ABORTING...\n"); + HTTRACE(PROT_TRACE, "HTTPGen..... ABORTING...\n"); if (me) { if (me->target) (*me->target->isa->abort)(me->target, e); HT_FREE(me); @@ -232,11 +318,15 @@ /* ** For backwards compatibility with HTTP applications that understand ** Connection: Keep-Alive, we send it along. However, we do NOT send - ** it to a proxy as it may confuse HTTP/1.0 proxies + ** it to a proxy as it may confuse HTTP/1.0 proxies. Also we do not + ** send it if the app has set Connection: close */ me->version = version; - if (me->version == HTTP_10 && HTRequest_proxy(request) == NULL) - HTRequest_addConnection(request, "Keep-Alive", ""); + if (me->version == HTTP_10 && HTRequest_proxy(request) == NULL) { + HTAssocList * alist = HTRequest_connection(request); + if (!(alist && HTAssocList_findObject(alist, "close"))) + HTRequest_addConnection(request, "Keep-Alive", ""); + } /* ** Check for any TE headers that are also hop-by-hop diff -Naur xdvik-22.40l/libs/libwww/HTTPGen.h xdvik-22.40n/libs/libwww/HTTPGen.h --- xdvik-22.40l/libs/libwww/HTTPGen.h Wed Apr 18 14:23:23 2001 +++ xdvik-22.40n/libs/libwww/HTTPGen.h Fri Sep 13 00:23:46 2002 @@ -53,6 +53,6 @@ - @(#) $Id: HTTPGen.h,v 1.1.1.1 2001/04/18 14:23:23 stefanulrich Exp $ + @(#) $Id: HTTPGen.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTPReq.c xdvik-22.40n/libs/libwww/HTTPReq.c --- xdvik-22.40l/libs/libwww/HTTPReq.c Sun Jun 24 14:51:48 2001 +++ xdvik-22.40n/libs/libwww/HTTPReq.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTPReq.c,v 1.3 2001/06/24 14:51:48 stefanulrich Exp $ +** @(#) $Id: HTTPReq.c,v 1.3.6.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module implements the output stream for HTTP used for sending ** requests with or without a entity body. @@ -61,7 +61,7 @@ } PUTC(CR); PUTC(LF); - if (PROT_TRACE)HTTrace("HTTP........ Generating HTTP/0.9 Request\n"); + HTTRACE(PROT_TRACE, "HTTP........ Generating HTTP/0.9 Request\n"); return HT_OK; } @@ -99,6 +99,33 @@ if (me->state == 1) { char * abs_location = NULL; char * addr = HTAnchor_physical(anchor); + char * location; + + /* JK: If the application specified a content-location (which is + stored in the request in default put-name!), we use it instead + of the URL that's being saved to. This is like having a user + defined Content-Location */ + location = HTRequest_defaultPutName (request); + if (location) + { + if (HTURL_isAbsolute (location)) + { + char * relative; + relative = HTRelative (location, location); + abs_location = HTParse (relative + 2, addr, PARSE_ALL); + HT_FREE (relative); + } + else + abs_location = HTParse (location, addr, PARSE_ALL); + addr = abs_location; + } + +#if 0 + /* + ** We don't use the content-location any more as it is superseeded + ** by etags and the combination of the two might do more harm than + ** good (The etag is not guaranteed to be unique over multiple URIs) + */ /* ** If we are using a method different from HEAD and GET then use @@ -121,6 +148,7 @@ } } } +#endif /* ** If we are using a proxy or newer versions of HTTP then we can @@ -172,12 +200,14 @@ /* Request Headers */ if (request_mask & HT_C_ACCEPT_TYPE) { + HTFormat format = HTRequest_outputFormat(request); + /* ** If caller has specified a specific output format then use this. ** Otherwise use all the registered converters to generate the ** accept header */ - if (HTRequest_outputFormat(request) == WWW_PRESENT) { + if (format == WWW_PRESENT) { int list; HTList *cur; BOOL first=YES; @@ -203,9 +233,17 @@ } if (!first) PUTBLOCK(crlf, 2); } else { - PUTS("Accept: "); - PUTS(HTAtom_name(HTRequest_outputFormat(request))); - PUTBLOCK(crlf, 2); + + /* + ** If we have an explicit output format then only send + ** this one if not this is an internal libwww format + ** of type www/ + */ + if (!HTMIMEMatch(WWW_INTERNAL, format)) { + PUTS("Accept: "); + PUTS(HTAtom_name(format)); + PUTBLOCK(crlf, 2); + } } } if (request_mask & HT_C_ACCEPT_CHAR) { @@ -384,24 +422,24 @@ PUTS(etag); PUTC('"'); PUTBLOCK(crlf, 2); - if (PROT_TRACE) HTTrace("HTTP........ If-Range using etag `%s\'\n", etag); + HTTRACE(PROT_TRACE, "HTTP........ If-Range using etag `%s\'\n" _ etag); } else if (request_mask & HT_C_IF_MATCH_ANY) { PUTS("If-Match: *"); PUTBLOCK(crlf, 2); - if (PROT_TRACE) HTTrace("HTTP........ If-Match using `*\'\n"); + HTTRACE(PROT_TRACE, "HTTP........ If-Match using `*\'\n"); } else if (request_mask & HT_C_IF_MATCH && etag) { PUTS("If-Match: \""); PUTS(etag); PUTC('"'); PUTBLOCK(crlf, 2); - if (PROT_TRACE) HTTrace("HTTP........ If-Match using etag `%s\'\n", etag); + HTTRACE(PROT_TRACE, "HTTP........ If-Match using etag `%s\'\n" _ etag); } else if (request_mask & HT_C_IF_UNMOD_SINCE) { time_t lm = HTAnchor_lastModified(anchor); if (lm > 0) { PUTS("If-Unmodified-Since: "); PUTS(HTDateTimeStr(&lm, NO)); PUTBLOCK(crlf, 2); - if (PROT_TRACE) HTTrace("HTTP........ If-Unmodified-Since\n"); + HTTRACE(PROT_TRACE, "HTTP........ If-Unmodified-Since `%s\'\n" _ HTDateTimeStr(&lm, NO)); } } @@ -413,13 +451,13 @@ if (request_mask & HT_C_IF_NONE_MATCH_ANY) { PUTS("If-None-Match: *"); PUTBLOCK(crlf, 2); - if (PROT_TRACE) HTTrace("HTTP........ If-None-Match using `*\'\n"); + HTTRACE(PROT_TRACE, "HTTP........ If-None-Match using `*\'\n"); } else if (request_mask & HT_C_IF_NONE_MATCH && etag) { PUTS("If-None-Match: \""); PUTS(etag); PUTC('"'); PUTBLOCK(crlf, 2); - if (PROT_TRACE) HTTrace("HTTP........ If-None-Match `%s\'\n", etag); + HTTRACE(PROT_TRACE, "HTTP........ If-None-Match `%s\'\n" _ etag); } if (request_mask & HT_C_IMS) { time_t lm = HTAnchor_lastModified(anchor); @@ -427,7 +465,7 @@ PUTS("If-Modified-Since: "); PUTS(HTDateTimeStr(&lm, NO)); PUTBLOCK(crlf, 2); - if (PROT_TRACE) HTTrace("HTTP........ If-Modified-Since\n"); + HTTRACE(PROT_TRACE, "HTTP........ If-Modified-Since `%s\'\n" _ HTDateTimeStr(&lm, NO)); } } @@ -496,7 +534,7 @@ PUTS(HTLib_version()); PUTBLOCK(crlf, 2); } - if (PROT_TRACE) HTTrace("HTTP........ Generating HTTP/1.x Request Headers\n"); + HTTRACE(PROT_TRACE, "HTTP........ Generating HTTP/1.x Request Headers\n"); return HT_OK; } @@ -557,7 +595,7 @@ PRIVATE int HTTPRequest_abort (HTStream * me, HTList * e) { - if (PROT_TRACE) HTTrace("HTTPRequest. ABORTING...\n"); + HTTRACE(PROT_TRACE, "HTTPRequest. ABORTING...\n"); /* JK: Added protection against NULL pointers */ if (me) { if (me->target && me->target->isa) diff -Naur xdvik-22.40l/libs/libwww/HTTPReq.h xdvik-22.40n/libs/libwww/HTTPReq.h --- xdvik-22.40l/libs/libwww/HTTPReq.h Wed Apr 18 14:23:24 2001 +++ xdvik-22.40n/libs/libwww/HTTPReq.h Fri Sep 13 00:23:46 2002 @@ -54,7 +54,7 @@ -@(#) $Id: HTTPReq.h,v 1.1.1.1 2001/04/18 14:23:24 stefanulrich Exp $ +@(#) $Id: HTTPReq.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTPRes.c xdvik-22.40n/libs/libwww/HTTPRes.c --- xdvik-22.40l/libs/libwww/HTTPRes.c Wed Apr 18 14:23:24 2001 +++ xdvik-22.40n/libs/libwww/HTTPRes.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTPRes.c,v 1.1.1.1 2001/04/18 14:23:24 stefanulrich Exp $ +** @(#) $Id: HTTPRes.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module implements the output stream for HTTP used for sending ** responces with or without a entity body. It is the server equivalent @@ -73,7 +73,7 @@ if (response_mask & HT_S_WWW_AUTH) { /* @@@ */ } - if(PROT_TRACE)HTTrace("HTTP........ Generating Response Headers\n"); + HTTRACE(PROT_TRACE, "HTTP........ Generating Response Headers\n"); return HT_OK; } @@ -132,7 +132,7 @@ PRIVATE int HTTPResponse_abort (HTStream * me, HTList * e) { if (me->target) (*me->target->isa->abort)(me->target, e); - if (PROT_TRACE) HTTrace("HTTPResponse ABORTING...\n"); + HTTRACE(PROT_TRACE, "HTTPResponse ABORTING...\n"); return HT_ERROR; } diff -Naur xdvik-22.40l/libs/libwww/HTTPRes.h xdvik-22.40n/libs/libwww/HTTPRes.h --- xdvik-22.40l/libs/libwww/HTTPRes.h Wed Apr 18 14:23:24 2001 +++ xdvik-22.40n/libs/libwww/HTTPRes.h Fri Sep 13 00:23:46 2002 @@ -54,7 +54,7 @@ -@(#) $Id: HTTPRes.h,v 1.1.1.1 2001/04/18 14:23:24 stefanulrich Exp $ +@(#) $Id: HTTPRes.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTPServ.c xdvik-22.40n/libs/libwww/HTTPServ.c --- xdvik-22.40l/libs/libwww/HTTPServ.c Wed Apr 18 14:23:24 2001 +++ xdvik-22.40n/libs/libwww/HTTPServ.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTPServ.c,v 1.1.1.1 2001/04/18 14:23:24 stefanulrich Exp $ +** @(#) $Id: HTTPServ.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module implments the HTTP protocol as a state machine ** @@ -16,9 +16,8 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWCore.h" -#include "WWWMIME.h" -#include "WWWStream.h" -#include "WWWTrans.h" +#include "HTHeader.h" +#include "HTMIMERq.h" #include "HTNetMan.h" #include "HTTPUtil.h" #include "HTTPRes.h" @@ -185,13 +184,13 @@ PRIVATE int HTTPReply_free (HTStream * me) { int status = HTTPReply_put_block(me, NULL, 0); - if (STREAM_TRACE) HTTrace("HTTPReply... Freeing server stream\n"); + HTTRACE(STREAM_TRACE, "HTTPReply... Freeing server stream\n"); return status==HT_OK ? (*me->target->isa->_free)(me->target) : status; } PRIVATE int HTTPReply_abort (HTStream * me, HTList * e) { - if (STREAM_TRACE) HTTrace("HTTPReply... ABORTING\n"); + HTTRACE(STREAM_TRACE, "HTTPReply... ABORTING\n"); if (me->target) (*me->target->isa->abort)(me->target, e); HT_FREE(me); return HT_ERROR; @@ -221,7 +220,7 @@ me->request = request; me->http = http; me->target = target; - if (STREAM_TRACE) HTTrace("HTTP Reply.. Stream %p created\n", me); + HTTRACE(STREAM_TRACE, "HTTP Reply.. Stream %p created\n" _ me); return me; } @@ -334,7 +333,7 @@ if (me->target) (*me->target->isa->abort)(me->target, e); HTChunk_delete(me->buffer); HT_FREE(me); - if (PROT_TRACE) HTTrace("HTTPReceive. ABORTING...\n"); + HTTRACE(PROT_TRACE, "HTTPReceive. ABORTING...\n"); return HT_ERROR; } @@ -362,7 +361,7 @@ me->http = http; me->state = EOL_BEGIN; me->buffer = HTChunk_new(128); /* Sufficiant for most URLs */ - if (STREAM_TRACE) HTTrace("HTTP Request Stream %p created\n", me); + HTTRACE(STREAM_TRACE, "HTTP Request Stream %p created\n" _ me); return me; } @@ -385,7 +384,7 @@ ** This is actually state HTTPS_BEGIN, but it can't be in the state ** machine as we need the object first (chicken and egg problem). */ - if (PROT_TRACE) HTTrace("Serv HTTP... on socket %d\n", soc); + HTTRACE(PROT_TRACE, "Serv HTTP... on socket %d\n" _ soc); if ((http = (https_info *) HT_CALLOC(1, sizeof(https_info))) == NULL) HT_OUTOFMEM("HTServHTTP"); http->server = request; @@ -414,7 +413,7 @@ HTRequest * request = HTNet_request(net); if (!net || !request) { - if (PROT_TRACE) HTTrace("Serv HTTP... Invalid argument\n"); + HTTRACE(PROT_TRACE, "Serv HTTP... Invalid argument\n"); return HT_ERROR; } diff -Naur xdvik-22.40l/libs/libwww/HTTPServ.h xdvik-22.40n/libs/libwww/HTTPServ.h --- xdvik-22.40l/libs/libwww/HTTPServ.h Wed Apr 18 14:23:24 2001 +++ xdvik-22.40n/libs/libwww/HTTPServ.h Fri Sep 13 00:23:46 2002 @@ -38,7 +38,7 @@ -@(#) $Id: HTTPServ.h,v 1.1.1.1 2001/04/18 14:23:24 stefanulrich Exp $ +@(#) $Id: HTTPServ.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTPUtil.h xdvik-22.40n/libs/libwww/HTTPUtil.h --- xdvik-22.40l/libs/libwww/HTTPUtil.h Wed Apr 18 14:23:24 2001 +++ xdvik-22.40n/libs/libwww/HTTPUtil.h Fri Sep 13 00:23:46 2002 @@ -55,6 +55,6 @@ - @(#) $Id: HTTPUtil.h,v 1.1.1.1 2001/04/18 14:23:24 stefanulrich Exp $ + @(#) $Id: HTTPUtil.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTeXGen.c xdvik-22.40n/libs/libwww/HTTeXGen.c --- xdvik-22.40l/libs/libwww/HTTeXGen.c Wed Apr 18 14:23:24 2001 +++ xdvik-22.40n/libs/libwww/HTTeXGen.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTeXGen.c,v 1.1.1.1 2001/04/18 14:23:24 stefanulrich Exp $ +** @(#) $Id: HTTeXGen.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This version of the HTML object sends LaTeX to the output stream. ** No attributes are considered in the translation! @@ -58,34 +58,36 @@ PRIVATE char *TeX_names[HTML_ELEMENTS][2] = { { "", "" }, /* HTML_A */ - { "", "" }, /* HTML_ABBREV */ - { "\n\\begin{abstract}\n","\n\\end{abstract}\n"}, /* HTML_ABSTRACT */ + { "", "" }, /* HTML_ABBR */ { "", "" }, /* HTML_ACRONYM */ - { "", "" }, /* HTML_ADDED */ { "{\\it ", "}" }, /* HTML_ADDRESS */ + { "", "" }, /* HTML_APPLET */ { "", "" }, /* HTML_AREA */ - { "", "" }, /* HTML_ARG */ { "{\\bf ", "}" }, /* HTML_B */ { "", "" }, /* HTML_BASE */ + { "", "" }, /* HTML_BASEFONT */ + { "", "" }, /* HTML_BDO */ + { "", "" }, /* HTML_BIG */ { "{\\sf ", "}" }, /* HTML_BLOCKQUOTE */ { "", "" }, /* HTML_BODY */ - { "", "" }, /* HTML_BOX */ { "", "" }, /* HTML_BR */ - { "", "" }, /* HTML_BYLINE */ + { "", "" }, /* HTML_BUTTON */ { "", "" }, /* HTML_CAPTION */ - { "", "" }, /* HTML_CHANGED */ + { "", "" }, /* HTML_CENTER */ { "\\cite{", "}" }, /* HTML_CITE */ - { "", "" }, /* HTML_CMD */ { "{\\tt ", "}" }, /* HTML_CODE */ - { "\n\\typeout{", "}\n" }, /* HTML_COMMENT */ + { "", "" }, /* HTML_COL */ + { "", "" }, /* HTML_COLGROUP */ { "]", "" }, /* HTML_DD */ + { "", "" }, /* HTML_DEL */ { "", "" }, /* HTML_DFN */ { "", "" }, /* HTML_DIR */ + { "", "" }, /* HTML_DIV */ { "\n\\begin{description}","\n\\end{description}\n"}, /* HTML_DL */ { "\n\\item[", "" }, /* HTML_DT */ { "{\\em ", "}" }, /* HTML_EM */ - { "", "" }, /* HTML_FIG */ - { "\n\\footnote{", "}\n" }, /* HTML_FOOTNOTE */ + { "", "" }, /* HTML_FIELDSET */ + { "", "" }, /* HTML_FONT */ { "", "" }, /* HTML_FORM */ { "", "" }, /* HTML_FRAME */ { "", "" }, /* HTML_FRAMESET */ @@ -95,57 +97,58 @@ { "\n\\subsubsection{","}\n" }, /* HTML_H4 */ { "\n\\paragraph{", "}\n" }, /* HTML_H5 */ { "\n\\subparagraph{","}\n" }, /* HTML_H6 */ - { "", "\n" }, /* HTML_H7 */ { "", "" }, /* HTML_HEAD */ { "", "" }, /* HTML_HR */ { "", "" }, /* HTML_HTML */ - { "", "" }, /* HTML_HTMLPLUS */ { "{\\it ", "}" }, /* HTML_I */ - { "", "" }, /* HTML_IMAGE */ + { "", "" }, /* HTML_IFRAME */ { "_FIGUR_", "" }, /* HTML_IMG */ { "", "" }, /* HTML_INPUT */ + { "", "" }, /* HTML_INS */ { "", "" }, /* HTML_ISINDEX */ { "{\\tt ", "}" }, /* HTML_KBD */ - { "", "" }, /* HTML_L */ + { "", "" }, /* HTML_LABEL */ + { "", "" }, /* HTML_LEGEND */ { "\n\\item ", "" }, /* HTML_LI */ { "", "" }, /* HTML_LINK */ - { "", "" }, /* HTML_LISTING */ - { "", "" }, /* HTML_LIT */ - { "", "" }, /* HTML_MARGIN */ - { "", "" }, /* HTML_MATH */ + { "", "" }, /* HTML_MAP */ { "", "" }, /* HTML_MENU */ + { "", "" }, /* HTML_META */ { "", "" }, /* HTML_NEXTID */ - { "", "" }, /* HTML_NOTE */ + { "", "" }, /* HTML_NOFRAME */ + { "", "" }, /* HTML_NOSCRIPT */ { "", "" }, /* HTML_OBJECT */ { "\n\\begin{enumerate}\n","\n\\end{enumerate}\n"}, /* HTML_OL */ + { "", "" }, /* HTML_OPTGROUP */ { "", "" }, /* HTML_OPTION */ - { "", "" }, /* HTML_OVER */ { "\n\n", "" }, /* HTML_P */ - { "", "" }, /* HTML_PERSON */ - { "", "" }, /* HTML_PLAINTEXT */ + { "", "" }, /* HTML_PARAM */ { "\n\\begin{verbatim}"," \\end{verbatim}\n"}, /* HTML_PRE */ { "", "" }, /* HTML_Q */ - { "\\begin{quote}", "\\end{quote}"}, /* HTML_QUOTE */ - { "", "" }, /* HTML_RENDER */ - { "", "" }, /* HTML_REMOVED */ { "", "" }, /* HTML_S */ { "", "" }, /* HTML_SAMP */ + { "", "" }, /* HTML_SCRIPT */ { "", "" }, /* HTML_SELECT */ + { "", "" }, /* HTML_SMALL */ + { "", "" }, /* HTML_SPAN */ + { "", "" }, /* HTML_STRIKE */ { "{\\bf ", "}" }, /* HTML_STRONG */ + { "", "" }, /* HTML_STYLE */ { "", "" }, /* HTML_SUB */ { "", "" }, /* HTML_SUP */ - { "", "" }, /* HTML_TAB */ { "", "" }, /* HTML_TABLE */ + { "", "" }, /* HTML_TBODY */ { "", "" }, /* HTML_TD */ { "", "" }, /* HTML_TEXTAREA */ + { "", "" }, /* HTML_TFOOT */ { "", "" }, /* HTML_TH */ + { "", "" }, /* HTML_THEAD */ { "\n\\title{", "}\n\\author{}\n\\maketitle\n"}, /* HTML_TITLE */ { "", "" }, /* HTML_TR */ { "", "" }, /* HTML_TT */ { "", "" }, /* HTML_U */ { "\n\\begin{itemize}","\n\\end{itemize}\n"}, /* HTML_UL */ - { "", "" }, /* HTML_VAR */ - { "{\\sf ", "}" } /* HTML_XMP */ + { "", "" } /* HTML_VAR */ }; PRIVATE char *TeX_entities[HTML_ENTITIES] = { @@ -354,8 +357,7 @@ { me->startup = YES; /* Now, let's get down to it */ if (me->preformatted == YES) { /* Don't start markup in here */ - if (WWWTRACE) - HTTrace("LaTeX....... No Markup in verbatim mode\n"); + HTTRACE(SGML_TRACE, "LaTeX....... No Markup in verbatim mode\n"); return; } if (element_number == HTML_PRE) @@ -368,7 +370,6 @@ element_number == HTML_H4 || element_number == HTML_H5 || element_number == HTML_H6 || - element_number == HTML_H7 || element_number == HTML_TITLE) me->sensitive = YES; else if (element_number == HTML_DD) /* Only way to turn
    off */ @@ -388,8 +389,7 @@ PRIVATE void HTTeXGen_end_element (HTStructured * me, int element_number) { if (me->preformatted && element_number != HTML_PRE) { - if (WWWTRACE) - HTTrace("LaTeX....... No markup in verbatim mode\n"); + HTTRACE(SGML_TRACE, "LaTeX....... No markup in verbatim mode\n"); return; } me->preformatted = NO; @@ -404,7 +404,6 @@ element_number == HTML_H4 || element_number == HTML_H5 || element_number == HTML_H6 || - element_number == HTML_H7 || element_number == HTML_TITLE) me->sensitive = NO; } diff -Naur xdvik-22.40l/libs/libwww/HTTeXGen.h xdvik-22.40n/libs/libwww/HTTeXGen.h --- xdvik-22.40l/libs/libwww/HTTeXGen.h Wed Apr 18 14:23:24 2001 +++ xdvik-22.40n/libs/libwww/HTTeXGen.h Fri Sep 13 00:23:46 2002 @@ -52,7 +52,7 @@ -@(#) $Id: HTTeXGen.h,v 1.1.1.1 2001/04/18 14:23:24 stefanulrich Exp $ +@(#) $Id: HTTeXGen.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTee.c xdvik-22.40n/libs/libwww/HTTee.c --- xdvik-22.40l/libs/libwww/HTTee.c Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTee.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTee.c,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ +** @(#) $Id: HTTee.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** The Tee class just writes to two streams. Easy. ** See also the Black Hole stream which is even easier. @@ -133,9 +133,8 @@ me->s1 = s1 ? s1 : HTBlackHole(); me->s2 = s2 ? s2 : HTBlackHole(); me->resolver = resolver ? resolver : default_resolver; - if (STREAM_TRACE) - HTTrace("Tee......... Created stream %p with resolver %p\n", - me, me->resolver); + HTTRACE(STREAM_TRACE, "Tee......... Created stream %p with resolver %p\n" _ + me _ me->resolver); return me; } diff -Naur xdvik-22.40l/libs/libwww/HTTee.h xdvik-22.40n/libs/libwww/HTTee.h --- xdvik-22.40l/libs/libwww/HTTee.h Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTee.h Fri Sep 13 00:23:46 2002 @@ -49,7 +49,7 @@ -@(#) $Id: HTTee.h,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ +@(#) $Id: HTTee.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTelnet.c xdvik-22.40n/libs/libwww/HTTelnet.c --- xdvik-22.40l/libs/libwww/HTTelnet.c Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTelnet.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTelnet.c,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ +** @(#) $Id: HTTelnet.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Authors ** TBL Tim Berners-Lee timbl@w3.org @@ -81,7 +81,7 @@ /* We must be in interactive mode */ if (!HTAlert_interactive()) { - if (PROT_TRACE) HTTrace("Telnet...... Not interactive\n"); + HTTRACE(PROT_TRACE, "Telnet...... Not interactive\n"); HT_FREE(access); HT_FREE(host); HTChunk_delete(cmd); @@ -206,15 +206,13 @@ #endif /* MULTINET */ } else { - if (PROT_TRACE) - HTTrace("Telnet...... Unknown access method: `%s\'\n", + HTTRACE(PROT_TRACE, "Telnet...... Unknown access method: `%s\'\n" _ access); status = HT_ERROR; } /* Now we are ready to execute the command */ - if (PROT_TRACE) - HTTrace("Telnet...... Command is `%s\'\n", cmd->data); + HTTRACE(PROT_TRACE, "Telnet...... Command is `%s\'\n" _ HTChunk_data(cmd)); if (user) { HTChunk *msg = HTChunk_new(128); if (strcasecomp(access, "rlogin")) { @@ -259,7 +257,7 @@ HTParentAnchor * anchor = HTRequest_anchor(request); char * url = HTAnchor_physical(anchor); - if (PROT_TRACE) HTTrace("Telnet...... Looking for `%s\'\n",url); + HTTRACE(PROT_TRACE, "Telnet...... Looking for `%s\'\n" _ url); HTNet_setEventCallback(net, TelnetEvent); HTNet_setEventParam(net, net); /* callbacks get http* */ diff -Naur xdvik-22.40l/libs/libwww/HTTelnet.h xdvik-22.40n/libs/libwww/HTTelnet.h --- xdvik-22.40l/libs/libwww/HTTelnet.h Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTelnet.h Fri Sep 13 00:23:46 2002 @@ -35,7 +35,7 @@ -@(#) $Id: HTTelnet.h,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ +@(#) $Id: HTTelnet.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTimer.c xdvik-22.40n/libs/libwww/HTTimer.c --- xdvik-22.40l/libs/libwww/HTTimer.c Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTimer.c Fri Sep 13 00:23:46 2002 @@ -1,17 +1,15 @@ -/* HTEvntrg.c -** EVENT MANAGER +/* +** TIMER MANAGER ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTimer.c,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ +** @(#) $Id: HTTimer.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** -** Updated HTEvent module -** This new module combines the functions of the old HTEvent module and -** the HTThread module. We retain the old HTThread module, but it -** consists of calls to the HTEvent interfaces +** Timers based on the X server timers ** ** Authors: ** EGP Eric Prud'hommeaux (eric@w3.org) +** HFN Henrik Frystyk Nielsen ** Bugs ** */ @@ -37,11 +35,11 @@ PRIVATE HTTimerSetCallback * SetPlatformTimer = NULL; PRIVATE HTTimerSetCallback * DeletePlatformTimer = NULL; -#if 0 /* WATCH_RECURSION */ +#ifdef WATCH_RECURSION PRIVATE HTTimer * InTimer = NULL; -#define CHECKME(timer) if (InTimer != NULL) HTDebugBreak(__FILE__, __LINE__, "\n"); InTimer = timer; -#define CLEARME(timer) if (InTimer != timer) HTDebugBreak(__FILE, __LINE__, "\n"); InTimer = NULL; +#define CHECKME(timer) if (InTimer != NULL) HTDEBUGBREAK("check timer\n"); InTimer = timer; +#define CLEARME(timer) if (InTimer != timer) HTDEBUGBREAK("clear timer\n"); InTimer = NULL; #define SETME(timer) InTimer = timer; #else /* WATCH_RECURSION */ @@ -51,11 +49,78 @@ #define SETME(timer) #endif /* !WATCH_RECURSION */ + +/* JK: used by Amaya */ +PUBLIC BOOL HTTimer_expireAll (void) +{ + HTList * cur; + HTTimer * timer; + if (Timers) { + /* + ** first delete all plattform specific timers to + ** avoid having a concurrent callback + */ + cur = Timers; + while ((timer = (HTTimer *) HTList_nextObject(cur))) { + if (DeletePlatformTimer) DeletePlatformTimer(timer); + } + + /* + ** simulate a timer timeout thru timer_dispatch + ** to kill its context + */ + cur = Timers; + while ((timer = (HTTimer *) HTList_nextObject(cur))) { + /* avoid having it being refreshed */ + timer->repetitive = NO; + HTTimer_dispatch (timer); + /* as the timer is erased, we start again from the top of the list */ + cur = Timers; + } + return YES; + } + return NO; +} + /* ------------------------------------------------------------------------- */ +/* +** When a timer has expired, we dispatch the event handler and re-register the +** timer with the next expiration time if repetitive. Otherwise we just leave +** it +*/ +PRIVATE int Timer_dispatch (HTList * cur, HTList * last) +{ + HTTimer * timer; + int ret = HT_ERROR; + + timer = (HTTimer *)HTList_objectOf(cur); + if (timer == NULL) { +#if 0 + HTDEBUGBREAK("Timer dispatch couldn't find a timer\n"); +#endif + CLEARME(timer); + return HT_ERROR; + } +#ifdef WWW_WIN_ASYNC + /* 2000/07/31 Jens Meggers (meggers@firepad.com): + On Windows, timers are always repetitive, so we have to delete the + timer */ + if (DeletePlatformTimer) + DeletePlatformTimer(timer); +#endif /* WWW_WIN_ASYNC */ + if (timer->repetitive) + HTTimer_new(timer, timer->cbf, timer->param, timer->millis, YES, YES); + else + HTList_quickRemoveElement(cur, last); + HTTRACE(THD_TRACE, "Timer....... Dispatch timer %p\n" _ timer); + ret = (*timer->cbf) (timer, timer->param, HTEvent_TIMEOUT); + return ret; +} + PUBLIC BOOL HTTimer_registerSetTimerCallback (HTTimerSetCallback * cbf) { - if (CORE_TRACE) HTTrace("Timer....... registering %p as timer set cbf\n", cbf); + HTTRACE(CORE_TRACE, "Timer....... registering %p as timer set cbf\n" _ cbf); if (cbf) { SetPlatformTimer = cbf; return YES; @@ -65,7 +130,7 @@ PUBLIC BOOL HTTimer_registerDeleteTimerCallback (HTTimerSetCallback * cbf) { - if (CORE_TRACE) HTTrace("Timer....... registering %p as timer delete cbf\n", cbf); + HTTRACE(CORE_TRACE, "Timer....... registering %p as timer delete cbf\n" _ cbf); if (cbf) { DeletePlatformTimer = cbf; return YES; @@ -73,11 +138,24 @@ return NO; } -PUBLIC ms_t HTTimer_getTime(HTTimer * timer) +PUBLIC ms_t HTTimer_expiresRelative (HTTimer * timer) +{ + return timer ? timer->millis : 0; +} + +PUBLIC ms_t HTTimer_expiresAbsolute (HTTimer * timer) { - if (timer) - return timer->millis; - return 0; + return timer ? timer->expires : 0; +} + +PUBLIC HTTimerCallback * HTTimer_callback (HTTimer * timer) +{ + return timer ? timer->cbf : NULL; +} + +PUBLIC BOOL HTTimer_isRelative (HTTimer * timer) +{ + return timer ? timer->relative : NO; } PUBLIC BOOL HTTimer_delete (HTTimer * timer) @@ -85,14 +163,11 @@ HTList * last; HTList * cur; CHECKME(timer); - if ((cur = HTList_elementOf(Timers, (void *)timer, &last)) == NULL) { - CLEARME(timer); - return NO; - } + if ((cur = HTList_elementOf(Timers, (void *)timer, &last)) == NULL) CLEARME(timer); if (HTList_quickRemoveElement(cur, last)) { - if (THD_TRACE) HTTrace("Timer....... Deleted timer %p\n", timer); + HTTRACE(THD_TRACE, "Timer....... Deleted active timer %p\n" _ timer); } else { - if (THD_TRACE) HTTrace("Timer....... Could not delete timer %p\n", timer); + HTTRACE(THD_TRACE, "Timer....... Deleted expired timer %p\n" _ timer); } /* @@ -130,14 +205,13 @@ /* if a timer is specified, it should already exist */ if ((cur = HTList_elementOf(Timers, (void *)timer, &last)) == NULL) { - HTDebugBreak(__FILE__, __LINE__, "Timer %p not found\n", timer); + HTDEBUGBREAK("Timer %p not found\n" _ timer); CLEARME(timer); return NULL; } HTList_quickRemoveElement(cur, last); - if (THD_TRACE) - HTTrace("Timer....... Found timer %p with callback %p, context %p, and %s timeout %d\n", - timer, cbf, param, relative ? "relative" : "absolute", millis); + HTTRACE(THD_TRACE, "Timer....... Found timer %p with callback %p, context %p, and %s timeout %d\n" _ + timer _ cbf _ param _ relative ? "relative" : "absolute" _ millis); /* could optimize by sorting from last when ((HTList *)(last->object))->expires < expires (most common case) */ } else { @@ -146,11 +220,10 @@ if ((timer = (HTTimer *) HT_CALLOC(1, sizeof(HTTimer))) == NULL) HT_OUTOFMEM("HTTimer_new"); last = Timers; - if (THD_TRACE) - HTTrace("Timer....... Created %s timer %p with callback %p, context %p, and %s timeout %d\n", - repetitive ? "repetitive" : "one shot", - timer, cbf, param, - relative ? "relative" : "absolute", millis); + HTTRACE(THD_TRACE, "Timer....... Created %s timer %p with callback %p, context %p, and %s timeout %d\n" _ + repetitive ? "repetitive" : "one shot" _ + timer _ cbf _ param _ + relative ? "relative" : "absolute" _ millis); } /* @@ -163,7 +236,7 @@ /* ** If the expiration is 0 then we still register it but dispatch it immediately. */ - if (!millis) if (THD_TRACE) HTTrace("Timer....... Timeout is 0 - expires NOW\n"); + if (!millis) HTTRACE(THD_TRACE, "Timer....... Timeout is 0 - expires NOW\n"); timer->expires = expires; timer->cbf = cbf; @@ -176,25 +249,15 @@ /* ** add to list if timer is new */ - HTList_addObject(last, (void *)timer); + cur = HTList_addList(last, (void *)timer); /* ** Call any platform specific timer handler */ if (SetPlatformTimer) SetPlatformTimer(timer); - /* - ** Check if the timer object has already expired - */ - if (timer->expires <= now) { - int status; - if ((status = (*timer->cbf)(timer, timer->param, HTEvent_TIMEOUT)) != HT_OK) { - if (cur) HTList_quickRemoveElement(cur, last); - CLEARME(timer); - HT_FREE(timer); - return NULL; - } - } + /* Check if the timer object has already expired. If so then dispatch */ + if (timer->expires <= now) Timer_dispatch(cur, last); CLEARME(timer); return timer; @@ -230,49 +293,12 @@ return NO; } -/* -** When a timer has expired, we dispatch the event handler and re-register the -** timer with the next expiration time. -*/ -PRIVATE int Timer_dispatch (HTList * cur, HTList * last, int now) -{ - HTTimer * timer; - int ret = HT_ERROR; - - timer = (HTTimer *)HTList_objectOf(cur); - if (timer == NULL) { -#if 0 - HTDebugBreak(__FILE__, __LINE__, "Timer dispatch couldn't find a timer\n"); -#endif - CLEARME(timer); - return HT_ERROR; - } - if (timer->repetitive) - HTTimer_new(timer, timer->cbf, timer->param, timer->millis, YES, YES); - else - HTList_quickRemoveElement(cur, last); - if (THD_TRACE) HTTrace("Timer....... Dispatch timer %p\n", timer); - ret = (*timer->cbf) (timer, timer->param, HTEvent_TIMEOUT); - - /* - ** If not repetitive then call any platform specific timer handler - ** and delete the timer - */ - if (!timer->repetitive) { - if (DeletePlatformTimer) DeletePlatformTimer(timer); - HT_FREE(timer); - } - return ret; -} - PUBLIC int HTTimer_dispatch (HTTimer * timer) { HTList * cur; HTList * last = Timers; - ms_t now = HTGetTimeInMillis(); - cur = HTList_elementOf(Timers, (void *)timer, &last); - return Timer_dispatch(cur, last, now); + return Timer_dispatch(cur, last); } /* @@ -291,39 +317,17 @@ ms_t now = HTGetTimeInMillis(); int ret = HT_OK; -#if 0 - if (Timers == NULL) return HT_OK; - /* The Timers list may be modified during a dispatch - ** so we have to build an intermediate list - */ - head = last = HTList_new(); - cur = Timers; - while ((pres = (HTTimer *) HTList_nextObject(cur)) && pres->expires <= now) { - HTList_addObject(last, (void *)pres); - last = HTList_nextObject(last); - } - - /* - ** Now dispatch the intermediate list - */ - cur = last = head; - while ((pres = (HTTimer *) HTList_nextObject(cur)) && ret == HT_OK) { - ret = Timer_dispatch(cur, last, now); - last = cur; - } -#else /* ** Dispatch all timers that have expired */ while (Timers && (pres = (HTTimer *) HTList_nextObject(cur))) { if (pres->expires <= now) { - if ((ret = Timer_dispatch(cur, last, now)) != HT_OK) break; + if ((ret = Timer_dispatch(cur, last)) != HT_OK) break; cur = last = Timers; } else { last = cur; } } -#endif if (pSoonest) { /* @@ -347,3 +351,5 @@ } } #endif + + diff -Naur xdvik-22.40l/libs/libwww/HTTimer.h xdvik-22.40n/libs/libwww/HTTimer.h --- xdvik-22.40l/libs/libwww/HTTimer.h Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTimer.h Fri Sep 13 00:23:46 2002 @@ -15,9 +15,32 @@ /* -The Timer class handles timer for libwww and the application. This works +The Timer class handles timers for libwww and the application. This works exactly as in X where you create a timer object with a callback function and a timeout. The callback will be called every time the timer expires. +There are several timeouts that can be set in libwww: + + o + The time we keep an idle persistent connection open. Here there are in fact + two mechanisms depending on whether you use blocking or non-blocking sockets. + The default is 60 secs. The timers can be accessed using the functions defined + in the HTHost object + o + The idle time we want to wait when receiving a response from a server, that + is, if it doesn't send anything in a number of secs. The default here is + no timeout. It can be accessed in the + HTHost object as well. + o + The timeout before we flush pending requests in a pipeline, the default here + is 30 ms. It is also accessed in the HTHost + object + o + The timeout before we start sending the body of a PUT or + POST request. Normally we send the Expect: 100-continue + header field but if the server doesn't send back a 100 Continue + code then we upload the body anyway. The default is 2 secs and can be accessed + in the HTTP module. + */ #ifndef HTTIMER_H @@ -26,16 +49,16 @@ #include "wwwsys.h" #include "HTReq.h" -#ifndef IN_EVENT typedef struct _HTTimer HTTimer; -#endif typedef int HTTimerCallback (HTTimer *, void *, HTEventType type); /* -( +. Create and Delete Timers -) +. + +The callback function is the function that is to be called when timer expires. */ extern HTTimer * HTTimer_new (HTTimer *, HTTimerCallback *, @@ -43,8 +66,28 @@ BOOL relative, BOOL repetitive); extern BOOL HTTimer_delete (HTTimer * timer); extern BOOL HTTimer_deleteAll (void); +extern BOOL HTTimer_expireAll (void); + +/* +. + Dispatch Timer +. + +Just do it +*/ + extern int HTTimer_dispatch (HTTimer * timer); -extern ms_t HTTimer_getTime(HTTimer * timer); + +/* +( + Get the next timer in line +) + +Dispatches all expired timers and optionally returns the time till the next +one. +*/ + +extern int HTTimer_next (ms_t * pSoonest); /* ( @@ -55,8 +98,33 @@ extern BOOL HTTimer_refresh(HTTimer * timer, ms_t now); /* +. + Get Information about a Timer Object +. +( + Absolute Time when This Timer Expires +) + +Absolute time in millies when this timer will expire +*/ + +extern ms_t HTTimer_expiresAbsolute (HTTimer * timer); + +/* +( + Relative Time this Timer is running +) + +Gived the relative time in millies that this timer was registered with. For +example, a relative timer set to expire in 20ms will return 20. +*/ + +#define HTTimer_getTime(t) HTTimer_expiresRelative(t) +extern ms_t HTTimer_expiresRelative (HTTimer * timer); + +/* ( - Has this timer Expired? + Has this Timer Expired? ) If so then it's time to call the dispatcher! @@ -66,8 +134,24 @@ /* ( - Platform Specific Timers + What callback is this Timer Registered with? ) +*/ + +extern HTTimerCallback * HTTimer_callback (HTTimer * timer); + +/* +( + Is this Time relative or Absolute? +) +*/ + +extern BOOL HTTimer_isRelative (HTTimer * timer); + +/* +. + Platform Specific Timers +. On some platform, timers are supported via events or other OS specific mechanisms. You can make libwww can support these by registering a platform @@ -80,17 +164,6 @@ extern BOOL HTTimer_registerDeleteTimerCallback (HTTimerSetCallback * cbf); /* -( - Get the next timer in line -) - -Dispatches all expired timers and optionally returns the time till the next -one. -*/ - -extern int HTTimer_next (ms_t * pSoonest); - -/* */ #endif /* HTTIMER_H */ @@ -99,6 +172,6 @@ - @(#) $Id: HTTimer.h,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ + @(#) $Id: HTTimer.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTTrace.c xdvik-22.40n/libs/libwww/HTTrace.c --- xdvik-22.40l/libs/libwww/HTTrace.c Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTrace.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1996. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTrace.c,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ +** @(#) $Id: HTTrace.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** 26 Nov 96 (EGP) moved HTTrace stuff here from HTString.c and ** added HTTrace_data @@ -25,8 +25,11 @@ PUBLIC unsigned int WWW_TraceFlag = 0; /* Global trace flag for ALL W3 code */ #endif -#if TRACECALLBACK PRIVATE HTTraceCallback * PHTTraceCallback = NULL; +PRIVATE HTPrintCallback * PHTPrintCallback = NULL; +PRIVATE HTTraceDataCallback * PHTTraceDataCallback = NULL; + +/* ------------------------------------------------------------------------- */ PUBLIC void HTTrace_setCallback (HTTraceCallback * pCall) { @@ -37,16 +40,13 @@ { return PHTTraceCallback; } -#endif PUBLIC int HTTrace (const char * fmt, ...) { va_list pArgs; va_start(pArgs, fmt); -#if TRACECALLBACK if (PHTTraceCallback) return (*PHTTraceCallback)(fmt, pArgs); -#endif #ifdef WWW_WIN_WINDOW return (0); #else @@ -54,8 +54,6 @@ #endif } -PRIVATE HTTraceDataCallback * PHTTraceDataCallback = NULL; - PUBLIC void HTTraceData_setCallback (HTTraceDataCallback * pCall) { PHTTraceDataCallback = pCall; @@ -75,6 +73,29 @@ return (0); } +PUBLIC void HTPrint_setCallback (HTPrintCallback * pCall) +{ + PHTPrintCallback = pCall; +} + +PUBLIC HTPrintCallback * HTPrint_getCallback (void) +{ + return PHTPrintCallback; +} + +PUBLIC int HTPrint (const char * fmt, ...) +{ + va_list pArgs; + va_start(pArgs, fmt); + if (PHTPrintCallback) + return (*PHTPrintCallback)(fmt, pArgs); +#ifdef WWW_WIN_WINDOW + return (0); +#else + return (vfprintf(stdout, fmt, pArgs)); +#endif +} + PUBLIC void HTDebugBreak (char * file, unsigned long line, const char * fmt, ...) { va_list pArgs; diff -Naur xdvik-22.40l/libs/libwww/HTTrans.c xdvik-22.40n/libs/libwww/HTTrans.c --- xdvik-22.40l/libs/libwww/HTTrans.c Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTrans.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTTrans.c,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ +** @(#) $Id: HTTrans.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** HISTORY: ** Marts 96 HFN Written @@ -42,9 +42,9 @@ tp->input_new = get_input; tp->output_new = get_output; if (!transports) transports = HTList_new(); - if (CORE_TRACE) HTTrace("Transport... Adding `%s'\n", name); + HTTRACE(CORE_TRACE, "Transport... Adding `%s'\n" _ name); return HTList_addObject(transports, (void *) tp); - } else if (CORE_TRACE) HTTrace("Transport... Can't add this...\n"); + } else HTTRACE(CORE_TRACE, "Transport... Can't add this...\n"); return NO; } @@ -58,8 +58,10 @@ HTTransport *pres; while ((pres = (HTTransport *) HTList_nextObject(cur))) { if (!strcmp(pres->name, name)) { + BOOL status = HTList_removeObject(transports, (void *) pres); HT_FREE(pres->name); - return HTList_removeObject(transports, (void *) pres); + HT_FREE(pres); + return status; } } } diff -Naur xdvik-22.40l/libs/libwww/HTTrans.h xdvik-22.40n/libs/libwww/HTTrans.h --- xdvik-22.40l/libs/libwww/HTTrans.h Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTTrans.h Fri Sep 13 00:23:46 2002 @@ -43,7 +43,7 @@ . All transport interfaces are registered dynamically in libwww. This means -that libwww is independent of the transport being used (for example TCP) +that libwww is independent of the transport being used (TCP, for example), and you can therefore use libwww in any context you like. You have to specify a set of parameters in order for libwww to be able to use it. The transport class is defined as follows: @@ -148,6 +148,6 @@ - @(#) $Id: HTTrans.h,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ + @(#) $Id: HTTrans.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTUTree.c xdvik-22.40n/libs/libwww/HTUTree.c --- xdvik-22.40l/libs/libwww/HTUTree.c Wed Apr 18 14:23:25 2001 +++ xdvik-22.40n/libs/libwww/HTUTree.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTUTree.c,v 1.1.1.1 2001/04/18 14:23:25 stefanulrich Exp $ +** @(#) $Id: HTUTree.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** AUTHORS: ** HFN Henrik Frystyk Nielsen @@ -27,7 +27,6 @@ #include "HTUTree.h" /* Implemented here */ #define TREE_TIMEOUT 43200L /* Default tree timeout is 12 h */ -#define HASH_SIZE 101 /* Arbitrary prime */ struct _HTUTree { /* Server URL info base */ char * name; @@ -102,8 +101,7 @@ HTURealm * pres; while ((pres = (HTURealm *) HTList_nextObject(cur))) { if (!strcmp(pres->realm, realm)) { - if (CORE_TRACE) - HTTrace("URL Node.... Realm `%s\' found\n", realm); + HTTRACE(CORE_TRACE, "URL Node.... Realm `%s\' found\n" _ realm); return pres; } } @@ -153,9 +151,8 @@ HTList * cur = tree->templates; while ((pres = (HTUTemplate *) HTList_nextObject(cur))) { if (HTStrMatch(pres->tmplate, path)) { - if (CORE_TRACE) - HTTrace("URL Node.... Found template `%s\' for for `%s\'\n", - pres->tmplate, path); + HTTRACE(CORE_TRACE, "URL Node.... Found template `%s\' for for `%s\'\n" _ + pres->tmplate _ path); return pres; } } @@ -179,7 +176,7 @@ HTUTemplate * tm = HTUTree_findTemplate(tree, path); if (tm) return tm->rm_ptr ? tm->rm_ptr->context : NULL; } - if (CORE_TRACE) HTTrace("URL Node.... Not found\n"); + HTTRACE(CORE_TRACE, "URL Node.... Not found\n"); return NULL; } @@ -201,8 +198,7 @@ HTUTree_newRealm(tree, realm, context); return YES; } - if (CORE_TRACE) - HTTrace("URL Node.... At least realm must be present\n"); + HTTRACE(CORE_TRACE, "URL Node.... At least realm must be present\n"); } return NO; } @@ -224,7 +220,7 @@ rm->context = context; return YES; } - if (CORE_TRACE) HTTrace("URL Node.... Not found\n"); + HTTRACE(CORE_TRACE, "URL Node.... Not found\n"); return NO; } @@ -287,18 +283,19 @@ HTUTree * pres = NULL; *hashlist = NULL; if (!name || !host) { - if (CORE_TRACE) HTTrace("URL Tree.... Bad argument\n"); + HTTRACE(CORE_TRACE, "URL Tree.... Bad argument\n"); return NULL; } /* Find a hash for this host */ { - int hash = 0; - const char * ptr; - for (ptr=host; *ptr; ptr++) - hash = (int) ((hash * 3 + (*(unsigned char *) ptr)) % HASH_SIZE); + int hash; + const unsigned char * p; + for (p=host, hash=0; *p; p++) { + hash = (hash * 3 + *p) % HT_L_HASH_SIZE; + } if (!InfoTable) { - if ((InfoTable = (HTList **) HT_CALLOC(HASH_SIZE, + if ((InfoTable = (HTList **) HT_CALLOC(HT_L_HASH_SIZE, sizeof(HTList *))) == NULL) HT_OUTOFMEM("HTUTree_find"); } @@ -315,8 +312,7 @@ if (!strcmp(pres->name, name) && !strcmp(pres->host, host) && pres->port==port) { if (time(NULL) > pres->created + UTreeTimeout) { - if (CORE_TRACE) - HTTrace("URL Tree.... Collecting URL Tree %p\n", pres); + HTTRACE(CORE_TRACE, "URL Tree.... Collecting URL Tree %p\n" _ pres); HTList_removeObject(*hashlist, pres); delete_tree(pres); pres = NULL; @@ -355,15 +351,15 @@ /* Add the new URL tree to the hash table */ HTList_addObject(hashlist, (void *) pres); - if (CORE_TRACE)HTTrace("URL Tree.... Created %p with name `%s\'\n", - pres, pres->name); + HTTRACE(CORE_TRACE, "URL Tree.... Created %p with name `%s\'\n" _ + pres _ pres->name); } else { - if (CORE_TRACE) HTTrace("URL Tree.... Found %p with name `%s\'\n", - pres, pres->name); + HTTRACE(CORE_TRACE, "URL Tree.... Found %p with name `%s\'\n" _ + pres _ pres->name); } return pres; } else { - if (CORE_TRACE) HTTrace("URL Tree.... Bad argument\n"); + HTTRACE(CORE_TRACE, "URL Tree.... Bad argument\n"); return NULL; } } @@ -378,11 +374,11 @@ if (name && host) { HTList * hashlist = NULL; HTUTree * pres = find_tree(name, host, port, &hashlist); - if (CORE_TRACE) HTTrace("URL Tree.... did %sfind `%s\'\n", - pres ? "" : "NOT ", name); + HTTRACE(CORE_TRACE, "URL Tree.... did %sfind `%s\'\n" _ + pres ? "" : "NOT " _ name); return pres; } else { - if (CORE_TRACE) HTTrace("URL Tree.... Bad augument\n"); + HTTRACE(CORE_TRACE, "URL Tree.... Bad augument\n"); } return NULL; } @@ -401,7 +397,7 @@ if (pres) { HTList_removeObject(hashlist, pres); delete_tree(pres); - if (CORE_TRACE) HTTrace("URL Tree.... deleted %p\n", pres); + HTTRACE(CORE_TRACE, "URL Tree.... deleted %p\n" _ pres); return YES; } } @@ -416,7 +412,7 @@ if (InfoTable) { int cnt; HTList * cur; - for (cnt=0; cntuser, name); /* Set the context */ @@ -61,7 +65,7 @@ PUBLIC BOOL HTUserProfile_localize (HTUserProfile * up) { if (up) { - if (CORE_TRACE) HTTrace("User Profile Localizing %p\n", up); + HTTRACE(CORE_TRACE, "User Profile Localizing %p\n" _ up); /* Find the FQDN */ up->fqdn = HTGetHostName(); @@ -77,8 +81,8 @@ /* Find the default location for temporary files */ StrAllocCopy(up->tmp, HT_TMP_ROOT); - if (*(up->tmp+strlen(up->tmp)-1) != '/') - StrAllocCat(up->tmp, "/"); + if (*(up->tmp+strlen(up->tmp)-1) != DIR_SEPARATOR_CHAR) + StrAllocCat(up->tmp, DIR_SEPARATOR_STR); return YES; } @@ -153,8 +157,8 @@ { if (up && tmp) { StrAllocCopy(up->tmp, tmp); - if (*(up->tmp+strlen(up->tmp)-1) != '/') - StrAllocCat(up->tmp, "/"); + if (*(up->tmp+strlen(up->tmp)-1) != DIR_SEPARATOR_CHAR) + StrAllocCat(up->tmp, DIR_SEPARATOR_STR); return YES; } return NO; diff -Naur xdvik-22.40l/libs/libwww/HTUser.h xdvik-22.40n/libs/libwww/HTUser.h --- xdvik-22.40l/libs/libwww/HTUser.h Wed Apr 18 14:23:26 2001 +++ xdvik-22.40n/libs/libwww/HTUser.h Fri Sep 13 00:23:46 2002 @@ -159,6 +159,6 @@ - @(#) $Id: HTUser.h,v 1.1.1.1 2001/04/18 14:23:26 stefanulrich Exp $ + @(#) $Id: HTUser.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTUtils.h xdvik-22.40n/libs/libwww/HTUtils.h --- xdvik-22.40l/libs/libwww/HTUtils.h Wed Apr 18 14:23:26 2001 +++ xdvik-22.40n/libs/libwww/HTUtils.h Fri Sep 13 00:23:46 2002 @@ -1,10 +1,11 @@ /* - W3C Sample Code Library libwww General Purpose Macros + W3C Sample Code Library libwww Debug Information and General Purpose + Macros ! - General Purpose Macros + Debug Information and General Purpose Macros ! */ @@ -15,8 +16,8 @@ /* -This module is a part of the -W3C Sample Code Library. See also the system dependent file +This module is a part of the W3C Sample +Code Library. See also the system dependent file sysdep module for system specific information. */ @@ -25,19 +26,58 @@ /* . + Destination for User Print Messages +. + +You can send print messages to the user to various destinations +depending on the type of your application. By default, on Unix the +messages are sent to stdout using +fprintf. If we are on MSWindows and have a windows +applications then register a HTPrintCallback +function. This is done with HTPrint_setCallback. It tells +HTPrint to call a HTPrintCallback. If +HTDEBUG +is not defined then don't do any of the above. +*/ + +typedef int HTPrintCallback(const char * fmt, va_list pArgs); +extern void HTPrint_setCallback(HTPrintCallback * pCall); +extern HTPrintCallback * HTPrint_getCallback(void); + +extern int HTPrint(const char * fmt, ...); + +/* +. Debug Message Control . -This is the global flag for setting the WWWTRACE options. The -verbose mode is no longer a simple boolean but a bit field so that it is -possible to see parts of the output messages. +This is the global flag for setting the WWWTRACE options. +The verbose mode is no longer a simple boolean but a bit field so that it +is possible to see parts of the output messages. */ -#ifndef DEBUG -#define DEBUG /* No one ever turns this off as trace is too important */ +#if defined(NODEBUG) || defined(NDEBUG) || defined(_NDEBUG) +#undef HTDEBUG +#else +#ifndef HTDEBUG +#define HTDEBUG 1 +#endif /* HTDEBUG */ +#endif + +/* +( + C Preprocessor defines +) -/* Call this function and the program halts */ -extern void HTDebugBreak (char * file, unsigned long line, const char * fmt, ...); +Make sure that the following macros are defined +*/ + +#ifndef __FILE__ +#define __FILE__ "" +#endif + +#ifndef __LINE__ +#define __LINE__ 0L #endif /* @@ -48,7 +88,7 @@ The global trace flag variable is available everywhere. */ -#ifdef DEBUG +#ifdef HTDEBUG #ifdef WWW_WIN_DLL extern int * WWW_TraceFlag; /* In DLLs, we need the indirection */ #define WWWTRACE (*WWW_TraceFlag) @@ -58,12 +98,19 @@ #endif /* WWW_WIN_DLL */ #else #define WWWTRACE 0 -#endif /* DEBUG */ +#endif /* HTDEBUG */ /* +( + Select which Trace Messages to show +) -The WWWTRACE define outputs messages if verbose mode -is active according to the following rules: +Libwww has a huge set of trace messages and it is therefor a good idea to +be able to select which ones to see for any particular trace. An easy way +to set this is using the funtion +HTSetTraceMessageMask. The WWWTRACE +define outputs messages if verbose mode is active according to the following +rules: */ typedef enum _HTTraceFlags { @@ -83,7 +130,8 @@ SHOW_CORE_TRACE = 0x2000, SHOW_MUX_TRACE = 0x4000, SHOW_SQL_TRACE = 0x8000, - SHOW_ALL_TRACE = -1 + SHOW_XML_TRACE = 0x10000, + SHOW_ALL_TRACE = (int) 0xFFFFFFFF } HTTraceFlags; /* @@ -108,6 +156,8 @@ #define CORE_TRACE (WWWTRACE & SHOW_CORE_TRACE) #define MUX_TRACE (WWWTRACE & SHOW_MUX_TRACE) #define SQL_TRACE (WWWTRACE & SHOW_SQL_TRACE) +#define XML_TRACE (WWWTRACE & SHOW_XML_TRACE) +#define ALL_TRACE (WWWTRACE & SHOW_ALL_TRACE) /* ( @@ -115,58 +165,89 @@ ) You can send trace messages to various destinations depending on the type -of your application. By default, on Unix the messages are sent to stderr -using fprintf() and if we are on Windows and have a windows applications -then register a HTTraceCallback function. This is done with HTTrace_setCallback. -It tells HTTrace to call a HTTraceCallback. If your compiler has problems -with va_list, then you may forget about registering the callback and instead -macro HTTrace as follows: #define HTTrace MyAppSpecificTrace - +of your application. By default, on Unix the messages are sent to +stderr using fprintf. If we are on MSWindows and +have a windows applications then register a HTTraceCallback +function. This is done with HTTrace_setCallback. It tells +HTTrace to call a HTTraceCallback. If +HTDEBUG is not defined then don't do any of the above. */ -#if TRACECALLBACK typedef int HTTraceCallback(const char * fmt, va_list pArgs); extern void HTTrace_setCallback(HTTraceCallback * pCall); extern HTTraceCallback * HTTrace_getCallback(void); -#endif +/* + +The HTTRACE macro uses "_" as parameter separater +instead of ",". This enables us to use a single macro instead +of a macro for each number of arguments which we consider a more elegant +and flexible solution. The implication is, however, that we can't have variables +that start or end with an "_" if they are to be used in a trace +message. +*/ + +#ifdef HTDEBUG +#undef _ +#define _ , +#define HTTRACE(TYPE, FMT) \ + do { if (TYPE) HTTrace(FMT); } while (0); extern int HTTrace(const char * fmt, ...); +#else +#define HTTRACE(TYPE, FMT) /* empty */ +#endif /* HTDEBUG */ /* ( - Trace Data Logging + Data Trace Logging ) -A similare mechanism exists for logging data, except that is adds a -data and length argument to the trace call. +A similar mechanism exists for logging data, except that is adds a data and +length argument to the trace call. Again, you can register your own callbacks +if need be. */ -typedef int HTTraceDataCallback(char * data, size_t len, - char * fmt, va_list pArgs); - +typedef int HTTraceDataCallback(char * data, size_t len, char * fmt, va_list pArgs); extern void HTTraceData_setCallback(HTTraceDataCallback * pCall); extern HTTraceDataCallback * HTTraceData_getCallback(void); +/* + +Again we use the same macro expansion mechanism as for HTTrace +*/ + +#ifdef HTDEBUG +#define HTTRACEDATA(DATA, LEN, FMT) HTTraceData((DATA), (LEN), FMT) extern int HTTraceData(char * data, size_t len, char * fmt, ...); +#else +#define HTTRACEDATA(DATA, LEN, FMT) /* empty */ +#endif /* HTDEBUG */ /* ( - Hiding Extraneous Logging Messages + Debug Breaks ) -Many of the long logging strings are wrapped with the HTHIDE -macro. This is usually defined to pass its parameter to the loggin -functions. However, if your application doesn't use the logging, you -may define HTHIDE to pass only a 0 to eliminate the strings from the -executable image. +Call this function and the program halts. We use the same macro expansion +mechanism as for HTTrace */ -#define HTHIDE(A) A +extern void HTDebugBreak(char * file, unsigned long line, const char * fmt, ...); + +#ifdef HTDEBUG +#define HTDEBUGBREAK(FMT) HTDebugBreak(__FILE__, __LINE__, FMT) +#else +#define HTDEBUGBREAK(FMT) /* empty */ +#endif /* HTDEBUG */ /* . Macros for Function Declarations . + +These function prefixes are used by scripts and other tools and helps figuring +out which functions are exported and which are not. See also the +libwww style guide. */ #define PUBLIC /* Accessible outside this module */ @@ -255,12 +336,22 @@ #define HT_RETRY -503 /* If service isn't available */ #define HT_BAD_VERSION -505 /* Bad protocol version */ +#ifdef HT_DAV /* WebDAV Status codes */ +#define HT_PROCESSING 102 /* Processing */ +#define HT_MULTI_STATUS 207 /* Multi-Status */ +#define HT_UNPROCESSABLE -422 /* Unprocessable Entity */ +#define HT_LOCKED -423 /* Locked */ +#define HT_FAILED_DEPENDENCY -424 /* Failed Dependency */ +#define HT_INSUFFICIENT_STORAGE -507 /* Insufficient Storage */ +#endif + #define HT_INTERNAL -900 /* Weird -- should never happen. */ #define HT_WOULD_BLOCK -901 /* If we are in a select */ #define HT_INTERRUPTED -902 /* Note the negative value! */ #define HT_PAUSE -903 /* If we want to pause a stream */ #define HT_RECOVER_PIPE -904 /* Recover pipe line */ #define HT_TIMEOUT -905 /* Connection timeout */ +#define HT_NO_HOST -906 /* Can't locate host */ /* . @@ -273,30 +364,12 @@ */ #ifndef TOLOWER -#define TOLOWER(c) tolower(c) -#define TOUPPER(c) toupper(c) +#define TOLOWER(c) tolower((int) (c)) +#define TOUPPER(c) toupper((int) (c)) #endif /* . - C Preprocessor defines -. - -Make sure that the following macros are defined - -*/ - -#ifndef __FILE__ -#define __FILE__ "" -#endif - -#ifndef __LINE__ -#define __LINE__ 0L -#endif - -/* - -. Max and Min values for Integers and Floating Point . */ @@ -340,6 +413,6 @@ - @(#) $Id: HTUtils.h,v 1.1.1.1 2001/04/18 14:23:26 stefanulrich Exp $ + @(#) $Id: HTUtils.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTWAIS.c xdvik-22.40n/libs/libwww/HTWAIS.c --- xdvik-22.40l/libs/libwww/HTWAIS.c Wed Apr 18 14:23:26 2001 +++ xdvik-22.40n/libs/libwww/HTWAIS.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTWAIS.c,v 1.1.1.1 2001/04/18 14:23:26 stefanulrich Exp $ +** @(#) $Id: HTWAIS.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module allows a WWW server or client to read data from a ** remote WAIS server, and provide that data to a WWW client in @@ -55,11 +55,6 @@ Brewster@think.com */ - -#define DIRECTORY "/cnidr.org:210/directory-of-servers" - -#define BIG 1024 /* identifier size limit @@@@@ */ - /* Library include files */ #include "wwwsys.h" #include "WWWUtil.h" @@ -67,6 +62,13 @@ #include "WWWHTML.h" #include "HTReqMan.h" +#ifndef HT_DIRECT_WAIS +PUBLIC int HTLoadWAIS (SOCKET soc, HTRequest* request) +{ + return HT_ERROR; +} +#else + #ifdef HAVE_WAIS_WAIS_H #include "wais/wais.h" #else @@ -81,6 +83,10 @@ #endif #endif +#define DIRECTORY "/cnidr.org:210/directory-of-servers" + +#define BIG 1024 /* identifier size limit @@@@@ */ + /* From WAIS ** --------- */ @@ -271,21 +277,24 @@ unsigned char * q = buf; char * p = (docid->bytes); int i, l; + +#ifdef HTDEBUG if (PROT_TRACE) { char *p; - HTTrace("HTLoadWAIS.. id (%d bytes) is ", (int)docid->size); + HTTRACE(PROT_TRACE, "HTLoadWAIS.. id (%d bytes) is " _ (int)docid->size); for(p=docid->bytes; pbytes+docid->size; p++) { if ((*p >= ' ') && (*p<= '~')) /* Assume ASCII! */ - HTTrace("%c", *p); + HTTRACE(PROT_TRACE, "%c" _ *p); else - HTTrace("<%x>", (unsigned)*p); + HTTRACE(PROT_TRACE, "<%x>" _ (unsigned)*p); } - HTTrace("\n"); + HTTRACE(PROT_TRACE, "\n"); } +#endif /* HTDEBUG */ + for (p=docid->bytes; (pbytes+docid->size) && (q<&buf[BIG]);) { - if (PROT_TRACE) - HTTrace("............ Record type %d, length %d\n", - (unsigned char) p[0], (unsigned char) p[1]); + HTTRACE(PROT_TRACE, "............ Record type %d, length %d\n" _ + (unsigned char) p[0] _ (unsigned char) p[1]); sprintf(num, "%d", (int)*p); memcpy(q, num, strlen(num)); q += strlen(num); @@ -313,8 +322,7 @@ *q++= ';'; /* Terminate field */ #ifdef OLD_CODE if (*p>10) { - if (PROT_TRACE) - HTTrace("WAIS........ DOCID record type of %d!\n", *p); + HTTRACE(PROT_TRACE, "WAIS........ DOCID record type of %d!\n" _ *p); return 0; } { /* Bug fix -- allow any byte value 15 Apr 93 */ @@ -344,7 +352,7 @@ #endif /* OLD_CODE */ } *q++ = 0; /* Terminate string */ - if (PROT_TRACE) HTTrace("HTLoadWAIS.. WWW form of id: %s\n", buf); + HTTRACE(PROT_TRACE, "HTLoadWAIS.. WWW form of id: %s\n" _ buf); { char *result; if ((result = (char *) HT_MALLOC((int) strlen((char *) buf)+1))==NULL) @@ -373,8 +381,7 @@ char *q; /* Poisition of "=" */ char *s; /* Position of semicolon */ int n; /* size */ - if (PROT_TRACE) - HTTrace("HTLoadWAIS.. WWW id (to become WAIS id): %s\n", + HTTRACE(PROT_TRACE, "HTLoadWAIS.. WWW id (to become WAIS id): %s\n" _ docname); for(n=0, p = docname; *p; p++) { /* Count sizes of strings */ n++; @@ -490,17 +497,21 @@ p++; /* After semicolon: start of next record */ } #endif /* OLD_CODE */ + +#ifdef HTDEBUG if (PROT_TRACE) { char *p; - HTTrace("WAIS........ id (%d bytes) is ", (int)docid->size); + HTTRACE(PROT_TRACE, "WAIS........ id (%d bytes) is " _ (int)docid->size); for(p=docid->bytes; pbytes+docid->size; p++) { if ((*p >= ' ') && (*p<= '~')) /* Assume ASCII! */ - HTTrace("%c", *p); + HTTRACE(PROT_TRACE, "%c" _ *p); else - HTTrace("<%x>", (unsigned)*p); + HTTRACE(PROT_TRACE, "<%x>" _ (unsigned)*p); } - HTTrace("\n"); - } + HTTRACE(PROT_TRACE, "\n"); + } +#endif /* HTDEBUG */ + return docid; /* Ok */ } /* WAIS_from_WWW */ @@ -561,7 +572,7 @@ BOOL archie = strstr(database, "archie")!=0; /* Specical handling */ - if (PROT_TRACE) HTTrace("WAIS........ Displaying search response\n"); + HTTRACE(PROT_TRACE, "WAIS........ Displaying search response\n"); sprintf(line, "Index %s contains the following %d item%s relevant to '%s'.\n", database, @@ -590,10 +601,9 @@ /* Make a printable string out of the document id. */ - if (PROT_TRACE) - HTTrace("HTWAIS: %2ld: Score: %4ld, lines:%4ld '%s'\n", i, - (long int)(info->DocHeaders[k]->Score), - (long int)(info->DocHeaders[k]->Lines), + HTTRACE(PROT_TRACE, "HTWAIS: %2ld: Score: %4ld, lines:%4ld '%s'\n" _ i _ + (long int)(info->DocHeaders[k]->Score) _ + (long int)(info->DocHeaders[k]->Lines) _ headline); START(HTML_LI); @@ -632,8 +642,7 @@ strcat (types_array, type_escaped); HT_FREE(type_escaped); } - if (PROT_TRACE) - HTTrace("WAIS........ Types_array `%s\'\n", + HTTRACE(PROT_TRACE, "WAIS........ Types_array `%s\'\n" _ types_array); } else { strcat (types_array, "TEXT"); @@ -916,7 +925,7 @@ if (!acceptable_inited) init_acceptable(); theWAISinfo->state = HTWAIS_PARSING_URL; - if (PROT_TRACE) HTTrace("HTLoadWAIS.. Looking for \"%s\"\n", arg); + HTTRACE(PROT_TRACE, "HTLoadWAIS.. Looking for \"%s\"\n" _ arg); theWAISinfo->names = HTParse(arg, "", PARSE_HOST | PARSE_PATH | PARSE_PUNCTUATION); @@ -990,7 +999,7 @@ return -1; } - if (PROT_TRACE) HTTrace("HTLoadWAIS.. URL Parsed OK\n"); + HTTRACE(PROT_TRACE, "HTLoadWAIS.. URL Parsed OK\n"); theWAISinfo->state = HTWAIS_NEED_CONNECTION; if ((service = strchr(theWAISinfo->names, ':'))) @@ -1012,10 +1021,9 @@ { char* host = HTParse(arg, "", PARSE_HOST); - if (PROT_TRACE) - HTTrace("HTLoadWAIS.." - " Can't open connection to %s via service %s.\n", - server_name, service); + HTTRACE(PROT_TRACE, "HTLoadWAIS.." + " Can't open connection to %s via service %s.\n" _ + server_name _ service); HTRequest_addError(request, ERR_FATAL, NO, HTERR_WAIS_NO_CONNECT, (void *) host, (int) strlen(host), "HTLoadWAIS"); @@ -1098,17 +1106,15 @@ START(HTML_ISINDEX); request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */ - if (PROT_TRACE) - HTTrace("HTLoadWAIS.. Search for `%s' in `%s'\n", - keywords, theWAISinfo->wais_database); + HTTRACE(PROT_TRACE, "HTLoadWAIS.. Search for `%s' in `%s'\n" _ + keywords _ theWAISinfo->wais_database); if (generate_search_apdu(theWAISinfo->request_message + HEADER_LENGTH, &request_buffer_length, keywords, theWAISinfo->wais_database, NULL, HTMaxWAISLines) == NULL) { - if (PROT_TRACE) - HTTrace("WAIS Search. Too many lines in response\n"); + HTTRACE(PROT_TRACE, "WAIS Search. Too many lines in response\n"); HTRequest_addError(request, ERR_WARN, NO, HTERR_WAIS_OVERFLOW, NULL, 0, "HTLoadWAIS"); @@ -1122,8 +1128,7 @@ false /* true verbose */ )) { - if (PROT_TRACE) - HTTrace("WAIS Search. Too many lines in response\n"); + HTTRACE(PROT_TRACE, "WAIS Search. Too many lines in response\n"); HTRequest_addError(request, ERR_WARN, NO, HTERR_WAIS_OVERFLOW, NULL, 0, "HTLoadWAIS"); @@ -1192,9 +1197,8 @@ server_name, service, theWAISinfo->www_database); fp = fopen(filename, "r"); /* Have we found this already? */ - if (PROT_TRACE) - HTTrace("HTLoadWAIS.. Description of server %s %s.\n", - filename, + HTTRACE(PROT_TRACE, "HTLoadWAIS.. Description of server %s %s.\n" _ + filename _ fp ? "exists already" : "does NOT exist!"); if (fp) @@ -1230,11 +1234,10 @@ any * docid = &doc_chunk; theWAISinfo->state = HTWAIS_FETCH_DOCUMENT; - if (PROT_TRACE) - HTTrace("HTLoadWAIS.. Retrieve document `%s'\n" - "............ type `%s' length %ld\n", - (docname ? docname : "unknown"), - (doctype ? doctype : "unknown"), + HTTRACE(PROT_TRACE, "HTLoadWAIS.. Retrieve document `%s'\n" + "............ type `%s' length %ld\n" _ + (docname ? docname : "unknown") _ + (doctype ? doctype : "unknown") _ document_length); if (doctype) @@ -1284,7 +1287,7 @@ char *type = s_strdup(doctype); request_buffer_length = MAX_MESSAGE_LEN; /* Amount left */ - if (PROT_TRACE) HTTrace("HTLoadWAIS.. Slice number %ld\n", count); + HTTRACE(PROT_TRACE, "HTLoadWAIS.. Slice number %ld\n" _ count); if (generate_retrieval_apdu(theWAISinfo->request_message + HEADER_LENGTH, &request_buffer_length, docid, CT_byte, @@ -1391,8 +1394,7 @@ else return HT_ERROR; - if (PROT_TRACE) - HTTrace("HTWAIS...... Looking for `%s\'\n", HTAnchor_physical(anchor)); + HTTRACE(PROT_TRACE, "HTWAIS...... Looking for `%s\'\n" _ HTAnchor_physical(anchor)); /* Get existing copy */ if ((theWAISinfo = (wais_info*)HTNet_context(net)) == NULL) @@ -1412,3 +1414,5 @@ /* get it started - ops is ignored */ return HTWAISEvent(soc, theWAISinfo, HTEvent_BEGIN); } + +#endif /* HT_DIRECT_WAIS */ diff -Naur xdvik-22.40l/libs/libwww/HTWAIS.h xdvik-22.40n/libs/libwww/HTWAIS.h --- xdvik-22.40l/libs/libwww/HTWAIS.h Wed Apr 18 14:23:26 2001 +++ xdvik-22.40n/libs/libwww/HTWAIS.h Fri Sep 13 00:23:46 2002 @@ -69,6 +69,6 @@ - @(#) $Id: HTWAIS.h,v 1.1.1.1 2001/04/18 14:23:26 stefanulrich Exp $ + @(#) $Id: HTWAIS.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTWSRC.c xdvik-22.40n/libs/libwww/HTWSRC.c --- xdvik-22.40l/libs/libwww/HTWSRC.c Wed Apr 18 14:23:26 2001 +++ xdvik-22.40n/libs/libwww/HTWSRC.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTWSRC.c,v 1.1.1.1 2001/04/18 14:23:26 stefanulrich Exp $ +** @(#) $Id: HTWSRC.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module parses a stream with WAIS source file ** format information on it and creates a structured stream. @@ -155,8 +155,7 @@ } } if (!par_name[me->param_number]) { /* Unknown field */ - if (WWWTRACE) HTTrace( - "HTWSRC: Unknown field `%s' in source file\n", + HTTRACE(PROT_TRACE, "HTWSRC: Unknown field `%s' in source file\n" _ me->param); me->param_number = PAR_UNKNOWN; me->state = before_value; /* Could be better ignore */ diff -Naur xdvik-22.40l/libs/libwww/HTWSRC.h xdvik-22.40n/libs/libwww/HTWSRC.h --- xdvik-22.40l/libs/libwww/HTWSRC.h Wed Apr 18 14:23:26 2001 +++ xdvik-22.40n/libs/libwww/HTWSRC.h Fri Sep 13 00:23:46 2002 @@ -55,7 +55,7 @@ -@(#) $Id: HTWSRC.h,v 1.1.1.1 2001/04/18 14:23:26 stefanulrich Exp $ +@(#) $Id: HTWSRC.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTWWWStr.c xdvik-22.40n/libs/libwww/HTWWWStr.c --- xdvik-22.40l/libs/libwww/HTWWWStr.c Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTWWWStr.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTWWWStr.c,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ +** @(#) $Id: HTWWWStr.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** Now 13 95 Spwaned from HTString.c */ @@ -166,6 +166,92 @@ return start; } +/* Find next Name-value param +** -------------------------- +** This is the same as HTNextPair but doesn't look for ',' +** Returns a pointer to the first word or NULL on error +*/ +PUBLIC char * HTNextParam (char ** pstr) +{ + char * p = *pstr; + char * start = NULL; + if (!pstr || !*pstr) return NULL; + while (1) { + /* Strip white space and other delimiters */ + while (*p && *p==';') p++; + if (!*p) { + *pstr = p; + return NULL; /* No field */ + } + + if (*p == '"') { /* quoted field */ + start = ++p; + for(;*p && *p!='"'; p++) + if (*p == '\\' && *(p+1)) p++; /* Skip escaped chars */ + break; /* kr95-10-9: needs to stop here */ + } else if (*p == '<') { /* quoted field */ + start = ++p; + for(;*p && *p!='>'; p++) + if (*p == '\\' && *(p+1)) p++; /* Skip escaped chars */ + break; /* kr95-10-9: needs to stop here */ + } else if (*p == '(') { /* Comment */ + for(;*p && *p!=')'; p++) + if (*p == '\\' && *(p+1)) p++; /* Skip escaped chars */ + p++; + } else { /* Spool field */ + start = p; + while (*p && *p!=';') + p++; + break; /* Got it */ + } + } + if (*p) *p++ = '\0'; + *pstr = p; + return start; +} + +/* Find next element in a comma separated string +** --------------------------------------------- +** This is the same as HTNextPair but it does not look for anything +** else than ',' as separator +** Returns a pointer to the first word or NULL on error +*/ +PUBLIC char * HTNextElement (char ** pstr) +{ + char * p = *pstr; + char * start = NULL; + if (!pstr || !*pstr) return NULL; + + /* Strip white space and other delimiters */ + while (*p && ((isspace((int) *p)) || *p==',')) p++; + if (!*p) { + *pstr = p; + return NULL; /* No field */ + } + start = p; + while (1) { + if (*p == '"') { /* quoted field */ + for(;*p && *p!='"'; p++) + if (*p == '\\' && *(p+1)) p++; /* Skip escaped chars */ + p++; + } else if (*p == '<') { /* quoted field */ + for(;*p && *p!='>'; p++) + if (*p == '\\' && *(p+1)) p++; /* Skip escaped chars */ + p++; + } else if (*p == '(') { /* Comment */ + for(;*p && *p!=')'; p++) + if (*p == '\\' && *(p+1)) p++; /* Skip escaped chars */ + p++; + } else { /* Spool field */ + while (*p && *p!=',') p++; + break; /* Got it */ + } + } + if (*p) *p++ = '\0'; + *pstr = p; + return start; +} + /* Find next "/" delimied segment ** ------------------------------ ** This is the same as HTNextField but it includes "/" as a delimiter. @@ -273,8 +359,7 @@ #endif /* HAVE_GETPID */ if (!address) address = tmpnam(NULL); if ((!address || !*address) && sectime < 0) { - if (CORE_TRACE) - HTTrace("MessageID... Can't make a unique MessageID\n"); + HTTRACE(CORE_TRACE, "MessageID... Can't make a unique MessageID\n"); return ""; } #ifdef HAVE_GETPID @@ -334,12 +419,9 @@ s++; /* or: Thu, 10 Jan 1993 01:29:59 GMT */ while (*s && *s==' ') s++; if (strchr(s,'-')) { /* First format */ - if (CORE_TRACE) - HTTrace("Format...... Weekday, 00-Mon-00 00:00:00 GMT\n"); + HTTRACE(CORE_TRACE, "Format...... Weekday, 00-Mon-00 00:00:00 GMT\n"); if ((int)strlen(s) < 18) { - if (CORE_TRACE) - HTTrace( - "ERROR....... Not a valid time format \"%s\"\n",s); + HTTRACE(CORE_TRACE, "ERROR....... Not a valid time format \"%s\"\n" _ s); return 0; } tm.tm_mday = strtol(s, &s, 10); @@ -350,11 +432,9 @@ tm.tm_sec = strtol(++s, &s, 10); } else { /* Second format */ - if (CORE_TRACE) - HTTrace("Format...... Wkd, 00 Mon 0000 00:00:00 GMT\n"); + HTTRACE(CORE_TRACE, "Format...... Wkd, 00 Mon 0000 00:00:00 GMT\n"); if ((int)strlen(s) < 20) { - if (CORE_TRACE) - HTTrace("ERROR....... Not a valid time format \"%s\"\n",s); + HTTRACE(CORE_TRACE, "ERROR....... Not a valid time format \"%s\"\n" _ s); return 0; } tm.tm_mday = strtol(s, &s, 10); @@ -367,12 +447,11 @@ } else if (isdigit((int) *str)) { if (strchr(str, 'T')) { /* ISO (limited format) date string */ - if (CORE_TRACE) HTTrace("Format...... YYYY.MM.DDThh:mmStzWkd\n"); + HTTRACE(CORE_TRACE, "Format...... YYYY.MM.DDThh:mmStzWkd\n"); s = (char *) str; while (*s && *s==' ') s++; if ((int)strlen(s) < 21) { - if (CORE_TRACE) - HTTrace("ERROR....... Not a valid time format `%s\'\n", s); + HTTRACE(CORE_TRACE, "ERROR....... Not a valid time format `%s\'\n" _ s); return 0; } tm.tm_year = strtol(s, &s, 10) - 1900; @@ -384,29 +463,37 @@ } else { /* delta seconds */ t = expand ? time(NULL) + atol(str) : atol(str); + +#ifdef HTDEBUG if (CORE_TRACE) { if (expand) { -#ifdef HT_REENTRANT +#if defined (HAVE_CTIME_R_2) + char buffer[CTIME_MAX]; + HTTRACE(CORE_TRACE, "Time string. Delta-time %s parsed to %ld seconds, or in local time: %s" _ + str _ (long) t _ (char *) ctime_r(&t, buffer)); +#elif defined(HAVE_CTIME_R_3) char buffer[CTIME_MAX]; - HTTrace("Time string. Delta-time %s parsed to %ld seconds, or in local time: %s", str, (long) t, (char *) ctime_r(&t, buffer, CTIME_MAX)); + HTTRACE(CORE_TRACE, "Time string. Delta-time %s parsed to %ld seconds, or in local time: %s" _ + str _ (long) t _ (char *) ctime_r(&t, buffer, CTIME_MAX)); #else - HTTrace("Time string. Delta-time %s parsed to %ld seconds, or in local time: %s", str, (long) t, ctime(&t)); -#endif + HTTRACE(CORE_TRACE, "Time string. Delta-time %s parsed to %ld seconds, or in local time: %s" _ + str _ (long) t _ ctime(&t)); +#endif /* HT_REENTRANT */ } else { - HTTrace("Time string. Delta-time %s parsed to %ld seconds\n", str, (long) t); + HTTRACE(CORE_TRACE, "Time string. Delta-time %s parsed to %ld seconds\n" _ str _ (long) t); } } +#endif /* HT_DEBUG */ return t; } } else { /* Try the other format: Wed Jun 9 01:29:59 1993 GMT */ - if (CORE_TRACE) HTTrace("Format...... Wkd Mon 00 00:00:00 0000 GMT\n"); + HTTRACE(CORE_TRACE, "Format...... Wkd Mon 00 00:00:00 0000 GMT\n"); s = (char *) str; while (*s && *s==' ') s++; - if (CORE_TRACE) HTTrace("Trying...... The Wrong time format: %s\n", s); + HTTRACE(CORE_TRACE, "Trying...... The Wrong time format: %s\n" _ s); if ((int)strlen(s) < 24) { - if (CORE_TRACE) - HTTrace("ERROR....... Not a valid time format \"%s\"\n",s); + HTTRACE(CORE_TRACE, "ERROR....... Not a valid time format \"%s\"\n" _ s); return 0; } tm.tm_mon = make_month(s, &s); @@ -422,16 +509,20 @@ tm.tm_mday < 1 || tm.tm_mday > 31 || tm.tm_mon < 0 || tm.tm_mon > 11 || tm.tm_year <70 || tm.tm_year >120) { - if (CORE_TRACE) HTTrace( - "ERROR....... Parsed illegal time: %02d.%02d.%02d %02d:%02d:%02d\n", - tm.tm_mday, tm.tm_mon+1, tm.tm_year, - tm.tm_hour, tm.tm_min, tm.tm_sec); + HTTRACE(CORE_TRACE, "ERROR....... Parsed illegal time: %02d.%02d.%02d %02d:%02d:%02d\n" _ + tm.tm_mday _ tm.tm_mon+1 _ tm.tm_year _ + tm.tm_hour _ tm.tm_min _ tm.tm_sec); return 0; } +#if 0 #if defined(HAVE_TIMEZONE) && defined(HAVE_ALTZONE) tm.tm_isdst = daylight; /* Already taken into account */ + HTTRACE(CORE_TRACE, "Time string. Daylight is %s\n" _ + daylight>0 ? "on" : daylight==0 ? "off" : "unknown"); +#endif #else + /* Let mktime decide whether we have DST or not */ tm.tm_isdst = -1; #endif @@ -446,10 +537,8 @@ #endif /* HAVE_TIMEGM */ #endif /* HAVE_MKTIME */ - if (CORE_TRACE) - HTTrace( - "Time string. %s parsed to %ld seconds, or in local time: %s", - str, (long) t, ctime(&t)); + HTTRACE(CORE_TRACE, "Time string. %s parsed to %ld calendar time or `%s' in local time\n" _ + str _ (long) t _ ctime(&t)); return t; } @@ -644,8 +733,7 @@ if ((*access && strcmp(access, "file") && strcmp(access, "cache")) || (*host && strcasecomp(host, "localhost") && myhost && strcmp(host, myhost))) { - if (PROT_TRACE) - HTTrace("LocalName... Not on local file system\n"); + HTTRACE(CORE_TRACE, "LocalName... Not on local file system\n"); HT_FREE(access); HT_FREE(host); HT_FREE(path); @@ -687,8 +775,7 @@ #endif HTUnEscape(path); /* Take out the escaped characters */ - if (PROT_TRACE) - HTTrace("Node........ `%s' means path `%s'\n",url,path); + HTTRACE(CORE_TRACE, "Node........ `%s' means path `%s'\n" _ url _ path); HT_FREE(access); HT_FREE(host); return path; @@ -704,15 +791,16 @@ ** OK: local file (that must be freed by caller) ** Error: NULL */ -PUBLIC char * HTLocalToWWW (const char * local) +PUBLIC char * HTLocalToWWW (const char * local, const char * access) { char * escaped = NULL; + const char * scheme = (access && *access) ? access : "file:"; if (local && *local) { #ifdef VMS char * unescaped = NULL; if ((unescaped = (char *) HT_MALLOC(strlen(local) + 10)) == NULL) HT_OUTOFMEM("HTLocalToWWW"); - strcpy(unescaped, "file:"); /* We get an absolute file name */ + strcpy(unescaped, scheme); /* We get an absolute file name */ /* convert directory name to Unix-style syntax */ { @@ -740,7 +828,7 @@ char * unescaped = NULL; if ((unescaped = (char *) HT_MALLOC(strlen(local) + 10)) == NULL) HT_OUTOFMEM("HTLocalToWWW"); - strcpy(unescaped, "file:"); /* We get an absolute file name */ + strcpy(unescaped, scheme); /* We get an absolute file name */ if (strchr(local, ':')) strcat(unescaped, "/"); { const char *p = local; @@ -759,7 +847,7 @@ #else /* Unix */ char * escaped_path = HTEscape(local, URL_PATH); - escaped = StrAllocMCopy(&escaped, "file:", escaped_path, NULL); + escaped = StrAllocMCopy(&escaped, scheme, escaped_path, NULL); HT_FREE(escaped_path); #endif /* not WIN32 */ diff -Naur xdvik-22.40l/libs/libwww/HTWWWStr.h xdvik-22.40n/libs/libwww/HTWWWStr.h --- xdvik-22.40l/libs/libwww/HTWWWStr.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTWWWStr.h Fri Sep 13 00:23:46 2002 @@ -35,9 +35,14 @@ /* . - Next word or quoted string + MIME Parsing and other String Based Utilities . +A bunch of "finding the next whatever" functions. +( + Next word or quoted string +) + This function returns a RFC822 word separated by space, comma, or semi-colons. pstr points to a string containing a word separated by white white space "," ";" or "=". The word can optionally be quoted using @@ -50,9 +55,9 @@ extern char * HTNextField (char** pstr); /* -. +( Next Name-value Pair -. +) This is the same as HTNextField but it does not look for '=' as a separator so if there is a name-value pair then both parts are returned. @@ -62,36 +67,54 @@ extern char * HTNextPair (char ** pstr); /* +( + Next Name-value Parameter +) + +This is the same as HTNextPair but it does not look for ',' +as a separator so if there is a name-value pair then both parts are returned. +Returns a pointer to the first word or NULL on error +*/ +extern char * HTNextParam (char ** pstr); + +/* ( Next LWS Delimited Token ) -A simpler version of the above that only looks for linear white space -as the delimiter. - +A simpler version of the above that only looks for linear white space as +the delimiter. */ extern char * HTNextLWSToken (char ** pstr); /* - ( Find next "/" Delimited Segment ) -This is the same as HTNextField but it includes "/" as a delimiter. -Returns a pointer to the first segment or NULL on error - +This is the same as HTNextField but it includes "/" as a delimiter. Returns +a pointer to the first segment or NULL on error */ extern char * HTNextSegment (char ** pstr); /* +( + Next Comma Separated String (or Element) +) -. +This is the same as HTNextPair but it does not look for anything else than +',' as separator Returns a pointer to the first word or NULL on error +*/ + +extern char * HTNextElement (char ** pstr); + +/* +( Next S-expression -. +) Find the next s-expression token from a string of characters. We return the name of this expression and the param points to @@ -228,10 +251,12 @@ ) Generates a WWW URL name from a local file name or NULL if error. Returns -URL (that must be freed by caller) if OK, else NULL. +URL (that must be freed by caller) if OK, else NULL. The access parameter +can be used to indicate any special scheme used for local file access. If +NULL then "file:" is used. */ -extern char * HTLocalToWWW (const char * local); +extern char * HTLocalToWWW (const char * local, const char * access); /* */ @@ -242,6 +267,6 @@ - @(#) $Id: HTWWWStr.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: HTWWWStr.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTWriter.c xdvik-22.40n/libs/libwww/HTWriter.c --- xdvik-22.40l/libs/libwww/HTWriter.c Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTWriter.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTWriter.c,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ +** @(#) $Id: HTWriter.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This is a try with a non-buffered output stream which remembers ** state using the write_pointer. As normally we have a big buffer @@ -94,8 +94,7 @@ /* If we don't have a Net object then return right away */ if (!net) { - if (STREAM_TRACE) - HTTrace("Write Socket WOULD BLOCK %d (offset %d)\n",soc, me->offset); + HTTRACE(STREAM_TRACE, "Write Socket No Net object %d (offset %d)\n" _ soc _ me->offset); return HT_ERROR; } @@ -135,8 +134,7 @@ { HTHost_register(host, net, HTEvent_WRITE); me->offset = wrtp - buf; - if (STREAM_TRACE) - HTTrace("Write Socket WOULD BLOCK %d (offset %d)\n",soc, me->offset); + HTTRACE(STREAM_TRACE, "Write Socket WOULD BLOCK %d (offset %d)\n" _ soc _ me->offset); return HT_WOULD_BLOCK; #ifdef EINTR } else if (socerrno == EINTR) { @@ -144,16 +142,26 @@ ** EINTR A signal was caught during the write opera- ** tion and no data was transferred. */ - if (STREAM_TRACE) - HTTrace("Write Socket call interruted - try again\n"); + HTTRACE(STREAM_TRACE, "Write Socket call interrupted - try again\n"); continue; #endif } else { + host->broken_pipe = YES; #ifdef EPIPE - if (socerrno == EPIPE) - if (STREAM_TRACE) HTTrace("Write Socket got EPIPE\n"); + if (socerrno == EPIPE) { + /* JK: an experimental bug solution proposed by + Olga and Mikhael */ + HTTRACE(STREAM_TRACE, "Write Socket got EPIPE\n"); + HTHost_unregister(host, net, HTEvent_WRITE); + HTHost_register(host, net, HTEvent_CLOSE); + /* @@ JK: seems that some functions check the errors + as part of the flow control */ + HTRequest_addSystemError(net->request, ERR_FATAL, socerrno, NO, + "NETWRITE"); + return HT_CLOSED; + } #endif /* EPIPE */ - host->broken_pipe = YES; + /* all errors that aren't EPIPE */ HTRequest_addSystemError(net->request, ERR_FATAL, socerrno, NO, "NETWRITE"); return HT_ERROR; @@ -161,11 +169,11 @@ } /* We do this unconditionally, should we check to see if we ever blocked? */ - HTTraceData(wrtp, b_write, "Writing to socket %d", soc); + HTTRACEDATA(wrtp, b_write, "Writing to socket %d" _ soc); HTNet_addBytesWritten(net, b_write); wrtp += b_write; len -= b_write; - if (STREAM_TRACE) HTTrace("Write Socket %d bytes written to %d\n", b_write, soc); + HTTRACE(STREAM_TRACE, "Write Socket %d bytes written to %d\n" _ b_write _ soc); { HTAlertCallback *cbf = HTAlert_find(HT_PROG_WRITE); if (cbf) { @@ -206,7 +214,7 @@ */ PRIVATE int HTWriter_close (HTOutputStream * me) { - if (STREAM_TRACE) HTTrace("Socket write FREEING....\n"); + HTTRACE(STREAM_TRACE, "Socket write FREEING....\n"); HT_FREE(me); return HT_OK; } diff -Naur xdvik-22.40l/libs/libwww/HTWriter.h xdvik-22.40n/libs/libwww/HTWriter.h --- xdvik-22.40l/libs/libwww/HTWriter.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTWriter.h Fri Sep 13 00:23:46 2002 @@ -57,6 +57,6 @@ - @(#) $Id: HTWriter.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: HTWriter.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTXML.c xdvik-22.40n/libs/libwww/HTXML.c --- xdvik-22.40l/libs/libwww/HTXML.c Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTXML.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTXML.c,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ +** @(#) $Id: HTXML.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module requires expat in order to compile/link */ @@ -12,41 +12,76 @@ #include "wwwsys.h" #include "WWWUtil.h" #include "WWWCore.h" -#include "HTXML.h" /* Implemented here */ -#include +/* 2000-29-08 JK : pre-pruning code out of libwww */ +#ifdef HT_STRUCT_XML_STREAM +#undef HT_STRUCT_XML_STREAM +#endif + +#ifdef HT_STRUCT_XML_STREAM +#include "SGML.h" +#endif /* HT_STRUCT_XML_STREAM */ +#include "HTXML.h" /* Implemented here */ + +#define XML_MAX_ATTRIBUTES 50 struct _HTStream { const HTStreamClass * isa; int state; HTRequest * request; - HTStream * target; + HTStream * target; + HTStructuredClass * actions; + HTStructured * starget; XML_Parser xmlstream; +#ifdef HT_STRUCT_XML_STREAM + SGML_dtd * dtd; +#endif /* HT_STRUCT_XML_STREAM */ + XML_StartElementHandler xml_start_element; + XML_EndElementHandler xml_end_element; + XML_CharacterDataHandler xml_character_data; + XML_DefaultHandler xml_default_handler; + void * xml_user_data; }; +/* @@@ SHould not be global but controlled by name spaces @@@ */ +PRIVATE HTXMLCallback_new * XMLInstance = NULL; +PRIVATE void * XMLInstanceContext = NULL; + /* ------------------------------------------------------------------------- */ PRIVATE int HTXML_flush (HTStream * me) { - return me->target ? (*me->target->isa->flush)(me->target) : HT_OK; + if(me->target) + return (*me->target->isa->flush)(me->target); + else if (me->starget) + return (*me->actions->flush)(me->starget); + return HT_OK; } PRIVATE int HTXML_free (HTStream * me) { int status = HT_OK; XML_ParserFree(me->xmlstream); - if ((status = (*me->target->isa->_free)(me->target)) == HT_WOULD_BLOCK) - return HT_WOULD_BLOCK; - if (STREAM_TRACE) HTTrace("XML Parser.. FREEING...\n"); + if (me->target) { + if ((status = (*me->target->isa->_free)(me->target)) == HT_WOULD_BLOCK) + return HT_WOULD_BLOCK; + } else if(me->starget) { + if ((status = (*me->actions->_free)(me->starget)) == HT_WOULD_BLOCK) + return HT_WOULD_BLOCK; + } + HTTRACE(XML_TRACE, "XML Parser.. FREEING...\n"); HT_FREE(me); return status; } PRIVATE int HTXML_abort (HTStream * me, HTList * e) { - if (STREAM_TRACE) HTTrace("XML Parser.. ABORTING...\n"); + HTTRACE(XML_TRACE, "XML Parser.. ABORTING...\n"); XML_ParserFree(me->xmlstream); - (*me->target->isa->abort)(me->target, NULL); + if (me->target) + (*me->target->isa->abort)(me->target, NULL); + else if (me->starget) + (*me->actions->abort)(me->starget, e); HT_FREE(me); return HT_ERROR; } @@ -56,11 +91,17 @@ if (me->state == HT_OK) { int status = XML_Parse(me->xmlstream, buf, len, 0); if (!status) { - HTTrace("XML Parser.. `%s\'\n", XML_ErrorString(status)); + HTTRACE(XML_TRACE, "XML Parser.. `%s\'\n" _ + (char *)XML_ErrorString(XML_GetErrorCode(me->xmlstream))); me->state = HT_ERROR; } } - return me->state; + + /* + ** We don't want to return an error here as this kills + ** a potential pipeline of requests we might have + */ + return HT_OK; } PRIVATE int HTXML_putCharacter (HTStream * me, char c) @@ -73,6 +114,77 @@ return HTXML_write(me, s, (int) strlen(s)); } +#ifdef HT_STRUCT_XML_STREAM + +PRIVATE BOOL set_attributes_values(HTTag *tag,BOOL *present,char **value, + const char *nameatt,const char *valueatt) +{ + if(tag && nameatt && valueatt) { + int i; + HTAttr *attributes= tag->attributes; + for(i = 0; i< tag->number_of_attributes ; i++) { + if(!strcasecomp(attributes[i].name,nameatt)) { + present[i] = TRUE; + value[i] = (char *)valueatt; + return TRUE; + } + } + } + return FALSE; +} + +PRIVATE void start_element(HTStream * me, + const XML_Char *name, + const XML_Char **atts) +{ + int element_number = + SGML_findElementNumber((SGML_dtd *)me->dtd,(char *)name); + if(element_number >= 0) { + HTTag *tag = SGML_findTag (me->dtd,element_number); + int i = 0; + BOOL present[XML_MAX_ATTRIBUTES]; + const char *value[XML_MAX_ATTRIBUTES]; + memset((void *) present, '\0', XML_MAX_ATTRIBUTES); + memset((void *) value, '\0', XML_MAX_ATTRIBUTES*sizeof(char *)); + + while(atts[i]) { + set_attributes_values(tag,present,(char **)value,atts[i],atts[i+1]); + i+=2; + /* attributes that are not in the dtd will be lost */ + } + (*me->actions->start_element) + (me->starget,element_number,present,value); + } else { + /* elements that are not in the dtd will be lost */ + } +} + +PRIVATE void end_element(HTStream * me, const XML_Char *name) +{ + int element_number = SGML_findElementNumber(me->dtd,(char *)name); + + if(element_number > 0) { + (*me->actions->end_element)(me->starget, element_number); + } else { + /* elements that are not in the dtd will be lost */ + } +} +PRIVATE void character_data(HTStream *me, const XML_Char *s, int len) +{ + (*me->actions->put_block)(me->starget, s, len); +} + +PRIVATE void default_handler(HTStream *me, const XML_Char *s, int len) +{ + if(s[0] == '&' && s[len-1]==';') { + (*me->actions->unparsed_entity)(me->starget, s,len); + } else { + /* characters that can not be parsed are lost */ + } +} + +#endif /* HT_STRUCT_XML_STREAM */ + PRIVATE const HTStreamClass HTXMLClass = { "xml", @@ -104,7 +216,80 @@ HT_FREE(me); return HTErrorStream(); } + HTTRACE(XML_TRACE, "XML Parser.. Stream created\n"); + + /* Call the stream callback handler (if any) with this new stream */ + if (XMLInstance) + (*XMLInstance)(me, request, output_format, output_stream, me->xmlstream, XMLInstanceContext); - if (STREAM_TRACE) HTTrace("XML Parser.. Stream created\n"); return me; } + +PUBLIC BOOL HTXMLCallback_registerNew (HTXMLCallback_new * me, void * context) +{ + XMLInstance = me; + XMLInstanceContext = context; + return YES; +} + +#ifdef HT_STRUCT_XML_STREAM + +PRIVATE HTStream * HTXMLStructured_new (const SGML_dtd * dtd, HTStructured * starget) +{ + HTStream * me = NULL; + if ((me = (HTStream *) HT_CALLOC(1, sizeof(HTStream))) == NULL) + HT_OUTOFMEM("HTXML_new"); + me->isa = &HTXMLClass; + me->state = HT_OK; + me->starget = starget; + me->dtd = (SGML_dtd *)dtd; + me->actions = (HTStructuredClass*)(((HTStream*)starget)->isa); + + /* Now create the XML parser instance */ + if ((me->xmlstream = XML_ParserCreate(NULL)) == NULL) { + HT_FREE(me); + return HTErrorStream(); + } + XML_SetUserData(me->xmlstream,me); + XML_SetElementHandler(me->xmlstream, + (XML_StartElementHandler)start_element, + (XML_EndElementHandler)end_element); + XML_SetCharacterDataHandler(me->xmlstream, + (XML_CharacterDataHandler)character_data); + XML_SetDefaultHandler(me->xmlstream, + (XML_DefaultHandler)default_handler); + + HTTRACE(XML_TRACE, "XML Parser.. Stream created\n"); + return me; +} + +PRIVATE BOOL HTXMLStructured_setHandlers (HTStream * me, + XML_StartElementHandler start, + XML_EndElementHandler end, + XML_CharacterDataHandler char_data, + XML_DefaultHandler def_handler) +{ + if(me) { + me->xml_start_element = start; + me->xml_end_element = end; + me->xml_character_data = char_data; + me->xml_default_handler = def_handler; + XML_SetElementHandler(me->xmlstream,start,end); + XML_SetCharacterDataHandler(me->xmlstream,char_data); + XML_SetDefaultHandler(me->xmlstream,def_handler); + return YES; + } + return NO; +} + +PRIVATE BOOL HTXMLStructured_setUserData(HTStream *me, void *user_data) +{ + if(me) { + me->xml_user_data = user_data; + XML_SetUserData(me->xmlstream,me->xml_user_data); + return YES; + } + return NO; +} + +#endif /* HT_STRUCT_XML_STREAM */ diff -Naur xdvik-22.40l/libs/libwww/HTXML.h xdvik-22.40n/libs/libwww/HTXML.h --- xdvik-22.40l/libs/libwww/HTXML.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTXML.h Fri Sep 13 00:23:46 2002 @@ -1,10 +1,10 @@ /* - W3C Sample Code Library libwww XML Parser Wrapper + W3C Sample Code Library libwww Expat XML Parser Wrapper ! - XML Parser Wrapper + Expat XML Parser Wrapper ! */ @@ -17,21 +17,101 @@ This module is implemented by HTXML.c, and is a part of the W3C Sample Code Library. + +We use James Clark's expat +XML parser which is very neat indeed. As the code doesn't come as a separate +library, I included it in the libwww CVS code base where I compile is as +two libraries: libxmltok.a and libxmlparse.a. See +the external modules that libwww works with for +details. Thanks so much to John Punin for writing this code! */ #ifndef HTXML_H #define HTXML_H #include "HTFormat.h" +#include "HTStream.h" +#ifdef HT_STRUCT_XML_STREAM +#include "HTStruct.h" +#include "SGML.h" +#endif /* HT_STRUCT_XML_STREAM */ + +#include + +/* +. + Libwww Stream Converter +. + +This stream is a libwww converter which +calls and creates a expat stream instance. In order to tell the application +that a new stream instance has been created. +*/ extern HTConverter HTXML_new; +/* +. + Callback Handler Announcing a new Expat Stream object +. + +When a libwww to expat XML stream converter instance +is created, the stream checks to see if there are any callbacks registered +which should be notified about the new stream instance. If that is the case +then this callback is called and a pointer to the XML parser passed along. +The output stream is the target that was originally set for the request object +before the request was issued. +*/ + +typedef void HTXMLCallback_new ( + HTStream * me, + HTRequest * request, + HTFormat target_format, + HTStream * target_stream, + XML_Parser xmlparser, + void * context); + +/* +( + Register Creation notification Callback +) +@@@Should be handled via XML names spaces@@@ +*/ + +extern BOOL HTXMLCallback_registerNew (HTXMLCallback_new *, void * context); + +/* +. + XML Expat Stream to Libwww Structured Stream +. + +This is a stream that converts from the expat stream to a +libwww structured stream. Again, the application +can +*/ + +#ifdef HT_STRUCT_XML_STREAM +extern BOOL HTXMLStructured_setHandlers( + HTStream * me, + XML_StartElementHandler start, + XML_EndElementHandler end, + XML_CharacterDataHandler char_data, + XML_DefaultHandler def_handler); + +extern BOOL HTXMLStructured_setUserData (HTStream * me, void * user_data); +extern HTStream * HTXMLStructured_new (const SGML_dtd * dtd, HTStructured * +starget); +#endif + +/* +*/ + #endif /* - @(#) $Id: HTXML.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: HTXML.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTXParse.c xdvik-22.40n/libs/libwww/HTXParse.c --- xdvik-22.40l/libs/libwww/HTXParse.c Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTXParse.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTXParse.c,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ +** @(#) $Id: HTXParse.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** AUTHORS: ** HWL 23/8/94 @@ -41,7 +41,7 @@ { int l = strlen(s); - if (STREAM_TRACE) HTTrace("HTXParse_put_string, %s\n",s); + HTTRACE(STREAM_TRACE, "HTXParse_put_string, %s\n" _ s); while ((me->eps->used + l) > (me->eps->length + 1)) { me->eps->length += INPUT_BUFFER_SIZE; @@ -65,21 +65,20 @@ me->eps->used += l; me->eps->buffer[me->eps->used] = '\0'; /* null-terminate string */ (*(me->eps->call_client))(me->eps); /* client can give status info */ - if (STREAM_TRACE) - HTTrace("HTXParse_write, l=%d, used = %d\n",l,me->eps->used); + HTTRACE(STREAM_TRACE, "HTXParse_write, l=%d, used = %d\n" _ l _ me->eps->used); return HT_OK; } PRIVATE int HTXParse_flush (HTStream * me) { - if (STREAM_TRACE) HTTrace("HTXParse_flush\n"); + HTTRACE(STREAM_TRACE, "HTXParse_flush\n"); return HT_OK; } PRIVATE int HTXParse_free (HTStream * me) { - if (STREAM_TRACE) HTTrace("HTXParse_free\n"); + HTTRACE(STREAM_TRACE, "HTXParse_free\n"); me->eps->finished = YES; (*(me->eps->call_client))(me->eps); /* client will free buffer */ HT_FREE(me->eps); @@ -89,8 +88,7 @@ PRIVATE int HTXParse_abort (HTStream * me, HTList * e) { - if (STREAM_TRACE) - HTTrace("HTXParse_abort\n"); + HTTRACE(STREAM_TRACE, "HTXParse_abort\n"); HTXParse_free(me); /* Henrik Nov 2 94 */ return HT_ERROR; } @@ -120,14 +118,16 @@ { HTStream* me; +#ifdef HTDEBUG if (STREAM_TRACE) { - HTTrace("HTXConvert.."); + HTTRACE(STREAM_TRACE, "HTXConvert.."); if (input_format && input_format->name) - HTTrace(".. input format is %s",input_format->name); + HTTRACE(STREAM_TRACE, ".. input format is %s" _ input_format->name); if (output_format && output_format->name) - HTTrace(".. output format is %s",output_format->name); - HTTrace("\n"); + HTTRACE(STREAM_TRACE, ".. output format is %s" _ output_format->name); + HTTRACE(STREAM_TRACE, "\n"); } +#endif /* HTDEBUG */ if ((me = (HTStream *) HT_CALLOC(1, sizeof(*me))) == NULL) HT_OUTOFMEM("HTXConvert"); diff -Naur xdvik-22.40l/libs/libwww/HTXParse.h xdvik-22.40n/libs/libwww/HTXParse.h --- xdvik-22.40l/libs/libwww/HTXParse.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTXParse.h Fri Sep 13 00:23:46 2002 @@ -1,12 +1,12 @@ /* - W3C Sample Code Library libwww CALLBACK STREAM + + W3C Sample Code Library libwww Callback Stream - - -!XParse: Module to get unparsed stream from libwww! - +! + XParse: Module to get Unparsed Stream from libwww +! */ /* @@ -16,23 +16,22 @@ /* -This version of the stream object is a hook for clients that want an -unparsed stream from libwww. The HTXParse_put_* and HTXParse_write -routines copy the content of the incoming buffer into a buffer that is -realloced whenever necessary. This buffer is handed over to the client -in HTXParse_free. See also HTFWriter -for writing to C files. - -(Bugs:) - +This version of the stream object is a hook for clients that want an unparsed +stream from libwww. The HTXParse_put_* and HTXParse_write routines copy the +content of the incoming buffer into a buffer that is realloced whenever +necessary. This buffer is handed over to the client in HTXParse_free. See +also HTFWriter for writing to C files. +( + Bugs: +) - o strings written must be less than buffer size. + o + strings written must be less than buffer size. - This module is implemented by HTXParse.c, and -it is a part of the W3C -Sample Code Library. - +This module is implemented by HTXParse.c, and it +is a part of the W3C Sample Code +Library. */ #ifndef HTXPARSE_H @@ -61,6 +60,6 @@ #endif /* -End of declaration +End of declaration */ diff -Naur xdvik-22.40l/libs/libwww/HTZip.c xdvik-22.40n/libs/libwww/HTZip.c --- xdvik-22.40l/libs/libwww/HTZip.c Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTZip.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HTZip.c,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ +** @(#) $Id: HTZip.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module requires zlib in order to compile/link */ @@ -41,10 +41,9 @@ (level == Z_DEFAULT_COMPRESSION || (level >= Z_BEST_SPEED && level <= Z_BEST_COMPRESSION))) { int status; - if (STREAM_TRACE) - HTTrace("Zlib Inflate Init stream %p with compression level %d\n", me, level); + HTTRACE(STREAM_TRACE, "Zlib Inflate Init stream %p with compression level %d\n" _ me _ level); if ((status = inflateInit(me->zstream)) != Z_OK) { - if (STREAM_TRACE) HTTrace("Zlib........ Failed with status %d\n", status); + HTTRACE(STREAM_TRACE, "Zlib........ Failed with status %d\n" _ status); return NO; } return YES; @@ -54,16 +53,15 @@ PRIVATE BOOL ZLib_terminate (HTStream * me) { - if (STREAM_TRACE) HTTrace("Zlib Inflate Terminating stream %p\n", me); + HTTRACE(STREAM_TRACE, "Zlib Inflate Terminating stream %p\n" _ me); if (me) { int status; - if (STREAM_TRACE) - HTTrace("Results..... Inflated incoming data: deflated %lu, inflated %lu, factor %.2f\n", - me->zstream->total_in, me->zstream->total_out, + HTTRACE(STREAM_TRACE, "Results..... Inflated incoming data: deflated %lu, inflated %lu, factor %.2f\n" _ + me->zstream->total_in _ me->zstream->total_out _ me->zstream->total_in == 0 ? 0.0 : (double) me->zstream->total_out / me->zstream->total_in); if ((status = inflateEnd(me->zstream)) != Z_OK) { - if (STREAM_TRACE) HTTrace("Zlib........ Failed with status %d\n", status); + HTTRACE(STREAM_TRACE, "Zlib........ Failed with status %d\n" _ status); return NO; } return YES; @@ -82,7 +80,7 @@ ZLib_terminate(me); if ((status = (*me->target->isa->_free)(me->target)) == HT_WOULD_BLOCK) return HT_WOULD_BLOCK; - if (STREAM_TRACE) HTTrace("Zlib Inflate FREEING...\n"); + HTTRACE(STREAM_TRACE, "Zlib Inflate FREEING...\n"); HT_FREE(me->zstream); HT_FREE(me); return status; @@ -90,7 +88,7 @@ PRIVATE int HTZLibInflate_abort (HTStream * me, HTList * e) { - if (STREAM_TRACE) HTTrace("Zlib Inflate ABORTING...\n"); + HTTRACE(STREAM_TRACE, "Zlib Inflate ABORTING...\n"); ZLib_terminate(me); (*me->target->isa->abort)(me->target, NULL); HT_FREE(me->zstream); @@ -154,11 +152,11 @@ OUTBUF_SIZE - me->zstream->avail_out); if (me->state != HT_OK) return me->state; - if (STREAM_TRACE) HTTrace("Zlib Inflate End of Stream\n"); + HTTRACE(STREAM_TRACE, "Zlib Inflate End of Stream\n"); return HT_OK; default: - if (STREAM_TRACE) HTTrace("Zlib Inflate Inflate returned %d\n", status); + HTTRACE(STREAM_TRACE, "Zlib Inflate Inflate returned %d\n" _ status); return HT_ERROR; } } @@ -190,7 +188,7 @@ { if (level >= Z_BEST_SPEED && level <= Z_BEST_COMPRESSION) { CompressionLevel = level; - if (STREAM_TRACE) HTTrace("Zlib........ Compression level set to %d\n", level); + HTTRACE(STREAM_TRACE, "Zlib........ Compression level set to %d\n" _ level); } return NO; } @@ -217,6 +215,6 @@ HT_FREE(me); return HTErrorStream(); } - if (STREAM_TRACE) HTTrace("Zlib Inflate Stream created\n"); + HTTRACE(STREAM_TRACE, "Zlib Inflate Stream created\n"); return me; } diff -Naur xdvik-22.40l/libs/libwww/HTZip.h xdvik-22.40n/libs/libwww/HTZip.h --- xdvik-22.40l/libs/libwww/HTZip.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTZip.h Fri Sep 13 00:23:46 2002 @@ -46,6 +46,6 @@ - @(#) $Id: HTZip.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: HTZip.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HText.c xdvik-22.40n/libs/libwww/HText.c --- xdvik-22.40l/libs/libwww/HText.c Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HText.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1999. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: HText.c,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ +** @(#) $Id: HText.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This generates of a hypertext object and calls the application ** via callbacks. @@ -52,7 +52,6 @@ HTextImp * me = NULL; if ((me = (HTextImp *) HT_CALLOC(1, sizeof (HTextImp))) == NULL) HT_OUTOFMEM("HTextImp_new"); - if (me->text_new) me->app = (*me->text_new)(request, anchor, output_stream); me->text_new = text_new; me->text_delete = text_delete; me->text_build = text_build; @@ -63,15 +62,22 @@ me->text_unparsedBeginElement = text_unparsedBeginElement; me->text_unparsedEndElement = text_unparsedEndElement; me->text_unparsedEntity = text_unparsedEntity; + if (me->text_new) me->app = (*me->text_new)(request, anchor, output_stream); return me; } PUBLIC BOOL HTextImp_delete (HTextImp * me) { if (me) { - HText * app = me->app; + + /* + ** Note that we do not call the delete method on the app + ** HText object as this normally stays around after the + ** request has been deleted and certainly it should be + ** deleted by the app and not libwww + */ HT_FREE(me); - return (me->app && me->text_delete) ? (*me->text_delete)(app) : NO; + return YES; } return NO; } @@ -159,6 +165,12 @@ { text_new = NULL; text_delete = NULL; + return YES; +} + +PUBLIC BOOL HText_registerBuildCallback (HText_build * bcb) +{ + text_build = bcb; return YES; } diff -Naur xdvik-22.40l/libs/libwww/HText.h xdvik-22.40n/libs/libwww/HText.h --- xdvik-22.40l/libs/libwww/HText.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HText.h Fri Sep 13 00:23:46 2002 @@ -286,6 +286,6 @@ - @(#) $Id: HText.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: HText.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/HTextImp.h xdvik-22.40n/libs/libwww/HTextImp.h --- xdvik-22.40l/libs/libwww/HTextImp.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/HTextImp.h Fri Sep 13 00:23:46 2002 @@ -88,6 +88,6 @@ - @(#) $Id: HTextImp.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: HTextImp.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/Makefile.in xdvik-22.40n/libs/libwww/Makefile.in --- xdvik-22.40l/libs/libwww/Makefile.in Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/Makefile.in Fri Sep 13 00:23:46 2002 @@ -1,10 +1,11 @@ -# Makefile for libwww - te@informatik.uni-hannover.de +# Makefile for libwww - te@dbs.uni-hannover.de ac_include ../../texk/make/common.mk ac_include ../../texk/make/programs.mk ac_include ../../texk/make/library.mk XDEFS= +X_CFLAGS = @X_CFLAGS@ UNUSED = HTANSI.o HTBTree.o HTDemux.o HTDescpt.o HTEPtoCl.o HTHist.o \ HTMemLog.o HTMuxCh.o HTMuxTx.o HTNetTxt.o HTSocket.o HTStyle.o \ @@ -24,7 +25,7 @@ HTFTP.o HTBufWrt.o HTWriter.o HTFTPDir.o HTNewsLs.o HTNDir.o \ HTReader.o HTConLen.o HTDialog.o HTPEP.o HTNewsRq.o HTTChunk.o \ HTGuess.o HTMIME.o HTMerge.o HTBound.o HTBInit.o HTHInit.o \ - HTTeXGen.o HTML.o SGML.o HText.o HTPlain.o + HTTeXGen.o HTML.o SGML.o HText.o HTPlain.o HTNoFree.o HTFSave.o # We'd like to disable telnet, news and probably some other protocols and # their support routines. diff -Naur xdvik-22.40l/libs/libwww/SGML.c xdvik-22.40n/libs/libwww/SGML.c --- xdvik-22.40l/libs/libwww/SGML.c Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/SGML.c Fri Sep 13 00:23:46 2002 @@ -3,7 +3,7 @@ ** ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. -** @(#) $Id: SGML.c,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ +** @(#) $Id: SGML.c,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ ** ** This module implements an HTStream object. To parse an ** SGML file, create this object which is a parser. The object @@ -17,6 +17,8 @@ ** use pointers to the string chunk instead. */ +#include + /* Library include files */ #include "wwwsys.h" #include "HTUtils.h" @@ -69,11 +71,6 @@ #define PUTC(ch) ((*context->actions->put_character)(context->target, ch)) #define PUTB(b,l) ((*context->actions->put_block)(context->target, b, l)) -#define TRACE1(f,a) \ - do {if (SGML_TRACE) HTTrace((f),(a)); } while(0) -#define TRACE2(f,a,b) \ - do {if (SGML_TRACE) HTTrace((f),(a),(b)); } while(0) - /* Find Attribute Number ** --------------------- */ @@ -82,6 +79,9 @@ HTAttr* attributes = tag->attributes; int high, low, i, diff; /* Binary search for attribute name */ + + assert(tag->number_of_attributes <= MAX_ATTRIBUTES); + for(low=0, high=tag->number_of_attributes; high > low ; diff < 0 ? (low = i+1) : (high = i) ) @@ -114,8 +114,8 @@ context->present[i] = YES; return; } - TRACE2("Unknown attribute %s for tag %s\n", - s, context->current_tag->name); + HTTRACE(SGML_TRACE, "Unknown attribute %s for tag %s\n" _ + s _ context->current_tag->name); } context->current_attribute_number = INVALID; /* Invalid */ } @@ -134,10 +134,11 @@ if (context->current_attribute_number != INVALID) context->value[context->current_attribute_number] = context->token; - else - TRACE1("Attribute value %s ignored\n", - context->string->data + context->token); - + else { + char * data = HTChunk_data(context->string); + HTTRACE(SGML_TRACE, "Attribute value %s ignored\n" _ + data ? data+context->token : ""); + } } context->current_attribute_number = INVALID; /* can't have two assignments! */ } @@ -151,7 +152,7 @@ PRIVATE void handle_entity (HTStream * context) { const char ** entities = context->dtd->entity_names; - const char *s = context->string->data; + const char *s = HTChunk_data(context->string); int high, low, i, diff; for(low=0, high = context->dtd->number_of_entities; @@ -168,9 +169,9 @@ } /* If entity string not found */ - TRACE1("Unknown entity %s\n", s); + HTTRACE(SGML_TRACE, "Unknown entity %s\n" _ s); (*context->actions->unparsed_entity) - (context->target, context->string->data, context->string->size); + (context->target, HTChunk_data(context->string), HTChunk_size(context->string)); } /* End element @@ -178,7 +179,7 @@ */ PRIVATE void end_element (HTStream * context, HTTag *tag) { - TRACE1("End \n", tag->name); + HTTRACE(SGML_TRACE, "End \n" _ tag->name); (*context->actions->end_element) (context->target, tag - context->dtd->tags); } @@ -192,7 +193,7 @@ char *value[MAX_ATTRIBUTES]; HTTag *tag = context->current_tag; - TRACE1("Start <%s>\n", tag->name); + HTTRACE(SGML_TRACE, "Start <%s>\n" _ tag->name); context->contents = tag->contents; /* @@ -203,7 +204,7 @@ */ for (i = 0; i < MAX_ATTRIBUTES; ++i) value[i] = context->value[i] < 0 ? NULL : - context->string->data + context->value[i]; + HTChunk_data(context->string) + context->value[i]; (*context->actions->start_element) (context->target, tag - context->dtd->tags, @@ -328,7 +329,7 @@ if (count > 0) PUTB(text, count); count = 0; - string->size = 0; + HTChunk_clear(string); context->state = S_ero; } else if (c == '<') @@ -336,7 +337,7 @@ if (count > 0) PUTB(text, count); count = 0; - string->size = 0; + HTChunk_clear(string); /* should scrap LITERAL, and use CDATA and RCDATA -- msa */ context->state = @@ -356,7 +357,7 @@ if (count > 0) PUTB(text, count); count = 0; - string->size = 0; + HTChunk_clear(string); context->state = (context->contents == SGML_LITERAL) ? S_literal : S_nl_tago; @@ -414,13 +415,13 @@ case S_literal: HTChunk_putc(string, c); if ( TOUPPER(c) != - ((string->size == 1) ? '/' - : context->current_tag->name[string->size-2])) + ((HTChunk_size(string) == 1) ? '/' + : context->current_tag->name[HTChunk_size(string)-2])) { /* If complete match, end literal */ if ((c == '>') && - (!context->current_tag->name[string->size-2])) + (!context->current_tag->name[HTChunk_size(string)-2])) { end_element (context,context->current_tag); @@ -435,7 +436,7 @@ { /* If Mismatch: recover string. */ PUTC( '<'); - PUTB(string->data, string->size); + PUTB(HTChunk_data(string), HTChunk_size(string)); } context->state = S_text; text = b; @@ -488,12 +489,12 @@ { int value; HTChunk_terminate(string); - if (sscanf(string->data, "%d", &value)==1) + if (sscanf(HTChunk_data(string), "%d", &value)==1) PUTC((char)value); else { PUTB("&#", 2); - PUTB(string->data, string->size-1); + PUTB(HTChunk_data(string), HTChunk_size(string)-1); } text = b; count = 0; @@ -510,42 +511,36 @@ handle_S_tag: if (isalnum((int)c)) HTChunk_putc(string, c); - else - { /* End of tag name */ - int i; - - if (c == '/') - { - if (string->size != 0) - TRACE1("`<%s/' found!\n", - string->data); - context->state = S_end; - break; - } - else if (c == '!') - { - if (string->size != 0) - TRACE1(" `<%s!' found!\n", - string->data); - context->state = S_md; - break; - } - HTChunk_terminate(string); - context->current_tag = SGMLFindTag(dtd, string->data); - if (context->current_tag == NULL) { - TRACE1("*** Unknown element %s\n", string->data); - (*context->actions->unparsed_begin_element) - (context->target, string->data, string->size); - } else { - for (i=0; icurrent_tag->number_of_attributes; i++) { - context->present[i] = NO; - context->value[i] = -1; - } + else { /* End of tag name */ + int i; + if (c == '/') { + if (HTChunk_size(string) > 0) + HTTRACE(SGML_TRACE, "`<%s/' found!\n" _ HTChunk_data(string)); + context->state = S_end; + break; + } else if (c == '!') { + if (HTChunk_size(string) > 0) + HTTRACE(SGML_TRACE, " `<%s!' found!\n" _ HTChunk_data(string)); + context->state = S_md; + break; + } + HTChunk_terminate(string); + context->current_tag = SGMLFindTag(dtd, HTChunk_data(string)); + if (context->current_tag == NULL) { + HTTRACE(SGML_TRACE, "*** Unknown element %s\n" _ HTChunk_data(string)); + (*context->actions->unparsed_begin_element) + (context->target, HTChunk_data(string), HTChunk_size(string)); + } else { + for (i=0; icurrent_tag->number_of_attributes; i++) { + context->present[i] = NO; + context->value[i] = -1; } - context->token = string->size = 0; - context->current_attribute_number = INVALID; - goto S_tag_gap; } + context->token = 0; + HTChunk_clear(string); + context->current_attribute_number = INVALID; + goto S_tag_gap; + } break; S_tag_gap: @@ -565,7 +560,7 @@ ** it in S_attr. */ context->state = S_attr; - string->size = context->token; + HTChunk_truncate(string, context->token); case S_attr: if (isspace((int) c) || c == '>' || c == '=') goto got_attribute_name; @@ -581,8 +576,8 @@ */ HTChunk_terminate(string) ; handle_attribute_name - (context, string->data + context->token); - string->size = context->token; + (context, HTChunk_data(string) + context->token); + HTChunk_truncate(string, context->token); context->state = S_attr_gap; case S_attr_gap: /* Expecting attribute or = or > */ if (isspace((int) c)) @@ -602,7 +597,7 @@ if (c == '>') { /* End of tag */ - TRACE1("found = but no value\n", NULL); + HTTRACE(SGML_TRACE, "found = but no value\n"); goto got_element_open; } else if (c == '\'') @@ -615,13 +610,13 @@ S_value: context->state = S_value; - string->size = context->token; + HTChunk_truncate(string, context->token); case S_value: if (isspace((int) c) || c == '>') { HTChunk_terminate(string); handle_attribute_value(context); - context->token = string->size; + context->token = HTChunk_size(string); goto S_tag_gap; } else @@ -633,7 +628,7 @@ { HTChunk_terminate(string); handle_attribute_value(context); - context->token = string->size; + context->token = HTChunk_size(string); context->state = S_tag_gap; } else if (c && c != '\n' && c != '\r') @@ -645,7 +640,7 @@ { HTChunk_terminate(string); handle_attribute_value(context); - context->token = string->size; + context->token = HTChunk_size(string); context->state = S_tag_gap; } else if (c && c != '\n' && c != '\r') @@ -658,10 +653,10 @@ else { /* End of end tag name */ HTTag *t; - + char * first; HTChunk_terminate(string); - if (*string->data) - t = SGMLFindTag(dtd, string->data); + if ((first=HTChunk_data(string))!=NULL && *first != '\0') + t = SGMLFindTag(dtd, HTChunk_data(string)); else /* Empty end tag */ /* Original code popped here one @@ -670,20 +665,19 @@ stack back... -- msa */ t = NULL; if (!t) { - TRACE1("Unknown end tag \n", string->data); + HTTRACE(SGML_TRACE, "Unknown end tag \n" _ HTChunk_data(string)); (*context->actions->unparsed_end_element) - (context->target, string->data, string->size); + (context->target, HTChunk_data(string), HTChunk_size(string)); } else { context->current_tag = NULL; end_element(context, t); } - string->size = 0; + HTChunk_clear(string); context->current_attribute_number = INVALID; if (c != '>') { if (!isspace((int) c)) - TRACE2("`data, c); + HTTRACE(SGML_TRACE, "`state = S_junk_tag; } else @@ -768,6 +762,8 @@ text = b; count = 0; context->state = S_text; + } else if (c == '-') { + context->state = S_com_2a; } else context->state = S_com; break; @@ -852,11 +848,30 @@ (dtd->tags+element_number)->contents : SGML_ELEMENT; } +PUBLIC int SGML_findElementNumber (SGML_dtd * dtd, char * name_element) +{ + if (dtd && name_element) { + int i; + HTTag *ct; + for (i = 0; i< dtd->number_of_tags; i++) { + ct = &(dtd->tags[i]); + if (!strcasecomp(ct->name,name_element)) + return i; + } + } + return -1; +} + PUBLIC char * HTTag_name (HTTag * tag) { return tag ? tag->name : NULL; } +PUBLIC SGMLContent HTTag_content (HTTag * tag) +{ + return tag ? tag->contents : SGML_EMPTY; +} + PUBLIC int HTTag_attributes (HTTag * tag) { return tag ? tag->number_of_attributes : -1; @@ -872,3 +887,6 @@ { return attr ? attr->name : NULL; } + + + diff -Naur xdvik-22.40l/libs/libwww/SGML.h xdvik-22.40n/libs/libwww/SGML.h --- xdvik-22.40l/libs/libwww/SGML.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/SGML.h Fri Sep 13 00:23:46 2002 @@ -110,7 +110,7 @@ Not the whole DTD, but all this parser uses of it. */ -#define MAX_ATTRIBUTES 20 /* Max number of attributes per element */ +#define MAX_ATTRIBUTES 32 /* Max number of attributes per element */ typedef struct { HTTag * tags; /* Must be in strcmp order by name */ @@ -122,6 +122,7 @@ extern HTTag * SGML_findTag (SGML_dtd * dtd, int element_number); extern char * SGML_findTagName (SGML_dtd * dtd, int element_number); extern SGMLContent SGML_findTagContents (SGML_dtd * dtd, int element_number); +extern int SGML_findElementNumber(SGML_dtd *dtd, char *name_element); /* . @@ -143,6 +144,6 @@ - @(#) $Id: SGML.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: SGML.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWApp.h xdvik-22.40n/libs/libwww/WWWApp.h --- xdvik-22.40l/libs/libwww/WWWApp.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWApp.h Fri Sep 13 00:23:46 2002 @@ -187,6 +187,6 @@ - @(#) $Id: WWWApp.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: WWWApp.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWCache.h xdvik-22.40n/libs/libwww/WWWCache.h --- xdvik-22.40l/libs/libwww/WWWCache.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWCache.h Fri Sep 13 00:23:46 2002 @@ -76,6 +76,6 @@ - @(#) $Id: WWWCache.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: WWWCache.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWCore.h xdvik-22.40n/libs/libwww/WWWCore.h --- xdvik-22.40l/libs/libwww/WWWCore.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWCore.h Fri Sep 13 00:23:46 2002 @@ -238,21 +238,6 @@ /* ( - File Suffix Binding -) - -This module sets up the binding between a file suffix and a media type, language, -encoding etc. In a client application the suffixes are used in protocols -that does not directly support media types etc., like FTP, and in server -applications they are used to make the bindings between the server and the -local file store that the server can serve to the rest of the world (well -almost) -*/ - -#include "HTBind.h" - -/* -( The Generic Stream Class ) @@ -280,28 +265,28 @@ /* ( - The Input/output Stream Classes + No Free Stream ) -The I/O Stream class defines objects which -accepts a sequence of characters to and from a -transport +This stream is a throughline for all methods except FREE and +ABORT. This means that it can be use to put ahead of streams that you +don't want to be freed or aborted until you are redy to do it +yourself. */ -#include "HTIOStream.h" +#include "HTNoFree.h" /* ( - File Writer Streams + The Input/output Stream Classes ) -This module contains a set of basic file writer streams that are used to -dump data objects to disk at various places within the Library core. Most -notably, we use these streams in the Format Manager -in order to handle external presenters, for example post script viewers etc. -These streams can of course also be used in other contexts by the application. +The I/O Stream class defines objects which +accepts a sequence of characters to and from a +transport */ -#include "HTFWrite.h" + +#include "HTIOStream.h" /* ( @@ -394,6 +379,6 @@ - @(#) $Id: WWWCore.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: WWWCore.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWDir.h xdvik-22.40n/libs/libwww/WWWDir.h --- xdvik-22.40l/libs/libwww/WWWDir.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWDir.h Fri Sep 13 00:23:46 2002 @@ -104,6 +104,6 @@ - @(#) $Id: WWWDir.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: WWWDir.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWFTP.h xdvik-22.40n/libs/libwww/WWWFTP.h --- xdvik-22.40l/libs/libwww/WWWFTP.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWFTP.h Fri Sep 13 00:23:46 2002 @@ -77,6 +77,6 @@ - @(#) $Id: WWWFTP.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: WWWFTP.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWFile.h xdvik-22.40n/libs/libwww/WWWFile.h --- xdvik-22.40l/libs/libwww/WWWFile.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWFile.h Fri Sep 13 00:23:46 2002 @@ -61,7 +61,7 @@ Content Negotiation ) -When accessing the lccal file system, you can enable content negotiation +When accessing the local file system, you can enable content negotiation as described in the HTTP specification.  The content negotiation algorithm is based on file suffixes as defined by the Bind manager. When looking @@ -73,9 +73,37 @@ encoding, etc. - exactly like a server would do with the accept headers. */ + #include "HTMulti.h" /* +( + File Suffix Binding +) + +This module sets up the binding between a file suffix and a media type, language, +encoding etc. In a client application the suffixes are used in protocols +that does not directly support media types etc., like FTP, and in server +applications they are used to make the bindings between the server and the +local file store that the server can serve to the rest of the world (well +almost) +*/ + +#include "HTBind.h" + +/* +. + Default File Suffix Bindings +. + +Register the default set of bindings between file suffixes and media types. +This is used for example to guess the media type of a FTP URL of a local +file URL. +*/ + +#include "HTBInit.h" + +/* End of FILE module */ @@ -90,6 +118,6 @@ - @(#) $Id: WWWFile.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: WWWFile.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWGophe.h xdvik-22.40n/libs/libwww/WWWGophe.h --- xdvik-22.40l/libs/libwww/WWWGophe.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWGophe.h Fri Sep 13 00:23:46 2002 @@ -73,7 +73,7 @@ -@(#) $Id: WWWGophe.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ +@(#) $Id: WWWGophe.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWHTML.h xdvik-22.40n/libs/libwww/WWWHTML.h --- xdvik-22.40l/libs/libwww/WWWHTML.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWHTML.h Fri Sep 13 00:23:46 2002 @@ -48,15 +48,15 @@ . */ -#include "HText.h" #include "HTMLPDTD.h" #include "SGML.h" #include "HTMLGen.h" #include "HTTeXGen.h" - -#ifdef HT_EXPAT -#include "HTXML.h" -#endif +#include "HTPlain.h" +#include "HTML.h" +#include "HText.h" +#include "HTHInit.h" +#include "HTStyle.h" /* @@ -73,6 +73,6 @@ - @(#) $Id: WWWHTML.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: WWWHTML.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWHTTP.h xdvik-22.40n/libs/libwww/WWWHTTP.h --- xdvik-22.40l/libs/libwww/WWWHTTP.h Wed Apr 18 14:23:27 2001 +++ xdvik-22.40n/libs/libwww/WWWHTTP.h Fri Sep 13 00:23:46 2002 @@ -116,7 +116,7 @@ /* ( - HTTP Extensions and PEP + HTTP Extensions ) The PEP Manager is a registry for PEP Protocols @@ -150,11 +150,27 @@ Contains code for parsing challenges and creating credentials for basic and digest authentication schemes. See also the HTAAUtil -module for how to handle other authentication schemes. +module for how to handle other authentication schemes. */ #include "HTAABrow.h" /* +( + HTTP Cookies +) + +The cookie module provides a simple +HTTP Cookie +handling mechanism. It really also is an excersize in showing how libwww +can be extended with something like cookies in a modular manner. An important +thing to note about this implementation is that it does not provide +storage for cookies - this is left to the application as normally cookies +have to be kept under lock. +*/ + +#include "HTCookie.h" + +/* End of HTTP module */ @@ -169,6 +185,6 @@ - @(#) $Id: WWWHTTP.h,v 1.1.1.1 2001/04/18 14:23:27 stefanulrich Exp $ + @(#) $Id: WWWHTTP.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWInit.h xdvik-22.40n/libs/libwww/WWWInit.h --- xdvik-22.40l/libs/libwww/WWWInit.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWInit.h Fri Sep 13 00:23:46 2002 @@ -1,6 +1,6 @@ /* - + W3C Sample Code Library libwww Default Initialization @@ -24,10 +24,9 @@ libwww is kept application independent and can be used as the basic building block for any kind of Web application. The Library comes with a large set of default functions, for example for accessing HTTP and FTP servers, parsing -RFC -822 headers etc. This module helps the application programmer setting -up all this functionality, but it is important to note that none of it is -required in order to use the Library. +MIME headers etc. This module helps the application programmer setting up +all this functionality, but it is important to note that none of it is +required in order to use libwww. */ #ifndef WWWINIT_H @@ -42,50 +41,31 @@ /* . - Application Profiles -. - -Application profiles are initialization functions that are "preset" to initialize -the Library with the set of features often used in clients, -servers, robots, and proxy servers. They are basically -collections of the more detailed initialization functions that you can find -later in this interface description. In many cases you do not need to use -anything else than the profiles, but if you have more specific requirements -then you can always fall back on using the initialization functions below -or even werite your own extensions. -*/ -#include "HTProfil.h" - -/* -. Default Protocols, Transports, MIME Headers, Dialogs etc. . This module contains a large set of default initialization functions for protocol modules, stream converters, event managers etc. */ + #include "HTInit.h" /* . - Default HTML Parsers + Application Profiles . -This file contains the initialization for the HTML parsers in libwww. The -parsers are used for presenting HTML objects as well as clear text documents. +Application profiles are initialization functions that are "preset" to initialize +the Library with the set of features often used in clients, +servers, robots, and proxy servers. They are basically +collections of the more detailed initialization functions that you can find +later in this interface description. In many cases you do not need to use +anything else than the profiles, but if you have more specific requirements +then you can always fall back on using the initialization functions below +or even werite your own extensions. */ -#include "HTHInit.h" - -/* -. - Default File Suffix Binding -. -Register the default set of bindings between file suffixes and media types. -This is used for example to guess the media type of a FTP URL of a local -file URL. -*/ -#include "HTBInit.h" +#include "HTProfil.h" /* */ @@ -100,6 +80,6 @@ - @(#) $Id: WWWInit.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWInit.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWLib.h xdvik-22.40n/libs/libwww/WWWLib.h --- xdvik-22.40l/libs/libwww/WWWLib.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWLib.h Fri Sep 13 00:23:46 2002 @@ -87,6 +87,6 @@ - @(#) $Id: WWWLib.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWLib.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWMIME.h xdvik-22.40n/libs/libwww/WWWMIME.h --- xdvik-22.40l/libs/libwww/WWWMIME.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWMIME.h Fri Sep 13 00:23:46 2002 @@ -123,6 +123,6 @@ - @(#) $Id: WWWMIME.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWMIME.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWMux.h xdvik-22.40n/libs/libwww/WWWMux.h --- xdvik-22.40l/libs/libwww/WWWMux.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWMux.h Fri Sep 13 00:23:46 2002 @@ -60,6 +60,6 @@ - @(#) $Id: WWWMux.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWMux.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWNews.h xdvik-22.40n/libs/libwww/WWWNews.h --- xdvik-22.40l/libs/libwww/WWWNews.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWNews.h Fri Sep 13 00:23:46 2002 @@ -99,6 +99,6 @@ - @(#) $Id: WWWNews.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWNews.h,v 1.1.1.1.8.1 2002/09/13 00:23:46 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWSQL.h xdvik-22.40n/libs/libwww/WWWSQL.h --- xdvik-22.40l/libs/libwww/WWWSQL.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWSQL.h Fri Sep 13 00:23:47 2002 @@ -84,6 +84,6 @@ - @(#) $Id: WWWSQL.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWSQL.h,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWStream.h xdvik-22.40n/libs/libwww/WWWStream.h --- xdvik-22.40l/libs/libwww/WWWStream.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWStream.h Fri Sep 13 00:23:47 2002 @@ -51,10 +51,26 @@ maximum buffer limit is reached Content-Length is calculated for logs but it is not sent to the client -- rather the buffer is flushed right away. */ + #include "HTConLen.h" /* Content Length Counter */ /* ( + File Writer Streams +) + +This module contains a set of basic file writer streams that are used to +dump data objects to disk at various places within the Library core. Most +notably, we use these streams in the Format Manager +in order to handle external presenters, for example post script viewers etc. +These streams can of course also be used in other contexts by the application. +*/ + +#include "HTFWrite.h" +#include "HTFSave.h" + +/* +( Content Guess Stream ) @@ -121,6 +137,18 @@ */ #include "HTXParse.h" /* External parse stream */ +#include "HTEPtoCl.h" /* Client callbacks */ + +/* +( + Network Telnet To Internal Character Text +) + +This is a filter stream suitable for taking text from a socket and passing +it into a stream which expects text in the local C representation. +*/ + +#include "HTNetTxt.h" /* */ @@ -135,6 +163,6 @@ - @(#) $Id: WWWStream.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWStream.h,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWTelnt.h xdvik-22.40n/libs/libwww/WWWTelnt.h --- xdvik-22.40l/libs/libwww/WWWTelnt.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWTelnt.h Fri Sep 13 00:23:47 2002 @@ -73,7 +73,7 @@ -@(#) $Id: WWWTelnt.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ +@(#) $Id: WWWTelnt.h,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWTrans.h xdvik-22.40n/libs/libwww/WWWTrans.h --- xdvik-22.40l/libs/libwww/WWWTrans.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWTrans.h Fri Sep 13 00:23:47 2002 @@ -77,6 +77,6 @@ - @(#) $Id: WWWTrans.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWTrans.h,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWUtil.h xdvik-22.40n/libs/libwww/WWWUtil.h --- xdvik-22.40l/libs/libwww/WWWUtil.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWUtil.h Fri Sep 13 00:23:47 2002 @@ -176,6 +176,6 @@ - @(#) $Id: WWWUtil.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWUtil.h,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWWAIS.h xdvik-22.40n/libs/libwww/WWWWAIS.h --- xdvik-22.40l/libs/libwww/WWWWAIS.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWWAIS.h Fri Sep 13 00:23:47 2002 @@ -68,6 +68,6 @@ - @(#) $Id: WWWWAIS.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWWAIS.h,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/WWWXML.h xdvik-22.40n/libs/libwww/WWWXML.h --- xdvik-22.40l/libs/libwww/WWWXML.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/WWWXML.h Fri Sep 13 00:23:47 2002 @@ -0,0 +1,92 @@ +/* + + W3C Sample Code Library libwww XML/RDF Module + + +! + Declaration of W3C Sample Code XML/RDF Module +! +*/ + +/* +** (c) COPYRIGHT MIT 1999. +** Please first read the full copyright statement in the file COPYRIGH. +*/ + +/* + +Thanks so much to John Punin for writing this code! + +We use James Clark's expat +XML parser which is very neat indeed. As the code doesn't come as a separate +library, I included it in the libwww CVS code base where I compile is as +two libraries: libxmltok.a and libxmlparse.a. See +the external modules that libwww works with for +details. +*/ + +#ifndef WWWXML_H +#define WWWXML_H + +/* +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +. + System dependencies +. + +The wwwsys.h file includes system-specific include +files and flags for I/O to network and disk. The only reason for this file +is that the Internet world is more complicated than Posix and ANSI. +*/ + +#include "wwwsys.h" + +/* +( + The Libwww Expat Wrapper Stream +) +*/ + +#ifdef HT_EXPAT +#include "HTXML.h" +#endif /* HT_EXPAT */ + +/* +( + The RDF Parser Using The XML Parser +) + +This RDF parser is based on Janne Saarela's Java based +SiRPAC and +James Clark's expat XML +parser +*/ + +#ifdef HT_EXPAT +#include "HTRDF.h" +#endif /* HT_EXPAT */ + +/* + +End of XML module +*/ + +#ifdef __cplusplus +} /* end extern C definitions */ +#endif + +#endif + +/* + + + + @(#) $Id: WWWXML.h,v 1.1.2.1 2002/09/13 00:23:47 stefanulrich Exp $ + +*/ diff -Naur xdvik-22.40l/libs/libwww/WWWZip.h xdvik-22.40n/libs/libwww/WWWZip.h --- xdvik-22.40l/libs/libwww/WWWZip.h Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/WWWZip.h Fri Sep 13 00:23:47 2002 @@ -65,6 +65,6 @@ - @(#) $Id: WWWZip.h,v 1.1.1.1 2001/04/18 14:23:28 stefanulrich Exp $ + @(#) $Id: WWWZip.h,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/libwww/aclocal.m4 xdvik-22.40n/libs/libwww/aclocal.m4 --- xdvik-22.40l/libs/libwww/aclocal.m4 Wed Apr 18 14:23:28 2001 +++ xdvik-22.40n/libs/libwww/aclocal.m4 Fri Sep 13 00:23:47 2002 @@ -1,7 +1,7 @@ -dnl aclocal.m4 generated automatically by aclocal 1.3 +dnl aclocal.m4 generated automatically by aclocal 1.4 -dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. -dnl This Makefile.in is free software; the Free Software Foundation +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -263,19 +263,6 @@ done ]) -dnl AC_C_VOLATILE -AC_DEFUN(AC_C_VOLATILE, -[ AC_MSG_CHECKING([for working volatile]) - AC_CACHE_VAL(ac_cv_c_volatile, - [ AC_TRY_COMPILE(,[ -extern volatile int errno; -], ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])dnl - AC_MSG_RESULT($ac_cv_c_volatile) -if test $ac_cv_c_volatile = no; then - AC_DEFINE(volatile, ) -fi -]) - dnl AC_C_NOSHARE AC_DEFUN(AC_C_NOSHARE, [ AC_MSG_CHECKING([for working noshare]) @@ -415,23 +402,6 @@ fi ]) -dnl AC_HEADER_TIOCGWINSZ -AC_DEFUN(AC_HEADER_TIOCGWINSZ, -[ AC_MSG_CHECKING([for TIOCGWINSZ get-window-size capability]) - AC_CACHE_VAL(ac_cv_header_tiocgwinsz, - [ AC_HEADER_INCLUDE(tmp_inc_termios, sys/termios.h termios.h) - AC_EGREP_HEADER(yes, [ -$tmp_inc_termios -#ifdef TIOCGWINSZ - yes -#endif -], ac_cv_header_tiocgwinsz=yes, ac_cv_header_tiocgwinsz=no)])dnl - AC_MSG_RESULT($ac_cv_header_tiocgwinsz) -if test $ac_cv_header_tiocgwinsz = yes; then - AC_DEFINE(GET_SCREEN_SIZE) -fi -]) - dnl AC_SYS_NEED_SIGNAL_RESET dnl If signal handlers need to be reset, define NEED_SIGNAL_RESET AC_DEFUN(AC_SYS_NEED_SIGNAL_RESET, @@ -745,7 +715,7 @@ dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AM_PROG_INSTALL]) +[AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] @@ -755,8 +725,8 @@ AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. @@ -768,15 +738,6 @@ AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# serial 1 - -AC_DEFUN(AM_PROG_INSTALL, -[AC_REQUIRE([AC_PROG_INSTALL]) -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' -AC_SUBST(INSTALL_SCRIPT)dnl -]) - # # Check to make sure that the build environment is sane. # @@ -859,42 +820,67 @@ done<<>>dnl>>) changequote([,]))]) -# Check to see if we're running under Cygwin32, without using -# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes". -# Otherwise set it to "no". - -dnl AM_CYGWIN32() -AC_DEFUN(AM_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32, -[AC_TRY_COMPILE(,[return __CYGWIN32__;], -am_cv_cygwin32=yes, am_cv_cygwin32=no) -rm -f conftest*]) -CYGWIN32= -test "$am_cv_cygwin32" = yes && CYGWIN32=yes]) - - -# serial 24 AM_PROG_LIBTOOL -AC_DEFUN(AM_PROG_LIBTOOL, -[AC_REQUIRE([AM_ENABLE_SHARED])dnl -AC_REQUIRE([AM_ENABLE_STATIC])dnl + +# serial 40 AC_PROG_LIBTOOL +AC_DEFUN(AC_PROG_LIBTOOL, +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN(AC_LIBTOOL_SETUP, +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AM_PROG_LD])dnl -AC_REQUIRE([AM_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl # Check for any special flags to pass to ltconfig. -libtool_flags= +libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$silent" = yes && libtool_flags="$libtool_flags --silent" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. @@ -920,30 +906,45 @@ *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi ;; -esac -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ -|| AC_MSG_ERROR([libtool configure failed]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; ]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) -# AM_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AM_ENABLE_SHARED[(DEFAULT)] +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. -AC_DEFUN(AM_ENABLE_SHARED, -[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_DEFUN(AC_ENABLE_SHARED, [dnl +define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(shared, changequote(<<, >>)dnl -<< --enable-shared build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT] +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], changequote([, ])dnl -[ --enable-shared=PKGS only build shared libraries if the current package - appears as an element in the PKGS list], [p=${PACKAGE-default} case "$enableval" in yes) enable_shared=yes ;; @@ -960,29 +961,23 @@ IFS="$ac_save_ifs" ;; esac], -enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl ]) -# AM_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN(AM_DISABLE_SHARED, -[AM_ENABLE_SHARED(no)]) +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) -# AM_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN(AM_DISABLE_STATIC, -[AM_ENABLE_STATIC(no)]) - -# AM_ENABLE_STATIC - implement the --enable-static flag -# Usage: AM_ENABLE_STATIC[(DEFAULT)] +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. -AC_DEFUN(AM_ENABLE_STATIC, -[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_DEFUN(AC_ENABLE_STATIC, [dnl +define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(static, changequote(<<, >>)dnl -<< --enable-static build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT] +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], changequote([, ])dnl -[ --enable-static=PKGS only build shared libraries if the current package - appears as an element in the PKGS list], [p=${PACKAGE-default} case "$enableval" in yes) enable_static=yes ;; @@ -999,26 +994,73 @@ IFS="$ac_save_ifs" ;; esac], -enable_static=AM_ENABLE_STATIC_DEFAULT)dnl +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl ]) +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + -# AM_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN(AM_PROG_LD, +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl +define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AC_PROG_LD, [AC_ARG_WITH(gnu-ld, [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by GCC]) ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in - # Accept absolute paths. - /* | [A-Za-z]:\\*) - test -z "$LD" && LD="$ac_prog" - ;; + # Accept absolute paths. +changequote(,)dnl + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' +changequote([,])dnl + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld @@ -1035,10 +1077,10 @@ fi AC_CACHE_VAL(ac_cv_path_LD, [if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog"; then + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then ac_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. @@ -1046,7 +1088,7 @@ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else - test "$with_gnu_ld" != yes && break + test "$with_gnu_ld" != yes && break fi fi done @@ -1062,10 +1104,10 @@ fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) AC_SUBST(LD) -AM_PROG_LD_GNU +AC_PROG_LD_GNU ]) -AC_DEFUN(AM_PROG_LD_GNU, +AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then @@ -1075,38 +1117,115 @@ fi]) ]) -# AM_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN(AM_PROG_NM, +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AC_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, -[case "$NM" in -/* | [A-Za-z]:\\*) - ac_cv_path_NM="$NM" # Let the user override the test with a path. - ;; -*) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do +[if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm; then + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" + ac_cv_path_NM="$ac_dir/nm -B" + break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" + ac_cv_path_NM="$ac_dir/nm -p" + break else - ac_cv_path_NM="$ac_dir/nm" + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags fi - break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm - ;; -esac]) +fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) AC_SUBST(NM) ]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN(AC_CHECK_LIBM, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case "$host" in +*-*-beos* | *-*-cygwin*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library, adds --enable-ltdl-convenience to +# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor +# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed +# to be `${top_builddir}/libltdl'. Make sure you start DIR with +# '${top_builddir}/' (note the single quotes!) if your package is not +# flat, and, if you're not using automake, define top_builddir as +# appropriate in the Makefiles. +AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case "$enable_ltdl_convenience" in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la + INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library, and adds --enable-ltdl-install to +# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor +# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed +# to be `${top_builddir}/libltdl'. Make sure you start DIR with +# '${top_builddir}/' (note the single quotes!) if your package is not +# flat, and, if you're not using automake, define top_builddir as +# appropriate in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la + INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +dnl old names +AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl +AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl +AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl +AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl +AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl +AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl +AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl diff -Naur xdvik-22.40l/libs/libwww/config/CVS/Entries xdvik-22.40n/libs/libwww/config/CVS/Entries --- xdvik-22.40l/libs/libwww/config/CVS/Entries Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/CVS/Entries Mon Sep 16 17:44:49 2002 @@ -0,0 +1,10 @@ +/config.guess/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/config.sub/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/install-sh/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/install.sh/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/klibtool/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/ltconfig/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/ltmain.sh/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/missing/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +/mkinstalldirs/1.1.2.1/Fri Sep 13 00:23:47 2002//Txdvik_22_40_STABLE +D diff -Naur xdvik-22.40l/libs/libwww/config/CVS/Repository xdvik-22.40n/libs/libwww/config/CVS/Repository --- xdvik-22.40l/libs/libwww/config/CVS/Repository Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/CVS/Repository Mon Sep 16 17:44:49 2002 @@ -0,0 +1 @@ +xdvik/libs/libwww/config diff -Naur xdvik-22.40l/libs/libwww/config/CVS/Root xdvik-22.40n/libs/libwww/config/CVS/Root --- xdvik-22.40l/libs/libwww/config/CVS/Root Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/CVS/Root Mon Sep 16 17:44:49 2002 @@ -0,0 +1 @@ +:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/libwww/config/CVS/Tag xdvik-22.40n/libs/libwww/config/CVS/Tag --- xdvik-22.40l/libs/libwww/config/CVS/Tag Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/CVS/Tag Mon Sep 16 17:44:49 2002 @@ -0,0 +1 @@ +Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/libwww/config/config.guess xdvik-22.40n/libs/libwww/config/config.guess --- xdvik-22.40l/libs/libwww/config/config.guess Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/config.guess Fri Sep 13 00:23:47 2002 @@ -0,0 +1,1363 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-09-03' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# This shell variable is my proudest work .. or something. --bje + +set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; +(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) + || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; +dummy=$tmpdir/dummy ; +files="$dummy.c $dummy.o $dummy.rel $dummy" ; +trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $files ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; +unset files' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + eval $set_cc_for_build + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + 3-1307) + UNAME_MACHINE="alphaev7" + ;; + esac + fi + rm -f $dummy.s $dummy && rmdir $tmpdir + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy && rmdir $tmpdir + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +rm -f $dummy.c $dummy && rmdir $tmpdir + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Naur xdvik-22.40l/libs/libwww/config/config.sub xdvik-22.40n/libs/libwww/config/config.sub --- xdvik-22.40l/libs/libwww/config/config.sub Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/config.sub Fri Sep 13 00:23:47 2002 @@ -0,0 +1,1470 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-08-22' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39 | mipstx39el \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Naur xdvik-22.40l/libs/libwww/config/install-sh xdvik-22.40n/libs/libwww/config/install-sh --- xdvik-22.40l/libs/libwww/config/install-sh Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/install-sh Fri Sep 13 00:23:47 2002 @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -Naur xdvik-22.40l/libs/libwww/config/install.sh xdvik-22.40n/libs/libwww/config/install.sh --- xdvik-22.40l/libs/libwww/config/install.sh Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/install.sh Fri Sep 13 00:23:47 2002 @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff -Naur xdvik-22.40l/libs/libwww/config/klibtool xdvik-22.40n/libs/libwww/config/klibtool --- xdvik-22.40l/libs/libwww/config/klibtool Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/klibtool Fri Sep 13 00:23:47 2002 @@ -0,0 +1,705 @@ +#!/bin/sh +# This purports to allow distributions to be built with shared libraries. +# +# I wrote it for Kpathsea and friends, but I don't think there's +# anything TeX-specific in here. +# +# There is a much fancier libtool project underway by +# , but I did not want to wait for that to be +# completed, stable, and portable before releasing Web2c. The ideas are +# based on Gord's Libtool, though, and you may find its documentation +# interesting/useful reading. +# +# Porting this to other systems shouldn't be too hard, mostly because I +# don't try to take advantage of all the fancy features offered by some +# os's (like multiple version compatibility, encoding directory paths in +# the binary, etc.) See the configure mode. I can send you the +# hello,world Makefile I used for testing if you want it. +# +rcs_version='$Id: klibtool,v 1.1.2.1 2002/09/13 00:23:47 stefanulrich Exp $' +version=0.1 +maint=tex-k@mail.tug.org +help="Usage: $0 [OPTION]... MODE [ARG]... +Help for building and linking with shared libraries. + +Modes: Environment variables used: +configure [HOSTTYPE] RANLIB, LIBTOOL_OBJTYPES +compile CC SOURCEFILE ARG... +archive AR ARFLAGS LIBNAME ARG... +link CC ARG... +install-lib DIR LIBNAME... INSTALL_DATA +install-prog DIR PROGNAME... INSTALL_PROGRAM +version + +Options: + --source-dir DIR + --config-dir DIR +-n, --dry-run + --help + --quiet, --silent +-v, --verbose + --version + +Email bugs to $maint. +" + +bug_report="$0: Please report this bug to $maint. +Please mention this is Klibtool version $version ($rcs_version), +and your hardware/operating system (`uname -a`, at least). + +Running this same command ($0 $*) with --verbose and including the +resulting output would be nice, but is not required." + +verbose=: +chicken= +show=echo +config_dir= +source_dir= + +# Yes, this option parsing is imperfect, e.g., -xcruddy will be +# recognized as --config-dir. I don't think it's worth the trouble to +# program correctly until somebody besides me uses this. +while test $# -gt 0; do + case "$1" in + configure|compile|archive|link|install-lib|install-prog|version) + mode=$1; break;; + --source-dir) # --source-dir + shift; source_dir=$1;; + -*c*) # --config-dir + shift; config_dir=$1;; + -n|-*d*) # -n, --dry-run + chicken=echo;; + -*help) # --help + echo "$help"; exit 0;; + -*q|-*s) # --quiet, --silent + show=:; verbose=:;; + -v|-*verb*) # --verbose + verbose=echo;; + -*version) # --version + echo "$0 version $version ($rcs_version)"; exit 0;; + -*) + echo "$0: Unknown option \`$1'. Try --help for info." >&2; exit 1;; + *) + echo "$0: Unknown mode \`$1'. Try --help for info." >&2; exit 1;; + esac + shift +done + +# Read all the arguments. Peel off the mode. +shift + +# +# Read the configuration file unless we're configuring. +# +if test $mode != configure; then + # Read configuration file. If we have it in the current directory, or + # the user told us where it is, great. More likely, though, it's only + # in the directory with the library that we're eventually going to + # link with. We have no way of knowing what that is, so let's use the + # location of this script itself as the default if not in `.', `..', + # or `../..'. + test -z "$config_dir" && config_dir=$KLIBTOOL_CONFIG_DIR + if test -z "$config_dir"; then + if test -r ./klibtool.config; then + config_dir=. + elif test -r ../klibtool.config; then + config_dir=.. + elif test -r ../../klibtool.config; then + config_dir=../.. + else + dir=`echo $0 | sed 's,/[^/]*$,,'` + test -r $dir/klibtool.config && config_dir=$dir + fi + fi + if test -z "$config_dir"; then + echo "$0: Cannot find klibtool.config in . or .. or $dir," >&2 + echo "$0: and no --config-dir option specified" >&2 + echo "$0: or KLIBTOOL_CONFIG_DIR environment variable set." >&2 + exit 1 + fi + # Read the file. + . $config_dir/klibtool.config + + if test -z "$LIBTOOL_OBJTYPES"; then + echo "$0: Impossibly empty LIBTOOL_OBJTYPES!" >&2 + echo "$bug_report" >&2 + exit 1 + fi + # Copy the valid object type names from LIBTOOL_OBJTYPES into objtypes. + $verbose "$0: checking LIBTOOL_OBJTYPES = $LIBTOOL_OBJTYPES." + objtypes= + for ot in `echo $LIBTOOL_OBJTYPES | tr : " "`; do + case $ot in + SHARED) + if $shared_support; then + objtypes=$objtypes:$ot + else + echo "$0: Shared libraries not supported on this system." >&2 + fi + ;; + STATIC) + objtypes=$objtypes:$ot;; + "") true;; # don't worry about empty object types. + *) + echo "$0: Ignoring unknown libtool object type $objtype." >&2;; + esac + done + # Remove the extra trailing colon from our list-building. + objtypes=`echo $objtypes | sed 's/^://'` + if test -z $objtypes; then + # If they just took the default, we started with STATIC and so + # wouldn't be here. + echo "$0: No valid object types in $LIBTOOL_OBJTYPES, quitting." >&2 + exit 1 + fi + $verbose "$0: final objtypes = $objtypes." +fi + + +# +# Do the deed. +# +# I wish we had subroutines so we could make this readable, but shell +# functions aren't portable enough, even nowadays. +# +$verbose "$0: mode = $mode." +case $mode in + + + # configure mode: [HOSTTYPE] + configure) + # If no config dir specified, use the script location. + if test -z "$config_dir"; then + if echo $0 | grep / >/dev/null; then + config_dir=`echo $0 | sed 's,/[^/]*$,,'` + else + config_dir=. # $0 is just the script name, no directory part. + fi + fi + if test -z "$source_dir"; then + source_dir=$config_dir + fi + config_file=$config_dir/klibtool.config + config_tmp=$config_dir/klt$$.tmp + $verbose "$0: writing to config_file = $config_file." + + # If no specified HOSTTYPE, guess it. + if test $# -eq 0; then + config_guess=$source_dir/config.guess + if test ! -r $config_guess; then + echo "$0: config.guess not in $source_dir." >&2 + echo "$0: Either specify a host type or get the scripts." >&2 + exit 1 + fi + host_alias=`$config_guess` + else + test $# -eq 1 \ + || echo "$0: Using $1 as host alias, ignoring other arguments ($*)." >&2 + host_alias=$1 + fi + + # Convert the original host type to canonical form. + config_sub=$source_dir/config.sub + if test ! -r $config_sub; then + echo "$0: config.sub missing from $source_dir; it's required." >&2 + exit 1 + fi + host_type=`$config_sub $host_alias` + if test -z "$host_type"; then + echo "$0: $host_alias not a recognizable host type." >&2 + exit 1 + fi + + # Define defaults, to be overridden in the system-specific cases. + config_vars="LIBTOOL_OBJTYPES shared_support shared_ext libpath_var CC + args_STATIC_compile args_SHARED_compile + args_STATIC_archive STATIC_ranlib args_SHARED_archive + args_SHARED_link + SHARED_postinstall" + for v in $config_vars; do + # Preserve existing value of a couple variables. + case $v in + LIBTOOL_OBJTYPES|CC) true;; + *) eval $v=;; + esac + done + test -z "$LIBTOOL_OBJTYPES" && LIBTOOL_OBJTYPES=STATIC + shared_ext=so + libpath_var=LD_LIBRARY_PATH + STATIC_ranlib=$RANLIB + + # The compiler. If the user set CC, take that, else use gcc if we + # can find it, else use cc. Up to the user to avoid /usr/ucb/cc. + if test -z "$CC"; then + for dir in `echo $PATH | tr : ' '`; do + test -z "$dir" && dir=. + if test -f $dir/gcc; then + CC=gcc + break + elif test -f $dir/gcc.exe; then + CC=gcc + break + fi + done + fi + test -z "$CC" && CC=cc + # + # But the real question is not the name of the command, it's whether + # it is GNU C. We only distinguish gcc and system cc. We have to + # assume that they use the same compiler at `klibtool compile' time + # as we determine here; the whole point is that we don't want to do + # this check before compiling every file (for speed). + rm -f conftest.c + ( + echo "#ifdef __GNUC__" + echo "yes;" + echo "#endif" + ) >conftest.c + if eval "$CC -E conftest.c" | grep yes >/dev/null 2>&1; then + compiler=gcc + args_SHARED_compile=-fPIC # should we have an option for -fpic? + args_SHARED_archive=-shared + else + compiler=cc + fi + rm -f conftest.c + + # Override defaults for this system. + case $host_type in + *-*-linux*) + shared_support=true + SHARED_postinstall='ldconfig $libdir' + ;; + + *-*-solaris2*) + shared_support=true + if test $compiler = cc; then # /opt/SUNWspro/cc, that is. + args_SHARED_compile=-KPIC + args_SHARED_archive="-G -z text" # Perhaps should have -h. + fi + ;; + + *-*-sysv4.2*) + shared_support=true + if test $compiler = cc; then # /opt/ccs/bin/cc, that is. + args_SHARED_compile=-KPIC + args_SHARED_archive="-G -z text" + fi + ;; + + *-*-sunos4*) + shared_support=true + STATIC_ranlib=ranlib + SHARED_postinstall='ldconfig $libdir' + if test $compiler = cc; then + args_SHARED_compile=-PIC + prog_SHARED_archive=ld + args_SHARED_archive="-assert pure-text" # gord has -Bstatic? + fi + ;; + + *-*-irix5*|*-*-irix6*) + shared_support=true + args_SHARED_compile= + ;; + + *-*-*djgpp* | *-*-*go32* | *-*-msdos*) + shared_support=false + libpath_var=LIBRARY_PATH + ;; + + *-*-freebsd*) + shared_support=true + SHARED_postinstall='ldconfig -m $libdir' + ;; + + hppa*-*-hpux*) + if test $compiler = gcc; then + shared_support=true + args_SHARED_archive='-shared -fPIC' + shared_ext='sl' + fi + ;; + + *) + echo "$0: $host_type not explicitly supported, using defaults." >&2 + ;; + esac + + # Finally, we'll be creating something. + rm -f $config_tmp + + # Output values. + for v in $config_vars; do + config_line=$v=\'`eval echo '$'$v`\' + $verbose "$0: writing config line $config_line." + echo $config_line >>$config_tmp + done + + # Check if this changed anything. + if cmp -s $config_file $config_tmp 2>/dev/null; then + $verbose "$0: $config_file is unchanged" + rm -f $config_tmp + else + rm -f $config_file + mv $config_tmp $config_file + fi + ;; + + + # compile mode: CC SOURCEFILE [ARG]... + compile) + compiler=$1; shift # must assume it's what configure found + sourcefile=$1 + objname=`basename $sourcefile | sed 's/\.[^./]*$//'`.o + $verbose "$0: object basename for source file $sourcefile = $objname." + # + for ot in `echo $objtypes | tr : " "`; do + # Snarf arguments for this object type. + ot_args=`eval echo '$'args_${ot}_${mode}` + $verbose "$0: args_${ot}_${mode} = $ot_args." + + # Have to output into a subdirectory of current directory (not + # source directory, which might be read-only). + output_arg="-o $ot/$objname" + if test ! -d $ot; then + $show mkdir $ot + $chicken mkdir $ot + fi + + # Construct and run the cmd. + cmd="$compiler ""$@"" $ot_args $output_arg" + $show $cmd + $chicken eval "$cmd" + status=$? + test $status -eq 0 || break + done # end of objtypes loop for compile mode + test $status -eq 0 && date >./"`echo $objname | sed 's/o$/lo/'`" + exit $status + ;; + + + # archive mode + archive) + cmdname=$1; shift # the archiver + for ot in `echo $objtypes | tr : " "`; do + libname= + args= + if test $ot = SHARED; then + # Can't generally use ar to make a shared library. + old_ar="$cmdname $1" + shift + ot_args=`eval echo '$'args_SHARED_archive` + ot_prog=`eval echo '$'prog_SHARED_archive` + test -z "$ot_prog" && ot_prog=$CC + cmdname="$ot_prog $ot_args -o" + $verbose "$0: replaced $old_ar with $cmdname." + fi + + # Now transform remaining arguments (presumably filenames). + for arg in "$@"; do + case "$arg" in + *.l[ao]) # Remove the `l' from a .la or .lo filename. + newarg=`echo $arg | sed 's/l\(.\)$/\1/'` + $verbose "$0: transformed arg $arg to $newarg." + # First .la file is the output library. + if test -z "$libname" && echo $newarg | grep '\.a$'>/dev/null; then + if test $ot = SHARED; then + $verbose "$0: running $0 version $newarg." + verstring=`$0 version $newarg` + $verbose "$0: got version $verstring." + libname=`echo $newarg | sed 's/\.a$/\.'$shared_ext$verstring/` + else + libname=$newarg + fi + if echo $libname | grep / >/dev/null; then + lib_dir=`echo $libname | sed 's,/[^/]*$,,'` + else + lib_dir=. + fi + lib_basename=`basename $libname` + lib_base=`echo $lib_basename | sed 's/[.0-9]*$//'` + + # We might have to run a command after making the library. + post= + if test $ot = SHARED; then + # If it supports shared libraries, it supports symlinks. + # Although this is unnecessary on (e.g.) SunOS, it + # doesn't hurt, and it is necessary on (e.g.) Solaris. + post="&& rm -f $lib_base && ln -s $lib_basename $lib_base" + elif test $ot = STATIC; then + ranlib=`eval echo '$'${ot}_ranlib` + $verbose "${ot}_ranlib = $ranlib." + test -n "$ranlib" && post="&& $ranlib $lib_basename" + fi + + $verbose "$0: output library dir = $lib_dir." + $verbose "$0: output library basename = $lib_basename." + $verbose "$0: output library base = $lib_base." + newarg=$lib_basename + fi + arg=$newarg + ;; + esac + args="$args $arg" + done + if test -z "$libname"; then + # FIXME: should check that the .la file was second arg. + echo "$0 archive: .la (libtool archive) argument missing." >&2 + exit 1 + fi + + # Remove old archive file because we recommend `ar q', not `r', + # and the user can't necessarily know the library name. We remove + # both $lib_base and $lib_base* because on MS-DOS the latter may not + # match the former. + cmd="cd $lib_dir/$ot && rm -f $lib_base $lib_base* && $cmdname $args $post" + $show $cmd + $chicken eval "($cmd)" + status=$? + test $status -eq 0 || break + + # If making both objtypes, need original arguments next time through. + if test $ot = SHARED; then + cmdname=$old_ar + else + true # Don't think we failed to make the library just because + # the last objtype was not SHARED. + fi + done # end of objtypes loop for archive mode + # + # Create the .la file we claimed that we would. + test $status -eq 0 && date >./"`echo $libname | sed 's/\.[^/]*$/.la/'`" + exit $status + ;; + + + # link mode + link) + cmdname=$1; shift # the linker + # Do links using the first object type. + linktype=`echo $objtypes | sed 's/:.*//'` + $verbose "$0: linktype = $linktype." + if test -z "$linktype"; then + echo "$0: Impossibly empty linktype?!" >&2 + exit 1 + fi + # + # Need to know the output name if we generate the wrapper. + looking_for_output=false + real_output_name= + libpath= + # + for arg in "$@"; do + if $looking_for_output; then + real_output_name=$arg + arg=$real_output_name.exe + looking_for_output=false + fi + case "$arg" in + -o) + test $linktype = SHARED && looking_for_output=true + ;; + *.l[ao]) # Find .la files in the linktype subdir + # of the given directory, e.g., if the user says + # ../foo/libfoo.la, transform into + # ../foo/$linktype/libfoo.{a,so...}. We do the same for + # libtool archive, although it's not as often necessary. + newarg=`echo $arg | sed -e 's,\([^/]*\)$,'$linktype'/\1,' \ + -e 's/l\(.\)$/\1/'` + if test $linktype = SHARED \ + && echo $newarg | grep '\.a$' >/dev/null; then + # If shared, transform dir/foo.la into -Ldir -lfoo. + dir=`echo $newarg | sed 's,/[^/]*$,,'` + lib=`echo $newarg | sed -e 's,.*/\([^/]*\),\1,' \ + -e 's/^lib//' -e 's/\.a$//'` + newarg="-L$dir -l$lib" + # Remember we will need this directory in LD_LIBRARY_PATH. + if echo $dir | grep -v '^/' >/dev/null; then + dir=`pwd`/$dir + fi + # Maybe had previous directories. + test -n "$libpath" && libpath=$libpath: + libpath=$libpath$dir + fi + $verbose "$0: transformed .la arg $arg to $newarg." + arg=$newarg + ;; + *.lo) # .lo files have no directory stripping or suffix changing. + newarg=`echo $arg | sed -e 's,\([^/]*\)$,'$linktype'/\1,' \ + -e 's/l\(.\)$/\1/'` + $verbose "$0: transformed .lo arg $arg to $newarg." + arg=$newarg + ;; + esac + args="$args $arg" + done + + # Set up to generate wrapper shell script if shared. + if test $linktype = SHARED; then + if $looking_for_output; then + echo "$0 link: -o requires an argument." >&2 + exit 1 + fi + if test -z "$real_output_name"; then + # If they didn't give -o at all, default to a.out. + real_output_name=a.out + args="$args -o $real_output_name.exe" + fi + fi + + # Do the link. + cmd="$cmdname $args" + $show $cmd + $chicken eval "$cmd" + + status=$? + if test $status -eq 0 && test -n "$real_output_name"; then + $verbose "$0: creating wrapper $real_output_name." + # We created the binary, so create the wrapper script. + # Use as short a temporary suffix as we can to minimize the chance + # of collisions on deficient systems. + rm -f ${real_output_name} ${real_output_name}T + ( + libpath_var_val='$'$libpath_var + echo "#! /bin/sh" + echo "# Generated `date` by $0." + echo "# Do not install this wrapper script." + echo "# It's only here to enable running $real_output_name" + echo "# before it's installed. (Use $0 install-progs to install it.)" + echo + echo "if test -z \"$libpath_var_val\"; then" + echo " $libpath_var=\"$libpath\"" + echo "else" + echo " $libpath_var=\"$libpath:$libpath_var_val\"" + echo "fi" + echo "export $libpath_var" + echo + echo "thisdir=\`echo $""0 | sed 's%/[^/]*$%%'\`" + echo 'test "x$thisdir" = "x$0" && thisdir=.' + echo + echo "exec \$thisdir/$real_output_name.exe \"\$@\"" + ) >${real_output_name}T + chmod +x ${real_output_name}T + mv ${real_output_name}T ${real_output_name} + fi + exit $status + ;; + + + # install-lib mode: DIR LIBNAME... + install-lib) + if test $# -lt 2; then + echo "$0 install-lib: Need directory and at least one library." >&2 + exit 1 + fi + libdir=$1; shift + if test ! -d $libdir; then + echo "$0 install-lib: $1 not a directory." >&2 + exit 1 + fi + for arg in "$@"; do # for each library... + # Always having a directory part simplifies the code below. + echo $arg | grep / >/dev/null || arg="./$arg" + for ot in `echo $objtypes | tr : " "`; do # for each object type... + case $ot in + SHARED) # needs shared extension and version number. + verstring=`$0 version $arg` + libname=`echo $arg | sed 's/\.la$/\.'$shared_ext$verstring/` + ;; + STATIC) # just get rid of the `l'. + libname=`echo $arg | sed 's/l\(.\)$/\1/'` + ;; + *) + echo "$0: Impossible object type $ot!" >&2 + echo "$bug_report" >&2 + exit 1;; + esac + # Have to insert the object type directory. + libname=`echo $libname | sed 's,\(/[^/]*\)$,/'$ot'\1,'` + lib_basename=`basename $libname` + $verbose "$0: library name = $libname." + $verbose "$0: installation name = $libdir/$lib_basename." + cmd="${INSTALL_DATA-cp} $libname $libdir/$lib_basename" + # + if test $ot = SHARED; then + # Link libfoo.so to libfoo.so.1.2.3. + lib_base=`echo $lib_basename | sed 's/[.0-9]*$//'` + $verbose "$0: linking $libdir/$lib_base to $lib_basename" + (cd $libdir && rm -f $lib_base && ln -s $lib_basename $lib_base) + fi + # + # Run ldconfig, etc. + postinstall=`eval echo '$'${ot}_postinstall` + test -n "$postinstall" && cmd="$cmd && $postinstall" + $show $cmd + $chicken eval "$cmd" + done + done + ;; + + + # install-prog mode: DIR PROGNAME... + install-prog) + if test $# -lt 2; then + echo "$0 install-prog: Need directory and at least one program." >&2 + exit 1 + fi + dir=$1; shift + if test ! -d $dir; then + echo "$0 install-prog: $1 not a directory." >&2 + exit 1 + fi + # The program got linked using the first object type, so + # installation of the program will proceed accordingly. + linktype=`echo $objtypes | sed 's/:.*//'` + $verbose "$0: linktype = $linktype." + if test -z "$linktype"; then + echo "$0: Impossibly empty linktype?!" >&2 + exit 1 + fi + if test $linktype = SHARED; then + # Install the binary, not the wrapper script. + suffix=.exe + else + suffix= + fi + for arg in "$@"; do # for each program... + # FIXME: On SunOS, AIX, and HP-UX, relink to avoid hardwired libdirs. + cmd="${INSTALL_PROGRAM-cp} $arg$suffix $dir/$arg" + $show $cmd + $chicken eval "$cmd" + done + ;; + + + # version mode + version) + if test $# -ne 1; then + echo "$0 version: Exactly one argument needed, not $# ($*)." >&2 + exit 1 + fi + # Strip directory name, `lib' prefix, and any .suffix. + dir=`echo $1 | sed 's,/[^/]*$,,'` + test "x$dir" = "x$1" && dir=. + libname=`basename $1 | sed -e 's,^lib,,' -e s',\..*$,,'` + verfile=$dir/klibtool.version + if test ! -r $verfile; then + echo "$0 version: No file $verfile for $libname version info." >&2 + echo "$0 version: Original argument was $1." >&2 + exit 1 + fi + $verbose "$0: dir = $dir, libname = $libname." + version=`awk '$1 == "'$libname'" { print "." $2 "." $3 "." $4 }' $verfile` + $verbose "$0: version for $libname = $version." + echo $version + ;; + + + # unknown mode + *) + echo "$0: Impossible mode \`$mode'!" >&2 + echo "$bug_report" >&2 + exit 1 + ;; +esac diff -Naur xdvik-22.40l/libs/libwww/config/ltconfig xdvik-22.40n/libs/libwww/config/ltconfig --- xdvik-22.40l/libs/libwww/config/ltconfig Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/ltconfig Fri Sep 13 00:23:47 2002 @@ -0,0 +1,3017 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A lot of this script is taken from autoconf-2.10. + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} +echo=echo +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec "$SHELL" "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null`} + case X$UNAME in + *-DOS) PATH_SEPARATOR=';' ;; + *) PATH_SEPARATOR=':' ;; + esac +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi + +if test "X${echo_test_string+set}" != "Xset"; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || + test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf "%s\n"' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # Cool, printf works + : + elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.3.3 +TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)" +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +default_ofile=libtool +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +enable_static=yes +enable_fast_install=yes +enable_dlopen=unknown +enable_win32_dll=no +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +ofile="$default_ofile" +verify_host=yes +with_gcc=no +with_gnu_ld=no +need_locks=yes +ac_ext=c +objext=o +libext=a +exeext= +cache_file= + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LDFLAGS="$LDFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_LIBS="$LIBS" +old_NM="$NM" +old_RANLIB="$RANLIB" +old_DLLTOOL="$DLLTOOL" +old_OBJDUMP="$OBJDUMP" +old_AS="$AS" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test ! -f "$ltmain"; then + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +if test -n "$cache_file" && test -r "$cache_file"; then + echo "loading cache $cache_file within ltconfig" + . $cache_file +fi + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to LTMAIN. + srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$SHELL $ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$SHELL $ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "${COLLECT_NAMES+set}" != set; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# Set a sane default for `OBJDUMP'. +test -z "$OBJDUMP" && OBJDUMP=objdump + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$AS" && AS=as + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc || test -f $dir/cc$ac_exeext; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:581: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for object suffix... $ac_c" 1>&6 +$rm conftest* +echo 'int i = 1;' > conftest.c +echo "$progname:603: checking for object suffix" >& 5 +if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* +echo "$ac_t$objext" 1>&6 + +echo $ac_n "checking for executable suffix... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_exeext="no" + $rm conftest* + echo 'main () { return 0; }' > conftest.c + echo "$progname:629: checking for executable suffix" >& 5 + if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c | *.err | *.$objext ) ;; + *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; + esac + done + else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* +fi +if test "X$ac_cv_exeext" = Xno; then + exeext="" +else + exeext="$ac_cv_exeext" +fi +echo "$ac_t$ac_cv_exeext" 1>&6 + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + + case "$host_os" in + beos* | irix5* | irix6* | osf3* | osf4*) + # PIC is the default for these OSes. + ;; + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # we not sure about C++ programs. + link_static_flag="$link_static_flag ${wl}-lC" + ;; + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + sysv4*MP*) + if test -d /usr/nec; then + pic_flag=-Kconform_pic + fi + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + sysv4*MP*) + if test -d /usr/nec ;then + pic_flag='-Kconform_pic' + link_static_flag='-Bstatic' + fi + ;; + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + case "$host_os" in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + ;; + *) + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + ;; + esac + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +$rm conftest* +echo "int some_variable = 0;" > conftest.c +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.o" +echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 +if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + echo "$ac_t"no 1>&6 + compiler_c_o=no + else + echo "$ac_t"yes 1>&6 + compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + compiler_c_o=no + echo "$ac_t"no 1>&6 +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 +if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_o_lo=no + else + echo "$ac_t"yes 1>&6 + compiler_o_lo=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_o_lo=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t$hard_links" 1>&6 + $rm conftest* + if test "$hard_links" = no; then + echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$with_gcc" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" + echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_rtti_exceptions=no + else + echo "$ac_t"yes 1>&6 + compiler_rtti_exceptions=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_rtti_exceptions=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi + +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftest.dat + if ln -s X conftest.dat 2>/dev/null; then + $rm conftest.dat + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:991: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we are not using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:1015: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:1018: checking for non-GNU ld" >&5 + fi + + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. + +case "$host_os" in +cygwin* | mingw*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$with_gcc" != yes; then + with_gnu_ld=no + fi + ;; + +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case "$host_os" in + aix3* | aix4*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols' + + archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ + _lt_hint=1; + for symbol in `cat $export_symbols`; do + echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def; + _lt_hint=`expr 1 + \$_lt_hint`; + done~ + test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' + + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' + ;; + + netbsd*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' + # can we support soname and/or expsyms with a.out? -oliva + fi + ;; + + solaris*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' + hardcode_libdir_separator=':' + if test "$with_gcc" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + shared_flag='-shared' + else + shared_flag='${wl}-bM:SRE' + hardcode_direct=yes + fi + allow_undefined_flag=' ${wl}-berok' + archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' + archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' + case "$host_os" in aix4.[01]|aix4.[01].*) + # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on + always_export_symbols=yes ;; + esac + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case "$host_os" in + hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF + fi + hardcode_libdir_flag_spec='${wl}-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3* | osf4*) + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case "$host_os" in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + # archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' + archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 +test "$ld_shlibs" = no && can_build_shared=no + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + break + else + NM=${NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + $rm conftest* + cat > conftest.c <&5 + if { (eval echo $progname:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:1596: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' + + cat <> conftest.c +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$objext conftstm.$objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + global_symbol_pipe= + fi +done +if test "$pipe_works" = yes; then + echo "${ac_t}ok" 1>&6 +else + echo "${ac_t}failed" 1>&6 +fi + +if test -z "$global_symbol_pipe"; then + global_symbol_to_cdecl= +fi + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t$hardcode_action" 1>&6 + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linkers may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" 1>&6 +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +file_magic_cmd= +file_magic_test_file= +deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4*) + version_type=linux + # AIX has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + # We preserve .a as extension for shared libraries though AIX4.2 + # and later linker supports .so + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' + shlibpath_var=LIBPATH + deplibs_check_method=pass_all + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + deplibs_check_method=pass_all + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + +bsdi4*) + version_type=linux + library_names_spec='${libname}.so$major ${libname}.so' + soname_spec='${libname}.so' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw*) + version_type=windows + need_version=no + need_lib_prefix=no + if test "$with_gcc" = yes; then + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' + else + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + fi + dynamic_linker='Win32 ld.exe' + deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + file_magic_cmd='${OBJDUMP} -f' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case "$version_type" in + freebsd-elf*) + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + deplibs_check_method=unknown + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + finish_cmds='PATH="\$PATH:/sbin" OBJFORMAT="'"$objformat"'" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + case "$host_os" in + freebsd2* | freebsd3.[01]*) + shlibpath_overrides_runpath=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so.$major' + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' + case "$host_os" in + irix5*) + libsuff= shlibsuff= + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case "$LD" in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib${libsuff}/libc.so*` + deplibs_check_method='pass_all' + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + ;; + +openbsd*) + version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method='file_magic COFF format alpha shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + deplibs_check_method='pass_all' + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" + file_magic_cmd=/usr/bin/file + file_magic_test_file=/lib/libc.so + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case "$host_vendor" in + ncr) + deplibs_check_method='pass_all' + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in +# configure.in, otherwise build static only libraries. +case "$host_os" in +cygwin* | mingw* | os2*) + if test x$can_build_shared = xyes; then + test x$enable_win32_dll = xno && can_build_shared=no + echo "checking if package supports dlls... $can_build_shared" 1>&6 + fi +;; +esac + +if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then + case "$deplibs_check_method" in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac +fi + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else +if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then + lt_cv_dlopen=no lt_cv_dlopen_libs= +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "$progname:2170: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "$progname:2207: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "$progname:2251: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "$progname:2288: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "$progname:2333: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + +fi + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + fi + + case "$lt_cv_dlopen" in + dlopen) +for ac_hdr in dlfcn.h; do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "$progname:2395: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int fnord = 0; +EOF +ac_try="$ac_compile conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo $progname:2405: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "x$ac_cv_header_dlfcn_h" = xyes; then + CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + fi + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2433: checking whether a program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "$lt_cv_dlopen_self" = yes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2506: checking whether a statically linked program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self_static=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self_static=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self_static=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi + ;; + esac + + case "$lt_cv_dlopen_self" in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case "$lt_cv_dlopen_self_static" in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" +if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ltecho="$CONFIG_SHELL \$0 --fallback-echo" +fi +LTSHELL="$SHELL" + +LTCONFIG_VERSION="$VERSION" + +# Only quote variables if we're using ltmain.sh. +case "$ltmain" in +*.sh) + # Now quote all the things that may contain metacharacters. + for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ + AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case "$ltecho" in + *'\$0 --fallback-echo"') + ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + + trap "$rm \"$ofile\"; exit 1" 1 2 15 + echo "creating $ofile" + $rm "$ofile" + cat < "$ofile" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +EOF + cfgfile="$ofile" + ;; + +*) + # Double-quote the variables that need it (for aesthetics). + for var in old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do + eval "$var=\\\"\$var\\\"" + done + + # Just create a config file. + cfgfile="$ofile.cfg" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + echo "creating $cfgfile" + $rm "$cfgfile" + cat < "$cfgfile" +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +EOF + ;; +esac + +cat <> "$cfgfile" +# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ +# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ +# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ +# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# The version of $progname that generated this script. +LTCONFIG_VERSION=$LTCONFIG_VERSION + +# Shell to use when invoking shell scripts. +SHELL=$LTSHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$ltecho + +# The archiver. +AR=$AR + +# The default C compiler. +CC=$CC + +# The linker used to build libraries. +LD=$LD + +# Whether we need hard or soft links. +LN_S=$LN_S + +# A BSD-compatible nm program. +NM=$NM + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$reload_flag +reload_cmds=$reload_cmds + +# How to pass a linker flag through the compiler. +wl=$wl + +# Object file suffix (normally "o"). +objext="$objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$pic_flag + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$RANLIB +old_archive_cmds=$old_archive_cmds +old_postinstall_cmds=$old_postinstall_cmds +old_postuninstall_cmds=$old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$old_archive_from_new_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$archive_cmds +archive_expsym_cmds=$archive_expsym_cmds +postinstall_cmds=$postinstall_cmds +postuninstall_cmds=$postuninstall_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$global_symbol_to_cdecl + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$include_expsyms + +EOF + +case "$ltmain" in +*.sh) + echo '### END LIBTOOL CONFIG' >> "$ofile" + echo >> "$ofile" + case "$host_os" in + aix3*) + cat <<\EOF >> "$ofile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "${COLLECT_NAMES+set}" != set; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # Append the ltmain.sh script. + sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) + + chmod +x "$ofile" + ;; + +*) + # Compile the libtool program. + echo "FIXME: would compile $ltmain" + ;; +esac + +test -n "$cache_file" || exit 0 + +# AC_CACHE_SAVE +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff -Naur xdvik-22.40l/libs/libwww/config/ltmain.sh xdvik-22.40n/libs/libwww/config/ltmain.sh --- xdvik-22.40l/libs/libwww/config/ltmain.sh Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/ltmain.sh Fri Sep 13 00:23:47 2002 @@ -0,0 +1,5029 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # Accept any command-line options. + case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n $prev + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | no/*-*-nonstopux*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test $linkmode = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test $pass = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test $pass = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test $pass = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test $pass = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not used here." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test $pass != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test $found = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test $pass = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test $linkmode != prog && test $linkmode != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test $pass = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test $pass = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test $linkmode = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" + fi + continue + fi + + if test $linkmode = prog && test $pass != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test $linkalldeplibs = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`echo $soroot | sed -e 's/^.*\///'` + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n $old_archive_from_expsyms_cmds + + if test $linkmode = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test $linkmode = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test $linkmode = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + add="-l$name" + fi + + if test $linkmode = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + echo "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test $linkmode = lib; then + if test -n "$dependency_libs" && + { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test $link_all_deplibs != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test $pass = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test $linkmode = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case $current in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + major=`expr $current - $age + 1` + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test $build_libtool_need_lc = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + echo "*** with $libname but no candidates were found. (...for file magic test)" + else + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check below in file_magic test + if eval echo \"$potent_lib\" 2>/dev/null \ + | sed 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test $hardcode_into_libs = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + test -z "$dlname" && dlname=$soname + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + prog) + case $host in + *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test $need_relink = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) exeext=.exe ;; + *) exeext= ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test $need_relink = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`echo $file | sed -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (sed -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + /usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`echo $destfile | sed -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = ":" && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + rmdirs= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test $mode = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test $mode = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test $mode = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test $mode = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff -Naur xdvik-22.40l/libs/libwww/config/missing xdvik-22.40n/libs/libwww/config/missing --- xdvik-22.40l/libs/libwww/config/missing Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/missing Fri Sep 13 00:23:47 2002 @@ -0,0 +1,283 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.3 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar ${1+"$@"} && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar ${1+"$@"} && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff -Naur xdvik-22.40l/libs/libwww/config/mkinstalldirs xdvik-22.40n/libs/libwww/config/mkinstalldirs --- xdvik-22.40l/libs/libwww/config/mkinstalldirs Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/libwww/config/mkinstalldirs Fri Sep 13 00:23:47 2002 @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1.2.1 2002/09/13 00:23:47 stefanulrich Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff -Naur xdvik-22.40l/libs/libwww/configure xdvik-22.40n/libs/libwww/configure --- xdvik-22.40l/libs/libwww/configure Sat May 12 23:21:47 2001 +++ xdvik-22.40n/libs/libwww/configure Mon Sep 16 17:45:27 2002 @@ -1,10 +1,6 @@ #! /bin/sh -# From configure.in Id: configure.in,v 1.1.1.1 2001/04/18 14:23:30 stefanulrich Exp - - - - +# From configure.in Id: configure.in,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp @@ -86,11 +82,6 @@ - -# serial 1 - - - # # Check to make sure that the build environment is sane. # @@ -103,41 +94,78 @@ -# Check to see if we're running under Cygwin32, without using -# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes". -# Otherwise set it to "no". + +# serial 40 AC_PROG_LIBTOOL + + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -# serial 24 AM_PROG_LIBTOOL +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -# AM_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AM_ENABLE_SHARED[(DEFAULT)] +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. -# AM_DISABLE_SHARED - set the default shared flag to --disable-shared +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared + + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. + +# AC_DISABLE_STATIC - set the default static flag to --disable-static -# AM_DISABLE_STATIC - set the default static flag to --disable-static -# AM_ENABLE_STATIC - implement the --enable-static flag -# Usage: AM_ENABLE_STATIC[(DEFAULT)] +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker + + + + +# AC_PROG_NM - find the path to a BSD-compatible name lister + -# AM_PROG_LD - find the path to the GNU or non-GNU linker +# AC_CHECK_LIBM - check for math library +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library, adds --enable-ltdl-convenience to +# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor +# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed +# to be `${top_builddir}/libltdl'. Make sure you start DIR with +# '${top_builddir}/' (note the single quotes!) if your package is not +# flat, and, if you're not using automake, define top_builddir as +# appropriate in the Makefiles. + + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library, and adds --enable-ltdl-install to +# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor +# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed +# to be `${top_builddir}/libltdl'. Make sure you start DIR with +# '${top_builddir}/' (note the single quotes!) if your package is not +# flat, and, if you're not using automake, define top_builddir as +# appropriate in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -# AM_PROG_NM - find the path to a BSD-compatible name lister # Guess values for system-dependent variables and create Makefiles. @@ -152,15 +180,7 @@ ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help - --enable-shared build shared libraries [default=yes] - --enable-shared=PKGS only build shared libraries if the current package - appears as an element in the PKGS list" -ac_help="$ac_help - --enable-static build static libraries [default=yes] - --enable-static=PKGS only build shared libraries if the current package - appears as an element in the PKGS list" -ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" + --enable-shared[=PKGS] build shared libraries [default=no]" ac_help="$ac_help --enable-shared build shared libraries [default=no]" ac_help="$ac_help @@ -181,9 +201,15 @@ ac_help="$ac_help --enable-multiplatform put executables in bin/PLATFORM" ac_help="$ac_help - --with-x use the X Window System" + --enable-static[=PKGS] build static libraries [default=yes]" +ac_help="$ac_help + --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" +ac_help="$ac_help + --disable-libtool-lock avoid locking (might break parallel builds)" ac_help="$ac_help - --with-wais[=PATH] Compile with support for direct WAIS access." + --with-x use the X Window System" ac_help="$ac_help --with-regex[=PATH] Compile with POSIC regex library support." ac_help="$ac_help @@ -195,7 +221,11 @@ ac_help="$ac_help --with-mysql[=PATH] Compile with support for mysql access." ac_help="$ac_help -" + --with-expat[=PATH] Compile with support for expat." +ac_help="$ac_help + --with-md5[=PATH] Compile with support for md5." +ac_help="$ac_help + --with-ssl[=PATH] Link with OpenSSL." ac_help="$ac_help --enable-signals use internal libwww signal handler." ac_help="$ac_help @@ -724,7 +754,7 @@ ac_aux_dir= -for ac_dir in ../../config $srcdir/../../config; do +for ac_dir in config $srcdir/config; do if test -f $ac_dir/install-sh; then case $ac_dir in /*|[A-z]:/*) ac_aux_dir=$ac_dir;; @@ -742,7 +772,7 @@ fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in ../../config $srcdir/../../config" 1>&2; exit 1; } + { echo "configure: error: can not find install-sh or install.sh in config $srcdir/config" 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub @@ -777,7 +807,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:781: checking host system type" >&5 +echo "configure:811: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -798,7 +828,7 @@ echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:802: checking target system type" >&5 +echo "configure:832: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -816,7 +846,7 @@ echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:820: checking build system type" >&5 +echo "configure:850: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -865,7 +895,7 @@ EOF -VERSION=5.2.1 +VERSION=5.4.0 cat >> confdefs.h <&6 -echo "configure:892: checking for a BSD compatible install" >&5 +echo "configure:922: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -942,11 +972,8 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:950: checking whether build environment is sane" >&5 +echo "configure:977: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -984,7 +1011,7 @@ rm -f conftest* echo "$ac_t""yes" 1>&6 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:988: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1015: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1030,7 +1057,7 @@ missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:1034: checking for working aclocal" >&5 +echo "configure:1061: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1043,7 +1070,7 @@ fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1047: checking for working autoconf" >&5 +echo "configure:1074: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1056,7 +1083,7 @@ fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1060: checking for working automake" >&5 +echo "configure:1087: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1069,7 +1096,7 @@ fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1073: checking for working autoheader" >&5 +echo "configure:1100: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1082,7 +1109,7 @@ fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1086: checking for working makeinfo" >&5 +echo "configure:1113: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -1099,7 +1126,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1103: checking for $ac_word" >&5 +echo "configure:1130: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1130,7 +1157,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1134: checking for $ac_word" >&5 +echo "configure:1161: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1182,7 +1209,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1186: checking for $ac_word" >&5 +echo "configure:1213: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1215,7 +1242,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1219: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1246: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1226,12 +1253,12 @@ cat > conftest.$ac_ext << EOF -#line 1230 "configure" +#line 1257 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1257,12 +1284,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1261: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1288: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1266: checking whether we are using GNU C" >&5 +echo "configure:1293: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1271,7 +1298,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1275: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1290,7 +1317,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1294: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1321: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1321,8 +1348,9 @@ fi fi +if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1326: checking for POSIXized ISC" >&5 +echo "configure:1354: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -1342,40 +1370,141 @@ ISC= fi +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:1375: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi -echo $ac_n "checking for Cygwin32 environment""... $ac_c" 1>&6 -echo "configure:1348: checking for Cygwin32 environment" >&5 -if eval "test \"`echo '$''{'am_cv_cygwin32'+set}'`\" = set"; then +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:1408: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - am_cv_cygwin32=yes + ac_cv_mingw32=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - am_cv_cygwin32=no + ac_cv_mingw32=no fi rm -f conftest* rm -f conftest* fi -echo "$ac_t""$am_cv_cygwin32" 1>&6 -CYGWIN32= -test "$am_cv_cygwin32" = yes && CYGWIN32=yes +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1439: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + +if test "$MINGW32" = "yes"; then + # With MinGW, need to explicitly link against winsock2 + LIBS="$LIBS -lws2_32" + # LIBS="$LIBS -no-unused" for DLL building, but doesn't work ATM, + # so completely disable shared libs (speeds up compilation because + # the .c files are not compiled twice): + # Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_shared=no +fi + +fi + + + + + + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1379: checking for $ac_word" >&5 +echo "configure:1508: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1406,7 +1535,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1410: checking for $ac_word" >&5 +echo "configure:1539: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1458,7 +1587,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1462: checking for $ac_word" >&5 +echo "configure:1591: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1491,7 +1620,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1495: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1624: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1502,12 +1631,12 @@ cat > conftest.$ac_ext << EOF -#line 1506 "configure" +#line 1635 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1533,12 +1662,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1537: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1666: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1542: checking whether we are using GNU C" >&5 +echo "configure:1671: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1547,7 +1676,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1680: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1566,7 +1695,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1570: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1699: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1597,1772 +1726,1650 @@ fi fi -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1742: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - enable_shared=yes -fi - -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + # Hack for MSDOS and descendants. + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test $ac_x $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac done - IFS="$ac_save_ifs" - ;; -esac -else - enable_static=yes + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi fi +echo "$ac_t""$INSTALL" 1>&6 -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1650: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1797: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + rm -f conftestdata +# MS-DOS is a special case, because it sort of pretends that ln -s +# works for executables. +if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test $ac_x $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" + ac_cv_prog_LN_S=ln fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:1820: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - with_gnu_ld=no -fi - - -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1691: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. - /* | A-Za-z:\\*) - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1709: checking for GNU ld" >&5 -else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1712: checking for non-GNU ld" >&5 -fi -if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no fi +rm -f conftestmake fi - -LD="$ac_cv_path_LD" -if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= else echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1748: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:1852: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - ac_cv_prog_gnu_ld=yes + cat > conftest.$ac_ext < +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:1865: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" else - ac_cv_prog_gnu_ld=no + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" fi +rm -f conftest* fi - -echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 - - -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1764: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - else - ac_cv_path_NM="$ac_dir/nm" - fi - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm - ;; -esac + echo "$ac_t""no" 1>&6 fi - -NM="$ac_cv_path_NM" -echo "$ac_t""$NM" 1>&6 - - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1801: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:1890: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - rm -f conftestdata -# MS-DOS is a special case, because it sort of pretends that ln -s -# works for executables. -if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" else - ac_cv_prog_LN_S=ln + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi +rm -f conftest* +LIBS="$ac_save_LIBS" + fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" else echo "$ac_t""no" 1>&6 fi -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Check for any special flags to pass to ltconfig. -libtool_flags= -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$silent" = yes && libtool_flags="$libtool_flags --silent" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$host" in -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 1839 "configure"' > conftest.$ac_ext - if { (eval echo configure:1840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - CFLAGS="$CFLAGS -belf" - ;; -esac - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1870: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:1931: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext </dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes +if { (eval echo configure:1950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" else - eval ac_cv_prog_make_${ac_make}_set=no + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" fi -rm -f conftestmake +rm -f conftest* +LIBS="$ac_save_LIBS" + fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - SET_MAKE= + LIBS="$LIBS -lx" else echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" fi -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1908: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - # Hack for MSDOS and descendants. - if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test $ac_x $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - - - - - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1971: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1973: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test $ac_x $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2002: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test $ac_x $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp fi +rm -f conftest* fi +rm -f conftest* fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" else - echo "$ac_t""no" 1>&6 + ac_cv_prog_CPP="$CPP" fi +echo "$ac_t""$CPP" 1>&6 - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2054: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:2053: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test $ac_x $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2087: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 2098 "configure" + cat > conftest.$ac_ext < +#include +#include +#include EOF -if { (eval echo configure:2103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes else + echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } + rm -rf conftest* + ac_cv_header_stdc=no fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2129: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross +rm -f conftest* -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2134: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c < conftest.$ac_ext < EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2143: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : else - ac_cv_prog_gcc=no -fi + rm -rf conftest* + ac_cv_header_stdc=no fi +rm -f conftest* -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= fi -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2162: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : else - ac_cv_prog_cc_g=no + rm -rf conftest* + ac_cv_header_stdc=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2205: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +EOF +if { (eval echo configure:2133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - # Hack for MSDOS and descendants. - if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test $ac_x $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi +rm -fr conftest* fi -echo "$ac_t""$INSTALL" 1>&6 -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +fi +fi -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +fi -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2260: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then +echo $ac_n "checking whether closedir returns void""... $ac_c" 1>&6 +echo "configure:2157: checking whether closedir returns void" >&5 +if eval "test \"`echo '$''{'ac_cv_func_closedir_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - rm -f conftestdata -# MS-DOS is a special case, because it sort of pretends that ln -s -# works for executables. -if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null + if test "$cross_compiling" = yes; then + ac_cv_func_closedir_void=yes +else + cat > conftest.$ac_ext < +#include <$ac_header_dirent> +int closedir(); main() { exit(closedir(opendir(".")) != 0); } +EOF +if { (eval echo configure:2171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" + ac_cv_func_closedir_void=no else - ac_cv_prog_LN_S=ln + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_closedir_void=yes fi +rm -fr conftest* fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 + fi -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:2283: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' +echo "$ac_t""$ac_cv_func_closedir_void" 1>&6 +if test $ac_cv_func_closedir_void = yes; then + cat >> confdefs.h <<\EOF +#define CLOSEDIR_VOID 1 EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi +fi -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +for ac_hdr in assert.h float.h limits.h memory.h pwd.h stdlib.h \ + string.h sys/param.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:2315: checking for $ac_hdr that defines DIR" >&5 -if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2198: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> -int main() { -DIR *dirp = 0; -; return 0; } EOF -if { (eval echo configure:2328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=yes" + eval "ac_cv_header_$ac_safe=yes" else + echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_header_dirent_$ac_safe=no" + eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi -if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then -echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:2353: checking for opendir in -ldir" >&5 -ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + + + + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2240: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_save_LIBS="$LIBS" -LIBS="-ldir $LIBS" -cat > conftest.$ac_ext <&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +# +echo $ac_n "checking for libtool object types""... $ac_c" 1>&6 +echo "configure:2272: checking for libtool object types" >&5 +# +## Check that the klibtool script is in ac_aux_dir. Don't bother to +# scan PATH. For one thing, if we found it somewhere there, we couldn't +# use that directory to put the config file ... and that's what we need +# to do, to avoid having to configure in every subdirectory. +LIBTOOL=$ac_aux_dir/klibtool + +if test ! -r $LIBTOOL; then + { echo "configure: error: klibtool not in $ac_aux_dir, goodbye" 1>&2; exit 1; } + exit 1 +fi +# +## Argument parsing: we support --enable-shared and --enable-static. +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + : +else + enable_shared=no +fi + +# +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + : +else + enable_static=yes +fi + +# +# If they explicitly --enable-static, make that the link type. +# More commonly, they will just --enable-shared; make that the link type. +# If they --disable-static, implicitly --enable-shared. +# In any case, prepend to any existing LIBTOOL_OBJTYPES. +# If they really want to build both and link statically, +# then they set LIBTOOL_OBJTYPES to SHARED and --enable-static. +test "$enable_static" = yes && LIBTOOL_OBJTYPES=STATIC:$LIBTOOL_OBJTYPES +(test "$enable_shared" = yes \ + || test "$enable_static" = no) \ +&& LIBTOOL_OBJTYPES=SHARED:$LIBTOOL_OBJTYPES +# Don't bother to remove the trailing :, it'll be ignored. +# +## Finally: Run the klibtool configure command. +LIBTOOL_OBJTYPES=$LIBTOOL_OBJTYPES RANLIB=$RANLIB \ + $LIBTOOL --source-dir $ac_aux_dir --config-dir .. configure "$host" +echo "$ac_t""$LIBTOOL_OBJTYPES" 1>&6 + + for ac_func in putenv strcasecmp strtol strstr +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2324: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char opendir(); +char $ac_func(); int main() { -opendir() + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + ; return 0; } EOF -if { (eval echo configure:2372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + eval "ac_cv_func_$ac_func=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -ldir" + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +LTLIBOBJS="$LTLIBOBJS $ac_func.lo" fi +done -else -echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:2394: checking for opendir in -lx" >&5 -ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lx $LIBS" -cat > conftest.$ac_ext <&6 +echo "configure:2382: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char opendir(); +char $ac_func(); int main() { -opendir() + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + ; return 0; } EOF -if { (eval echo configure:2413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" + eval "ac_cv_func_$ac_func=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 - LIBS="$LIBS -lx" + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 fi +done -fi -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2436: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:2436: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2457: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < -Syntax Error + +int main() { + +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero = {0,0}; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2474: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 +if { (eval echo configure:2490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2491: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : + ac_cv_c_const=yes else - echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* + ac_cv_c_const=no fi rm -f conftest* - ac_cv_prog_CPP="$CPP" fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + fi -echo "$ac_t""$CPP" 1>&6 -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2516: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + +# Check whether prototypes work. +echo $ac_n "checking whether the compiler accepts prototypes""... $ac_c" 1>&6 +echo "configure:2513: checking whether the compiler accepts prototypes" >&5 +if eval "test \"`echo '$''{'kb_cv_c_prototypes'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include -#include -#include +int main() { +extern void foo(int i,...); +; return 0; } EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2529: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then +if { (eval echo configure:2525: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* - ac_cv_header_stdc=yes + kb_cv_c_prototypes=yes else - echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_header_stdc=no + kb_cv_c_prototypes=no fi rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext < -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no fi -rm -f conftest* +echo "$ac_t""$kb_cv_c_prototypes" 1>&6 +if test "$kb_cv_c_prototypes" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_PROTOTYPES 1 +EOF fi -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <&6 +echo "configure:2546: checking whether program_invocation_name is predefined" >&5 +if eval "test \"`echo '$''{'kb_cv_var_program_inv_name'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < + +int main() { +extern char *program_invocation_name; program_invocation_name = "love"; +; return 0; } EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : +if { (eval echo configure:2558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + kb_cv_var_program_inv_name=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* - ac_cv_header_stdc=no + kb_cv_var_program_inv_name=no fi rm -f conftest* +fi +echo "$ac_t""$kb_cv_var_program_inv_name" 1>&6 +if test "$kb_cv_var_program_inv_name" = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_PROGRAM_INVOCATION_NAME 1 +EOF fi -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : +# Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. +# This test program is due to Mike Hibler . +# We don't actually need to run this if we don't have putenv, but it +# doesn't hurt. +echo $ac_n "checking whether putenv uses malloc""... $ac_c" 1>&6 +echo "configure:2582: checking whether putenv uses malloc" >&5 +if eval "test \"`echo '$''{'kb_cv_func_putenv_malloc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + kb_cv_func_putenv_malloc=no else cat > conftest.$ac_ext < -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#define VAR "YOW_VAR" +#define STRING1 "GabbaGabbaHey" +#define STRING2 "Yow!!" /* should be shorter than STRING1 */ +extern char *getenv (); /* in case char* and int don't mix gracefully */ +main () +{ + char *str1, *rstr1, *str2, *rstr2; + str1 = getenv (VAR); + if (str1) + exit (1); + str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1); + if (str1 == 0) + exit (2); + strcpy (str1, VAR); + strcat (str1, "="); + strcat (str1, STRING1); + if (putenv (str1) < 0) + exit (3); + rstr1 = getenv (VAR); + if (rstr1 == 0) + exit (4); + rstr1 -= strlen (VAR) + 1; + if (strncmp (rstr1, VAR, strlen (VAR))) + exit (5); + str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1); + if (str2 == 0 || str1 == str2) + exit (6); + strcpy (str2, VAR); + strcat (str2, "="); + strcat (str2, STRING2); + if (putenv (str2) < 0) + exit (7); + rstr2 = getenv (VAR); + if (rstr2 == 0) + exit (8); + rstr2 -= strlen (VAR) + 1; +#if 0 + printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2); + /* + * If string from first call was reused for the second call, + * you had better not do a free on the first string! + */ + if (rstr1 == rstr2) + printf ("#define SMART_PUTENV\n"); + else + printf ("#undef SMART_PUTENV\n"); +#endif + exit (rstr1 == rstr2 ? 0 : 1); +} EOF -if { (eval echo configure:2596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then - : + kb_cv_func_putenv_malloc=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* - ac_cv_header_stdc=no + kb_cv_func_putenv_malloc=no fi rm -fr conftest* fi fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then +echo "$ac_t""$kb_cv_func_putenv_malloc" 1>&6 +if test $kb_cv_func_putenv_malloc = yes; then cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 +#define SMART_PUTENV 1 EOF fi -echo $ac_n "checking whether closedir returns void""... $ac_c" 1>&6 -echo "configure:2620: checking whether closedir returns void" >&5 -if eval "test \"`echo '$''{'ac_cv_func_closedir_void'+set}'`\" = set"; then +if test $ac_cv_func_getcwd = yes; then +# We only need to run this if we have getcwd. +echo $ac_n "checking whether getcwd uses fork or vfork""... $ac_c" 1>&6 +echo "configure:2667: checking whether getcwd uses fork or vfork" >&5 +if eval "test \"`echo '$''{'kb_cv_func_getcwd_forks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - ac_cv_func_closedir_void=yes + kb_cv_func_getcwd_forks=no else cat > conftest.$ac_ext < -#include <$ac_header_dirent> -int closedir(); main() { exit(closedir(opendir(".")) != 0); } + +int fork() { exit(1); } +int vfork() { exit(1); } +extern char *getcwd(); +char path[100]; +int main() { +getcwd(path,100); +return 0; +} EOF -if { (eval echo configure:2634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then - ac_cv_func_closedir_void=no + kb_cv_func_getcwd_forks=no else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* - ac_cv_func_closedir_void=yes + kb_cv_func_getcwd_forks=yes fi rm -fr conftest* fi fi - -echo "$ac_t""$ac_cv_func_closedir_void" 1>&6 -if test $ac_cv_func_closedir_void = yes; then +echo "$ac_t""$kb_cv_func_getcwd_forks" 1>&6 +if test $kb_cv_func_getcwd_forks = yes; then cat >> confdefs.h <<\EOF -#define CLOSEDIR_VOID 1 +#define GETCWD_FORKS 1 EOF fi +fi -for ac_hdr in assert.h float.h limits.h memory.h pwd.h stdlib.h \ - string.h sys/param.h unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2661: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" +# Common --with and --enable options. + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:2712: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + USE_MAINTAINER_MODE=no fi -rm -f conftest* + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test "x$USE_MAINTAINER_MODE" = xyes; then + MAINT= + else + MAINT='#M#' + fi + + + +echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 +echo "configure:2731: checking for loader (symbol LD)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$LD" && LD=ld +cf_cv_subst_LD=$LD fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 + + +echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 +echo "configure:2745: checking for archiver (symbol AR)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - echo "$ac_t""no" 1>&6 + +test -z "$AR" && AR=ar +cf_cv_subst_AR=$AR fi -done +AR=${cf_cv_subst_AR} +echo "$ac_t""$AR" 1>&6 +echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 +echo "configure:2759: checking for archiver options (symbol AR_OPTS)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$AR_OPTS" && AR_OPTS=rc +cf_cv_subst_AR_OPTS=$AR_OPTS +fi +AR_OPTS=${cf_cv_subst_AR_OPTS} +echo "$ac_t""$AR_OPTS" 1>&6 -# -echo $ac_n "checking for libtool object types""... $ac_c" 1>&6 -echo "configure:2704: checking for libtool object types" >&5 -# -## Check that the klibtool script is in ac_aux_dir. Don't bother to -# scan PATH. For one thing, if we found it somewhere there, we couldn't -# use that directory to put the config file ... and that's what we need -# to do, to avoid having to configure in every subdirectory. -LIBTOOL=$ac_aux_dir/klibtool -if test ! -r $LIBTOOL; then - { echo "configure: error: klibtool not in $ac_aux_dir, goodbye" 1>&2; exit 1; } - exit 1 -fi -# -## Argument parsing: we support --enable-shared and --enable-static. -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" +# Check whether --with-mktexmf-default or --without-mktexmf-default was given. +if test "${with_mktexmf_default+set}" = set; then + withval="$with_mktexmf_default" : else - enable_shared=no + withval=yes fi -# -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_MF_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mktexpk-default or --without-mktexpk-default was given. +if test "${with_mktexpk_default+set}" = set; then + withval="$with_mktexpk_default" : else - enable_static=yes + withval=yes fi -# -# If they explicitly --enable-static, make that the link type. -# More commonly, they will just --enable-shared; make that the link type. -# If they --disable-static, implicitly --enable-shared. -# In any case, prepend to any existing LIBTOOL_OBJTYPES. -# If they really want to build both and link statically, -# then they set LIBTOOL_OBJTYPES to SHARED and --enable-static. -test "$enable_static" = yes && LIBTOOL_OBJTYPES=STATIC:$LIBTOOL_OBJTYPES -(test "$enable_shared" = yes \ - || test "$enable_static" = no) \ -&& LIBTOOL_OBJTYPES=SHARED:$LIBTOOL_OBJTYPES -# Don't bother to remove the trailing :, it'll be ignored. -# -## Finally: Run the klibtool configure command. -LIBTOOL_OBJTYPES=$LIBTOOL_OBJTYPES RANLIB=$RANLIB \ - $LIBTOOL --source-dir $ac_aux_dir --config-dir .. configure "$host" -echo "$ac_t""$LIBTOOL_OBJTYPES" 1>&6 +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_PK_BY_DEFAULT 1 +EOF - for ac_func in putenv strcasecmp strtol strstr -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2756: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +# Check whether --with-mktextfm-default or --without-mktextfm-default was given. +if test "${with_mktextfm_default+set}" = set; then + withval="$with_mktextfm_default" + : else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); + withval=yes +fi -int main() { +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_TFM_BY_DEFAULT 1 +EOF -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif +fi +# Check whether --with-mkocp-default or --without-mkocp-default was given. +if test "${with_mkocp_default+set}" = set; then + withval="$with_mkocp_default" + : +else + withval=yes +fi -; return 0; } +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_OMEGA_OCP_BY_DEFAULT 1 EOF -if { (eval echo configure:2784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + fi -rm -f conftest* +# Check whether --with-mkofm-default or --without-mkofm-default was given. +if test "${with_mkofm_default+set}" = set; then + withval="$with_mkofm_default" + : +else + withval=yes fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <> confdefs.h <<\EOF +#define MAKE_OMEGA_OFM_BY_DEFAULT 1 EOF - -else - echo "$ac_t""no" 1>&6 -LTLIBOBJS="$LTLIBOBJS $ac_func.lo" + fi -done +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi -for ac_func in bcmp bcopy bzero getcwd getwd index memcmp memcpy rindex strchr strrchr -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2814: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:2851: checking host system type" >&5 -int main() { +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 -; return 0; } -EOF -if { (eval echo configure:2842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" +# Check whether --enable-multiplatform or --disable-multiplatform was given. +if test "${enable_multiplatform+set}" = set; then + enableval="$enable_multiplatform" + if test "x$enable_multiplatform" = xyes && + test "x$bindir" = 'x${exec_prefix}/bin' +then + bindir="$bindir/$host" fi -rm -f conftest* fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <&6 +echo "configure:2883: checking where the main texmf tree is located" >&5 +texmfmain= +if test "x$datadir" != 'x${prefix}/share'; then + # First case, datadir is defined... + eval p=\"$datadir\" + # Unconditionally set the directory, but... + texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` + # ... do complain if it wasn't found. + if test -d "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + echo "$ac_t""not found" 1>&6 + echo "configure: warning: No texmf tree found at $texmfmain. + If you do not have the files, you can retrieve a minimal set from + ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts + in systems/web2c. Winging it." 1>&2 + fi else - echo "$ac_t""no" 1>&6 + # Second case, datadir is default... + if test "x$prefix" = "xNONE"; then + p="$ac_default_prefix" + else + eval p=\"$prefix\" + fi + for e in share/texmf lib/texmf texmf; do + if test -d "$p/$e"; then + texmfmain="$p/$e" + break + fi + done + texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` + if test -n "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + eval texmfmain="$datadir/texmf" + echo "$ac_t""not found" 1>&6 + echo "configure: warning: The main texmf tree was not found. + Specify the location of its parent directory with the --datadir option. + If you do not have the files, you can retrieve a minimal set from + ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts + in systems/web2c. Winging it by using the default location + $texmfmain." 1>&2 + fi fi -done -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2868: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} -; return 0; } -EOF -if { (eval echo configure:2922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac +else + enable_static=yes fi - -# Check whether prototypes work. -echo $ac_n "checking whether the compiler accepts prototypes""... $ac_c" 1>&6 -echo "configure:2945: checking whether the compiler accepts prototypes" >&5 -if eval "test \"`echo '$''{'kb_cv_c_prototypes'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int main() { -extern void foo(int i,...); -; return 0; } -EOF -if { (eval echo configure:2957: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - kb_cv_c_prototypes=yes +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - kb_cv_c_prototypes=no + enable_fast_install=yes fi -rm -f conftest* -fi -echo "$ac_t""$kb_cv_c_prototypes" 1>&6 -if test "$kb_cv_c_prototypes" = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_PROTOTYPES 1 -EOF +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no fi -# This is a GNU libc invention. -echo $ac_n "checking whether program_invocation_name is predefined""... $ac_c" 1>&6 -echo "configure:2978: checking whether program_invocation_name is predefined" >&5 -if eval "test \"`echo '$''{'kb_cv_var_program_inv_name'+set}'`\" = set"; then +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:2993: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:3017: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:3020: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - kb_cv_var_program_inv_name=yes + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - kb_cv_var_program_inv_name=no + ac_cv_path_LD="$LD" # Let the user override the test with a path. fi -rm -f conftest* fi -echo "$ac_t""$kb_cv_var_program_inv_name" 1>&6 -if test "$kb_cv_var_program_inv_name" = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_PROGRAM_INVOCATION_NAME 1 -EOF +LD="$ac_cv_path_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -# Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment. -# This test program is due to Mike Hibler . -# We don't actually need to run this if we don't have putenv, but it -# doesn't hurt. -echo $ac_n "checking whether putenv uses malloc""... $ac_c" 1>&6 -echo "configure:3014: checking whether putenv uses malloc" >&5 -if eval "test \"`echo '$''{'kb_cv_func_putenv_malloc'+set}'`\" = set"; then +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:3056: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - kb_cv_func_putenv_malloc=no -else - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - kb_cv_func_putenv_malloc=yes + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - kb_cv_func_putenv_malloc=no + ac_cv_prog_gnu_ld=no fi -rm -fr conftest* fi -fi -echo "$ac_t""$kb_cv_func_putenv_malloc" 1>&6 -if test $kb_cv_func_putenv_malloc = yes; then - cat >> confdefs.h <<\EOF -#define SMART_PUTENV 1 -EOF +echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 -fi -if test $ac_cv_func_getcwd = yes; then -# We only need to run this if we have getcwd. -echo $ac_n "checking whether getcwd uses fork or vfork""... $ac_c" 1>&6 -echo "configure:3099: checking whether getcwd uses fork or vfork" >&5 -if eval "test \"`echo '$''{'kb_cv_func_getcwd_forks'+set}'`\" = set"; then +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:3072: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - kb_cv_func_getcwd_forks=no -else - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - kb_cv_func_getcwd_forks=no + if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - kb_cv_func_getcwd_forks=yes + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm fi -rm -fr conftest* fi -fi -echo "$ac_t""$kb_cv_func_getcwd_forks" 1>&6 -if test $kb_cv_func_getcwd_forks = yes; then - cat >> confdefs.h <<\EOF -#define GETCWD_FORKS 1 -EOF +NM="$ac_cv_path_NM" +echo "$ac_t""$NM" 1>&6 -fi -fi -# Common --with and --enable options. -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:3144: checking whether to enable maintainer-specific portions of Makefiles" >&5 - # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then - enableval="$enable_maintainer_mode" - USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" + + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + : fi - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - if test "x$USE_MAINTAINER_MODE" = xyes; then - MAINT= - else - MAINT='#M#' +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$host" in +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3132 "configure"' > conftest.$ac_ext + if { (eval echo configure:3133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac fi - - + rm -rf conftest* + ;; -echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 -echo "configure:3163: checking for loader (symbol LD)" >&5 -if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +echo "configure:3154: checking whether the C compiler needs -belf" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else -test -z "$LD" && LD=ld -cf_cv_subst_LD=$LD -fi + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross -LD=${cf_cv_subst_LD} -echo "$ac_t""$LD" 1>&6 + cat > conftest.$ac_ext <&6 -echo "configure:3177: checking for archiver (symbol AR)" >&5 -if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +; return 0; } +EOF +if { (eval echo configure:3174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes else - -test -z "$AR" && AR=ar -cf_cv_subst_AR=$AR + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_needs_belf=no fi +rm -f conftest* + ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross -AR=${cf_cv_subst_AR} -echo "$ac_t""$AR" 1>&6 - - -echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 -echo "configure:3191: checking for archiver options (symbol AR_OPTS)" >&5 -if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - -test -z "$AR_OPTS" && AR_OPTS=rc -cf_cv_subst_AR_OPTS=$AR_OPTS fi -AR_OPTS=${cf_cv_subst_AR_OPTS} -echo "$ac_t""$AR_OPTS" 1>&6 +echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +esac -# Check whether --with-mktexmf-default or --without-mktexmf-default was given. -if test "${with_mktexmf_default+set}" = set; then - withval="$with_mktexmf_default" - : -else - withval=yes -fi -if test "x$withval" = xyes; then - cat >> confdefs.h <<\EOF -#define MAKE_TEX_MF_BY_DEFAULT 1 +# Save cache, so that ltconfig can load it +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# EOF - -fi -# Check whether --with-mktexpk-default or --without-mktexpk-default was given. -if test "${with_mktexpk_default+set}" = set; then - withval="$with_mktexpk_default" +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then : else - withval=yes + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi fi +rm -f confcache -if test "x$withval" = xyes; then - cat >> confdefs.h <<\EOF -#define MAKE_TEX_PK_BY_DEFAULT 1 -EOF - -fi -# Check whether --with-mktextfm-default or --without-mktextfm-default was given. -if test "${with_mktextfm_default+set}" = set; then - withval="$with_mktextfm_default" - : -else - withval=yes -fi -if test "x$withval" = xyes; then - cat >> confdefs.h <<\EOF -#define MAKE_TEX_TFM_BY_DEFAULT 1 -EOF +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } -fi -# Check whether --with-mkocp-default or --without-mkocp-default was given. -if test "${with_mkocp_default+set}" = set; then - withval="$with_mkocp_default" - : +# Reload cache, that may have been modified by ltconfig +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file else - withval=yes + echo "creating cache $cache_file" + > $cache_file fi -if test "x$withval" = xyes; then - cat >> confdefs.h <<\EOF -#define MAKE_OMEGA_OCP_BY_DEFAULT 1 -EOF - -fi -# Check whether --with-mkofm-default or --without-mkofm-default was given. -if test "${with_mkofm_default+set}" = set; then - withval="$with_mkofm_default" - : -else - withval=yes -fi -if test "x$withval" = xyes; then - cat >> confdefs.h <<\EOF -#define MAKE_OMEGA_OFM_BY_DEFAULT 1 -EOF +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" -fi +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:3283: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:3283: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -# Check whether --enable-multiplatform or --disable-multiplatform was given. -if test "${enable_multiplatform+set}" = set; then - enableval="$enable_multiplatform" - if test "x$enable_multiplatform" = xyes && - test "x$bindir" = 'x${exec_prefix}/bin' -then - bindir="$bindir/$host" +rm -f conftestmake fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" fi - -echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 -echo "configure:3315: checking where the main texmf tree is located" >&5 -texmfmain= -if test "x$datadir" != 'x${prefix}/share'; then - # First case, datadir is defined... - eval p=\"$datadir\" - # Unconditionally set the directory, but... - texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` - # ... do complain if it wasn't found. - if test -d "$texmfmain"; then - echo "$ac_t"""$texmfmain"" 1>&6 - else - echo "$ac_t""not found" 1>&6 - echo "configure: warning: No texmf tree found at $texmfmain. - If you do not have the files, you can retrieve a minimal set from - ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts - in systems/web2c. Winging it." 1>&2 - fi -else - # Second case, datadir is default... - if test "x$prefix" = "xNONE"; then - p="$ac_default_prefix" - else - eval p=\"$prefix\" - fi - for e in share/texmf lib/texmf texmf; do - if test -d "$p/$e"; then - texmfmain="$p/$e" - break - fi +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:3321: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + # Hack for MSDOS and descendants. + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test $ac_x $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac done - texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` - if test -n "$texmfmain"; then - echo "$ac_t"""$texmfmain"" 1>&6 + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" else - eval texmfmain="$datadir/texmf" - echo "$ac_t""not found" 1>&6 - echo "configure: warning: The main texmf tree was not found. - Specify the location of its parent directory with the --datadir option. - If you do not have the files, you can retrieve a minimal set from - ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts - in systems/web2c. Winging it by using the default location - $texmfmain." 1>&2 + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" fi fi +echo "$ac_t""$INSTALL" 1>&6 +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - - - - - +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # If we find X, set shell vars x_includes and x_libraries to the @@ -3370,7 +3377,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:3374: checking for X" >&5 +echo "configure:3381: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -3432,12 +3439,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3441: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3448: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3506,14 +3513,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -3607,7 +3614,7 @@ echo $ac_n "checking whether to define additional compiler specific flags""... $ac_c" 1>&6 -echo "configure:3611: checking whether to define additional compiler specific flags" >&5 +echo "configure:3618: checking whether to define additional compiler specific flags" >&5 case "$target" in alpha-dec*) if test "$CC" = "cc"; then @@ -3635,7 +3642,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3639: checking for $ac_word" >&5 +echo "configure:3646: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_have_telnet'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3676,7 +3683,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3680: checking for $ac_word" >&5 +echo "configure:3687: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_have_rlogin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3717,7 +3724,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3721: checking for $ac_word" >&5 +echo "configure:3728: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_have_tn3270'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3753,10 +3760,49 @@ EOF fi +for ac_prog in perl +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3769: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_have_perl'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$have_perl"; then + ac_cv_prog_have_perl="$have_perl" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_have_perl="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +have_perl="$ac_cv_prog_have_perl" +if test -n "$have_perl"; then + echo "$ac_t""$have_perl" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$have_perl" && break +done + +if test ! -n "$have_perl" ; then + { echo "configure: error: "Perl needs to be installed in order to compile libwww"" 1>&2; exit 1; } +fi + # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3760: checking for $ac_word" >&5 +echo "configure:3806: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3793,7 +3839,7 @@ # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3797: checking for $ac_word" >&5 +echo "configure:3843: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3830,7 +3876,7 @@ # Extract the first word of "mkdir", so it can be a program name with args. set dummy mkdir; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3834: checking for $ac_word" >&5 +echo "configure:3880: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MKDIR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3867,7 +3913,7 @@ # Extract the first word of "chmod", so it can be a program name with args. set dummy chmod; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3871: checking for $ac_word" >&5 +echo "configure:3917: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_CHMOD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3904,7 +3950,7 @@ # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3908: checking for $ac_word" >&5 +echo "configure:3954: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3941,7 +3987,7 @@ # Extract the first word of "tar", so it can be a program name with args. set dummy tar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3945: checking for $ac_word" >&5 +echo "configure:3991: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3978,7 +4024,7 @@ # Extract the first word of "cvs", so it can be a program name with args. set dummy cvs; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3982: checking for $ac_word" >&5 +echo "configure:4028: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_CVS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4015,7 +4061,7 @@ # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4019: checking for $ac_word" >&5 +echo "configure:4065: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SED'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4054,7 +4100,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4058: checking for $ac_word" >&5 +echo "configure:4104: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_COMPRESS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4091,50 +4137,8 @@ done test -n "$COMPRESS" || COMPRESS="compress" -for ac_prog in www -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4100: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_path_WWW'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - case "$WWW" in - /*|[A-z]:/*) - ac_cv_path_WWW="$WWW" # Let the user override the test with a path. - ;; - ?:/*) - ac_cv_path_WWW="$WWW" # Let the user override the test with a dos path. - ;; - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test $ac_x $ac_dir/$ac_word; then - ac_cv_path_WWW="$ac_dir/$ac_word" - break - fi - done - IFS="$ac_save_ifs" - ;; -esac -fi -WWW="$ac_cv_path_WWW" -if test -n "$WWW"; then - echo "$ac_t""$WWW" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$WWW" && break -done -test -n "$WWW" || WWW="""" - echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:4138: checking whether ln -s works" >&5 +echo "configure:4142: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4160,7 +4164,7 @@ # Extract the first word of "resolv.conf", so it can be a program name with args. set dummy resolv.conf; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4164: checking for $ac_word" >&5 +echo "configure:4168: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_have_resolv_conf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4209,17 +4213,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4213: checking for $ac_hdr" >&5 +echo "configure:4217: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4249,17 +4253,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4253: checking for $ac_hdr" >&5 +echo "configure:4257: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4289,17 +4293,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4293: checking for $ac_hdr" >&5 +echo "configure:4297: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4329,17 +4333,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4333: checking for $ac_hdr" >&5 +echo "configure:4337: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4343: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4369,17 +4373,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4373: checking for $ac_hdr" >&5 +echo "configure:4377: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4387: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4409,17 +4413,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4413: checking for $ac_hdr" >&5 +echo "configure:4417: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4423: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4449,17 +4453,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4453: checking for $ac_hdr" >&5 +echo "configure:4457: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4489,17 +4493,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4493: checking for $ac_hdr" >&5 +echo "configure:4497: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4503: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4507: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4529,17 +4533,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4533: checking for $ac_hdr" >&5 +echo "configure:4537: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4543: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4569,17 +4573,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4573: checking for $ac_hdr" >&5 +echo "configure:4577: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4587: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4609,17 +4613,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4613: checking for $ac_hdr" >&5 +echo "configure:4617: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4649,17 +4653,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4653: checking for $ac_hdr" >&5 +echo "configure:4657: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4667: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4689,17 +4693,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4693: checking for $ac_hdr" >&5 +echo "configure:4697: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4729,17 +4733,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4733: checking for $ac_hdr" >&5 +echo "configure:4737: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4769,17 +4773,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4773: checking for $ac_hdr" >&5 +echo "configure:4777: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4809,17 +4813,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4813: checking for $ac_hdr" >&5 +echo "configure:4817: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4849,17 +4853,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4853: checking for $ac_hdr" >&5 +echo "configure:4857: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4863: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4889,17 +4893,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4893: checking for $ac_hdr" >&5 +echo "configure:4897: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4903: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4907: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4929,17 +4933,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4933: checking for $ac_hdr" >&5 +echo "configure:4937: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4969,17 +4973,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4973: checking for $ac_hdr" >&5 +echo "configure:4977: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4983: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5009,17 +5013,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5013: checking for $ac_hdr" >&5 +echo "configure:5017: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5027: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5049,17 +5053,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5053: checking for $ac_hdr" >&5 +echo "configure:5057: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5067: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5089,17 +5093,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5093: checking for $ac_hdr" >&5 +echo "configure:5097: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5103: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5107: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5129,17 +5133,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5133: checking for $ac_hdr" >&5 +echo "configure:5137: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5143: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5147: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5169,17 +5173,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5173: checking for $ac_hdr" >&5 +echo "configure:5177: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5187: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5209,17 +5213,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5213: checking for $ac_hdr" >&5 +echo "configure:5217: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5249,17 +5253,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5253: checking for $ac_hdr" >&5 +echo "configure:5257: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5289,17 +5293,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5293: checking for $ac_hdr" >&5 +echo "configure:5297: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5329,17 +5333,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5333: checking for $ac_hdr" >&5 +echo "configure:5337: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5343: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5369,17 +5373,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5373: checking for $ac_hdr" >&5 +echo "configure:5377: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5387: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5409,17 +5413,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5413: checking for $ac_hdr" >&5 +echo "configure:5417: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5423: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5449,17 +5453,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5453: checking for $ac_hdr" >&5 +echo "configure:5457: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5467: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5489,17 +5493,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5493: checking for $ac_hdr" >&5 +echo "configure:5497: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5503: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5507: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5529,17 +5533,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5533: checking for $ac_hdr" >&5 +echo "configure:5537: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5543: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5569,17 +5573,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5573: checking for $ac_hdr" >&5 +echo "configure:5577: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5583: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5587: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5609,17 +5613,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5613: checking for $ac_hdr" >&5 +echo "configure:5617: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5649,17 +5653,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5653: checking for $ac_hdr" >&5 +echo "configure:5657: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5667: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5689,17 +5693,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5693: checking for $ac_hdr" >&5 +echo "configure:5697: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5729,17 +5733,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5733: checking for $ac_hdr" >&5 +echo "configure:5737: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5769,17 +5773,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5773: checking for $ac_hdr" >&5 +echo "configure:5777: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5809,17 +5813,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5813: checking for $ac_hdr" >&5 +echo "configure:5817: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5850,12 +5854,12 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:5854: checking for $ac_hdr that defines DIR" >&5 +echo "configure:5858: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -5863,7 +5867,7 @@ DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:5867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -5888,7 +5892,7 @@ # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:5892: checking for opendir in -ldir" >&5 +echo "configure:5896: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5896,7 +5900,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5929,7 +5933,7 @@ else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:5933: checking for opendir in -lx" >&5 +echo "configure:5937: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5937,7 +5941,7 @@ ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5974,17 +5978,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5978: checking for $ac_hdr" >&5 +echo "configure:5982: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5988: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5992: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6010,12 +6014,12 @@ fi done echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:6014: checking for ANSI C header files" >&5 +echo "configure:6018: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6023,7 +6027,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6027: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6040,7 +6044,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -6058,7 +6062,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -6079,7 +6083,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -6090,7 +6094,7 @@ exit (0); } EOF -if { (eval echo configure:6094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -6114,12 +6118,12 @@ fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:6118: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:6122: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6135,7 +6139,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:6139: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -6156,12 +6160,12 @@ fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:6160: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:6164: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6170,7 +6174,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:6174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -6191,12 +6195,12 @@ fi echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:6195: checking whether stat file-mode macros are broken" >&5 +echo "configure:6199: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6248,12 +6252,12 @@ echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:6252: checking for uid_t in sys/types.h" >&5 +echo "configure:6256: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -6282,12 +6286,12 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:6286: checking for pid_t" >&5 +echo "configure:6290: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6315,7 +6319,7 @@ fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:6319: checking type of array argument to getgroups" >&5 +echo "configure:6323: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6323,7 +6327,7 @@ ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -6362,7 +6366,7 @@ if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF @@ -6386,12 +6390,12 @@ echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:6390: checking for mode_t" >&5 +echo "configure:6394: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6419,12 +6423,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:6423: checking for size_t" >&5 +echo "configure:6427: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6452,12 +6456,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:6456: checking return type of signal handlers" >&5 +echo "configure:6460: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6474,7 +6478,7 @@ int i; ; return 0; } EOF -if { (eval echo configure:6478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6482: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -6493,13 +6497,14 @@ -echo $ac_n "checking for BOOLEAN""... $ac_c" 1>&6 -echo "configure:6498: checking for BOOLEAN" >&5 +if test "$MINGW32" != "yes"; then + echo $ac_n "checking for BOOLEAN""... $ac_c" 1>&6 +echo "configure:6503: checking for BOOLEAN" >&5 if eval "test \"`echo '$''{'ac_cv_type_BOOLEAN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6526,13 +6531,13 @@ fi -echo $ac_n "checking for u_char""... $ac_c" 1>&6 -echo "configure:6531: checking for u_char" >&5 + echo $ac_n "checking for u_char""... $ac_c" 1>&6 +echo "configure:6536: checking for u_char" >&5 if eval "test \"`echo '$''{'ac_cv_type_u_char'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6559,13 +6564,13 @@ fi -echo $ac_n "checking for u_short""... $ac_c" 1>&6 -echo "configure:6564: checking for u_short" >&5 + echo $ac_n "checking for u_short""... $ac_c" 1>&6 +echo "configure:6569: checking for u_short" >&5 if eval "test \"`echo '$''{'ac_cv_type_u_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6592,13 +6597,13 @@ fi -echo $ac_n "checking for u_long""... $ac_c" 1>&6 -echo "configure:6597: checking for u_long" >&5 + echo $ac_n "checking for u_long""... $ac_c" 1>&6 +echo "configure:6602: checking for u_long" >&5 if eval "test \"`echo '$''{'ac_cv_type_u_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6625,17 +6630,18 @@ fi +fi echo $ac_n "checking size of char""... $ac_c" 1>&6 -echo "configure:6631: checking size of char" >&5 +echo "configure:6637: checking size of char" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } + ac_cv_sizeof_char=1 else cat > conftest.$ac_ext < main() @@ -6646,7 +6652,7 @@ exit(0); } EOF -if { (eval echo configure:6650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_char=`cat conftestval` else @@ -6666,7 +6672,7 @@ echo $ac_n "checking size of char *""... $ac_c" 1>&6 -echo "configure:6670: checking size of char *" >&5 +echo "configure:6676: checking size of char *" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_char_p'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6674,7 +6680,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -6685,7 +6691,7 @@ exit(0); } EOF -if { (eval echo configure:6689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_char_p=`cat conftestval` else @@ -6705,15 +6711,15 @@ echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:6709: checking size of int" >&5 +echo "configure:6715: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } + ac_cv_sizeof_int=4 else cat > conftest.$ac_ext < main() @@ -6724,7 +6730,7 @@ exit(0); } EOF -if { (eval echo configure:6728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -6744,15 +6750,15 @@ echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:6748: checking size of long" >&5 +echo "configure:6754: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } + ac_cv_sizeof_long=4 else cat > conftest.$ac_ext < main() @@ -6763,7 +6769,7 @@ exit(0); } EOF -if { (eval echo configure:6767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -6783,7 +6789,7 @@ echo $ac_n "checking for whether time_t is long""... $ac_c" 1>&6 -echo "configure:6787: checking for whether time_t is long" >&5 +echo "configure:6793: checking for whether time_t is long" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_time_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6791,13 +6797,13 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < int main() { exit(sizeof(time_t) == sizeof(long)); } EOF -if { (eval echo configure:6801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_long_time_t=no else @@ -6821,7 +6827,7 @@ fi echo $ac_n "checking for whether size_t is long""... $ac_c" 1>&6 -echo "configure:6825: checking for whether size_t is long" >&5 +echo "configure:6831: checking for whether size_t is long" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6829,13 +6835,13 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < int main() { exit(sizeof(size_t) == sizeof(int)); } EOF -if { (eval echo configure:6839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_long_size_t=yes else @@ -6860,12 +6866,12 @@ echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:6864: checking for working const" >&5 +echo "configure:6870: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -6935,14 +6941,14 @@ fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:6939: checking whether byte ordering is bigendian" >&5 +echo "configure:6945: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -6953,11 +6959,11 @@ #endif ; return 0; } EOF -if { (eval echo configure:6957: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -6968,7 +6974,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:6972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -6988,7 +6994,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -7025,14 +7031,14 @@ fi echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:7029: checking whether char is unsigned" >&5 +echo "configure:7035: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -7088,7 +7094,7 @@ fi echo $ac_n "checking for long double""... $ac_c" 1>&6 -echo "configure:7092: checking for long double" >&5 +echo "configure:7098: checking for long double" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7099,7 +7105,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_long_double=yes else @@ -7132,12 +7138,12 @@ echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:7136: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:7142: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -7145,7 +7151,7 @@ struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:7149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -7166,12 +7172,12 @@ fi echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:7170: checking for tm_gmtoff in struct tm" >&5 +echo "configure:7176: checking for tm_gmtoff in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_gmtoff'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -7179,7 +7185,7 @@ struct tm tm; tm.tm_gmtoff; ; return 0; } EOF -if { (eval echo configure:7183: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_gmtoff=yes else @@ -7200,19 +7206,19 @@ fi echo $ac_n "checking for time.h that defines timezone""... $ac_c" 1>&6 -echo "configure:7204: checking for time.h that defines timezone" >&5 +echo "configure:7210: checking for time.h that defines timezone" >&5 if eval "test \"`echo '$''{'ac_cv_extern_timezone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return timezone; ; return 0; } EOF -if { (eval echo configure:7216: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_extern_timezone=yes else @@ -7233,19 +7239,19 @@ fi echo $ac_n "checking for time.h that defines altzone""... $ac_c" 1>&6 -echo "configure:7237: checking for time.h that defines altzone" >&5 +echo "configure:7243: checking for time.h that defines altzone" >&5 if eval "test \"`echo '$''{'ac_cv_extern_altzone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return altzone; ; return 0; } EOF -if { (eval echo configure:7249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7255: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_extern_altzone=yes else @@ -7266,19 +7272,19 @@ fi echo $ac_n "checking for time.h that defines daylight""... $ac_c" 1>&6 -echo "configure:7270: checking for time.h that defines daylight" >&5 +echo "configure:7276: checking for time.h that defines daylight" >&5 if eval "test \"`echo '$''{'ac_cv_extern_daylight'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return daylight; ; return 0; } EOF -if { (eval echo configure:7282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7288: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_extern_daylight=yes else @@ -7300,7 +7306,7 @@ if test $ac_cv_extern_timezone = yes; then echo $ac_n "checking if timezone is backwards""... $ac_c" 1>&6 -echo "configure:7304: checking if timezone is backwards" >&5 +echo "configure:7310: checking if timezone is backwards" >&5 if eval "test \"`echo '$''{'ac_cv_backwards_timezone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7308,7 +7314,7 @@ ac_cv_backwards_timezone=cross-compiling else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:7337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_backwards_timezone=no else @@ -7351,12 +7357,12 @@ fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:7355: checking for tm_zone in struct tm" >&5 +echo "configure:7361: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -7364,7 +7370,7 @@ struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:7368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7374: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -7384,12 +7390,12 @@ else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:7388: checking for tzname" >&5 +echo "configure:7394: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -7399,7 +7405,7 @@ atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:7403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -7421,12 +7427,12 @@ fi echo $ac_n "checking for winsize structure""... $ac_c" 1>&6 -echo "configure:7425: checking for winsize structure" >&5 +echo "configure:7431: checking for winsize structure" >&5 if eval "test \"`echo '$''{'ac_cv_struct_winsize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7450: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_winsize=yes else @@ -7462,12 +7468,12 @@ echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:7466: checking for vprintf" >&5 +echo "configure:7472: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -7514,12 +7520,12 @@ if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:7518: checking for _doprnt" >&5 +echo "configure:7524: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -7567,12 +7573,12 @@ fi echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:7571: checking for strftime" >&5 +echo "configure:7577: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else @@ -7617,7 +7623,7 @@ echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:7621: checking for strftime in -lintl" >&5 +echo "configure:7627: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7625,7 +7631,7 @@ ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7666,15 +7672,15 @@ select socket strerror strtol opendir getpid strchr memcpy \ getlogin getpass fcntl readdir sysinfo ioctl chdir tempnam \ getsockopt setsockopt \ - gettimeofday mktime timegm + gettimeofday mktime timegm tzset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7673: checking for $ac_func" >&5 +echo "configure:7679: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7721,13 +7727,15 @@ fi done +# AC_CHECK_FUNC(unlink, , AC_CHECK_FUNC(remove, AC_DEFINE(unlink, remove))) +## Path submitted by thurog@gmx.de for autoconf 2.53 echo $ac_n "checking for unlink""... $ac_c" 1>&6 -echo "configure:7726: checking for unlink" >&5 +echo "configure:7734: checking for unlink" >&5 if eval "test \"`echo '$''{'ac_cv_func_unlink'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_unlink=yes" else @@ -7767,13 +7775,16 @@ : else echo "$ac_t""no" 1>&6 -echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:7772: checking for remove" >&5 +fi + + if test "$ac_cv_func_unlink" != yes ; then + echo $ac_n "checking for remove""... $ac_c" 1>&6 +echo "configure:7783: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -7810,72 +7821,31 @@ if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define unlink remove -EOF - + : else echo "$ac_t""no" 1>&6 fi -fi - - -cat >> confdefs.h <<\EOF -#define TTY_IS_SELECTABLE 1 + if test "$ac_cv_func_remove" == yes ; then + cat >> confdefs.h <<\EOF +#define unlink remove EOF + fi +fi -echo $ac_n "checking whether to support direct WAIS access.""... $ac_c" 1>&6 -echo "configure:7831: checking whether to support direct WAIS access." >&5 -# Check whether --with-wais or --without-wais was given. -if test "${with_wais+set}" = set; then - withval="$with_wais" - case "$withval" in - no) - echo "$ac_t""no" 1>&6 - HTWAIS="" - ;; - *) - echo "$ac_t""yes" 1>&6 - if test "x$withval" = "xyes"; then - withval="/usr/local/lib/wais/wais.a /usr/local/lib/wais/client.a" - fi - LIBS="$withval -lm $LIBS" - cat >> confdefs.h <<\EOF -#define HT_DIRECT_WAIS 1 -EOF +HTWAIS="" +WWWWAIS="" +LWWWWAIS="" +LIBWWWWAIS="" - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - { echo "configure: error: Could not find one or more of the $withval libraries. You must first install WAIS." 1>&2; exit 1; } -fi -rm -f conftest* - HTWAIS="HTWAIS.lo" - ;; - esac -else - echo "$ac_t""no" 1>&6 - HTWAIS="" -fi echo $ac_n "checking whether to support POSIX regex""... $ac_c" 1>&6 -echo "configure:7879: checking whether to support POSIX regex" >&5 +echo "configure:7849: checking whether to support POSIX regex" >&5 # Check whether --with-regex or --without-regex was given. if test "${with_regex+set}" = set; then withval="$with_regex" @@ -7891,7 +7861,7 @@ if test "x$withval" = "xyes"; then echo $ac_n "checking for regexec in -lrx""... $ac_c" 1>&6 -echo "configure:7895: checking for regexec in -lrx" >&5 +echo "configure:7865: checking for regexec in -lrx" >&5 ac_lib_var=`echo rx'_'regexec | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7899,7 +7869,7 @@ ac_save_LIBS="$LIBS" LIBS="-lrx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7932,21 +7902,21 @@ else echo $ac_n "checking for $withval""... $ac_c" 1>&6 -echo "configure:7936: checking for $withval" >&5 +echo "configure:7906: checking for $withval" >&5 LP=`dirname $withval` LN=`basename $withval | sed 's/lib\(.*\)\.a/\1/g'` echo "$ac_t""-L$LP -l$LN" 1>&6 LIBS="$LIBS -L$LP -l$LN" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -7966,7 +7936,7 @@ # borrowed from SSH - thanks! echo $ac_n "checking whether to support SOCKS""... $ac_c" 1>&6 -echo "configure:7970: checking whether to support SOCKS" >&5 +echo "configure:7940: checking whether to support SOCKS" >&5 # Check whether --with-socks or --without-socks was given. if test "${with_socks+set}" = set; then withval="$with_socks" @@ -7977,7 +7947,7 @@ yes) echo "$ac_t""yes" 1>&6 echo $ac_n "checking for SOCKSconnect in -lsocks5""... $ac_c" 1>&6 -echo "configure:7981: checking for SOCKSconnect in -lsocks5" >&5 +echo "configure:7951: checking for SOCKSconnect in -lsocks5" >&5 ac_lib_var=`echo socks5'_'SOCKSconnect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7985,7 +7955,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocks5 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8018,7 +7988,7 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for Rconnect in -lsocks""... $ac_c" 1>&6 -echo "configure:8022: checking for Rconnect in -lsocks" >&5 +echo "configure:7992: checking for Rconnect in -lsocks" >&5 ac_lib_var=`echo socks'_'Rconnect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8026,7 +7996,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocks $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8073,7 +8043,7 @@ if test "x$socks" = "x"; then echo $ac_n "checking whether to support SOCKS5""... $ac_c" 1>&6 -echo "configure:8077: checking whether to support SOCKS5" >&5 +echo "configure:8047: checking whether to support SOCKS5" >&5 # Check whether --with-socks5 or --without-socks5 was given. if test "${with_socks5+set}" = set; then withval="$with_socks5" @@ -8089,7 +8059,7 @@ LIBS="$withval $LIBS" else echo $ac_n "checking for $withval""... $ac_c" 1>&6 -echo "configure:8093: checking for $withval" >&5 +echo "configure:8063: checking for $withval" >&5 LP=`dirname $withval` LN=`basename $withval | sed 's/lib\(.*\)\.a/\1/g'` echo "$ac_t""-L$LP -l$LN" 1>&6 @@ -8097,14 +8067,14 @@ fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -8124,7 +8094,7 @@ if test "x$socks" = "x"; then echo $ac_n "checking whether to support SOCKS4""... $ac_c" 1>&6 -echo "configure:8128: checking whether to support SOCKS4" >&5 +echo "configure:8098: checking whether to support SOCKS4" >&5 # Check whether --with-socks4 or --without-socks4 was given. if test "${with_socks4+set}" = set; then withval="$with_socks4" @@ -8140,7 +8110,7 @@ LIBS="$withval $LIBS" else echo $ac_n "checking for $withval""... $ac_c" 1>&6 -echo "configure:8144: checking for $withval" >&5 +echo "configure:8114: checking for $withval" >&5 LP=`dirname $withval` LN=`basename $withval | sed 's/lib\(.*\)\.a/\1/g'` echo "$ac_t""-L$LP -l$LN" 1>&6 @@ -8148,14 +8118,14 @@ fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -8196,7 +8166,7 @@ fi echo $ac_n "checking whether to support mysql access.""... $ac_c" 1>&6 -echo "configure:8200: checking whether to support mysql access." >&5 +echo "configure:8170: checking whether to support mysql access." >&5 # Check whether --with-mysql or --without-mysql was given. if test "${with_mysql+set}" = set; then withval="$with_mysql" @@ -8205,21 +8175,36 @@ echo "$ac_t""no" 1>&6 HTSQL="" HTSQLLOG="" + WWWSQL="" + LWWWSQL="" + LIBWWWSQL="" CVS2SQL="" ;; *) echo "$ac_t""yes" 1>&6 if test "x$withval" = "xyes"; then - echo $ac_n "checking for "/usr/local/lib/mysql/libmysqlclient.a"""... $ac_c" 1>&6 -echo "configure:8215: checking for "/usr/local/lib/mysql/libmysqlclient.a"" >&5 + if test -f '/usr/local/lib/mysql/libmysqlclient.a'; then + echo $ac_n "checking for "/usr/local/lib/mysql/libmysqlclient.a"""... $ac_c" 1>&6 +echo "configure:8189: checking for "/usr/local/lib/mysql/libmysqlclient.a"" >&5 LP=`dirname "/usr/local/lib/mysql/libmysqlclient.a"` LN=`basename "/usr/local/lib/mysql/libmysqlclient.a" | sed 's/lib\(.*\)\.a/\1/g'` echo "$ac_t""-L$LP -l$LN" 1>&6 LIBS="$LIBS -L$LP -l$LN" + elif test -f '/usr/lib/mysql/libmysqlclient.a'; then + echo $ac_n "checking for "/usr/lib/mysql/libmysqlclient.a"""... $ac_c" 1>&6 +echo "configure:8197: checking for "/usr/lib/mysql/libmysqlclient.a"" >&5 + LP=`dirname "/usr/lib/mysql/libmysqlclient.a"` + LN=`basename "/usr/lib/mysql/libmysqlclient.a" | sed 's/lib\(.*\)\.a/\1/g'` + echo "$ac_t""-L$LP -l$LN" 1>&6 + LIBS="$LIBS -L$LP -l$LN" + + else + { echo "configure: error: Could not find the mysql client library." 1>&2; exit 1; } + fi else echo $ac_n "checking for $withval""... $ac_c" 1>&6 -echo "configure:8223: checking for $withval" >&5 +echo "configure:8208: checking for $withval" >&5 LP=`dirname $withval` LN=`basename $withval | sed 's/lib\(.*\)\.a/\1/g'` echo "$ac_t""-L$LP -l$LN" 1>&6 @@ -8232,6 +8217,9 @@ HTSQL="HTSQL.lo" HTSQLLOG="HTSQLLog.lo" + WWWSQL="libwwwsql.la" + LWWWSQL="-lwwwsql" + LIBWWWSQL='${top_builddir}/Library/src/libwwwsql.la' CVS2SQL="cvs2sql" ;; esac @@ -8239,45 +8227,202 @@ echo "$ac_t""no" 1>&6 HTSQL="" HTSQLLOG="" + WWWSQL="" + LWWWSQL="" + LIBWWWSQL="" CVS2SQL="" fi - - - - - -echo $ac_n "checking whether to link libwww as shared library""... $ac_c" 1>&6 -echo "configure:8252: checking whether to link libwww as shared library" >&5 -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - case "${enableval}" in - no) - echo "$ac_t""no" 1>&6 - ;; - *) + + + + + + + + +echo $ac_n "checking whether we include the Expat XML parser.""... $ac_c" 1>&6 +echo "configure:8246: checking whether we include the Expat XML parser." >&5 +# Check whether --with-expat or --without-expat was given. +if test "${with_expat+set}" = set; then + withval="$with_expat" + case "$withval" in + no) + echo "$ac_t""no" 1>&6 + HTXML="" + HTLIBXML="" + XMLTOK="" + XMLPARSE="" + WWWXML="" + LWWWXML="" + LIBWWWXML="" + SHOWXML="" + ;; + *) + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HT_EXPAT 1 +EOF + + HTXML="HTXML.lo" + HTLIBXML='${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la' + XMLTOK="libxmltok.la" + XMLPARSE="libxmlparse.la" + WWWXML="libwwwxml.la" + LWWWXML="-lwwwxml -lxmltok -lxmlparse" + LIBWWWXML='${top_builddir}/Library/src/libwwwxml.la ${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la' + SHOWXML='showxml$(EXEEXT) ptri$(EXEEXT) stri$(EXEEXT) rdf_parse_file$(EXEEXT) rdf_parse_buffer$(EXEEXT)' + ;; + esac +else + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HT_EXPAT 1 +EOF + + HTXML="HTXML.lo" + HTLIBXML='${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la' + XMLTOK="libxmltok.la" + XMLPARSE="libxmlparse.la" + WWWXML="libwwwxml.la" + LWWWXML="-lwwwxml -lxmltok -lxmlparse" + LIBWWWXML='${top_builddir}/Library/src/libwwwxml.la ${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la' + SHOWXML='showxml$(EXEEXT) ptri$(EXEEXT) stri$(EXEEXT) rdf_parse_file$(EXEEXT) rdf_parse_buffer$(EXEEXT)' + +fi + + # for old style big library + # for old style big library + + + + + + + +echo $ac_n "checking whether we include MD5 support for HTTP Digest Authentication.""... $ac_c" 1>&6 +echo "configure:8305: checking whether we include MD5 support for HTTP Digest Authentication." >&5 +# Check whether --with-md5 or --without-md5 was given. +if test "${with_md5+set}" = set; then + withval="$with_md5" + case "$withval" in + no) + echo "$ac_t""no" 1>&6 + WWWMD5="" + LWWWMD5="" + LIBWWWMD5="" + ;; + *) + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HT_MD5 1 +EOF + + WWWMD5="libmd5.la" + LWWWMD5="-lmd5" + LIBWWWMD5='${top_builddir}/modules/md5/libmd5.la' + ;; + esac +else + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HT_MD5 1 +EOF + + WWWMD5="libmd5.la" + LWWWMD5="-lmd5" + LIBWWWMD5='${top_builddir}/modules/md5/libmd5.la' + +fi + + + + + +WWWDAV= +LWWWDAV= +LIBWWWDAV= +DAVSAMPLE= + + + + + +echo $ac_n "checking whether we can find OpenSSL""... $ac_c" 1>&6 +echo "configure:8353: checking whether we can find OpenSSL" >&5 +if test -d '/usr/local/ssl/lib'; then + ssllib="-L/usr/local/ssl/lib -lssl -lcrypto" +else + ssllib="-L/usr/lib -lssl -lcrypto" +fi +if test -d '/usr/local/ssl/include'; then + sslinc="-I/usr/local/ssl/include" +elif test -d '/usr/local/openssl/include'; then + sslinc="-I/usr/local/openssl/include" +elif test -d '/usr/local/include/openssl'; then + sslinc="-I/usr/local/include/openssl" +elif test -d '/usr/include/ssl'; then + sslinc="-I/usr/include/ssl" +elif test -d '/usr/include/openssl'; then + sslinc="-I/usr/include/openssl" +else + sslinc="" +fi +WWWSSL="" +SSLINC="" +LIBSSL="" +LWWWSSL="" +LIBWWWSSL="" +WWWSSLEX="" +# Check whether --with-ssl or --without-ssl was given. +if test "${with_ssl+set}" = set; then + withval="$with_ssl" + case "$withval" in + no) + echo "$ac_t""no" 1>&6 + ;; + *) + if test "x$withval" = "xyes"; then + withval=$ssllib + SSLINC=$sslinc + fi + LIBS="$LIBS $withval" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Could not find the $withval libraries. You must first install openSSL." 1>&2; exit 1; } +fi +rm -f conftest* echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define LIBWWW_SHARED 1 -EOF - + WWWSSL="libwwwssl.la" + LWWWSSL="-lwwwssl" + LIBWWWSSL='${top_builddir}/Library/src/SSL/libwwwssl.la' + WWWSSLEX='wwwssl$(EXEEXT)' ;; esac else - - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define LIBWWW_SHARED 1 -EOF + echo "$ac_t""no" 1>&6 +fi + + -fi echo $ac_n "checking whether to use internal signal handlers""... $ac_c" 1>&6 -echo "configure:8281: checking whether to use internal signal handlers" >&5 +echo "configure:8426: checking whether to use internal signal handlers" >&5 # Check whether --enable-signals or --disable-signals was given. if test "${enable_signals+set}" = set; then enableval="$enable_signals" @@ -8300,7 +8445,7 @@ echo $ac_n "checking whether to disable Nagle's algorithm""... $ac_c" 1>&6 -echo "configure:8304: checking whether to disable Nagle's algorithm" >&5 +echo "configure:8449: checking whether to disable Nagle's algorithm" >&5 # Check whether --enable-nagle or --disable-nagle was given. if test "${enable_nagle+set}" = set; then enableval="$enable_nagle" @@ -8327,7 +8472,7 @@ echo $ac_n "checking whether to accept new rule files without asking an end user.""... $ac_c" 1>&6 -echo "configure:8331: checking whether to accept new rule files without asking an end user." >&5 +echo "configure:8476: checking whether to accept new rule files without asking an end user." >&5 # Check whether --enable-autorules or --disable-autorules was given. if test "${enable_autorules+set}" = set; then enableval="$enable_autorules" @@ -8350,7 +8495,7 @@ echo $ac_n "checking whether to disable HTTP/1.1 pipelining""... $ac_c" 1>&6 -echo "configure:8354: checking whether to disable HTTP/1.1 pipelining" >&5 +echo "configure:8499: checking whether to disable HTTP/1.1 pipelining" >&5 # Check whether --enable-pipelining or --disable-pipelining was given. if test "${enable_pipelining+set}" = set; then enableval="$enable_pipelining" @@ -8374,7 +8519,7 @@ echo $ac_n "checking whether to use MUX as transport for HTTP.""... $ac_c" 1>&6 -echo "configure:8378: checking whether to use MUX as transport for HTTP." >&5 +echo "configure:8523: checking whether to use MUX as transport for HTTP." >&5 # Check whether --enable-mux or --disable-mux was given. if test "${enable_mux+set}" = set; then enableval="$enable_mux" @@ -8397,13 +8542,14 @@ echo $ac_n "checking whether to define _REENTRANT""... $ac_c" 1>&6 -echo "configure:8401: checking whether to define _REENTRANT" >&5 +echo "configure:8546: checking whether to define _REENTRANT" >&5 # Check whether --enable-reentrant or --disable-reentrant was given. if test "${enable_reentrant+set}" = set; then enableval="$enable_reentrant" case "${enableval}" in no) echo "$ac_t""no" 1>&6 + ac_cv_reentrant=no ;; *) echo "$ac_t""yes" 1>&6 @@ -8411,6 +8557,7 @@ #define HT_REENTRANT 1 EOF CFLAGS="$CFLAGS -D_REENTRANT" + ac_cv_reentrant=yes ;; esac else @@ -8419,8 +8566,487 @@ fi +if test "$ac_cv_reentrant" = "yes"; then + + echo $ac_n "checking for ctime_r""... $ac_c" 1>&6 +echo "configure:8573: checking for ctime_r" >&5 + if test -z "$ac_cv_ctime_args"; then + cat > conftest.$ac_ext < +int main() { + + time_t clock; + char buf[26]; + ctime_r(&clock, buf); + +; return 0; } +EOF +if { (eval echo configure:8587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_ctime_args=2 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test -z "$ac_cv_ctime_args" ; then + cat > conftest.$ac_ext < +int main() { + + time_t clock; + char buf[26]; + ctime_r(&clock, buf, 26); + +; return 0; } +EOF +if { (eval echo configure:8609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_ctime_args=3 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test -z "$ac_cv_ctime_args"; then + echo "$ac_t""no" 1>&6 + have_missing_r_funcs="$have_missing_r_funcs ctime_r" + else + if test "$ac_cv_ctime_args" = 2; then + cat >> confdefs.h <<\EOF +#define HAVE_CTIME_R_2 1 +EOF + + elif test "$ac_cv_ctime_args" = 3; then + cat >> confdefs.h <<\EOF +#define HAVE_CTIME_R_3 1 +EOF + + fi + echo "$ac_t""yes, and it takes $ac_cv_ctime_args arguments" 1>&6 + fi + + echo $ac_n "checking for readdir_r""... $ac_c" 1>&6 +echo "configure:8637: checking for readdir_r" >&5 + if test -z "$ac_cv_readdir_args"; then + cat > conftest.$ac_ext < + +#if defined(HAVE_DIRENT_H) +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if defined(HAVE_SYS_NDIR_H) +# include +# endif +# if defined(HAVE_SYS_DIR_H) +# include +# endif +# if defined(HAVE_NDIR_H) +# include +# endif +#endif +int main() { + + struct dirent dir, *dirp; + DIR *mydir; + dirp = readdir_r(mydir, &dir); + +; return 0; } +EOF +if { (eval echo configure:8669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_readdir_args=2 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test -z "$ac_cv_readdir_args"; then + + cat > conftest.$ac_ext < +#if defined(HAVE_DIRENT_H) +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if defined(HAVE_SYS_NDIR_H) +# include +# endif +# if defined(HAVE_SYS_DIR_H) +# include +# endif +# if defined(HAVE_NDIR_H) +# include +# endif +#endif +int main() { + + struct dirent dir, *dirp; + DIR *mydir; + int rc; + rc = readdir_r(mydir, &dir, &dirp); + +; return 0; } +EOF +if { (eval echo configure:8710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_readdir_args=3 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + + if test -z "$ac_cv_readdir_args"; then + echo "$ac_t""no" 1>&6 + have_missing_r_funcs="$have_missing_r_funcs readdir_r" + else + if test "$ac_cv_readdir_args" = 2; then + cat >> confdefs.h <<\EOF +#define HAVE_READDIR_R_2 1 +EOF + + elif test "$ac_cv_readdir_args" = 3; then + cat >> confdefs.h <<\EOF +#define HAVE_READDIR_R_3 1 +EOF + + fi + echo "$ac_t""yes, and it takes $ac_cv_readdir_args arguments" 1>&6 + fi + + echo $ac_n "checking for gethostbyname_r""... $ac_c" 1>&6 +echo "configure:8739: checking for gethostbyname_r" >&5 + if test -z "$ac_cv_gethostbyname_args"; then + cat > conftest.$ac_ext < +#include +int main() { + +struct hostent *hp; +struct hostent h; +char *name; +char buffer[10]; +int h_errno; +hp = gethostbyname_r(name, &h, buffer, 10, &h_errno); +; return 0; } +EOF +if { (eval echo configure:8757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_gethostbyname_args=5 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test -z "$ac_cv_gethostbyname_args"; then + cat > conftest.$ac_ext < +#include +int main() { + +struct hostent h; +struct hostent_data hdata; +char *name; +int rc; +rc = gethostbyname_r(name, &h, &hdata); +; return 0; } +EOF +if { (eval echo configure:8782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_gethostbyname_args=3 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test -z "$ac_cv_gethostbyname_args"; then + cat > conftest.$ac_ext < +#include +int main() { + +struct hostent h; +struct hostent *hp; +char *name; +char buf[10]; +int rc; +int h_errno; + +rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno); + +; return 0; } +EOF +if { (eval echo configure:8811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_gethostbyname_args=6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test -z "$ac_cv_gethostbyname_args"; then + echo "$ac_t""no" 1>&6 + have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r" + else + if test "$ac_cv_gethostbyname_args" = 3; then + cat >> confdefs.h <<\EOF +#define HAVE_GETHOSTBYNAME_R_3 1 +EOF + + elif test "$ac_cv_gethostbyname_args" = 5; then + cat >> confdefs.h <<\EOF +#define HAVE_GETHOSTBYNAME_R_5 1 +EOF + + elif test "$ac_cv_gethostbyname_args" = 6; then + cat >> confdefs.h <<\EOF +#define HAVE_GETHOSTBYNAME_R_6 1 +EOF + + fi + echo "$ac_t""yes, and it takes $ac_cv_gethostbyname_args arguments" 1>&6 + fi + + echo $ac_n "checking for gethostbyaddr_r""... $ac_c" 1>&6 +echo "configure:8844: checking for gethostbyaddr_r" >&5 + if test -z "$ac_cv_gethostbyaddr_args"; then + cat > conftest.$ac_ext < +#include +int main() { + + char * address; + int length; + int type; + struct hostent h; + struct hostent_data hdata; + int rc; + rc = gethostbyaddr_r(address, length, type, &h, &hdata); + +; return 0; } +EOF +if { (eval echo configure:8864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_gethostbyaddr_args=5 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + + fi + if test -z "$ac_cv_gethostbyaddr_args"; then + cat > conftest.$ac_ext < +#include +int main() { + + char * address; + int length; + int type; + struct hostent h; + char buffer[10]; + int buflen; + int h_errnop; + struct hostent * hp; + + hp = gethostbyaddr_r(address, length, type, &h, + buffer, buflen, &h_errnop); + +; return 0; } +EOF +if { (eval echo configure:8897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_gethostbyaddr_args=7 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + + if test -z "$ac_cv_gethostbyaddr_args"; then + cat > conftest.$ac_ext < +#include +int main() { + + char * address; + int length; + int type; + struct hostent h; + char buffer[10]; + int buflen; + int h_errnop; + struct hostent * hp; + int rc; + + rc = gethostbyaddr_r(address, length, type, &h, + buffer, buflen, &hp, &h_errnop); + +; return 0; } +EOF +if { (eval echo configure:8931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_gethostbyaddr_args=8 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + fi + if test -z "$ac_cv_gethostbyaddr_args"; then + echo "$ac_t""no" 1>&6 + have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r" + else + if test "$ac_cv_gethostbyaddr_args" = 5; then + cat >> confdefs.h <<\EOF +#define HAVE_GETHOSTBYADDR_R_5 1 +EOF + + elif test "$ac_cv_gethostbyaddr_args" = 7; then + cat >> confdefs.h <<\EOF +#define HAVE_GETHOSTBYADDR_R_7 1 +EOF + + elif test "$ac_cv_gethostbyaddr_args" = 8; then + cat >> confdefs.h <<\EOF +#define HAVE_GETHOSTBYADDR_R_8 1 +EOF + + fi + echo "$ac_t""yes, and it takes $ac_cv_gethostbyaddr_args arguments" 1>&6 + fi + + echo $ac_n "checking for getlogin_r""... $ac_c" 1>&6 +echo "configure:8964: checking for getlogin_r" >&5 + if test -z "$ac_cv_getlogin_r_style"; then + if test "$cross_compiling" = yes; then + + ac_cv_getlogin_r_style= + +else + cat > conftest.$ac_ext < + +int main() +{ + char name[1024]; + int len=1024; + int rc; + char *login; + + name[0]='\0'; + + rc = getlogin_r(name, len); + if(rc == 0 && name[0] != '\0') + { + return 0; /* returns zero on success */ + } + else if(rc != 0 && name[0] == '\0') + { + return 0; /* returns errno on failure */ + } + else if(rc == 0 && name[0] == '\0') + { + return 0; /* can't tell */ + } + else if(rc != 0 && name[0] != '\0') + { + return 1; /* returns pointer on success */ + } +} + +EOF +if { (eval echo configure:9006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + + ac_cv_getlogin_r_style=1 + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + + ac_cv_getlogin_r_style=2 + +fi +rm -fr conftest* +fi + + fi + if test -z "$ac_cv_getlogin_r_style"; then + echo "$ac_t""no" 1>&6 + have_missing_r_funcs="$have_missing_r_funcs getlogin_r" + else + if test $ac_cv_getlogin_r_style = 1; then + cat >> confdefs.h <<\EOF +#define GETLOGIN_R_RETURNS_INT 1 +EOF + + echo "$ac_t""yes, and it returns an int" 1>&6 + elif test $ac_cv_getlogin_r_style = 2; then + cat >> confdefs.h <<\EOF +#define GETLOGIN_R_RETURNS_POINTER 1 +EOF + + echo "$ac_t""yes, and it returns a pointer" 1>&6 + else + echo "$ac_t""no: result is $ac_cv_getlogin_r_style" 1>&6 + have_missing_r_funcs="$have_missing_r_funcs getlogin_r" + fi + fi + if test -n "$have_missing_r_funcs"; then + echo "configure: warning: missing reentrant functions: $have_missing_r_funcs" 1>&2 + fi +fi + echo $ac_n "checking whether to define _POSIX_SOURCE""... $ac_c" 1>&6 -echo "configure:8424: checking whether to define _POSIX_SOURCE" >&5 +echo "configure:9050: checking whether to define _POSIX_SOURCE" >&5 # Check whether --enable-posix or --disable-posix was given. if test "${enable_posix+set}" = set; then enableval="$enable_posix" @@ -8618,22 +9244,24 @@ s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g -s%@RANLIB@%$RANLIB%g -s%@LD@%$LD%g -s%@NM@%$NM%g +s%@EXEEXT@%$EXEEXT%g s%@LN_S@%$LN_S%g -s%@LIBTOOL@%$LIBTOOL%g s%@CPP@%$CPP%g +s%@RANLIB@%$RANLIB%g +s%@LIBTOOL@%$LIBTOOL%g s%@LTLIBOBJS@%$LTLIBOBJS%g s%@MAINT@%$MAINT%g +s%@LD@%$LD%g s%@AR@%$AR%g s%@AR_OPTS@%$AR_OPTS%g s%@texmfmain@%$texmfmain%g +s%@NM@%$NM%g s%@icondir@%$icondir%g s%@PURIFY_CACHE@%$PURIFY_CACHE%g s%@have_telnet@%$have_telnet%g s%@have_rlogin@%$have_rlogin%g s%@have_tn3270@%$have_tn3270%g +s%@have_perl@%$have_perl%g s%@RM@%$RM%g s%@MKDIR@%$MKDIR%g s%@CHMOD@%$CHMOD%g @@ -8642,12 +9270,37 @@ s%@CVS@%$CVS%g s%@SED@%$SED%g s%@COMPRESS@%$COMPRESS%g -s%@WWW@%$WWW%g s%@have_resolv_conf@%$have_resolv_conf%g s%@HTWAIS@%$HTWAIS%g +s%@WWWWAIS@%$WWWWAIS%g +s%@LWWWWAIS@%$LWWWWAIS%g +s%@LIBWWWWAIS@%$LIBWWWWAIS%g s%@HTSQL@%$HTSQL%g s%@HTSQLLOG@%$HTSQLLOG%g +s%@WWWSQL@%$WWWSQL%g +s%@LWWWSQL@%$LWWWSQL%g +s%@LIBWWWSQL@%$LIBWWWSQL%g s%@CVS2SQL@%$CVS2SQL%g +s%@HTXML@%$HTXML%g +s%@HTLIBXML@%$HTLIBXML%g +s%@XMLTOK@%$XMLTOK%g +s%@XMLPARSE@%$XMLPARSE%g +s%@WWWXML@%$WWWXML%g +s%@LWWWXML@%$LWWWXML%g +s%@LIBWWWXML@%$LIBWWWXML%g +s%@SHOWXML@%$SHOWXML%g +s%@WWWMD5@%$WWWMD5%g +s%@LWWWMD5@%$LWWWMD5%g +s%@LIBWWWMD5@%$LIBWWWMD5%g +s%@WWWDAV@%$WWWDAV%g +s%@LWWWDAV@%$LWWWDAV%g +s%@LIBWWWDAV@%$LIBWWWDAV%g +s%@DAVSAMPLE@%$DAVSAMPLE%g +s%@WWWSSL@%$WWWSSL%g +s%@SSLINC@%$SSLINC%g +s%@LWWWSSL@%$LWWWSSL%g +s%@LIBWWWSSL@%$LIBWWWSSL%g +s%@WWWSSLEX@%$WWWSSLEX%g s%@A_STDIO@%$A_STDIO%g CEOF @@ -8897,10 +9550,8 @@ EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h date>stamp-h exit 0 EOF diff -Naur xdvik-22.40l/libs/libwww/configure.in xdvik-22.40n/libs/libwww/configure.in --- xdvik-22.40l/libs/libwww/configure.in Wed Apr 18 14:23:30 2001 +++ xdvik-22.40n/libs/libwww/configure.in Fri Sep 13 00:23:47 2002 @@ -1,13 +1,13 @@ dnl Process this file with Autoconf to create configure dnl (c) COPYRIGHT MIT 1995. dnl Please first read the full copyright statement in the file COPYRIGH. -dnl @(#) $Id: configure.in,v 1.1.1.1 2001/04/18 14:23:30 stefanulrich Exp $ +dnl @(#) $Id: configure.in,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ -AC_REVISION([$Id: configure.in,v 1.1.1.1 2001/04/18 14:23:30 stefanulrich Exp $]) -AC_PREREQ(2.2) +AC_REVISION([$Id: configure.in,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $]) +AC_PREREQ(2.13) AC_INIT(HTAABrow.c) -AC_CONFIG_AUX_DIR(../../config) +AC_CONFIG_AUX_DIR(config) AC_CANONICAL_SYSTEM AC_ARG_PROGRAM @@ -17,31 +17,43 @@ AC_SUBST(PACKAGE) AC_DEFINE_UNQUOTED(W3C_PACKAGE, "$PACKAGE") -VERSION=5.2.1 +VERSION=5.4.0 AC_SUBST(VERSION) AC_DEFINE_UNQUOTED(W3C_VERSION, "$VERSION") #dnl for CVS to be able to make a release diff -PREVIOUS_VERSION=5.1m +PREVIOUS_VERSION=5.3.2 AC_SUBST(PREVIOUS_VERSION) AM_INIT_AUTOMAKE($PACKAGE, $VERSION) -AC_ISC_POSIX - dnl Regular configure... -AM_CYGWIN32 AC_PROG_CC -AM_PROG_LIBTOOL -AC_PROG_MAKE_SET -AC_PROG_INSTALL +if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall"; fi +AC_ISC_POSIX +dnl AC_PROG_CXX Caused problems and is not needed... +dnl You should probably use all three of these for maximum portability +AC_CYGWIN +AC_MINGW32 +AC_EXEEXT +if test "$MINGW32" = "yes"; then + # With MinGW, need to explicitly link against winsock2 + LIBS="$LIBS -lws2_32" + # LIBS="$LIBS -no-unused" for DLL building, but doesn't work ATM, + # so completely disable shared libs (speeds up compilation because + # the .c files are not compiled twice): + AC_DISABLE_SHARED +fi sinclude(../../texk/kpathsea/common.ac) sinclude(../zlib/withenable.ac) sinclude(../zlib/zlib.ac) -dnl AM_CONFIG_HEADER(wwwconf.h) -AM_CONFIG_HEADER(wwwconf.h:wwwconf.h.in) +AC_CONFIG_HEADER(wwwconf.h:wwwconf.h.in) + +AM_PROG_LIBTOOL +AC_PROG_MAKE_SET +AC_PROG_INSTALL dnl Remove next line and you get an error -- autoconf dnl should deal with this automatically. @@ -93,6 +105,11 @@ if test -n "$have_tn3270" ; then AC_DEFINE_UNQUOTED(TN3270_PROGRAM, "$have_tn3270") fi +AC_CHECK_PROGS(have_perl, perl) +if test ! -n "$have_perl" ; then + AC_MSG_ERROR("Perl needs to be installed in order to compile libwww") +fi + AC_PATH_PROG(RM, rm, rm) AC_PATH_PROG(AR, ar, ar) AC_PATH_PROG(MKDIR, mkdir, mkdir) @@ -102,7 +119,9 @@ AC_PATH_PROG(CVS, cvs, cvs) AC_PATH_PROG(SED, sed, sed) AC_PATH_PROGS(COMPRESS, gzip compress, compress) -AC_PATH_PROGS(WWW, www, [""]) +dnl JK 26/July/2000: desactivated the use of the www tool, as it's faster to +dnl use perl +dnl AC_PATH_PROGS(WWW, www, [""]) AC_PROG_LN_S dnl Checks for misc files @@ -172,15 +191,17 @@ AC_TYPE_SIZE_T AC_TYPE_SIGNAL -AC_CHECK_TYPE(BOOLEAN, char) -AC_CHECK_TYPE(u_char, unsigned char) -AC_CHECK_TYPE(u_short, unsigned short) -AC_CHECK_TYPE(u_long, unsigned long) +if test "$MINGW32" != "yes"; then + AC_CHECK_TYPE(BOOLEAN, char) + AC_CHECK_TYPE(u_char, unsigned char) + AC_CHECK_TYPE(u_short, unsigned short) + AC_CHECK_TYPE(u_long, unsigned long) +fi -AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(char,1) AC_CHECK_SIZEOF(char *) -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(int,4) +AC_CHECK_SIZEOF(long,4) AC_CHECK_SIZEOF_TIME_T AC_CHECK_SIZEOF_SIZE_T @@ -201,40 +222,26 @@ select socket strerror strtol opendir getpid strchr memcpy \ getlogin getpass fcntl readdir sysinfo ioctl chdir tempnam \ getsockopt setsockopt \ - gettimeofday mktime timegm) -AC_CHECK_FUNC(unlink, , AC_CHECK_FUNC(remove, AC_DEFINE(unlink, remove))) + gettimeofday mktime timegm tzset) +# AC_CHECK_FUNC(unlink, , AC_CHECK_FUNC(remove, AC_DEFINE(unlink, remove))) +## Path submitted by thurog@gmx.de for autoconf 2.53 +AC_CHECK_FUNC(unlink) + if test "$ac_cv_func_unlink" != yes ; then + AC_CHECK_FUNC(remove) + if test "$ac_cv_func_remove" == yes ; then + AC_DEFINE(unlink, remove) + fi +fi + +HTWAIS="" +WWWWAIS="" +LWWWWAIS="" +LIBWWWWAIS="" -dnl THINGS TO CONSIDER -dnl ****************** -AC_DEFINE(TTY_IS_SELECTABLE) - -dnl Checks for configuration arguments -AC_MSG_CHECKING(whether to support direct WAIS access.) -AC_ARG_WITH(wais, -[ --with-wais[=PATH] Compile with support for direct WAIS access.], -[ case "$withval" in - no) - AC_MSG_RESULT(no) - HTWAIS="" - ;; - *) - AC_MSG_RESULT(yes) - if test "x$withval" = "xyes"; then - withval="/usr/local/lib/wais/wais.a /usr/local/lib/wais/client.a" - fi - LIBS="$withval -lm $LIBS" - AC_DEFINE(HT_DIRECT_WAIS) - AC_TRY_LINK([], - [ makeDocID(); ], - [], - [ AC_MSG_ERROR(Could not find one or more of the $withval libraries. You must first install WAIS.) ]) - HTWAIS="HTWAIS.lo" - ;; - esac ], - AC_MSG_RESULT(no) - HTWAIS="" -) AC_SUBST(HTWAIS) +AC_SUBST(WWWWAIS) +AC_SUBST(LWWWWAIS) +AC_SUBST(LIBWWWWAIS) AC_MSG_CHECKING(whether to support POSIX regex) AC_ARG_WITH(regex, @@ -354,46 +361,190 @@ AC_MSG_RESULT(no) HTSQL="" HTSQLLOG="" + WWWSQL="" + LWWWSQL="" + LIBWWWSQL="" CVS2SQL="" ;; *) AC_MSG_RESULT(yes) if test "x$withval" = "xyes"; then - AC_ADDLIB("/usr/local/lib/mysql/libmysqlclient.a") + if test -f '/usr/local/lib/mysql/libmysqlclient.a'; then + AC_ADDLIB("/usr/local/lib/mysql/libmysqlclient.a") + elif test -f '/usr/lib/mysql/libmysqlclient.a'; then + AC_ADDLIB("/usr/lib/mysql/libmysqlclient.a") + else + AC_MSG_ERROR(Could not find the mysql client library.) + fi else AC_ADDLIB($withval) fi AC_DEFINE(HT_MYSQL) HTSQL="HTSQL.lo" HTSQLLOG="HTSQLLog.lo" + WWWSQL="libwwwsql.la" + LWWWSQL="-lwwwsql" + LIBWWWSQL='${top_builddir}/Library/src/libwwwsql.la' CVS2SQL="cvs2sql" ;; esac ], AC_MSG_RESULT(no) HTSQL="" HTSQLLOG="" + WWWSQL="" + LWWWSQL="" + LIBWWWSQL="" CVS2SQL="" ) AC_SUBST(HTSQL) AC_SUBST(HTSQLLOG) +AC_SUBST(WWWSQL) +AC_SUBST(LWWWSQL) +AC_SUBST(LIBWWWSQL) AC_SUBST(CVS2SQL) -AC_MSG_CHECKING(whether to link libwww as shared library) -AC_ARG_ENABLE(shared, [], -[ case "${enableval}" in +AC_MSG_CHECKING(whether we include the Expat XML parser.) +AC_ARG_WITH(expat, +[ --with-expat[=PATH] Compile with support for expat.], +[ case "$withval" in no) AC_MSG_RESULT(no) + HTXML="" + HTLIBXML="" + XMLTOK="" + XMLPARSE="" + WWWXML="" + LWWWXML="" + LIBWWWXML="" + SHOWXML="" ;; - *) + *) AC_MSG_RESULT(yes) - AC_DEFINE(LIBWWW_SHARED) + AC_DEFINE(HT_EXPAT) + HTXML="HTXML.lo" + HTLIBXML='${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la' + XMLTOK="libxmltok.la" + XMLPARSE="libxmlparse.la" + WWWXML="libwwwxml.la" + LWWWXML="-lwwwxml -lxmltok -lxmlparse" + LIBWWWXML='${top_builddir}/Library/src/libwwwxml.la ${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la' + SHOWXML='showxml$(EXEEXT) ptri$(EXEEXT) stri$(EXEEXT) rdf_parse_file$(EXEEXT) rdf_parse_buffer$(EXEEXT)' ;; esac ], -[ AC_MSG_RESULT(yes) - AC_DEFINE(LIBWWW_SHARED) -] -) + AC_DEFINE(HT_EXPAT) + HTXML="HTXML.lo" + HTLIBXML='${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la' + XMLTOK="libxmltok.la" + XMLPARSE="libxmlparse.la" + WWWXML="libwwwxml.la" + LWWWXML="-lwwwxml -lxmltok -lxmlparse" + LIBWWWXML='${top_builddir}/Library/src/libwwwxml.la ${top_builddir}/modules/expat/xmlparse/libxmlparse.la ${top_builddir}/modules/expat/xmltok/libxmltok.la' + SHOWXML='showxml$(EXEEXT) ptri$(EXEEXT) stri$(EXEEXT) rdf_parse_file$(EXEEXT) rdf_parse_buffer$(EXEEXT)' +) +AC_SUBST(HTXML) # for old style big library +AC_SUBST(HTLIBXML) # for old style big library +AC_SUBST(XMLTOK) +AC_SUBST(XMLPARSE) +AC_SUBST(WWWXML) +AC_SUBST(LWWWXML) +AC_SUBST(LIBWWWXML) +AC_SUBST(SHOWXML) + +AC_MSG_CHECKING(whether we include MD5 support for HTTP Digest Authentication.) +AC_ARG_WITH(md5, +[ --with-md5[=PATH] Compile with support for md5.], +[ case "$withval" in + no) + AC_MSG_RESULT(no) + WWWMD5="" + LWWWMD5="" + LIBWWWMD5="" + ;; + *) + AC_MSG_RESULT(yes) + AC_DEFINE(HT_MD5) + WWWMD5="libmd5.la" + LWWWMD5="-lmd5" + LIBWWWMD5='${top_builddir}/modules/md5/libmd5.la' + ;; + esac ], + AC_MSG_RESULT(yes) + AC_DEFINE(HT_MD5) + WWWMD5="libmd5.la" + LWWWMD5="-lmd5" + LIBWWWMD5='${top_builddir}/modules/md5/libmd5.la' +) +AC_SUBST(WWWMD5) +AC_SUBST(LWWWMD5) +AC_SUBST(LIBWWWMD5) + +WWWDAV= +LWWWDAV= +LIBWWWDAV= +DAVSAMPLE= +AC_SUBST(WWWDAV) +AC_SUBST(LWWWDAV) +AC_SUBST(LIBWWWDAV) +AC_SUBST(DAVSAMPLE) + +dnl Checks for libwww and OpenSSL: +AC_MSG_CHECKING(whether we can find OpenSSL) +dnl find the ssl library dir (empirical) +if test -d '/usr/local/ssl/lib'; then + ssllib="-L/usr/local/ssl/lib -lssl -lcrypto" +else + ssllib="-L/usr/lib -lssl -lcrypto" +fi +dnl find the ssl include dir (empirical) +if test -d '/usr/local/ssl/include'; then + sslinc="-I/usr/local/ssl/include" +elif test -d '/usr/local/openssl/include'; then + sslinc="-I/usr/local/openssl/include" +elif test -d '/usr/local/include/openssl'; then + sslinc="-I/usr/local/include/openssl" +elif test -d '/usr/include/ssl'; then + sslinc="-I/usr/include/ssl" +elif test -d '/usr/include/openssl'; then + sslinc="-I/usr/include/openssl" +else + sslinc="" +fi +WWWSSL="" +SSLINC="" +LIBSSL="" +LWWWSSL="" +LIBWWWSSL="" +WWWSSLEX="" +AC_ARG_WITH(ssl, +[ --with-ssl[=PATH] Link with OpenSSL.], +[ case "$withval" in + no) + AC_MSG_RESULT(no) + ;; + *) + if test "x$withval" = "xyes"; then + withval=$ssllib + SSLINC=$sslinc + fi + LIBS="$LIBS $withval" + AC_TRY_LINK([], + [ SSL_library_init(); ], + [], + [ AC_MSG_ERROR(Could not find the $withval libraries. You must first install openSSL.) ]) + AC_MSG_RESULT(yes) + WWWSSL="libwwwssl.la" + LWWWSSL="-lwwwssl" + LIBWWWSSL='${top_builddir}/Library/src/SSL/libwwwssl.la' + WWWSSLEX='wwwssl$(EXEEXT)' + ;; + esac ], +[ AC_MSG_RESULT(no) ]) +AC_SUBST(WWWSSL) +AC_SUBST(SSLINC) +AC_SUBST(LWWWSSL) +AC_SUBST(LIBWWWSSL) +AC_SUBST(WWWSSLEX) AC_MSG_CHECKING(whether to use internal signal handlers) AC_ARG_ENABLE(signals, [ --enable-signals use internal libwww signal handler.], @@ -476,14 +627,315 @@ [ case "${enableval}" in no) AC_MSG_RESULT(no) + ac_cv_reentrant=no ;; *) AC_MSG_RESULT(yes) AC_DEFINE(HT_REENTRANT) [CFLAGS="$CFLAGS -D_REENTRANT"] + ac_cv_reentrant=yes ;; esac ], AC_MSG_RESULT(no) ) + +if test "$ac_cv_reentrant" = "yes"; then + + AC_MSG_CHECKING(for ctime_r) + if test -z "$ac_cv_ctime_args"; then + AC_TRY_COMPILE( + [#include ], + [ + time_t clock; + char buf[26]; + ctime_r(&clock, buf); + ], ac_cv_ctime_args=2) + fi + if test -z "$ac_cv_ctime_args" ; then + AC_TRY_COMPILE( + [#include ], + [ + time_t clock; + char buf[26]; + ctime_r(&clock, buf, 26); + ], ac_cv_ctime_args=3) + fi + if test -z "$ac_cv_ctime_args"; then + AC_MSG_RESULT(no) + have_missing_r_funcs="$have_missing_r_funcs ctime_r" + else + if test "$ac_cv_ctime_args" = 2; then + AC_DEFINE(HAVE_CTIME_R_2) + elif test "$ac_cv_ctime_args" = 3; then + AC_DEFINE(HAVE_CTIME_R_3) + fi + AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments]) + fi + + AC_MSG_CHECKING(for readdir_r) + if test -z "$ac_cv_readdir_args"; then + AC_TRY_COMPILE( + [ +#include + +#if defined(HAVE_DIRENT_H) +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if defined(HAVE_SYS_NDIR_H) +# include +# endif +# if defined(HAVE_SYS_DIR_H) +# include +# endif +# if defined(HAVE_NDIR_H) +# include +# endif +#endif ], + [ + struct dirent dir, *dirp; + DIR *mydir; + dirp = readdir_r(mydir, &dir); + ], ac_cv_readdir_args=2) + fi + if test -z "$ac_cv_readdir_args"; then + + AC_TRY_COMPILE( + [ +#include +#if defined(HAVE_DIRENT_H) +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if defined(HAVE_SYS_NDIR_H) +# include +# endif +# if defined(HAVE_SYS_DIR_H) +# include +# endif +# if defined(HAVE_NDIR_H) +# include +# endif +#endif ], + [ + struct dirent dir, *dirp; + DIR *mydir; + int rc; + rc = readdir_r(mydir, &dir, &dirp); + ], ac_cv_readdir_args=3) + fi + + if test -z "$ac_cv_readdir_args"; then + AC_MSG_RESULT(no) + have_missing_r_funcs="$have_missing_r_funcs readdir_r" + else + if test "$ac_cv_readdir_args" = 2; then + AC_DEFINE(HAVE_READDIR_R_2) + elif test "$ac_cv_readdir_args" = 3; then + AC_DEFINE(HAVE_READDIR_R_3) + fi + AC_MSG_RESULT([yes, and it takes $ac_cv_readdir_args arguments]) + fi + + AC_MSG_CHECKING(for gethostbyname_r) + if test -z "$ac_cv_gethostbyname_args"; then + AC_TRY_COMPILE( + [ +#include +#include ], + [ +struct hostent *hp; +struct hostent h; +char *name; +char buffer[10]; +int h_errno; +hp = gethostbyname_r(name, &h, buffer, 10, &h_errno);], + ac_cv_gethostbyname_args=5) + fi + if test -z "$ac_cv_gethostbyname_args"; then + AC_TRY_COMPILE( + [ +#include +#include ], + [ +struct hostent h; +struct hostent_data hdata; +char *name; +int rc; +rc = gethostbyname_r(name, &h, &hdata);], + ac_cv_gethostbyname_args=3) + fi + if test -z "$ac_cv_gethostbyname_args"; then + AC_TRY_COMPILE( + [ +#include +#include ], + [ +struct hostent h; +struct hostent *hp; +char *name; +char buf[10]; +int rc; +int h_errno; + +rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno); + ], + ac_cv_gethostbyname_args=6) + fi + if test -z "$ac_cv_gethostbyname_args"; then + AC_MSG_RESULT(no) + have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r" + else + if test "$ac_cv_gethostbyname_args" = 3; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_3) + elif test "$ac_cv_gethostbyname_args" = 5; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_5) + elif test "$ac_cv_gethostbyname_args" = 6; then + AC_DEFINE(HAVE_GETHOSTBYNAME_R_6) + fi + AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyname_args arguments]) + fi + + AC_MSG_CHECKING(for gethostbyaddr_r) + if test -z "$ac_cv_gethostbyaddr_args"; then + AC_TRY_COMPILE( + [ +#include +#include ], + [ + char * address; + int length; + int type; + struct hostent h; + struct hostent_data hdata; + int rc; + rc = gethostbyaddr_r(address, length, type, &h, &hdata); + ], + ac_cv_gethostbyaddr_args=5) + + fi + if test -z "$ac_cv_gethostbyaddr_args"; then + AC_TRY_COMPILE( + [ +#include +#include ], + [ + char * address; + int length; + int type; + struct hostent h; + char buffer[10]; + int buflen; + int h_errnop; + struct hostent * hp; + + hp = gethostbyaddr_r(address, length, type, &h, + buffer, buflen, &h_errnop); + ], + ac_cv_gethostbyaddr_args=7) + fi + + if test -z "$ac_cv_gethostbyaddr_args"; then + AC_TRY_COMPILE( + [ +#include +#include ], + [ + char * address; + int length; + int type; + struct hostent h; + char buffer[10]; + int buflen; + int h_errnop; + struct hostent * hp; + int rc; + + rc = gethostbyaddr_r(address, length, type, &h, + buffer, buflen, &hp, &h_errnop); + ], + ac_cv_gethostbyaddr_args=8) + fi + if test -z "$ac_cv_gethostbyaddr_args"; then + AC_MSG_RESULT(no) + have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r" + else + if test "$ac_cv_gethostbyaddr_args" = 5; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R_5) + elif test "$ac_cv_gethostbyaddr_args" = 7; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R_7) + elif test "$ac_cv_gethostbyaddr_args" = 8; then + AC_DEFINE(HAVE_GETHOSTBYADDR_R_8) + fi + AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyaddr_args arguments]) + fi + + AC_MSG_CHECKING(for getlogin_r) + if test -z "$ac_cv_getlogin_r_style"; then + AC_TRY_RUN( + [ +#include + +int main() +{ + char name[1024]; + int len=1024; + int rc; + char *login; + + name[0]='\0'; + + rc = getlogin_r(name, len); + if(rc == 0 && name[0] != '\0') + { + return 0; /* returns zero on success */ + } + else if(rc != 0 && name[0] == '\0') + { + return 0; /* returns errno on failure */ + } + else if(rc == 0 && name[0] == '\0') + { + return 0; /* can't tell */ + } + else if(rc != 0 && name[0] != '\0') + { + return 1; /* returns pointer on success */ + } +} + ], + [ + ac_cv_getlogin_r_style=1 + ], + [ + ac_cv_getlogin_r_style=2 + ], + [ + ac_cv_getlogin_r_style= + ]) + fi + if test -z "$ac_cv_getlogin_r_style"; then + AC_MSG_RESULT(no) + have_missing_r_funcs="$have_missing_r_funcs getlogin_r" + else + if test $ac_cv_getlogin_r_style = 1; then + AC_DEFINE(GETLOGIN_R_RETURNS_INT) + AC_MSG_RESULT([yes, and it returns an int]) + elif test $ac_cv_getlogin_r_style = 2; then + AC_DEFINE(GETLOGIN_R_RETURNS_POINTER) + AC_MSG_RESULT([yes, and it returns a pointer]) + else + AC_MSG_RESULT(no: result is $ac_cv_getlogin_r_style) + have_missing_r_funcs="$have_missing_r_funcs getlogin_r" + fi + fi + if test -n "$have_missing_r_funcs"; then + AC_MSG_WARN(missing reentrant functions: $have_missing_r_funcs) + fi +fi AC_MSG_CHECKING(whether to define _POSIX_SOURCE) AC_ARG_ENABLE(posix, [ --enable-posix define _POSIX_SOURCE], diff -Naur xdvik-22.40l/libs/libwww/libwww.ac xdvik-22.40n/libs/libwww/libwww.ac --- xdvik-22.40l/libs/libwww/libwww.ac Wed Apr 18 14:23:30 2001 +++ xdvik-22.40n/libs/libwww/libwww.ac Fri Sep 13 00:23:47 2002 @@ -1,71 +1,103 @@ -LibWWW_headers="WWWLib.h WWWApp.h WWWFile.h WWWHTTP.h WWWMIME.h WWWNews.h WWWTrans.h" -LibWWW_config_h="wwwconf.h" -libwww_include_list="${libwww_include} ${libwww_dir} \ - ${libwww_dir}/include ${libwww_dir}/Library/src" -libwww_libdir_list="${libwww_library_dir} ${libwww_dir} ${libwww_dir}/lib \ - ${libwww_dir}/Library/src" - -libwww_include_found=no -libwww_libdir_found=no - -if test $try_system_wwwlib = yes; then - for d in $libwww_include_list; do - ok=yes - for h in $LibWWW_headers; do - if test ! -f $d/$h; then - ok=no - break - fi - done - if test $ok = yes; then - libwww_include=$d - libwww_include_found=yes - break - fi - done -fi - -if test $libwww_include_found = yes; then - LIBWWWCPPFLAGS="-I${libwww_include} -DHAVE_LIBWWW -DHAVE_WWWLIB_H" +if test "$needs_libwww" = no; then + LDLIBWWW= + LIBWWWCPPFLAGS= + LIBWWWDEP= else - LIBWWWCPPFLAGS="-DHAVE_LIBWWW -DHAVE_WWWLIB_H" + OLD_LIBS=$LIBS + + LibWWW_headers="WWWLib.h WWWApp.h WWWFile.h WWWHTTP.h WWWMIME.h WWWNews.h WWWTrans.h" + LibWWW_config_h="wwwconf.h" + libwww_include_list="${libwww_include} ${libwww_dir} \ + ${libwww_dir}/include ${libwww_dir}/Library/src" + libwww_libdir_list="${libwww_library_dir} ${libwww_dir} ${libwww_dir}/lib \ + ${libwww_dir}/Library/src" + if test $try_system_wwwlib = yes; then - libwww_include_found=yes - AC_CHECK_HEADERS($LibWWW_headers,, libwww_include_found=no; break ) - : - fi -fi + test -z "$libwww_config" && libwww_config=libwww-config -# only check for libwww.a if the includes could be found -if test $libwww_include_found = yes; then - for d in $libwww_libdir_list; do - if test -f $d/libwww.a; then - libwww_libdir=$d - libwww_libdir_found=yes + # can we find the $libwww_config program? + LIBWWW_CONFIG= + if test -f "$libwww_config"; then + LIBWWW_CONFIG=$libwww_config + else + AC_PATH_PROG(LIBWWW_CONFIG, $libwww_config) fi - done - if test ${libwww_libdir_found} = yes; then - LDLIBWWW="-L${libwww_libdir} -lwww" - : - else - LDLIBWWW=-lwww - libwww_libdir_found=yes - AC_CHECK_LIB(www, HTParse,, libwww_libdir_found=no) - : + if test -n "$LIBWWW_CONFIG"; then + libwww_include_found=yes + libwww_libdir_found=yes + LDLIBWWW=`$libwww_config --libs` + + # te: I have seen xmlparse.h one directory above the directory given + # by libwww-config. Therefore, this hack: + libwww_config_cflags=`$libwww_config --cflags` + hack=`echo $libwww_config_cflags | sed 's@-I@@; s@/w3c-libwww.*@@'` + test -n "$hack" && test -f "$hack/xmlparse.h" \ + && libwww_config_cflags="$libwww_config_cflags -I$hack" + + LIBWWWCPPFLAGS="$libwww_config_cflags -DHAVE_LIBWWW -DHAVE_WWWLIB_H" + else + libwww_include_found=no + libwww_libdir_found=no + for d in $libwww_include_list; do + ok=yes + for h in $LibWWW_headers; do + if test ! -f $d/$h; then + ok=no + break + fi + done + if test $ok = yes; then + libwww_include=$d + libwww_include_found=yes + break + fi + done + + if test $libwww_include_found = yes; then + LIBWWWCPPFLAGS="-I${libwww_include} -DHAVE_LIBWWW -DHAVE_WWWLIB_H" + else + LIBWWWCPPFLAGS="-DHAVE_LIBWWW -DHAVE_WWWLIB_H" + if test $try_system_wwwlib = yes; then + libwww_include_found=yes + AC_CHECK_HEADERS($LibWWW_headers,, libwww_include_found=no; break ) + fi + fi + + # only check for libwww.a if the includes could be found + if test $libwww_include_found = yes; then + for d in $libwww_libdir_list; do + if test -f $d/libwww.a; then + libwww_libdir=$d + libwww_libdir_found=yes + fi + done + + if test ${libwww_libdir_found} = yes; then + LDLIBWWW="-L${libwww_libdir} -lwww" + else + LDLIBWWW=-lwww + libwww_libdir_found=yes + AC_CHECK_LIB(www, HTParse,, libwww_libdir_found=no) + fi + fi + fi fi -fi -if test "${libwww_include_found}" != yes || - test "${libwww_libdir_found}" != yes; then - if test $try_system_wwwlib = yes; then - AC_MSG_WARN(Have not found standard LIBWWW library. Shall compile my own one.) + if test "${libwww_include_found}" != yes || + test "${libwww_libdir_found}" != yes; then + if test $try_system_wwwlib = yes; then + AC_MSG_WARN(Have not found standard LIBWWW library. Shall compile my own one.) + fi + LDLIBWWW='$(LIBWWWDIR)/libwww.a' + LIBWWWCPPFLAGS='-I$(LIBWWWDIR) -I$(LIBWWWSRCDIR) -DHAVE_LIBWWW -DHAVE_WWWLIB_H' + LIBWWWDEP='$(LIBWWWDIR)/libwww.a' + using_system_wwwlib=no + else + using_system_wwwlib=yes + LIBWWWDEP= fi - LDLIBWWW='$(LIBWWWDIR)/libwww.a' - LIBWWWCPPFLAGS='-I$(LIBWWWDIR) -I$(LIBWWWSRCDIR) -DHAVE_LIBWWW -DHAVE_WWWLIB_H' - LIBWWWDEP='$(LIBWWWDIR)/libwww.a' -else - LIBWWWDEP= + LIBS=$OLD_LIBS fi AC_SUBST(LDLIBWWW) diff -Naur xdvik-22.40l/libs/libwww/md5.h xdvik-22.40n/libs/libwww/md5.h --- xdvik-22.40l/libs/libwww/md5.h Wed Apr 18 14:23:30 2001 +++ xdvik-22.40n/libs/libwww/md5.h Fri Sep 13 00:23:47 2002 @@ -32,7 +32,7 @@ been defined with C compiler flags. */ #ifndef PROTOTYPES -#define PROTOTYPES 0 +#define PROTOTYPES 1 #endif /* POINTER defines a generic pointer type */ diff -Naur xdvik-22.40l/libs/libwww/withenable.ac xdvik-22.40n/libs/libwww/withenable.ac --- xdvik-22.40l/libs/libwww/withenable.ac Wed Apr 18 14:23:30 2001 +++ xdvik-22.40n/libs/libwww/withenable.ac Fri Sep 13 00:23:47 2002 @@ -73,3 +73,12 @@ fi ] ) + +AC_ARG_WITH(libwww-config, +[ --with-libwww-config=PROG + Use PROG as libwww-config program.], +[ + libwww_config=$with_libwww_config + try_system_wwwlib=yes +] +) diff -Naur xdvik-22.40l/libs/libwww/wwwconf.h.in xdvik-22.40n/libs/libwww/wwwconf.h.in --- xdvik-22.40l/libs/libwww/wwwconf.h.in Wed Apr 18 14:23:30 2001 +++ xdvik-22.40n/libs/libwww/wwwconf.h.in Fri Sep 13 00:23:47 2002 @@ -71,15 +71,24 @@ byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN -/* Define to enable linking libwww as shared library. */ -#undef LIBWWW_SHARED - /* Define to enable direct WAIS access. */ #undef HT_DIRECT_WAIS /* Define to enable mysql access. */ #undef HT_MYSQL +/* Define to enable MD5 for HTTP access authentication. */ +#undef HT_MD5 + +/* Define to enable WebDAV protocol. */ +#undef HT_DAV + +/* Define to enable extension methods. */ +#undef HT_EXT + +/* Define to enable expat XML parser. */ +#undef HT_EXPAT + /* Define to enable Zlib compression / decompression support. */ #undef HT_ZLIB @@ -103,6 +112,42 @@ /* Define to build using reentrant system calls. */ #undef HT_REENTRANT +/* Define to use the two-argument variant of ctime_r */ +#undef HAVE_CTIME_R_2 + +/* Define to use the three-argument variant of ctime_r */ +#undef HAVE_CTIME_R_3 + +/* Define to use the two-argument variant of readdir_r */ +#undef HAVE_READDIR_R_2 + +/* Define to use the three-argument variant of readdir_r */ +#undef HAVE_READDIR_R_3 + +/* Define to use the three-argument variant of gethostbyname_r */ +#undef HAVE_GETHOSTBYNAME_R_3 + +/* Define to use the five-argument variant of gethostbyname_r */ +#undef HAVE_GETHOSTBYNAME_R_5 + +/* Define to use the six-argument variant of gethostbyname_r */ +#undef HAVE_GETHOSTBYNAME_R_6 + +/* Define to use the five-argument variant of gethostbyaddr_r */ +#undef HAVE_GETHOSTBYADDR_R_5 + +/* Define to use the seven-argument variant of gethostbyaddr_r */ +#undef HAVE_GETHOSTBYADDR_R_7 + +/* Define to use the eight-argument variant of gethostbyaddr_r */ +#undef HAVE_GETHOSTBYADDR_R_8 + +/* Define if getlogin_r returns an integer */ +#undef GETLOGIN_R_RETURNS_INT + +/* Define if getlogin_r returns a pointer */ +#undef GETLOGIN_R_RETURNS_POINTER + /* Define to be the package name. */ #undef W3C_PACKAGE @@ -112,9 +157,6 @@ /* Define this to be the prefix for cache files. */ #undef CACHE_FILE_PREFIX -/* Define this if we can select on stdin. */ -#undef TTY_IS_SELECTABLE - /* Define to disable Nagle's algorithm */ #undef HT_NO_NAGLE @@ -247,6 +289,9 @@ /* Define if you have the timegm function. */ #undef HAVE_TIMEGM +/* Define if you have the tzset function. */ +#undef HAVE_TZSET + /* Define if you have the header file. */ #undef HAVE_APPKIT_H @@ -448,9 +493,6 @@ /* Define if you have the header file. */ #undef HAVE_WAIS_WAIS_H -/* Define if you have the ICE library (-lICE). */ -#undef HAVE_LIBICE - /* Define if you have the dl library (-ldl). */ #undef HAVE_LIBDL @@ -462,6 +504,13 @@ /* Define if you have the socket library (-lsocket). */ #undef HAVE_LIBSOCKET + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + /* Define this if you have the external variable 'socket_errno'. */ #undef HAVE_SOCKET_ERRNO diff -Naur xdvik-22.40l/libs/libwww/wwwsys.h xdvik-22.40n/libs/libwww/wwwsys.h --- xdvik-22.40l/libs/libwww/wwwsys.h Wed Apr 18 14:23:31 2001 +++ xdvik-22.40n/libs/libwww/wwwsys.h Fri Sep 13 00:23:47 2002 @@ -270,6 +270,10 @@ #define S_ISREG(m) (((m)&_IFMT) == _IFREG) +#define DIR_SEPARATOR +#define DIR_SEPARATOR_CHAR '\\' +#define DIR_SEPARATOR_STR "\\" + /* ( Errno and Return Codes @@ -298,6 +302,9 @@ #define EHOSTDOWN WSAEHOSTDOWN #define EISCONN WSAEISCONN #define EINVAL WSAEINVAL +#define ECONNRESET WSAECONNRESET +#define ECONNABORTED WSAECONNABORTED +#define ESHUTDOWN WSAESHUTDOWN /* Some compilers do only define WIN32 and NOT _WINDOWS */ #define NO_GROUPS @@ -315,6 +322,79 @@ . Macintosh . +( + mingw32 - Minimalist GNU for Windows +) + +A bit like Cygwin, except it uses the native Windows API, which means +the programs do not need the huge Cygwin DLL to run. + +Patch by Richard Atterer , October 2001 +*/ + +#ifdef __MINGW32__ + +#include + +#define WWW_MSWINDOWS +/* #define WWW_WIN_CONSOLE */ +#define WWW_WIN_WINDOW +/* #define WWW_WIN_ASYNC */ +/* #define WWW_WIN_DLL */ + +#ifndef _WINSOCKAPI_ +#define _WINSOCKAPI_ +#endif + +#define NETREAD(s,b,l) recv((s),(b),(l),0) +#define NETWRITE(s,b,l) send((s),(b),(l),0) +#define NETCLOSE(s) closesocket(s) +#define IOCTL(s,c,a) ioctlsocket(s,c, (long *) a) + +#define MKDIR(a,b) mkdir(a) +#define REMOVE(a) remove((a)) +#define DEFAULT_SUFFIXES "." + +#define SOCKET SOCKET /* WinSocks socket descriptor */ +#define INVSOC INVALID_SOCKET /* WinSocks invalid socket */ + +#define DESIRED_WINSOCK_VERSION 0x0101 /* we'd like winsock ver 1.1... */ +#define MINIMUM_WINSOCK_VERSION 0x0101 /* ...but we'll take ver 1.1 :) */ + +#define DIR_SEPARATOR +#define DIR_SEPARATOR_CHAR '\\' +#define DIR_SEPARATOR_STR "\\" + +#define socerrno WSAGetLastError() +#define ERRNO_DONE + +/* Taken from the WIN32 stuff above. */ +#define EWOULDBLOCK WSAEWOULDBLOCK +#define EINPROGRESS WSAEINPROGRESS +#define ECONNREFUSED WSAECONNREFUSED +#define ETIMEDOUT WSAETIMEDOUT +#define ENETUNREACH WSAENETUNREACH +#define EHOSTUNREACH WSAEHOSTUNREACH +#define EHOSTDOWN WSAEHOSTDOWN +#define EISCONN WSAEISCONN +/*#define EINVAL WSAEINVAL*/ +#define ECONNRESET WSAECONNRESET +#define ECONNABORTED WSAECONNABORTED +#define ESHUTDOWN WSAESHUTDOWN + +/* The configure.in script is wrong to default to #define GETGROUPS_T int */ +#ifdef GETGROUPS_T +#undef GETGROUPS_T +#endif + +#define HT_LSTAT stat + +#endif /* __MINGW32__ */ + +/* +. + Macintosh +. We have two environments on Macintosh: Codeworrior and MPV. ( @@ -597,8 +677,9 @@ /* -On non-VMS machines STAT should be stat...On VMS machines STAT is a function -that converts directories and devices so that you can stat them. +On non-VMS machines STAT should be stat, unless that was overridden +somewhere above. On VMS machines STAT is a function that converts +directories and devices so that you can stat them. */ #ifdef VMS @@ -606,8 +687,12 @@ #define HT_STAT HTStat #define HT_LSTAT HTStat #else +#ifndef HT_STAT #define HT_STAT stat +#endif +#ifndef HT_LSTAT #define HT_LSTAT lstat +#endif #endif /* non VMS */ /* @@ -1056,9 +1141,11 @@ . */ +#ifndef __MINGW32__ /* has a typedef for BOOLEAN */ #ifndef BOOLEAN typedef char BOOLEAN; /* Logical value */ #endif +#endif #ifndef CURSES #ifndef TRUE @@ -1085,6 +1172,11 @@ should (is?) be handled by the configure script already. */ +/* Richard Atterer + Disabled - caused problems because mingw32 has typedefs for these. + They seem useless now. */ + +/* #ifndef u_short #define u_short unsigned short #endif @@ -1093,6 +1185,8 @@ #define u_long unsigned long #endif +*/ + /* . NULL Definition @@ -1295,6 +1389,44 @@ /* . + Hash Table Sizes +. + +The size of the hash tables used by the various libwww classes like the +HTNet class, the HTHost +class etc. is a speed-size compromize. Here you can set the sizes depending +on whether you have a lot of memory or not. The values must be prime numbers, +of course. +*/ + +#ifdef LIBWWW_SMALL +#define HT_XL_HASH_SIZE 101 +#define HT_L_HASH_SIZE 67 +#define HT_M_HASH_SIZE 31 +#define HT_S_HASH_SIZE 5 +#else +#ifdef LIBWWW_LARGE +#define HT_XL_HASH_SIZE 1499 +#define HT_L_HASH_SIZE 599 +#define HT_M_HASH_SIZE 101 +#define HT_S_HASH_SIZE 67 +#else +#ifdef LIBWWW_EXTRA_LARGE +#define HT_XL_HASH_SIZE 9973 +#define HT_L_HASH_SIZE 1499 +#define HT_M_HASH_SIZE 599 +#define HT_S_HASH_SIZE 101 +#else +#define HT_XL_HASH_SIZE 599 +#define HT_L_HASH_SIZE 101 +#define HT_M_HASH_SIZE 67 +#define HT_S_HASH_SIZE 11 +#endif +#endif +#endif + +/* +. Definition of NGROUPS . */ @@ -1341,6 +1473,11 @@ #define DEFAULT_SUFFIXES ".,_" #endif +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR_CHAR '/' +#define DIR_SEPARATOR_STR "/" +#endif + #ifndef F_OK #define R_OK 4 #define W_OK 2 @@ -1418,7 +1555,7 @@ #endif #endif -#define HOSTENT_MAX 128 +#define HOSTENT_MAX 1024 #define CTIME_MAX 26 #endif /* HT_REENTRANT */ @@ -1441,6 +1578,6 @@ - @(#) $Id: wwwsys.h,v 1.1.1.1 2001/04/18 14:23:31 stefanulrich Exp $ + @(#) $Id: wwwsys.h,v 1.1.1.1.8.1 2002/09/13 00:23:47 stefanulrich Exp $ */ diff -Naur xdvik-22.40l/libs/t1lib/CVS/Entries xdvik-22.40n/libs/t1lib/CVS/Entries --- xdvik-22.40l/libs/t1lib/CVS/Entries Sat Aug 31 23:06:37 2002 +++ xdvik-22.40n/libs/t1lib/CVS/Entries Mon Sep 16 17:45:07 2002 @@ -1,17 +1,50 @@ /Changes/1.2.8.2/Mon Jan 7 19:06:06 2002//Txdvik_22_40_STABLE /LGPL/1.1.1.1/Wed Apr 18 14:23:31 2001//Txdvik_22_40_STABLE /LICENSE/1.1.1.1/Wed Apr 18 14:23:31 2001//Txdvik_22_40_STABLE -/Makefile.in/1.2.8.1/Tue Jan 29 20:05:37 2002//Txdvik_22_40_STABLE +/Makefile.in/1.2.8.2/Sat Sep 14 00:07:32 2002//Txdvik_22_40_STABLE +/README.t1lib-1.2/1.1.2.3/Sat Sep 14 00:24:46 2002//Txdvik_22_40_STABLE /README.t1lib-1.3.1/1.1.2.1/Mon Jan 7 15:55:52 2002//Txdvik_22_40_STABLE /README.t1python/1.1.1.1/Wed Apr 18 14:23:31 2001//Txdvik_22_40_STABLE /README.win32/1.1/Wed Apr 18 23:23:15 2001//Txdvik_22_40_STABLE -/configure/1.3.8.3/Tue Jan 29 20:05:37 2002//Txdvik_22_40_STABLE +/configure/1.3.8.5/Mon Sep 16 17:45:28 2002//Txdvik_22_40_STABLE /configure.com/1.2/Wed Apr 18 23:23:15 2001//Txdvik_22_40_STABLE -/configure.in/1.2.8.3/Tue Jan 29 20:05:37 2002//Txdvik_22_40_STABLE -D/ac-tools//// -D/examples//// -D/lib//// -D/parse_afm//// -D/type1afm//// -D/win32//// -D/xglyph//// +/configure.in/1.2.8.4/Sat Sep 14 00:07:32 2002//Txdvik_22_40_STABLE +/libtool/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/parseAFM.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/parseAFM.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/sysconf.h.in/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1aaset.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1aaset.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1afmtool.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1afmtool.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1base.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1base.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1delete.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1delete.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1enc.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1enc.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1env.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1env.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1extern.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1finfo.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1finfo.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1global.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1lib.ac/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1lib.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1libx.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1load.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1load.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1misc.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1outline.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1outline.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1set.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1set.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1subset.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1subset.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1trans.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1trans.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1types.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1x11.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/t1x11.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/withenable.ac/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +D diff -Naur xdvik-22.40l/libs/t1lib/Makefile.in xdvik-22.40n/libs/t1lib/Makefile.in --- xdvik-22.40l/libs/t1lib/Makefile.in Tue Jan 29 20:05:37 2002 +++ xdvik-22.40n/libs/t1lib/Makefile.in Sat Sep 14 00:07:32 2002 @@ -1,152 +1,26 @@ -# Makefile.in -# -# This file is part of the t1lib-package! See documentation and Readme files -# of the t1lib-package for copyright restrictions. -# -# Targets provided: -# all (default) -# install -# uninstall -# clean -# distclean -# t1python-all -# t1python-clean -# -# Author: Rainer Menzner (Rainer.Menzner@web.de) -# Date: 04/06/1997 -# Last modified: 2001-04-01 -# - -SHELL = /bin/sh -CC = @CC@ -CPP = @CPP@ -CFLAGS = @CFLAGS@ -OPTIONS = @OPTIONS@ -X_LIBS = @X_LIBS@ -TOPSRC = @top_srcdir@ -XPM_LIB = -lXpm -XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ -LDFLAGS = @LDFLAGS@ -LDLIBS = @LDLIBS@ -AR = ar rc -RANLIB = @RANLIB@ -RM = rm -f -X_CFLAGS = @X_CFLAGS@ -YACC = @YACC@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -ALLCFLAGS = $(CFLAGS) $(X_CFLAGS) -SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(ALLCFLAGS)' 'OPTIONS=$(OPTIONS)' -@SET_MAKE@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @top_srcdir@/ac-tools/mkinstalldirs -prefix = @prefix@ -exec_prefix = @exec_prefix@ -includedir = @includedir@ -bindir = @bindir@ -datadir = @datadir@ -libdir = @libdir@ -mandir = @mandir@/man1 -manext = .1 -no_x = @no_x@ - -t1lib_version = @T1LIB_VERSION@ -t1lib_revision = @T1LIB_REVISION@ -t1lib_patchlevel = @T1LIB_PATCHLEVEL@ - -# Main target to build - -MAIN_TARGET = @MAIN_TARGET@ -COMMONSUBDIRS = lib \ - type1afm \ - examples - - - -# Drop xglyph from targets if we do not have X11 -XSUBDIRS = @XSUBDIRS@ - - -ALLSUBDIRS = $(COMMONSUBDIRS) $(XSUBDIRS) - -DUMMYSUBDIRS = XXXX - -all: $(DUMMYSUBDIRS) - - -# warning the following target does only work with gcc and is no -# official target. It generates .dependencies files and changes -# the suffixes from .o to .lo. -dependencies: dummy - for i in $(ALLSUBDIRS); do \ - (cd $$i; make dependencies ) || exit 1; \ - done - - - - -$(DUMMYSUBDIRS): dummy - for i in $(ALLSUBDIRS); do \ - (cd $$i; $(SUBMAKE) ) || exit 1; \ - done - - -install: dummy - for i in $(ALLSUBDIRS); do \ - (cd $$i; $(MAKE) install) || exit 1; \ - done - - -uninstall: dummy - for i in $(ALLSUBDIRS); do \ - (cd $$i; $(MAKE) uninstall) || exit 1; \ - done - $(RM) -Rf $(datadir)/t1lib-$(t1lib_version).$(t1lib_revision) - - -.PHONY: uninstall - - -.PHONY: install - - -.PHONY: clean - - -clean: dummy - for i in $(ALLSUBDIRS); do \ - (cd $$i; $(MAKE) clean) || exit 1; \ - done - - -# In order not to delete the t1python Makefile, we have to remove the -# Makefile's one at a time: -distclean: clean - $(RM) *~ - $(RM) config.* - $(RM) Makefile - $(RM) lib/Makefile - $(RM) lib/type1/Makefile - $(RM) lib/t1lib/Makefile - $(RM) lib/t1lib/sysconf.h - $(RM) type1afm/Makefile - $(RM) examples/Makefile - $(RM) xglyph/Makefile - $(RM) libtool - - -# The following two targets are for building and cleaning the python- -# interface contributed by Fred L. Drake, Jr. They are completely -# independent from the other t1lib-targets. -t1python-all: - (cd t1python; $(MAKE); $(MAKE)) +ac_include ../../texk/make/common.mk +ac_include ../../texk/make/programs.mk +ac_include ../../texk/make/library.mk +ac_include ../../texk/make/paths.mk +RANLIB = @RANLIB@ +prog_cflags = @X_CFLAGS@ -DT1LIB_IDENT=\"@T1LIB_IDENTIFIER@\" -DGLOBAL_CONFIG_DIR=\"@T1LIB_DATA_DIR@\" -t1python-clean: - (cd t1python; $(MAKE) clean) +OBJS = parseAFM.o t1aaset.o t1afmtool.o t1base.o t1delete.o t1enc.o \ + t1env.o t1finfo.o t1load.o t1outline.o t1set.o t1subset.o t1trans.o \ + t1x11.o +libt1.a: $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + $(RANLIB) $@ -dummy: +all: libt1.a +uninstall: + +mostlyclean clean: + rm -f *.o libt1.a + +distclean realclean extraclean configclean: clean + rm -f config.status config.log Makefile config.cache sysconf.h + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff -Naur xdvik-22.40l/libs/t1lib/README.t1lib-1.2 xdvik-22.40n/libs/t1lib/README.t1lib-1.2 --- xdvik-22.40l/libs/t1lib/README.t1lib-1.2 Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/README.t1lib-1.2 Sat Sep 14 00:24:46 2002 @@ -0,0 +1,203 @@ + + -------------------------------------------------------------------------- + --------------------------- t1lib-README --------------------------------- + -------------------------------------------------------------------------- + +/*-------------------------------------------------------------------------- + ----- File: REAMDE.t1lib-1.2 + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + + Version 0.4-beta and later incorporate contributions + from: + Raph Levien (raph@acm.org) and + Fred L. Drake, Jr. (fdrake@acm.org) + ----- Date: 2001-07-01 + ----- Description: This is file README.t1lib of the t1lib-package. It + contains an overview and brief installation + instructions for the t1-library. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library License. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + + +About t1lib: +------------ + +t1lib is a library distributed under the GNU General Public Library +License for generating character- and string-glyphs from Adobe Type 1 +fonts under UNIX. t1lib uses most of the code of the X11 rasterizer +donated by IBM to the X11-project. But some disadvantages of the +rasterizer being included in X11 have been eliminated. Here are some +of the features: + +- t1lib is completely independent of X11 (although the program + provided for testing the library needs X11) + +- fonts are made known to library by means of a font database file at + runtime + +- searchpaths for all types of input files are configured by means + of a configuration file at runtime + +- characters are rastered as they are needed + +- characters and complete strings may be rastered by a simple function + call + +- when rastering strings, pairwise kerning information from .afm-files + may optionally be taken into account + +- an interface to ligature-information of afm-files is provided + +- a program to generate afm-files from Type 1 font files is included + +- rotation and arbitrary transformations are supported + +- there's support for extending and slanting fonts + +- underlining, overlining and overstriking is supported + +- new encoding vectors may be loaded at runtime and fonts may be + reencoded using these encoding vectors + +- antialiasing is implemented + +- Right-To-Left typesetting is supported + +- Font subsetting is easily possible + +- support of composite character information + +- An interactive test program called "xglyph" is included in the + distribution. This program allows to test all of the features of the + library. It requires X11. + + + +Changes and New Features: +------------------------- + +- See the file Changes in the T1Lib top-directory for information on new + features. + + + +Installation: +------------- + +----------------------------------------------------------------------------- +Note: VMS-users should examine configure.com in the toplevel directory, which + is a configure-script for VMS, kindly contributed by John Hasstedt + and updated by Martin Zinser. + This file contains notes on how to compile t1lib on VMS. +----------------------------------------------------------------------------- + + +After unpacking the archive (what you obviously did already), change +to subdirectory T1-..../ and type: + + ./configure + +This will create the Makefiles. Then type + + make + + +In order to use the testprogram xglyph, X11 needs to be installed on your +system. + +If you have difficulties during configuring and building t1lib, cd to +directory T1-.../doc and execute + + $ latex t1lib_doc.tex + $ makeindex t1lib_doc + $ latex t1lib_doc.tex + $ latex t1lib_doc.tex + +This will generate the docs which contain a more detailed description +of the build-process. LaTeX2e is required. Alternatively, you can scan the +preformatted pdf-documentation. + + +Before installing the libraries, you should test whether all things +work correct: + +1) Change to subdirectory xglyph + +2) Start the program xglyph + +3) Ensure that the output-window is not hidden behind another window. + +4) Before doing anything other, click on button "String". The + string "Test" should now be rastered and displayed in the + output-window, using font BitstreamCharterBTRoman at 100bp without + kerning. If that works, most probably all works for you. + +5) Have a look at t1lib_doc.dvi in the doc-subdirectory of the package + and read the chapter on xglyph. However, most of this program is + self-explaining, so that you might want to omit this step. + +6) Play with the program and enjoy. + +7) If you do not have X11, you can still check whether t1lib works for + you. Copy one of the pfb-files from T1../Fonts/type1, say, + bchr.pfb, to the type1afm-subdirectory, and run + + type1afm bchr.pfb + + If the afm-file bchr.afm is generated, t1lib will most probably + work on your system. + + +Documentation: +-------------- + +As mentioned above, documentation is provided in LaTeX2e-format +subdirectory T1Lib/doc. It should have been built during the build. +The section on runtime setup is really important, +because programs may fail due to an invalid or incomplete runtime +setup, although the programs itself may be correct! +A preformatted Version is also available in pdf. + +How to get it: +-------------- + +t1lib is available at + +ftp://sunsite.unc.edu/pub/Linux/libs/graphics/t1lib-x.y[.z].tar.gz + +where x.y[.z] is the version identification. + +Closing: +-------- + +You are allowed to send the author lots of money and dozents of gifts, +but you needn't :-) +If you have any comments to this library, feedback is wanted. Send +eMail to: + +Rainer.Menzner@web.de + + +Have fun, + + -Rainer + diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/CVS/Entries xdvik-22.40n/libs/t1lib/ac-tools/CVS/Entries --- xdvik-22.40l/libs/t1lib/ac-tools/CVS/Entries Sat Aug 31 22:50:34 2002 +++ xdvik-22.40n/libs/t1lib/ac-tools/CVS/Entries Thu Jan 1 00:00:00 1970 @@ -1,9 +0,0 @@ -/aclocal.m4/1.1.1.1.8.1/Mon Jan 7 15:50:12 2002//Txdvik_22_40_STABLE -/config.guess/1.2.8.2/Fri Aug 23 19:39:52 2002//Txdvik_22_40_STABLE -/config.sub/1.2.8.2/Fri Aug 23 19:39:52 2002//Txdvik_22_40_STABLE -/ice_find_athena.m4/1.1.1.1/Wed Apr 18 14:23:38 2001//Txdvik_22_40_STABLE -/install-sh/1.1.1.1/Wed Apr 18 14:23:38 2001//Txdvik_22_40_STABLE -/ltconfig/1.2/Wed Apr 18 23:23:15 2001//Txdvik_22_40_STABLE -/ltmain.sh/1.2/Wed Apr 18 23:23:15 2001//Txdvik_22_40_STABLE -/mkinstalldirs/1.2.8.2/Mon Jan 7 15:50:12 2002//Txdvik_22_40_STABLE -D diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/CVS/Repository xdvik-22.40n/libs/t1lib/ac-tools/CVS/Repository --- xdvik-22.40l/libs/t1lib/ac-tools/CVS/Repository Sat Aug 31 22:50:32 2002 +++ xdvik-22.40n/libs/t1lib/ac-tools/CVS/Repository Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -xdvik/libs/t1lib/ac-tools diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/CVS/Root xdvik-22.40n/libs/t1lib/ac-tools/CVS/Root --- xdvik-22.40l/libs/t1lib/ac-tools/CVS/Root Sat Aug 31 22:50:32 2002 +++ xdvik-22.40n/libs/t1lib/ac-tools/CVS/Root Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/CVS/Tag xdvik-22.40n/libs/t1lib/ac-tools/CVS/Tag --- xdvik-22.40l/libs/t1lib/ac-tools/CVS/Tag Sat Aug 31 23:06:36 2002 +++ xdvik-22.40n/libs/t1lib/ac-tools/CVS/Tag Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/aclocal.m4 xdvik-22.40n/libs/t1lib/ac-tools/aclocal.m4 --- xdvik-22.40l/libs/t1lib/ac-tools/aclocal.m4 Mon Jan 7 15:50:12 2002 +++ xdvik-22.40n/libs/t1lib/ac-tools/aclocal.m4 Thu Jan 1 00:00:00 1970 @@ -1,434 +0,0 @@ -## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- -## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit , 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. - -# serial 40 AC_PROG_LIBTOOL -AC_DEFUN(AC_PROG_LIBTOOL, -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl - -# Save cache, so that ltconfig can load it -AC_CACHE_SAVE - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ -DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ -|| AC_MSG_ERROR([libtool configure failed]) - -# Reload cache, that may have been modified by ltconfig -AC_CACHE_LOAD - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log -]) - -AC_DEFUN(AC_LIBTOOL_SETUP, -[AC_PREREQ(2.13)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_RANLIB])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -dnl - -case "$target" in -NONE) lt_target="$host" ;; -*) lt_target="$target" ;; -esac - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], -[libtool_flags="$libtool_flags --enable-dlopen"]) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[libtool_flags="$libtool_flags --enable-win32-dll"]) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$lt_target" in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -]) -esac -]) - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_SHARED, [dnl -define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl -]) - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no)]) - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_STATIC, [dnl -define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AC_ENABLE_STATIC_DEFAULT)dnl -]) - -# AC_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no)]) - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl -define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(fast-install, -changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case "$enableval" in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl -]) - -# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install -AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no)]) - -# AC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN(AC_PROG_LD, -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. -changequote(,)dnl - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' -changequote([,])dnl - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(ac_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$ac_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -]) - -AC_DEFUN(AC_PROG_LD_GNU, -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi]) -]) - -# AC_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN(AC_PROG_NM, -[AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(ac_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - ac_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - break - else - ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm -fi]) -NM="$ac_cv_path_NM" -AC_MSG_RESULT([$NM]) -]) - -# AC_CHECK_LIBM - check for math library -AC_DEFUN(AC_CHECK_LIBM, -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case "$lt_target" in -*-*-beos* | *-*-cygwin*) - # These system don't have libm - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, main, LIBM="-lm") - ;; -esac -]) - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and INCLTDL are not -# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not -# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed -# with '${top_builddir}/' and INCLTDL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case "$enable_ltdl_convenience" in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is -# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed -# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed -# with '${top_srcdir}/' (note the single quotes!). If your package is -# not flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, main, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - INCLTDL= - fi -]) - -dnl old names -AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl -AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl -AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl -AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl -AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl -AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl -AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl - -dnl This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL])dnl diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/config.guess xdvik-22.40n/libs/t1lib/ac-tools/config.guess --- xdvik-22.40l/libs/t1lib/ac-tools/config.guess Fri Aug 23 19:39:52 2002 +++ xdvik-22.40n/libs/t1lib/ac-tools/config.guess Thu Jan 1 00:00:00 1970 @@ -1,1325 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. - -timestamp='2002-08-20' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - - -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c ; - for c in cc gcc c89 c99 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; - if test $? = 0 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - rm -f $dummy.c $dummy.o $dummy.rel ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - cat <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy - fi ;; - esac - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i386-pc-interix3 - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - rm -f $dummy.c - test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/config.sub xdvik-22.40n/libs/t1lib/ac-tools/config.sub --- xdvik-22.40l/libs/t1lib/ac-tools/config.sub Fri Aug 23 19:39:52 2002 +++ xdvik-22.40n/libs/t1lib/ac-tools/config.sub Thu Jan 1 00:00:00 1970 @@ -1,1443 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. - -timestamp='2002-05-28' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el | mips64vr4300 \ - | mips64vr4300el | mips64vr5000 | mips64vr5000el \ - | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ - | mipsisa32 | mipsisa64 \ - | mn10200 | mn10300 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | m32r-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ - | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ - | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3d) - basic_machine=alpha-cray - os=-unicos - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh3eb | sh4eb) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto*) - os=-nto-qnx - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/ice_find_athena.m4 xdvik-22.40n/libs/t1lib/ac-tools/ice_find_athena.m4 --- xdvik-22.40l/libs/t1lib/ac-tools/ice_find_athena.m4 Wed Apr 18 14:23:38 2001 +++ xdvik-22.40n/libs/t1lib/ac-tools/ice_find_athena.m4 Thu Jan 1 00:00:00 1970 @@ -1,185 +0,0 @@ -dnl -dnl ice_find_athena.m4 -dnl -dnl ----------------------------------------------------------- -dnl -dnl * To: autoconf-collection@peti.gmd.de -dnl * Subject: ice_find_athena.m4 -dnl * From: Andreas Zeller -dnl * Date: Sat, 29 Nov 1997 17:14:09 +0100 (MET) -dnl * Sender: autoconf-collection-owner@peti.gmd.de -dnl -dnl ----------------------------------------------------------- -dnl -dnl ICE_FIND_ATHENA -dnl --------------- -dnl -dnl Find Athena libraries and headers. -dnl Put Athena include directory in athena_includes, -dnl put Athena library directory in athena_libraries, -dnl and add appropriate flags to X_CFLAGS and X_LIBS. -dnl -dnl -AC_DEFUN(ICE_FIND_ATHENA, -[ -AC_REQUIRE([AC_PATH_XTRA]) -athena_includes= -athena_libraries= -AC_ARG_WITH(athena, -[ --without-athena do not use Athena widgets]) -dnl Treat --without-athena like -dnl --without-athena-includes --without-athena-libraries. -if test "$with_athena" = "no" -then -athena_includes=no -athena_libraries=no -fi -AC_ARG_WITH(athena-includes, -[ --with-athena-includes=DIR Athena include files are in DIR], -athena_includes="$withval") -AC_ARG_WITH(athena-libraries, -[ --with-athena-libraries=DIR Athena libraries are in DIR], -athena_libraries="$withval") -AC_MSG_CHECKING(for Athena) -# -# -# Search the include files. -# -if test "$athena_includes" = ""; then -AC_CACHE_VAL(ice_cv_athena_includes, -[ -ice_athena_save_LIBS="$LIBS" -ice_athena_save_CFLAGS="$CFLAGS" -ice_athena_save_CPPFLAGS="$CPPFLAGS" -ice_athena_save_LDFLAGS="$LDFLAGS" -# -LIBS="$X_PRE_LIBS -lXaw -lXmu -lXext -lXt -lX11 $X_EXTRA_LIBS $LIBS" -CFLAGS="$X_CFLAGS $CFLAGS" -CPPFLAGS="$X_CFLAGS $CPPFLAGS" -LDFLAGS="$X_LIBS $LDFLAGS" -# -AC_TRY_COMPILE([ -#include -#include -],[int a;], -[ -# X11/Xaw/Text.h is in the standard search path. -ice_cv_athena_includes= -], -[ -# X11/Xaw/Text.h is not in the standard search path. -# Locate it and put its directory in `athena_includes' -# -# /usr/include/Motif* are used on HP-UX (Motif). -# /usr/include/X11* are used on HP-UX (X and Athena). -# /usr/dt is used on Solaris (Motif). -# /usr/openwin is used on Solaris (X and Athena). -# Other directories are just guesses. -for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ - /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ - /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ - /usr/dt/include /usr/openwin/include \ - /usr/dt/*/include /opt/*/include /usr/include/Motif* \ - "${prefix}"/*/include /usr/*/include /usr/local/*/include \ - "${prefix}"/include/* /usr/include/* /usr/local/include/*; do -if test -f "$dir/X11/Xaw/Text.h"; then -ice_cv_athena_includes="$dir" -break -fi -done -]) -# -LIBS="$ice_athena_save_LIBS" -CFLAGS="$ice_athena_save_CFLAGS" -CPPFLAGS="$ice_athena_save_CPPFLAGS" -LDFLAGS="$ice_athena_save_LDFLAGS" -]) -athena_includes="$ice_cv_athena_includes" -fi -# -# -# Now for the libraries. -# -if test "$athena_libraries" = ""; then -AC_CACHE_VAL(ice_cv_athena_libraries, -[ -ice_athena_save_LIBS="$LIBS" -ice_athena_save_CFLAGS="$CFLAGS" -ice_athena_save_CPPFLAGS="$CPPFLAGS" -ice_athena_save_LDFLAGS="$LDFLAGS" -# -LIBS="$X_PRE_LIBS -lXaw -lXmu -lXext -lXt -lX11 $X_EXTRA_LIBS $LIBS" -CFLAGS="$X_CFLAGS $CFLAGS" -CPPFLAGS="$X_CFLAGS $CPPFLAGS" -LDFLAGS="$X_LIBS $LDFLAGS" -# -AC_TRY_LINK([ -#include -#include -],[XtToolkitInitialize();], -[ -# libXaw.a is in the standard search path. -ice_cv_athena_libraries= -], -[ -# libXaw.a is not in the standard search path. -# Locate it and put its directory in `athena_libraries' -# -# -# /usr/lib/Motif* are used on HP-UX (Motif). -# /usr/lib/X11* are used on HP-UX (X and Athena). -# /usr/dt is used on Solaris (Motif). -# /usr/openwin is used on Solaris (X and Athena). -# Other directories are just guesses. -for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ - /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ - /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ - /usr/dt/lib /usr/openwin/lib \ - /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ - "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ - "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do -if test -d "$dir" && test "`ls $dir/libXaw.* 2> /dev/null`" != ""; then -ice_cv_athena_libraries="$dir" -break -fi -done -]) -# -LIBS="$ice_athena_save_LIBS" -CFLAGS="$ice_athena_save_CFLAGS" -CPPFLAGS="$ice_athena_save_CPPFLAGS" -LDFLAGS="$ice_athena_save_LDFLAGS" -]) -# -athena_libraries="$ice_cv_athena_libraries" -fi -# Add Athena definitions to X flags -# -if test "$athena_includes" != "" && test "$athena_includes" != "$x_includes" && test "$athena_includes" != "no" -then -X_CFLAGS="-I$athena_includes $X_CFLAGS" -fi -if test "$athena_libraries" != "" && test "$athena_libraries" != "$x_libraries" && test "$athena_libraries" != "no" -then -case "$X_LIBS" in - *-R\ *) X_LIBS="-L$athena_libraries -R $athena_libraries $X_LIBS";; - *-R*) X_LIBS="-L$athena_libraries -R$athena_libraries $X_LIBS";; - *) X_LIBS="-L$athena_libraries $X_LIBS";; -esac -fi -# -# -athena_libraries_result="$athena_libraries" -athena_includes_result="$athena_includes" -test "$athena_libraries_result" = "" && - athena_libraries_result="in default path" -test "$athena_includes_result" = "" && - athena_includes_result="in default path" -test "$athena_libraries_result" = "no" && - athena_libraries_result="(none)" -test "$athena_includes_result" = "no" && - athena_includes_result="(none)" -AC_MSG_RESULT( - [libraries $athena_libraries_result, headers $athena_includes_result]) -])dnl - diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/install-sh xdvik-22.40n/libs/t1lib/ac-tools/install-sh --- xdvik-22.40l/libs/t1lib/ac-tools/install-sh Wed Apr 18 14:23:38 2001 +++ xdvik-22.40n/libs/t1lib/ac-tools/install-sh Thu Jan 1 00:00:00 1970 @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/ltconfig xdvik-22.40n/libs/t1lib/ac-tools/ltconfig --- xdvik-22.40l/libs/t1lib/ac-tools/ltconfig Wed Apr 18 23:23:15 2001 +++ xdvik-22.40n/libs/t1lib/ac-tools/ltconfig Thu Jan 1 00:00:00 1970 @@ -1,3114 +0,0 @@ -#! /bin/sh - -# ltconfig - Create a system-specific libtool. -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A lot of this script is taken from autoconf-2.10. - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} -echo=echo -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec "$SHELL" "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null`} - case X$UNAME in - *-DOS) PATH_SEPARATOR=';' ;; - *) PATH_SEPARATOR=':' ;; - esac -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string="`eval $cmd`") 2>/dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || - test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH /usr/ucb; do - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running ltconfig again with it. - ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf "%s\n"' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - # Cool, printf works - : - elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# The name of this program. -progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` - -# Constants: -PROGRAM=ltconfig -PACKAGE=libtool -VERSION=1.3.5 -TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -rm="rm -f" - -help="Try \`$progname --help' for more information." - -# Global variables: -default_ofile=libtool -can_build_shared=yes -enable_shared=yes -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -enable_static=yes -enable_fast_install=yes -enable_dlopen=unknown -enable_win32_dll=no -ltmain= -silent= -srcdir= -ac_config_guess= -ac_config_sub= -host= -nonopt= -ofile="$default_ofile" -verify_host=yes -with_gcc=no -with_gnu_ld=no -need_locks=yes -ac_ext=c -objext=o -libext=a -exeext= -cache_file= - -old_AR="$AR" -old_CC="$CC" -old_CFLAGS="$CFLAGS" -old_CPPFLAGS="$CPPFLAGS" -old_LDFLAGS="$LDFLAGS" -old_LD="$LD" -old_LN_S="$LN_S" -old_LIBS="$LIBS" -old_NM="$NM" -old_RANLIB="$RANLIB" -old_DLLTOOL="$DLLTOOL" -old_OBJDUMP="$OBJDUMP" -old_AS="$AS" - -# Parse the command line options. -args= -prev= -for option -do - case "$option" in - -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - eval "$prev=\$option" - prev= - continue - fi - - case "$option" in - --help) cat <&2 - echo "$help" 1>&2 - exit 1 - ;; - - *) - if test -z "$ltmain"; then - ltmain="$option" - elif test -z "$host"; then -# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 -# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then -# echo "$progname: warning \`$option' is not a valid host type" 1>&2 -# fi - host="$option" - else - echo "$progname: too many arguments" 1>&2 - echo "$help" 1>&2 - exit 1 - fi ;; - esac -done - -if test -z "$ltmain"; then - echo "$progname: you must specify a LTMAIN file" 1>&2 - echo "$help" 1>&2 - exit 1 -fi - -if test ! -f "$ltmain"; then - echo "$progname: \`$ltmain' does not exist" 1>&2 - echo "$help" 1>&2 - exit 1 -fi - -# Quote any args containing shell metacharacters. -ltconfig_args= -for arg -do - case "$arg" in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ltconfig_args="$ltconfig_args '$arg'" ;; - *) ltconfig_args="$ltconfig_args $arg" ;; - esac -done - -# A relevant subset of AC_INIT. - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 5 compiler messages saved in config.log -# 6 checking for... messages and results -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>>./config.log - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi -if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi - -if test -n "$cache_file" && test -r "$cache_file"; then - echo "loading cache $cache_file within ltconfig" - . $cache_file -fi - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - -if test -z "$srcdir"; then - # Assume the source directory is the same one as the path to LTMAIN. - srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` - test "$srcdir" = "$ltmain" && srcdir=. -fi - -trap "$rm conftest*; exit 1" 1 2 15 -if test "$verify_host" = yes; then - # Check for config.guess and config.sub. - ac_aux_dir= - for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/config.guess; then - ac_aux_dir=$ac_dir - break - fi - done - if test -z "$ac_aux_dir"; then - echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 - echo "$help" 1>&2 - exit 1 - fi - ac_config_guess=$ac_aux_dir/config.guess - ac_config_sub=$ac_aux_dir/config.sub - - # Make sure we can run config.sub. - if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : - else - echo "$progname: cannot run $ac_config_sub" 1>&2 - echo "$help" 1>&2 - exit 1 - fi - - echo $ac_n "checking host system type""... $ac_c" 1>&6 - - host_alias=$host - case "$host_alias" in - "") - if host_alias=`$SHELL $ac_config_guess`; then : - else - echo "$progname: cannot guess host type; you must specify one" 1>&2 - echo "$help" 1>&2 - exit 1 - fi ;; - esac - host=`$SHELL $ac_config_sub $host_alias` - echo "$ac_t$host" 1>&6 - - # Make sure the host verified. - test -z "$host" && exit 1 - -elif test -z "$host"; then - echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 - echo "$help" 1>&2 - exit 1 -else - host_alias=$host -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case "$host_os" in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -case "$host_os" in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR cru $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -# Set a sane default for `AR'. -test -z "$AR" && AR=ar - -# Set a sane default for `OBJDUMP'. -test -z "$OBJDUMP" && OBJDUMP=objdump - -# If RANLIB is not set, then run the test. -if test "${RANLIB+set}" != "set"; then - result=no - - echo $ac_n "checking for ranlib... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then - RANLIB="ranlib" - result="ranlib" - break - fi - done - IFS="$save_ifs" - - echo "$ac_t$result" 1>&6 -fi - -if test -n "$RANLIB"; then - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" -fi - -# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$AS" && AS=as - -# Check to see if we are using GCC. -if test "$with_gcc" != yes || test -z "$CC"; then - # If CC is not set, then try to find GCC or a usable CC. - if test -z "$CC"; then - echo $ac_n "checking for gcc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then - CC="gcc" - break - fi - done - IFS="$save_ifs" - - if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - fi - - # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". - if test -z "$CC"; then - echo $ac_n "checking for cc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - cc_rejected=no - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/cc || test -f $dir/cc$ac_exeext; then - if test "$dir/cc" = "/usr/ucb/cc"; then - cc_rejected=yes - continue - fi - CC="cc" - break - fi - done - IFS="$save_ifs" - if test $cc_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same name, so the bogon will be chosen - # first if we set CC to just the name; use the full file name. - shift - set dummy "$dir/cc" "$@" - shift - CC="$@" - fi - fi - - if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - - if test -z "$CC"; then - echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 - exit 1 - fi - fi - - # Now see if the compiler is really GCC. - with_gcc=no - echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 - echo "$progname:581: checking whether we are using GNU C" >&5 - - $rm conftest.c - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - with_gcc=yes - fi - $rm conftest.c - echo "$ac_t$with_gcc" 1>&6 -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" - -echo $ac_n "checking for object suffix... $ac_c" 1>&6 -$rm conftest* -echo 'int i = 1;' > conftest.c -echo "$progname:603: checking for object suffix" >& 5 -if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - cat conftest.err 1>&5 - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 -fi -$rm conftest* -echo "$ac_t$objext" 1>&6 - -echo $ac_n "checking for executable suffix... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_exeext="no" - $rm conftest* - echo 'main () { return 0; }' > conftest.c - echo "$progname:629: checking for executable suffix" >& 5 - if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - for ac_file in conftest.*; do - case $ac_file in - *.c | *.err | *.$objext ) ;; - *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; - esac - done - else - cat conftest.err 1>&5 - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - $rm conftest* -fi -if test "X$ac_cv_exeext" = Xno; then - exeext="" -else - exeext="$ac_cv_exeext" -fi -echo "$ac_t$ac_cv_exeext" 1>&6 - -echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 -pic_flag= -special_shlib_compile_flags= -wl= -link_static_flag= -no_builtin_flag= - -if test "$with_gcc" = yes; then - wl='-Wl,' - link_static_flag='-static' - - case "$host_os" in - beos* | irix5* | irix6* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # we not sure about C++ programs. - link_static_flag="$link_static_flag ${wl}-lC" - ;; - cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - pic_flag='-m68020 -resident32 -malways-restore-a4' - ;; - sysv4*MP*) - if test -d /usr/nec; then - pic_flag=-Kconform_pic - fi - ;; - *) - pic_flag='-fPIC' - ;; - esac -else - # PORTME Check for PIC flags for the system compiler. - case "$host_os" in - aix3* | aix4*) - # All AIX code is PIC. - link_static_flag='-bnso -bI:/lib/syscalls.exp' - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better link_static_flag that works with the bundled CC? - wl='-Wl,' - link_static_flag="${wl}-a ${wl}archive" - pic_flag='+Z' - ;; - - irix5* | irix6*) - wl='-Wl,' - link_static_flag='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - wl='-Wl,' - link_static_flag='-non_shared' - ;; - - sco3.2v5*) - pic_flag='-Kpic' - link_static_flag='-dn' - special_shlib_compile_flags='-belf' - ;; - - solaris*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - sunos4*) - pic_flag='-PIC' - link_static_flag='-Bstatic' - wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - uts4*) - pic_flag='-pic' - link_static_flag='-Bstatic' - ;; - sysv4*MP*) - if test -d /usr/nec ;then - pic_flag='-Kconform_pic' - link_static_flag='-Bstatic' - fi - ;; - *) - can_build_shared=no - ;; - esac -fi - -if test -n "$pic_flag"; then - echo "$ac_t$pic_flag" 1>&6 - - # Check to make sure the pic_flag actually works. - echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $pic_flag -DPIC" - echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 - if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - case "$host_os" in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then they - # create non-PIC objects. So, if there were any warnings, we assume that - # PIC is not supported. - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - can_build_shared=no - pic_flag= - else - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - fi - ;; - *) - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - ;; - esac - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - can_build_shared=no - pic_flag= - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - echo "$ac_t"none 1>&6 -fi - -# Check to see if options -o and -c are simultaneously supported by compiler -echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -$rm conftest* -echo "int some_variable = 0;" > conftest.c -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.o" -echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 -if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - echo "$ac_t"no 1>&6 - compiler_c_o=no - else - echo "$ac_t"yes 1>&6 - compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - compiler_c_o=no - echo "$ac_t"no 1>&6 -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 -if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_o_lo=no - else - echo "$ac_t"yes 1>&6 - compiler_o_lo=yes - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_o_lo=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed -hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$ac_t$hard_links" 1>&6 - $rm conftest* - if test "$hard_links" = no; then - echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 - need_locks=warn - fi -else - need_locks=no -fi - -if test "$with_gcc" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" - echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 - if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_rtti_exceptions=no - else - echo "$ac_t"yes 1>&6 - compiler_rtti_exceptions=yes - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_rtti_exceptions=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* - - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi - -fi - -# Check for any special shared library compilation flags. -if test -n "$special_shlib_compile_flags"; then - echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : - else - echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 - can_build_shared=no - fi -fi - -echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 -$rm conftest* -echo 'main(){return(0);}' > conftest.c -save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS $link_static_flag" -echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 -if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - echo "$ac_t$link_static_flag" 1>&6 -else - echo "$ac_t"none 1>&6 - link_static_flag= -fi -LDFLAGS="$save_LDFLAGS" -$rm conftest* - -if test -z "$LN_S"; then - # Check to see if we can use ln -s, or we need hard links. - echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 - $rm conftest.dat - if ln -s X conftest.dat 2>/dev/null; then - $rm conftest.dat - LN_S="ln -s" - else - LN_S=ln - fi - if test "$LN_S" = "ln -s"; then - echo "$ac_t"yes 1>&6 - else - echo "$ac_t"no 1>&6 - fi -fi - -# Make sure LD is an absolute path. -if test -z "$LD"; then - ac_prog=ld - if test "$with_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 - echo "$progname:991: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we are not using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac - elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld... $ac_c" 1>&6 - echo "$progname:1015: checking for GNU ld" >&5 - else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 - echo "$progname:1018: checking for non-GNU ld" >&5 - fi - - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" - fi - - if test -n "$LD"; then - echo "$ac_t$LD" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - - if test -z "$LD"; then - echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 - exit 1 - fi -fi - -# Check to see if it really is or is not GNU ld. -echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 -# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - with_gnu_ld=yes -else - with_gnu_ld=no -fi -echo "$ac_t$with_gnu_ld" 1>&6 - -# See if the linker supports building shared libraries. -echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. - -case "$host_os" in -cygwin* | mingw*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$with_gcc" != yes; then - with_gnu_ld=no - fi - ;; - -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case "$host_os" in - aix3* | aix4*) - # On AIX, the GNU linker is very broken - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left by newer dlltools. - export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ - test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ - $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' - - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done~ - test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ - test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ - $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' - - old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' - # can we support soname and/or expsyms with a.out? -oliva - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi -else - # PORTME fill in a description of your system's linker (not GNU ld) - case "$host_os" in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$with_gcc" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4*) - hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' - hardcode_libdir_separator=':' - if test "$with_gcc" = yes; then - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - shared_flag='-shared' - else - shared_flag='${wl}-bM:SRE' - hardcode_direct=yes - fi - allow_undefined_flag=' ${wl}-berok' - archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' - archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' - case "$host_os" in aix4.[01]|aix4.[01].*) - # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on - always_export_symbols=yes ;; - esac - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs' - fix_srcfile_path='`cygpath -w $srcfile`' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case "$host_os" in - hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6*) - if test "$with_gcc" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF - fi - hardcode_libdir_flag_spec='${wl}-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - openbsd*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' - ;; - - osf3*) - if test "$with_gcc" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # As osf3* with the addition of the -msym flag - if test "$with_gcc" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - rhapsody*) - archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flags_spec='-L$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case "$host_os" in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' - else - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - unixware7*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac -fi -echo "$ac_t$ld_shlibs" 1>&6 -test "$ld_shlibs" = no && can_build_shared=no - -if test -z "$NM"; then - echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 - case "$NM" in - [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -p" - break - else - NM=${NM="$ac_dir/nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$NM" && NM=nm - ;; - esac - echo "$ac_t$NM" 1>&6 -fi - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Define system-specific variables. -case "$host_os" in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" - ;; -irix*) - symcode='[BCDEGRST]' - ;; -solaris*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - $rm conftest* - cat > conftest.c <&5 - if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then - # Now try to grab the symbols. - nlist=conftest.nm - if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then - - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.c -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' - - cat <> conftest.c -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c - cat <<\EOF >> conftest.c - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$objext conftstm.$objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - pipe_works=yes - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - LIBS="$save_LIBS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - $rm conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - global_symbol_pipe= - fi -done -if test "$pipe_works" = yes; then - echo "${ac_t}ok" 1>&6 -else - echo "${ac_t}failed" 1>&6 -fi - -if test -z "$global_symbol_pipe"; then - global_symbol_to_cdecl= -fi - -# Check hardcoding attributes. -echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$ac_t$hardcode_action" 1>&6 - - -reload_flag= -reload_cmds='$LD$reload_flag -o $output$reload_objs' -echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 -# PORTME Some linkers may need a different reload flag. -reload_flag='-r' -echo "$ac_t$reload_flag" 1>&6 -test -n "$reload_flag" && reload_flag=" $reload_flag" - -# PORTME Fill in your ld.so characteristics -library_names_spec= -libname_spec='lib$name' -soname_spec= -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -file_magic_cmd= -file_magic_test_file= -deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. -echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 -case "$host_os" in -aix3*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' - ;; - -aix4*) - version_type=linux - # AIX has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - # We preserve .a as extension for shared libraries though AIX4.2 - # and later linker supports .so - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' - shlibpath_var=LIBPATH - deplibs_check_method=pass_all - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}.so' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - deplibs_check_method=pass_all - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/shlib/libc.so - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw*) - version_type=windows - need_version=no - need_lib_prefix=no - if test "$with_gcc" = yes; then - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' - else - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' - fi - dynamic_linker='Win32 ld.exe' - deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - file_magic_cmd='${OBJDUMP} -f' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case "$version_type" in - freebsd-elf*) - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /usr/lib/libc.so*` - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - deplibs_check_method=unknown - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case "$host_os" in - freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - dynamic_linker="$host_os dld.sl" - version_type=sunos - need_lib_prefix=no - need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - case "$host_os" in - hpux10.20*) - # TODO: Does this work for hpux-11 too? - deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6*) - version_type=irix - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}.so.$major' - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' - case "$host_os" in - irix5*) - libsuff= shlibsuff= - # this will be overridden with pass_all, but let us keep it just in case - deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case "$LD" in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /lib${libsuff}/libc.so*` - deplibs_check_method='pass_all' - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux-gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - deplibs_check_method=pass_all - - if test -f /lib/ld.so.1; then - dynamic_linker='GNU ld.so' - else - # Only the GNU ld.so supports shared libraries on MkLinux. - case "$host_cpu" in - powerpc*) dynamic_linker=no ;; - *) dynamic_linker='Linux ld.so' ;; - esac - fi - ;; - -netbsd*) - version_type=sunos - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - ;; - -openbsd*) - version_type=sunos - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - need_version=no - fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - -os2*) - libname_spec='$name' - need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_version=no - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - shlibpath_var=LD_LIBRARY_PATH - # this will be overridden with pass_all, but let us keep it just in case - deplibs_check_method='file_magic COFF format alpha shared library' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/shlib/libc.so - deplibs_check_method='pass_all' - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rhapsody*) - version_type=sunos - library_names_spec='${libname}.so' - soname_spec='${libname}.so' - shlibpath_var=DYLD_LIBRARY_PATH - deplibs_check_method=pass_all - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" - file_magic_cmd=/usr/bin/file - file_magic_test_file=/lib/libc.so - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - case "$host_vendor" in - sequent) - file_magic_cmd='/bin/file' - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - ncr) - deplibs_check_method='pass_all' - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$ac_t$dynamic_linker" 1>&6 -test "$dynamic_linker" = no && can_build_shared=no - -# Report the final consequences. -echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 - -# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in -# configure.in, otherwise build static only libraries. -case "$host_os" in -cygwin* | mingw* | os2*) - if test x$can_build_shared = xyes; then - test x$enable_win32_dll = xno && can_build_shared=no - echo "checking if package supports dlls... $can_build_shared" 1>&6 - fi -;; -esac - -if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then - case "$deplibs_check_method" in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac -fi - -echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - test "$enable_shared" = yes && enable_static=no - ;; -esac - -echo "$ac_t$enable_shared" 1>&6 - -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes - -echo "checking whether to build static libraries... $enable_static" 1>&6 - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -echo $ac_n "checking for objdir... $ac_c" 1>&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$ac_t$objdir" 1>&6 - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else -if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then - lt_cv_dlopen=no lt_cv_dlopen_libs= -echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "$progname:2248: checking for dlopen in -ldl" >&5 -ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "$progname:2288: checking for dlopen" >&5 -if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_dlopen) || defined (__stub___dlopen) -choke me -#else -dlopen(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_dlopen=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_dlopen=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dlopen" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 -echo "$progname:2335: checking for dld_link in -ldld" >&5 -ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for shl_load""... $ac_c" 1>&6 -echo "$progname:2375: checking for shl_load" >&5 -if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_shl_load) || defined (__stub___shl_load) -choke me -#else -shl_load(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_shl_load=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_shl_load=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="shl_load" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "$progname:2423: checking for shl_load in -ldld" >&5 -ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - echo "$ac_t""no" 1>&6 -fi - - -fi - - -fi - - -fi - - -fi - -fi - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - fi - - case "$lt_cv_dlopen" in - dlopen) -for ac_hdr in dlfcn.h; do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "$progname:2488: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -int fnord = 0; -EOF -ac_try="$ac_compile >/dev/null 2>conftest.out" -{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -done - - if test "x$ac_cv_header_dlfcn_h" = xyes; then - CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - fi - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 -echo "$progname:2526: checking whether a program can dlopen itself" >&5 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - lt_cv_dlopen_self=cross - else - cat > conftest.c < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL -# else -# define LTDL_GLOBAL 0 -# endif -#endif - -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW -# ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW -# else -# define LTDL_LAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } - -EOF -if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - lt_cv_dlopen_self=yes -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - lt_cv_dlopen_self=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$lt_cv_dlopen_self" 1>&6 - - if test "$lt_cv_dlopen_self" = yes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 -echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - lt_cv_dlopen_self_static=cross - else - cat > conftest.c < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL -# else -# define LTDL_GLOBAL 0 -# endif -#endif - -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW -# ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW -# else -# define LTDL_LAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } - -EOF -if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - lt_cv_dlopen_self_static=yes -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - lt_cv_dlopen_self_static=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 -fi - ;; - esac - - case "$lt_cv_dlopen_self" in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case "$lt_cv_dlopen_self_static" in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - -# Copy echo and quote the copy, instead of the original, because it is -# used later. -ltecho="$echo" -if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ltecho="$CONFIG_SHELL \$0 --fallback-echo" -fi -LTSHELL="$SHELL" - -LTCONFIG_VERSION="$VERSION" - -# Only quote variables if we're using ltmain.sh. -case "$ltmain" in -*.sh) - # Now quote all the things that may contain metacharacters. - for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ - old_LD old_LDFLAGS old_LIBS \ - old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ - AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ - file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do - - case "$var" in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case "$ltecho" in - *'\$0 --fallback-echo"') - ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - - trap "$rm \"$ofile\"; exit 1" 1 2 15 - echo "creating $ofile" - $rm "$ofile" - cat < "$ofile" -#! $SHELL - -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. -# -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -### BEGIN LIBTOOL CONFIG -EOF - cfgfile="$ofile" - ;; - -*) - # Double-quote the variables that need it (for aesthetics). - for var in old_CC old_CFLAGS old_CPPFLAGS \ - old_LD old_LDFLAGS old_LIBS \ - old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do - eval "$var=\\\"\$var\\\"" - done - - # Just create a config file. - cfgfile="$ofile.cfg" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - echo "creating $cfgfile" - $rm "$cfgfile" - cat < "$cfgfile" -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -EOF - ;; -esac - -cat <> "$cfgfile" -# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ -# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ -# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ -# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ -# $0$ltconfig_args -# -# Compiler and other test output produced by $progname, useful for -# debugging $progname, is in ./config.log if it exists. - -# The version of $progname that generated this script. -LTCONFIG_VERSION=$LTCONFIG_VERSION - -# Shell to use when invoking shell scripts. -SHELL=$LTSHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$ltecho - -# The archiver. -AR=$AR - -# The default C compiler. -CC=$CC - -# The linker used to build libraries. -LD=$LD - -# Whether we need hard or soft links. -LN_S=$LN_S - -# A BSD-compatible nm program. -NM=$NM - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$reload_flag -reload_cmds=$reload_cmds - -# How to pass a linker flag through the compiler. -wl=$wl - -# Object file suffix (normally "o"). -objext="$objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$pic_flag - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$compiler_c_o - -# Can we write directly to a .lo ? -compiler_o_lo=$compiler_o_lo - -# Must we lock files when doing compilation ? -need_locks=$need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$link_static_flag - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$RANLIB -old_archive_cmds=$old_archive_cmds -old_postinstall_cmds=$old_postinstall_cmds -old_postuninstall_cmds=$old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$old_archive_from_new_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$archive_cmds -archive_expsym_cmds=$archive_expsym_cmds -postinstall_cmds=$postinstall_cmds -postuninstall_cmds=$postuninstall_cmds - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$global_symbol_to_cdecl - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$hardcode_libdir_separator - -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$include_expsyms - -EOF - -case "$ltmain" in -*.sh) - echo '### END LIBTOOL CONFIG' >> "$ofile" - echo >> "$ofile" - case "$host_os" in - aix3*) - cat <<\EOF >> "$ofile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # Append the ltmain.sh script. - sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - - chmod +x "$ofile" - ;; - -*) - # Compile the libtool program. - echo "FIXME: would compile $ltmain" - ;; -esac - -test -n "$cache_file" || exit 0 - -# AC_CACHE_SAVE -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/ltmain.sh xdvik-22.40n/libs/t1lib/ac-tools/ltmain.sh --- xdvik-22.40l/libs/t1lib/ac-tools/ltmain.sh Wed Apr 18 23:23:15 2001 +++ xdvik-22.40n/libs/t1lib/ac-tools/ltmain.sh Thu Jan 1 00:00:00 1970 @@ -1,4024 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun ltconfig. -# -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - echo "$modename: not configured to build any kind of library" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -# Parse our command line options once, thoroughly. -while test $# -gt 0 -do - arg="$1" - shift - - case "$arg" in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case "$prev" in - execute_dlfiles) - eval "$prev=\"\$$prev \$arg\"" - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case "$arg" in - --help) - show_help=yes - ;; - - --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - exit 0 - ;; - - --config) - sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 - exit 0 - ;; - - --debug) - echo "$progname: enabling shell trace mode" - set -x - ;; - - --dry-run | -n) - run=: - ;; - - --features) - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - exit 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --quiet | --silent) - show=: - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - case "$nonopt" in - *cc | *++ | gcc* | *-gcc*) - mode=link - for arg - do - case "$arg" in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case "$mode" in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - lastarg= - srcfile="$nonopt" - suppress_output= - - user_target=no - for arg - do - # Accept any command-line options. - case "$arg" in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next - ;; - - -static) - build_old_libs=yes - continue - ;; - esac - - case "$user_target" in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set - libobj="$arg" - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly in scan - # sets, so we specify it separately. - case "$lastarg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - done - - case "$user_target" in - set) - ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' - case "$libobj" in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case "$libobj" in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $libobj" - else - removelist="$libobj" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 - else - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until ln "$0" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - # All platforms use -DPIC, to notify preprocessed assembler code. - command="$base_compile $srcfile $pic_flag -DPIC" - if test "$build_old_libs" = yes; then - lo_libobj="$libobj" - dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$libobj"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - - if test -d "$dir"; then - $show "$rm $libobj" - $run $rm $libobj - else - $show "$mkdir $dir" - $run $mkdir $dir - status=$? - if test $status -ne 0 && test ! -d $dir; then - exit $status - fi - fi - fi - if test "$compiler_o_lo" = yes; then - output_obj="$libobj" - command="$command -o $output_obj" - elif test "$compiler_c_o" = yes; then - output_obj="$obj" - command="$command -o $output_obj" - fi - - $run $rm "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - test -n "$output_obj" && $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then - echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # If we have no pic_flag, then copy the object into place and finish. - if test -z "$pic_flag" && test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi - - $show "$mv $libobj $obj" - if $run $mv $libobj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` - libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - # Now arrange that obj and lo_libobj become the same file - $show "(cd $xdir && $LN_S $baseobj $libobj)" - if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then - exit 0 - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - command="$base_compile $srcfile" - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - output_obj="$obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - $run $rm "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then - echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed - if test x"$output_obj" != x"$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - fi - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - $rm "$lockfile" - fi - - exit 0 - ;; - - # libtool link mode - link) - modename="$modename: link" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invokation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (!dll) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test $# -gt 0; do - arg="$1" - shift - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case "$prev" in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case "$prev" in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case "$arg" in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit 1 - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case "$arg" in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi - - prevarg="$arg" - - case "$arg" in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: not more than one -exported-symbols argument allowed" - exit 1 - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case "$dir" in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - absdir="$dir" - fi - dir="$absdir" - ;; - esac - case " $deplibs " in - *" $arg "*) ;; - *) deplibs="$deplibs $arg";; - esac - case " $lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir";; - esac - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - case ":$dllsearchpath:" in - ::) dllsearchpath="$dllsearchdir";; - *":$dllsearchdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dllsearchdir";; - esac - ;; - esac - ;; - - -l*) - if test "$arg" = "-lc"; then - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) - # These systems don't actually have c library (as such) - continue - ;; - esac - elif test "$arg" = "-lm"; then - case "$host" in - *-*-cygwin* | *-*-beos*) - # These systems don't actually have math library (as such) - continue - ;; - esac - fi - deplibs="$deplibs $arg" - ;; - - -module) - module=yes - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -o) prev=output ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case "$dir" in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # If we have no pic_flag, then this is the same as -all-static. - if test -z "$pic_flag" && test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - - *.o | *.obj | *.a | *.lib) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A library object. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - fi - libobjs="$libobjs $arg" - ;; - - *.la) - # A libtool-controlled library. - - dlname= - libdir= - library_names= - old_library= - - # Check to see that this really is a libtool archive. - if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 - exit 1 - fi - - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes - - # Read the .la file - # If there is no directory component, then add one. - case "$arg" in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 - exit 1 - fi - - # Find the relevant object directory and library name. - name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` - - if test "X$installed" = Xyes; then - dir="$libdir" - else - dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$arg"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - fi - - if test -n "$dependency_libs"; then - # Extract -R and -L from dependency_libs - temp_deplibs= - for deplib in $dependency_libs; do - case "$deplib" in - -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - case " $rpath $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - -L*) case "$compile_command $temp_deplibs " in - *" $deplib "*) ;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac - temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` - case " $lib_search_path " in - *" $temp_dir "*) ;; - *) lib_search_path="$lib_search_path $temp_dir";; - esac - ;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac - done - dependency_libs="$temp_deplibs" - fi - - if test -z "$libdir"; then - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$deplibs$dependency_libs" - compile_command="$compile_command $dir/$old_library$dependency_libs" - finalize_command="$finalize_command $dir/$old_library$dependency_libs" - continue - fi - - # This library was specified with -dlopen. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking statically, - # we need to preload. - prev=dlprefiles - else - # We should not create a dependency on this library, but we - # may need any libraries it requires. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - prev= - continue - fi - fi - - # The library was specified with -dlpreopen. - if test "$prev" = dlprefiles; then - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - dlprefiles="$dlprefiles $dir/$old_library" - else - dlprefiles="$dlprefiles $dir/$linklib" - fi - prev= - fi - - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - link_against_libtool_libs="$link_against_libtool_libs $arg" - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # We need an absolute path. - case "$dir" in - [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - absdir="$dir" - fi - ;; - esac - - # This is the magic to use -rpath. - # Skip directories that are in the system default run-time - # search path, unless they have been requested with -R. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - - lib_linked=yes - case "$hardcode_action" in - immediate | unsupported) - if test "$hardcode_direct" = no; then - compile_command="$compile_command $dir/$linklib" - deplibs="$deplibs $dir/$linklib" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - if test -n "$dllsearchpath"; then - dllsearchpath="$dllsearchpath:$dllsearchdir" - else - dllsearchpath="$dllsearchdir" - fi - ;; - esac - elif test "$hardcode_minus_L" = no; then - case "$host" in - *-*-sunos*) - compile_shlibpath="$compile_shlibpath$dir:" - ;; - esac - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = no; then - case ":$compile_shlibpath:" in - *":$dir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$dir:";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" - else - lib_linked=no - fi - ;; - - relink) - if test "$hardcode_direct" = yes; then - compile_command="$compile_command $absdir/$linklib" - deplibs="$deplibs $absdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - case "$compile_command " in - *" -L$absdir "*) ;; - *) compile_command="$compile_command -L$absdir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$absdir -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case ":$compile_shlibpath:" in - *":$absdir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$absdir:";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" - else - lib_linked=no - fi - ;; - - *) - lib_linked=no - ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - finalize_command="$finalize_command $libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - case "$finalize_command " in - *" -L$libdir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case ":$finalize_shlibpath:" in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:";; - esac - finalize_command="$finalize_command -l$name" - else - # We cannot seem to hardcode it, guess we'll fake it. - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" - fi - else - # Transform directly to old archives if we don't build new libraries. - if test -n "$pic_flag" && test -z "$old_library"; then - $echo "$modename: cannot find static library for \`$arg'" 1>&2 - exit 1 - fi - - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_command="$compile_command $dir/$linklib" - finalize_command="$finalize_command $dir/$linklib" - else - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$dir";; - esac - finalize_command="$finalize_command -l$name" - fi - fi - - # Add in any libraries that this one depends upon. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - ;; - esac - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - case "$output" in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *.a | *.lib) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 - exit 1 - fi - - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - ;; - - *.la) - # Make sure we only generate libraries of the form `libNAME.la'. - case "$outputname" in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - - if test -n "$objs"; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 - exit 1 - fi - - # How the heck are we supposed to write a wrapper for a shared library? - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 - exit 1 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test $# -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - libext=al - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - dependency_libs="$deplibs" - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - current="$2" - revision="$3" - age="$4" - - # Check that each of the things are valid numbers. - case "$current" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$revision" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$age" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - if test $age -gt $current; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case "$version_type" in - none) ;; - - irix) - major=`expr $current - $age + 1` - versuffix="$major.$revision" - verstring="sgi$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test $loop != 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="sgi$major.$iface:$verstring" - done - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test $loop != 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - windows) - # Like Linux, but with '-' rather than '.', since we only - # want one extension on Windows 95. - major=`expr $current - $age` - versuffix="-$major-$age-$revision" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - verstring="0.0" - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - dependency_libs="$deplibs" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody*) - # rhapsody is a little odd... - deplibs="$deplibs -framework System" - ;; - *) - # Add libc to deplibs on all other systems. - deplibs="$deplibs -lc" - ;; - esac - fi - - # Create the output directory, or remove our outputs if we need to. - if test -d $output_objdir; then - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* - else - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - if test "$build_libtool_libs" = yes; then - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case "$deplibs_check_method" in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | sed 's/.* -> //'` - case "$potliblink" in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | sed 10q \ - | egrep "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - echo "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - # Get the real and link names of the library. - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case "$xlib" in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linkopts="$linkopts $flag" - fi - - # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - *.lo | *.o | *.obj) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 - exit 1 - fi - - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case "$output" in - *.lo) - if test -n "$objs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case "$xlib" in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - # Create the old-style object. - reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" - - output="$obj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 - fi - - if test -n "$pic_flag"; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - ;; - - # Anything else should be a program. - *) - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$compile_rpath " in - *" $libdir "*) ;; - *) compile_rpath="$compile_rpath $libdir" ;; - esac - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - - # Create the binary in the object directory, then wrap it. - if test ! -d $output_objdir; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status - fi - fi - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case "$dlsyms" in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" - $run $rm $export_symbols - $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | sed -e 's%^.*/%%'` - $run eval 'echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{\ -" - - sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ - -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ - < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr_t) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case "$host" in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case "$dir" in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case "$0" in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`echo $output|sed 's,.exe$,,'` ;; - esac - $rm $output - trap "$rm $output; exit 1" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - link_against_libtool_libs='$link_against_libtool_libs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - echo >> $output "\ - program=lt-'$outputname' - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if (cd \"\$thisdir\" && eval \$relink_command); then : - else - $rm \"\$progdir/\$file\" - exit 1 - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # win32 systems need to use the prog path for dll - # lookup to work - *-*-cygwin*) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case "$xlib" in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - # Ensure that we have .o objects in place in case we decided - # not to build a shared library, and have fallen back to building - # static libs even though --disable-static was passed! - for oldobj in $oldobjs; do - if test ! -f $oldobj; then - xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$oldobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` - obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - $show "(cd $xdir && ${LN_S} $obj $baseobj)" - $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? - fi - done - - eval cmds=\"$old_archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case "$output" in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - if test -n "$xrpath"; then - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - done - dependency_libs="$temp_xrpath $dependency_libs" - fi - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - fi - $rm $output - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$dlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Directory that this library needs to be installed in: -libdir='$install_libdir'\ -" - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? - ;; - esac - exit 0 - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case "$arg" in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case "$arg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit 1 - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test $# -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - fi - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case "$file" in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case "$file" in - *.a | *.lib) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - library_names= - old_library= - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$realname $destdir/$realname" - $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? - - if test $# -gt 0; then - # Delete the old symlinks, and create new ones. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case "$destfile" in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.o | *.obj) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit 0 - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - link_against_libtool_libs= - relink_command= - - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Check the variables that should have been set. - if test -z "$link_against_libtool_libs"; then - $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 - exit 1 - fi - - finalize=yes - for lib in $link_against_libtool_libs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec $SHELL $0 --finish$current_libdirs - exit 1 - fi - - exit 0 - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit 0 - - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - echo " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "----------------------------------------------------------------------" - exit 0 - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit 1 - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - dir= - case "$file" in - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case "$file" in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case "$file" in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved enviroment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now actually exec the command. - eval "exec \$cmd$args" - - $echo "$modename: cannot exec \$cmd$args" - exit 1 - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit 0 - fi - ;; - - # libtool uninstall mode - uninstall) - modename="$modename: uninstall" - rm="$nonopt" - files= - - for arg - do - case "$arg" in - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - rmfiles="$file" - - case "$name" in - *.la) - # Possibly a libtool archive, so verify it. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $dir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" - - $show "$rm $rmfiles" - $run $rm $rmfiles - - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - # FIXME: should reinstall the best remaining shared library. - fi - ;; - - *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` - rmfiles="$rmfiles $dir/$oldobj" - fi - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - - *) - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - esac - done - exit 0 - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - ;; - esac - - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 -fi # test -z "$show_help" - -# We need to display help for each of the modes. -case "$mode" in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --version print version information - -MODE must be one of the following: - - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." - exit 0 - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; -esac - -echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff -Naur xdvik-22.40l/libs/t1lib/ac-tools/mkinstalldirs xdvik-22.40n/libs/t1lib/ac-tools/mkinstalldirs --- xdvik-22.40l/libs/t1lib/ac-tools/mkinstalldirs Mon Jan 7 15:50:12 2002 +++ xdvik-22.40n/libs/t1lib/ac-tools/mkinstalldirs Thu Jan 1 00:00:00 1970 @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.2.8.2 2002/01/07 15:50:12 stefanulrich Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff -Naur xdvik-22.40l/libs/t1lib/configure xdvik-22.40n/libs/t1lib/configure --- xdvik-22.40l/libs/t1lib/configure Tue Jan 29 20:05:37 2002 +++ xdvik-22.40n/libs/t1lib/configure Mon Sep 16 17:45:28 2002 @@ -1,6 +1,22 @@ #! /bin/sh # From configure.in configure.in 1.00 + + + + + + + + + + + + + + + + # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. @@ -15,21 +31,20 @@ ac_help="$ac_help --with-x use the X Window System" ac_help="$ac_help - --without-athena do not use Athena widgets" + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" ac_help="$ac_help - --with-athena-includes=DIR Athena include files are in DIR" + --without-mktexmf-default do not run mktexmf if MF source missing" ac_help="$ac_help - --with-athena-libraries=DIR Athena libraries are in DIR" + --without-mktexpk-default do not run mktexpk if PK font missing" ac_help="$ac_help - --enable-shared[=PKGS] build shared libraries [default=yes]" + --without-mktextfm-default do not run mktextfm if TFM file missing" ac_help="$ac_help - --enable-static[=PKGS] build static libraries [default=yes]" + --without-mkocp-default do not run mkocp if OCP file missing" ac_help="$ac_help - --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" + --without-mkofm-default do not run mkofm if OFM file missing" ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" -ac_help="$ac_help - --disable-libtool-lock avoid locking (might break parallel builds)" + --enable-multiplatform put executables in bin/PLATFORM" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -470,7 +485,7 @@ # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=lib/t1lib/t1base.c +ac_unique_file=t1base.c # Find the source files, if location was not specified. if test -z "$srcdir"; then @@ -542,147 +557,35 @@ ac_aux_dir= -for ac_dir in ac-tools $srcdir/ac-tools; do +for ac_dir in ../../config $srcdir/../../config; do if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in ac-tools $srcdir/ac-tools" 1>&2; exit 1; } + { echo "configure: error: can not find install-sh or install.sh in ../../config $srcdir/../../config" 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - - T1LIB_LT_CURRENT=4 T1LIB_LT_REVISION=1 T1LIB_LT_AGE=3 T1LIB_IDENTIFIER="1.3.1" - - - - - - - - - - -## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- -## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit , 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. - -# serial 40 AC_PROG_LIBTOOL - - - - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support - - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's - - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. - - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared - - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. - - -# AC_DISABLE_STATIC - set the default static flag to --disable-static - - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. - - -# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install - - -# AC_PROG_LD - find the path to the GNU or non-GNU linker - - - - -# AC_PROG_NM - find the path to a BSD-compatible name lister - - -# AC_CHECK_LIBM - check for math library - - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and INCLTDL are not -# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not -# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed -# with '${top_builddir}/' and INCLTDL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. - - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is -# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed -# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed -# with '${top_srcdir}/' (note the single quotes!). If your package is -# not flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. - - - - - -test -z "$LDLIBS" && LDLIBS=-lm -test -z "$PROGEXT" && PROGEXT="" -test -z "$CFLAGS" -test -z "$LDFLAGS" - T1LIB_DATA_DIR="${datadir}/t1lib" @@ -690,25 +593,8 @@ - - - - - - - - - - - - - - - - - echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:712: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:598: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -737,7 +623,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:741: checking for $ac_word" >&5 +echo "configure:627: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -745,10 +631,11 @@ ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then + if test $ac_x $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi @@ -767,7 +654,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:771: checking for $ac_word" >&5 +echo "configure:658: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -776,10 +663,11 @@ else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then + if test $ac_x $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -818,7 +706,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:822: checking for $ac_word" >&5 +echo "configure:710: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -826,10 +714,11 @@ ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then + if test $ac_x $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi @@ -850,7 +739,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:854: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:743: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -861,12 +750,12 @@ cat > conftest.$ac_ext << EOF -#line 865 "configure" +#line 754 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -892,12 +781,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:896: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:785: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:901: checking whether we are using GNU C" >&5 +echo "configure:790: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -906,7 +795,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -925,7 +814,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:929: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:818: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -957,7 +846,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:961: checking how to run the C preprocessor" >&5 +echo "configure:850: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -972,13 +861,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:982: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -989,13 +878,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:888: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1006,13 +895,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1041,7 +930,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1045: checking for X" >&5 +echo "configure:934: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1103,12 +992,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1112: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1001: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1177,14 +1066,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -1285,22 +1174,24 @@ # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" + + # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:1294: checking whether -R must be followed by a space" >&5 +echo "configure:1185: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -1316,14 +1207,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -1341,6 +1232,12 @@ fi fi LIBS="$ac_xsave_LIBS" + ;; + OSF1*|IRIX*) + # OSF1 refers to Dec-Unix. -rpath is required in du 4.0 - at least + # -rpath is required in irix 5.x and 6.x - at least + X_LIBS="$X_LIBS -Wl,-rpath,$x_libraries" + ;; esac fi @@ -1355,7 +1252,7 @@ # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:1359: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:1256: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1363,7 +1260,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1396,7 +1293,7 @@ if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:1400: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:1297: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1404,7 +1301,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1444,12 +1341,12 @@ # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1448: checking for gethostbyname" >&5 +echo "configure:1345: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1493,7 +1390,7 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1497: checking for gethostbyname in -lnsl" >&5 +echo "configure:1394: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1501,7 +1398,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1542,12 +1439,12 @@ # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1546: checking for connect" >&5 +echo "configure:1443: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -1591,7 +1488,7 @@ if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1595: checking for connect in -lsocket" >&5 +echo "configure:1492: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1599,7 +1496,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1634,12 +1531,12 @@ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:1638: checking for remove" >&5 +echo "configure:1535: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -1683,7 +1580,7 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:1687: checking for remove in -lposix" >&5 +echo "configure:1584: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1691,7 +1588,7 @@ ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1726,12 +1623,12 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:1730: checking for shmat" >&5 +echo "configure:1627: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -1775,7 +1672,7 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:1779: checking for shmat in -lipc" >&5 +echo "configure:1676: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1783,7 +1680,7 @@ ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1827,7 +1724,7 @@ # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:1831: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:1728: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1835,7 +1732,7 @@ ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1870,280 +1767,236 @@ fi +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1783: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + # Hack for MSDOS and descendants. + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test $ac_x $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" - -athena_includes= -athena_libraries= -# Check whether --with-athena or --without-athena was given. -if test "${with_athena+set}" = set; then - withval="$with_athena" - : -fi - -if test "$with_athena" = "no" -then -athena_includes=no -athena_libraries=no fi -# Check whether --with-athena-includes or --without-athena-includes was given. -if test "${with_athena_includes+set}" = set; then - withval="$with_athena_includes" - athena_includes="$withval" + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi fi +echo "$ac_t""$INSTALL" 1>&6 -# Check whether --with-athena-libraries or --without-athena-libraries was given. -if test "${with_athena_libraries+set}" = set; then - withval="$with_athena_libraries" - athena_libraries="$withval" -fi +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -echo $ac_n "checking for Athena""... $ac_c" 1>&6 -echo "configure:1902: checking for Athena" >&5 -# -# -# Search the include files. -# -if test "$athena_includes" = ""; then -if eval "test \"`echo '$''{'ice_cv_athena_includes'+set}'`\" = set"; then +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1840: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - -ice_athena_save_LIBS="$LIBS" -ice_athena_save_CFLAGS="$CFLAGS" -ice_athena_save_CPPFLAGS="$CPPFLAGS" -ice_athena_save_LDFLAGS="$LDFLAGS" -# -LIBS="$X_PRE_LIBS -lXaw -lXmu -lXext -lXt -lX11 $X_EXTRA_LIBS $LIBS" -CFLAGS="$X_CFLAGS $CFLAGS" -CPPFLAGS="$X_CFLAGS $CPPFLAGS" -LDFLAGS="$X_LIBS $LDFLAGS" -# -cat > conftest.$ac_ext <&6 +else + echo "$ac_t""no" 1>&6 +fi -#include -#include -int main() { -int a; -; return 0; } -EOF -if { (eval echo configure:1933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1871: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test "x$USE_MAINTAINER_MODE" = xyes; then + MAINT= + else + MAINT='#M#' + fi -# X11/Xaw/Text.h is in the standard search path. -ice_cv_athena_includes= + +echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 +echo "configure:1890: checking for loader (symbol LD)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* -# X11/Xaw/Text.h is not in the standard search path. -# Locate it and put its directory in `athena_includes' -# -# /usr/include/Motif* are used on HP-UX (Motif). -# /usr/include/X11* are used on HP-UX (X and Athena). -# /usr/dt is used on Solaris (Motif). -# /usr/openwin is used on Solaris (X and Athena). -# Other directories are just guesses. -for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \ - /usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \ - /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \ - /usr/dt/include /usr/openwin/include \ - /usr/dt/*/include /opt/*/include /usr/include/Motif* \ - "${prefix}"/*/include /usr/*/include /usr/local/*/include \ - "${prefix}"/include/* /usr/include/* /usr/local/include/*; do -if test -f "$dir/X11/Xaw/Text.h"; then -ice_cv_athena_includes="$dir" -break +test -z "$LD" && LD=ld +cf_cv_subst_LD=$LD fi -done -fi -rm -f conftest* -# -LIBS="$ice_athena_save_LIBS" -CFLAGS="$ice_athena_save_CFLAGS" -CPPFLAGS="$ice_athena_save_CPPFLAGS" -LDFLAGS="$ice_athena_save_LDFLAGS" +LD=${cf_cv_subst_LD} +echo "$ac_t""$LD" 1>&6 -fi -athena_includes="$ice_cv_athena_includes" -fi -# -# -# Now for the libraries. -# -if test "$athena_libraries" = ""; then -if eval "test \"`echo '$''{'ice_cv_athena_libraries'+set}'`\" = set"; then +echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 +echo "configure:1904: checking for archiver (symbol AR)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else -ice_athena_save_LIBS="$LIBS" -ice_athena_save_CFLAGS="$CFLAGS" -ice_athena_save_CPPFLAGS="$CPPFLAGS" -ice_athena_save_LDFLAGS="$LDFLAGS" -# -LIBS="$X_PRE_LIBS -lXaw -lXmu -lXext -lXt -lX11 $X_EXTRA_LIBS $LIBS" -CFLAGS="$X_CFLAGS $CFLAGS" -CPPFLAGS="$X_CFLAGS $CPPFLAGS" -LDFLAGS="$X_LIBS $LDFLAGS" -# -cat > conftest.$ac_ext < -#include +AR=${cf_cv_subst_AR} +echo "$ac_t""$AR" 1>&6 -int main() { -XtToolkitInitialize(); -; return 0; } -EOF -if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - -# libXaw.a is in the standard search path. -ice_cv_athena_libraries= +echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 +echo "configure:1918: checking for archiver options (symbol AR_OPTS)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* -# libXaw.a is not in the standard search path. -# Locate it and put its directory in `athena_libraries' -# -# -# /usr/lib/Motif* are used on HP-UX (Motif). -# /usr/lib/X11* are used on HP-UX (X and Athena). -# /usr/dt is used on Solaris (Motif). -# /usr/openwin is used on Solaris (X and Athena). -# Other directories are just guesses. -for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \ - /usr/lib/Motif2.0 /usr/lib/Motif1.2 /usr/lib/Motif1.1 \ - /usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \ - /usr/dt/lib /usr/openwin/lib \ - /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \ - "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \ - "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do -if test -d "$dir" && test "`ls $dir/libXaw.* 2> /dev/null`" != ""; then -ice_cv_athena_libraries="$dir" -break +test -z "$AR_OPTS" && AR_OPTS=rc +cf_cv_subst_AR_OPTS=$AR_OPTS fi -done -fi -rm -f conftest* -# -LIBS="$ice_athena_save_LIBS" -CFLAGS="$ice_athena_save_CFLAGS" -CPPFLAGS="$ice_athena_save_CPPFLAGS" -LDFLAGS="$ice_athena_save_LDFLAGS" +AR_OPTS=${cf_cv_subst_AR_OPTS} +echo "$ac_t""$AR_OPTS" 1>&6 + + +# Check whether --with-mktexmf-default or --without-mktexmf-default was given. +if test "${with_mktexmf_default+set}" = set; then + withval="$with_mktexmf_default" + : +else + withval=yes fi -# -athena_libraries="$ice_cv_athena_libraries" +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_MF_BY_DEFAULT 1 +EOF + fi -# Add Athena definitions to X flags -# -if test "$athena_includes" != "" && test "$athena_includes" != "$x_includes" && test "$athena_includes" != "no" -then -X_CFLAGS="-I$athena_includes $X_CFLAGS" +# Check whether --with-mktexpk-default or --without-mktexpk-default was given. +if test "${with_mktexpk_default+set}" = set; then + withval="$with_mktexpk_default" + : +else + withval=yes fi -if test "$athena_libraries" != "" && test "$athena_libraries" != "$x_libraries" && test "$athena_libraries" != "no" -then -case "$X_LIBS" in - *-R\ *) X_LIBS="-L$athena_libraries -R $athena_libraries $X_LIBS";; - *-R*) X_LIBS="-L$athena_libraries -R$athena_libraries $X_LIBS";; - *) X_LIBS="-L$athena_libraries $X_LIBS";; -esac + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_PK_BY_DEFAULT 1 +EOF + fi -# -# -athena_libraries_result="$athena_libraries" -athena_includes_result="$athena_includes" -test "$athena_libraries_result" = "" && - athena_libraries_result="in default path" -test "$athena_includes_result" = "" && - athena_includes_result="in default path" -test "$athena_libraries_result" = "no" && - athena_libraries_result="(none)" -test "$athena_includes_result" = "no" && - athena_includes_result="(none)" -echo "$ac_t""libraries $athena_libraries_result, headers $athena_includes_result" 1>&6 - -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} -case "$enableval" in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac +# Check whether --with-mktextfm-default or --without-mktextfm-default was given. +if test "${with_mktextfm_default+set}" = set; then + withval="$with_mktextfm_default" + : else - enable_shared=yes + withval=yes fi -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} -case "$enableval" in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_TFM_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mkocp-default or --without-mkocp-default was given. +if test "${with_mkocp_default+set}" = set; then + withval="$with_mkocp_default" + : else - enable_static=yes + withval=yes fi -# Check whether --enable-fast-install or --disable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval="$enable_fast_install" - p=${PACKAGE-default} -case "$enableval" in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_OMEGA_OCP_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mkofm-default or --without-mkofm-default was given. +if test "${with_mkofm_default+set}" = set; then + withval="$with_mkofm_default" + : else - enable_fast_install=yes + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_OMEGA_OFM_BY_DEFAULT 1 +EOF + fi @@ -2153,7 +2006,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:2157: checking host system type" >&5 +echo "configure:2010: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -2173,439 +2026,74 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:2178: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2198: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +# Check whether --enable-multiplatform or --disable-multiplatform was given. +if test "${enable_multiplatform+set}" = set; then + enableval="$enable_multiplatform" + if test "x$enable_multiplatform" = xyes && + test "x$bindir" = 'x${exec_prefix}/bin' +then + bindir="$bindir/$host" fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$ac_cv_prog_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:2237: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:2261: checking for GNU ld" >&5 -else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:2264: checking for non-GNU ld" >&5 -fi -if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - ac_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - ac_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi -LD="$ac_cv_path_LD" -if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:2299: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - ac_cv_prog_gnu_ld=yes -else - ac_cv_prog_gnu_ld=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 - - -echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:2315: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$NM"; then - # Let the user override the test. - ac_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - ac_cv_path_NM="$ac_dir/nm -p" - break - else - ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm -fi -fi - -NM="$ac_cv_path_NM" -echo "$ac_t""$NM" 1>&6 - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2351: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - -case "$target" in -NONE) lt_target="$host" ;; -*) lt_target="$target" ;; -esac - -# Check for any special flags to pass to ltconfig. -libtool_flags="--cache-file=$cache_file" -test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" -test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" -test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" -test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" - - -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - : -fi - -test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" -test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case "$lt_target" in -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 2400 "configure"' > conftest.$ac_ext - if { (eval echo configure:2401: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac +echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 +echo "configure:2042: checking where the main texmf tree is located" >&5 +texmfmain= +if test "x$datadir" != 'x${prefix}/share'; then + # First case, datadir is defined... + eval p=\"$datadir\" + # Unconditionally set the directory, but... + texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` + # ... do complain if it wasn't found. + if test -d "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + echo "$ac_t""not found" 1>&6 + echo "configure: warning: No texmf tree found at $texmfmain. + If you do not have the files, you can retrieve a minimal set from + ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts + in systems/web2c. Winging it." 1>&2 fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2422: checking whether the C compiler needs -belf" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - lt_cv_cc_needs_belf=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_needs_belf=no -fi -rm -f conftest* -fi - -echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6 - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - - -esac - - -# Save cache, so that ltconfig can load it -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + # Second case, datadir is default... + if test "x$prefix" = "xNONE"; then + p="$ac_default_prefix" else - echo "not updating unwritable cache $cache_file" + eval p=\"$prefix\" fi -fi -rm -f confcache - - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ -LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ -DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ -|| { echo "configure: error: libtool configure failed" 1>&2; exit 1; } - -# Reload cache, that may have been modified by ltconfig -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2547: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac + for e in share/texmf lib/texmf texmf; do + if test -d "$p/$e"; then + texmfmain="$p/$e" + break + fi done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` + if test -n "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" + eval texmfmain="$datadir/texmf" + echo "$ac_t""not found" 1>&6 + echo "configure: warning: The main texmf tree was not found. + Specify the location of its parent directory with the --datadir option. + If you do not have the files, you can retrieve a minimal set from + ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts + in systems/web2c. Winging it by using the default location + $texmfmain." 1>&2 fi fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:2602: checking whether char is unsigned" >&5 +echo "configure:2090: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -2661,7 +2149,7 @@ fi echo $ac_n "checking size of char""... $ac_c" 1>&6 -echo "configure:2665: checking size of char" >&5 +echo "configure:2153: checking size of char" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2669,7 +2157,7 @@ ac_cv_sizeof_char=0 else cat > conftest.$ac_ext < main() @@ -2680,7 +2168,7 @@ exit(0); } EOF -if { (eval echo configure:2684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_char=`cat conftestval` else @@ -2700,7 +2188,7 @@ echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:2704: checking size of short" >&5 +echo "configure:2192: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2708,7 +2196,7 @@ ac_cv_sizeof_short=0 else cat > conftest.$ac_ext < main() @@ -2719,7 +2207,7 @@ exit(0); } EOF -if { (eval echo configure:2723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -2739,7 +2227,7 @@ echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:2743: checking size of int" >&5 +echo "configure:2231: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2747,7 +2235,7 @@ ac_cv_sizeof_int=0 else cat > conftest.$ac_ext < main() @@ -2758,7 +2246,7 @@ exit(0); } EOF -if { (eval echo configure:2762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -2778,7 +2266,7 @@ echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:2782: checking size of long" >&5 +echo "configure:2270: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2786,7 +2274,7 @@ ac_cv_sizeof_long=0 else cat > conftest.$ac_ext < main() @@ -2797,7 +2285,7 @@ exit(0); } EOF -if { (eval echo configure:2801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -2817,7 +2305,7 @@ echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:2821: checking size of long long" >&5 +echo "configure:2309: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2825,7 +2313,7 @@ ac_cv_sizeof_long_long=0 else cat > conftest.$ac_ext < main() @@ -2836,7 +2324,7 @@ exit(0); } EOF -if { (eval echo configure:2840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else @@ -2856,7 +2344,7 @@ echo $ac_n "checking size of float""... $ac_c" 1>&6 -echo "configure:2860: checking size of float" >&5 +echo "configure:2348: checking size of float" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2864,7 +2352,7 @@ ac_cv_sizeof_float=0 else cat > conftest.$ac_ext < main() @@ -2875,7 +2363,7 @@ exit(0); } EOF -if { (eval echo configure:2879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_float=`cat conftestval` else @@ -2895,7 +2383,7 @@ echo $ac_n "checking size of double""... $ac_c" 1>&6 -echo "configure:2899: checking size of double" >&5 +echo "configure:2387: checking size of double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2903,7 +2391,7 @@ ac_cv_sizeof_double=0 else cat > conftest.$ac_ext < main() @@ -2914,7 +2402,7 @@ exit(0); } EOF -if { (eval echo configure:2918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_double=`cat conftestval` else @@ -2934,7 +2422,7 @@ echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:2938: checking size of long double" >&5 +echo "configure:2426: checking size of long double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2942,7 +2430,7 @@ ac_cv_sizeof_long_double=0 else cat > conftest.$ac_ext < main() @@ -2953,7 +2441,7 @@ exit(0); } EOF -if { (eval echo configure:2957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_double=`cat conftestval` else @@ -2973,7 +2461,7 @@ echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:2977: checking size of void *" >&5 +echo "configure:2465: checking size of void *" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2981,7 +2469,7 @@ ac_cv_sizeof_void_p=0 else cat > conftest.$ac_ext < main() @@ -2992,7 +2480,7 @@ exit(0); } EOF -if { (eval echo configure:2996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_void_p=`cat conftestval` else @@ -3012,12 +2500,11 @@ - if test "x${GCC}" = "xyes" then CFLAGS="$CFLAGS" echo $ac_n "checking "for gcc strength-reduce bug"""... $ac_c" 1>&6 -echo "configure:3021: checking "for gcc strength-reduce bug"" >&5 +echo "configure:2508: checking "for gcc strength-reduce bug"" >&5 if eval "test \"`echo '$''{'ac_cv_c_gcc_strength_bug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3025,7 +2512,7 @@ ac_cv_c_gcc_strength_bug="yes" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_gcc_strength_bug="no" else @@ -3057,52 +2544,8 @@ fi fi - -echo $ac_n "checking "whether external symbols need an underscore prefix"""... $ac_c" 1>&6 -echo "configure:3063: checking "whether external symbols need an underscore prefix"" >&5 -if eval "test \"`echo '$''{'ac_cv_c_extern_prefix'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - saved_libs=$LIBS -LIBS="conftest_asm.s $LIBS" -cat > conftest_asm.s < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_c_extern_prefix="yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_extern_prefix="no" -fi -rm -f conftest* -LIBS=$saved_libs -fi - -echo "$ac_t""$ac_cv_c_extern_prefix" 1>&6 -if test "$ac_cv_c_extern_prefix" = "yes" -then - cat >> confdefs.h <<\EOF -#define NEED_UNDERSCORE_PREFIX 1 -EOF - -fi - - echo $ac_n "checking "which ANSI integer type is 16 bit"""... $ac_c" 1>&6 -echo "configure:3106: checking "which ANSI integer type is 16 bit"" >&5 +echo "configure:2549: checking "which ANSI integer type is 16 bit"" >&5 if eval "test \"`echo '$''{'ac_16bit_type'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3110,7 +2553,7 @@ ac_16bit_type= else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_16bit_type="short" else @@ -3145,9 +2588,8 @@ fi - echo $ac_n "checking "which ANSI integer type is 32 bit"""... $ac_c" 1>&6 -echo "configure:3151: checking "which ANSI integer type is 32 bit"" >&5 +echo "configure:2593: checking "which ANSI integer type is 32 bit"" >&5 if eval "test \"`echo '$''{'ac_32bit_type'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3155,7 +2597,7 @@ ac_32bit_type= else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_32bit_type="int" else @@ -3190,9 +2632,8 @@ fi - echo $ac_n "checking "which ANSI integer type is 64 bit"""... $ac_c" 1>&6 -echo "configure:3196: checking "which ANSI integer type is 64 bit"" >&5 +echo "configure:2637: checking "which ANSI integer type is 64 bit"" >&5 if eval "test \"`echo '$''{'ac_64bit_type'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3200,7 +2641,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_64bit_type="long" else @@ -3233,16 +2674,16 @@ fi -CFLAGS="${CFLAGS} -DT1LIB_IDENT=\"\\\"${T1LIB_IDENTIFIER}\\\"\" -DGLOBAL_CONFIG_DIR=\"\\\"${T1LIB_DATA_DIR}\\\"\"" + echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:3241: checking whether stat file-mode macros are broken" >&5 +echo "configure:2682: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3293,12 +2734,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3297: checking for working const" >&5 +echo "configure:2738: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3368,12 +2809,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3372: checking for ANSI C header files" >&5 +echo "configure:2813: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3381,7 +2822,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3385: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3398,7 +2839,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3416,7 +2857,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3437,7 +2878,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3448,7 +2889,7 @@ exit (0); } EOF -if { (eval echo configure:3452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3472,12 +2913,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3476: checking for size_t" >&5 +echo "configure:2917: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3505,48 +2946,6 @@ fi - -if test "$no_x" = "yes" -then -MAIN_TARGET="libt1.la" -MAIN_HEADER="t1lib.h" -XSUBDIRS="" -T1LIBX_OBJS="" -T1LIBX_SRCS="" -T1LIBX_HEADERS="" -XOBJS="" -else -MAIN_TARGET="libt1.la libt1x.la" -MAIN_HEADER="t1lib.h t1libx.h" -XSUBDIRS="xglyph" -T1LIBX_OBJS="t1lib/t1x11.lo" -T1LIBX_SRCS="t1lib/t1x11.c" -T1LIBX_HEADERS="t1lib/t1x11.h t1lib/t1libx.h" -XOBJS="t1x11.lo" -fi - - - -if test "$no_x" = "yes" -then -CFLAGS="${CFLAGS} -DT1LIB_NO_X11_SUPPORT" -MAKEFILES="Makefile \ - lib/Makefile \ - lib/type1/Makefile \ - lib/t1lib/Makefile \ - type1afm/Makefile \ - examples/Makefile" -else -MAKEFILES="Makefile \ - lib/Makefile \ - lib/type1/Makefile \ - lib/t1lib/Makefile \ - xglyph/Makefile \ - type1afm/Makefile \ - examples/Makefile" -fi - - trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -3648,9 +3047,7 @@ ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo " -$MAKEFILES - lib/t1lib/sysconf.h:lib/t1lib/sysconf.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile sysconf.h:sysconf.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -3795,14 +3175,17 @@ .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + /*|[A-z]:/*) # Absolute path. + srcdir="$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; + "") ;; + [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac @@ -3815,13 +3198,47 @@ *) ac_comsub= ;; esac - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` + # Replace lines of the form ac_include foo with the contents of foo: + # first, from the ac_include lines construct a list of file names. + # From that list, we construct a second list of those files that exist. + # Then we construct lists of sed commands for including those files, + # and a sed command that removes the ac_include lines. We don't attempt + # to read non-existent files because some (buggy) versions of sed choke + # on this. Have to use sed because old (Ultrix, SunOS) awk does not support + # getline or system. (Anyway, configure scripts aren't supposed to use awk.) + # Can't use only one -e and commands {dr foo} because foo has to be last. + # Be careful, because the filename may contain /. Be careful with + # whitespace; we need to use echo. + # + # No support for the multiple-output file :-separated stuff. + # + file_substs=`sed -n \ +'/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' \ + "$ac_given_srcdir/$ac_file_in"` + # Create the sed command line ... + file_subst_cmd='sed' + for ac_inc in $file_substs; do + if test -f "$ac_given_srcdir/$ac_inc"; then + ac_mung=`echo $ac_inc | sed 's,/,%,g'` + file_subst_cmd="$file_subst_cmd -e '/^ac_include $ac_mung$/r $ac_inc'" + fi + done + file_subst_cmd="$file_subst_cmd -e '/^ac_include/d'" + # ... and fix the whitespace and escaped slashes. + file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \ +-e 's/ac_include /ac_include[ ]*/g'` + # cd into the srcdir because the files being included more or less + # must be part of the distribution. I can't find any way to do + # variable substitution in the sed commands (so the user could have, + # e.g., $top_srcdir in their ac_include line). + (cd $ac_given_srcdir && eval $file_subst_cmd $ac_file_in) \ + | sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +" | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* @@ -3830,7 +3247,7 @@ # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". @@ -3847,7 +3264,7 @@ if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi @@ -3862,7 +3279,7 @@ echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` cat $ac_file_inputs > conftest.in EOF @@ -3943,8 +3360,4 @@ chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - - - - diff -Naur xdvik-22.40l/libs/t1lib/configure.in xdvik-22.40n/libs/t1lib/configure.in --- xdvik-22.40l/libs/t1lib/configure.in Tue Jan 29 20:05:37 2002 +++ xdvik-22.40n/libs/t1lib/configure.in Sat Sep 14 00:07:32 2002 @@ -1,106 +1,30 @@ -dnl Process this file with autoconf to produce a configure script. -dnl -dnl This file configure.in is part of the t1lib-package (V. 1.0). -dnl -dnl Author: Rainer Menzner (Rainer.Menzner@web.de) -dnl Date: 06/25/1997 -dnl Last Modified: 2001-11-12 -dnl - AC_REVISION([configure.in 1.00]) -AC_INIT(lib/t1lib/t1base.c) -AC_CONFIG_HEADER(lib/t1lib/sysconf.h:lib/t1lib/sysconf.h.in) -AC_CONFIG_AUX_DIR(ac-tools) - -dnl The following variables specify version information of the -dnl library. Starting with V. 1.0.0 the libtool scheme is used -dnl as intended by its authors. - +AC_INIT(t1base.c) +AC_CONFIG_HEADER(sysconf.h:sysconf.h.in) +AC_CONFIG_AUX_DIR(../../config) T1LIB_LT_CURRENT=4 T1LIB_LT_REVISION=1 T1LIB_LT_AGE=3 T1LIB_IDENTIFIER="1.3.1" - -dnl Since I'm forgetful sometimes, I quote the libtool infopage here: -dnl -dnl 1. Start with version information of `0:0:0' for each libtool library. -dnl -dnl 2. Update the version information only immediately before a public -dnl release of your software. More frequent updates are unnecessary, -dnl and only guarantee that the current interface number gets larger -dnl faster. -dnl -dnl 3. If the library source code has changed at all since the last -dnl update, then increment REVISION (`C:R:A' becomes `C:r+1:A'). -dnl -dnl 4. If any interfaces have been added, removed, or changed since the -dnl last update, increment CURRENT, and set REVISION to 0. -dnl -dnl 5. If any interfaces have been added since the last public release, -dnl then increment AGE. -dnl -dnl 6. If any interfaces have been removed since the last public release, -dnl then set AGE to 0. - - -dnl We set CFLAGS in order to have complete control over compiler -dnl switches during development -dnl CFLAGS="$CFLAGS -g -Wall" - - -dnl ----------------------------------------------------------- -dnl Do not change anything below this line! -dnl ----------------------------------------------------------- - - - -dnl We use this file by Andreas Zeller to check for libXaw -builtin(include, ac-tools/ice_find_athena.m4) -builtin(include, ac-tools/aclocal.m4) - -dnl We want these before the checks, so the checks can modify their values. -test -z "$LDLIBS" && LDLIBS=-lm AC_SUBST(LDLIBS) -test -z "$PROGEXT" && PROGEXT="" AC_SUBST(PROGEXT) -test -z "$CFLAGS" AC_SUBST(CFLAGS) -test -z "$LDFLAGS" AC_SUBST(LDFLAGS) - T1LIB_DATA_DIR="${datadir}/t1lib" dnl The following variables should be used -AC_SUBST(T1LIB_LT_CURRENT) -AC_SUBST(T1LIB_LT_REVISION) -AC_SUBST(T1LIB_LT_AGE) -AC_SUBST(T1LIB_DATA_DIR) -AC_SUBST(T1LIB_IDENTIFIER) -AC_SUBST(MAIN_TARGET) -AC_SUBST(MAIN_HEADER) -AC_SUBST(OPTIONS) -AC_SUBST(no_x) -AC_SUBST(CC) AC_SUBST(T1_AA_TYPE16) AC_SUBST(T1_AA_TYPE32) AC_SUBST(T1_AA_TYPE64) -AC_SUBST(XSUBDIRS) -AC_SUBST(T1LIBX_OBJS) -AC_SUBST(T1LIBX_SRCS) -AC_SUBST(T1LIBX_HEADERS) -AC_SUBST(XOBJS) - - -dnl **** Check for some programs and libraries **** AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CPP AC_PATH_XTRA -ICE_FIND_ATHENA -AM_PROG_LIBTOOL AC_PROG_INSTALL +AC_PROG_RANLIB -dnl **** Check for some compiler/system characteristics +sinclude(../../texk/kpathsea/withenable.ac) +dnl **** Check for some compiler/system characteristics AC_C_CHAR_UNSIGNED AC_CHECK_SIZEOF(char,0) AC_CHECK_SIZEOF(short,0) @@ -113,10 +37,8 @@ AC_CHECK_SIZEOF(void *,0) dnl **** Check for gcc strength-reduce bug **** - if test "x${GCC}" = "xyes" then -dnl We don'use CFLAGS="$CFLAGS" AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug, AC_TRY_RUN([ @@ -136,27 +58,7 @@ fi fi -dnl **** Check for underscore on external symbols **** - -AC_CACHE_CHECK("whether external symbols need an underscore prefix", - ac_cv_c_extern_prefix, -[saved_libs=$LIBS -LIBS="conftest_asm.s $LIBS" -cat > conftest_asm.s < we do it by hand: -if test "$no_x" = "yes" -then -CFLAGS="${CFLAGS} -DT1LIB_NO_X11_SUPPORT" -MAKEFILES="Makefile \ - lib/Makefile \ - lib/type1/Makefile \ - lib/t1lib/Makefile \ - type1afm/Makefile \ - examples/Makefile" -else -MAKEFILES="Makefile \ - lib/Makefile \ - lib/type1/Makefile \ - lib/t1lib/Makefile \ - xglyph/Makefile \ - type1afm/Makefile \ - examples/Makefile" -fi - - -AC_OUTPUT([ -$MAKEFILES -]) - - - -dnl echo " Do: 'make t1python-all' to compile the t1python-package." -dnl echo "" - -dnl Local Variables: -dnl comment-start: "dnl " -dnl comment-end: "" -dnl comment-start-skip: "\\bdnl\\b\\s *" -dnl compile-command: "autoconf" -dnl End: +AC_OUTPUT([Makefile]) diff -Naur xdvik-22.40l/libs/t1lib/examples/.dependencies xdvik-22.40n/libs/t1lib/examples/.dependencies --- xdvik-22.40l/libs/t1lib/examples/.dependencies Wed Apr 18 23:23:15 2001 +++ xdvik-22.40n/libs/t1lib/examples/.dependencies Thu Jan 1 00:00:00 1970 @@ -1,2 +0,0 @@ -subset.lo: subset.c ../lib/t1lib/t1lib.h -t1example1.lo: t1example1.c diff -Naur xdvik-22.40l/libs/t1lib/examples/CVS/Entries xdvik-22.40n/libs/t1lib/examples/CVS/Entries --- xdvik-22.40l/libs/t1lib/examples/CVS/Entries Sat Aug 31 22:50:34 2002 +++ xdvik-22.40n/libs/t1lib/examples/CVS/Entries Thu Jan 1 00:00:00 1970 @@ -1,7 +0,0 @@ -/.dependencies/1.2/Wed Apr 18 23:23:15 2001//Txdvik_22_40_STABLE -/FontDataBase/1.1.1.1/Wed Apr 18 14:24:05 2001//Txdvik_22_40_STABLE -/Makefile.in/1.2/Wed Apr 18 23:23:15 2001//Txdvik_22_40_STABLE -/subset.c/1.1.8.1/Sun Oct 14 12:30:23 2001//Txdvik_22_40_STABLE -/t1example1.c/1.2/Wed Apr 18 23:23:15 2001//Txdvik_22_40_STABLE -/t1lib.config/1.1.1.1/Wed Apr 18 14:24:05 2001//Txdvik_22_40_STABLE -D diff -Naur xdvik-22.40l/libs/t1lib/examples/CVS/Repository xdvik-22.40n/libs/t1lib/examples/CVS/Repository --- xdvik-22.40l/libs/t1lib/examples/CVS/Repository Sat Aug 31 22:50:34 2002 +++ xdvik-22.40n/libs/t1lib/examples/CVS/Repository Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -xdvik/libs/t1lib/examples diff -Naur xdvik-22.40l/libs/t1lib/examples/CVS/Root xdvik-22.40n/libs/t1lib/examples/CVS/Root --- xdvik-22.40l/libs/t1lib/examples/CVS/Root Sat Aug 31 22:50:34 2002 +++ xdvik-22.40n/libs/t1lib/examples/CVS/Root Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/t1lib/examples/CVS/Tag xdvik-22.40n/libs/t1lib/examples/CVS/Tag --- xdvik-22.40l/libs/t1lib/examples/CVS/Tag Sat Aug 31 23:06:36 2002 +++ xdvik-22.40n/libs/t1lib/examples/CVS/Tag Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/t1lib/examples/FontDataBase xdvik-22.40n/libs/t1lib/examples/FontDataBase --- xdvik-22.40l/libs/t1lib/examples/FontDataBase Wed Apr 18 14:24:05 2001 +++ xdvik-22.40n/libs/t1lib/examples/FontDataBase Thu Jan 1 00:00:00 1970 @@ -1,10 +0,0 @@ -8 -bchr.afm -bchri.afm -bchb.afm -bchbi.afm -dcr10.afm -dcti10.afm -dcbx10.afm -dcbxti10.afm - diff -Naur xdvik-22.40l/libs/t1lib/examples/Makefile.in xdvik-22.40n/libs/t1lib/examples/Makefile.in --- xdvik-22.40l/libs/t1lib/examples/Makefile.in Wed Apr 18 23:23:15 2001 +++ xdvik-22.40n/libs/t1lib/examples/Makefile.in Thu Jan 1 00:00:00 1970 @@ -1,112 +0,0 @@ -# Makefile.in -# -# This file is part of the t1lib-package! See documentation and Readme files -# of the t1lib-package for copyright restrictions. -# -# Targets provided: -# all (default) -# install -# uninstall -# clean -# -# Author: Rainer Menzner (Rainer.Menzner@web.de) -# Date: 10/16/1998 -# Last modified: 2001-04-01 -# - - -LIBTOOL = ../libtool -SHELL = /bin/sh -CC = @CC@ -CPP = @CPP@ -CFLAGS = @CFLAGS@ -OPTIONS = @OPTIONS@ -X_LIBS = @X_LIBS@ -TOPSRC = @top_srcdir@ -XPM_LIB = -lXpm -XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ -LDFLAGS = @LDFLAGS@ -LDLIBS = @LDLIBS@ -AR = ar rc -RANLIB = @RANLIB@ -RM = rm -f -X_CFLAGS = @X_CFLAGS@ -YACC = @YACC@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ - - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @top_srcdir@/ac-tools/mkinstalldirs -prefix = @prefix@ -exec_prefix = @exec_prefix@ -includedir = @includedir@ -bindir = @bindir@ -datadir = @datadir@ -libdir = @libdir@ -mandir = @mandir@/man1 -manext = .1 -no_x = @no_x@ - - -# targets to build - -INCDIR = -I../lib - -TARGET1 = t1example1 -TARGET2 = subset - -OBJS1 = \ - t1example1.lo - -SRCS1 = \ - t1example1.c - -OBJS2 = \ - subset.lo - -SRCS2 = \ - subset.c - -T1LIB = ../lib/libt1.la - -.SUFFIXES: .lo -.c.lo: - $(LIBTOOL) --mode=compile \ - $(CC) $(INCDIR) -c $(CPPFLAGS) $(CFLAGS) $< - -all: $(TARGET1) $(TARGET2) - - -$(TARGET1): $(OBJS1) ../lib/t1lib.h - $(LIBTOOL) --mode=link \ - $(CC) -o $(TARGET1) $(LDFLAGS) $(OBJS1) $(T1LIB) $(LDLIBS) - -$(TARGET2): $(OBJS2) ../lib/t1lib.h - $(LIBTOOL) --mode=link \ - $(CC) -o $(TARGET2) $(LDFLAGS) $(OBJS2) $(T1LIB) $(LDLIBS) - -.c.o: - $(LIBTOOL) --mode=compile \ - $(CC) $(INCDIR) -c $(CPPFLAGS) $(CFLAGS) $? - -.PHONY: clean - -dependencies: dummy - gcc -MM *.c | sed 's/\.o:/.lo:/g' > .dependencies - -clean: dummy - $(RM) $(TARGET1) $(TARGET2) *.o *.lo .libs/* *~ \#*\# *.log *.bak - -rmdir .libs - -install: dummy - -uninstall: dummy - -dummy: - - -# Dependencies of object files -include .dependencies diff -Naur xdvik-22.40l/libs/t1lib/examples/subset.c xdvik-22.40n/libs/t1lib/examples/subset.c --- xdvik-22.40l/libs/t1lib/examples/subset.c Sun Oct 14 12:30:23 2001 +++ xdvik-22.40n/libs/t1lib/examples/subset.c Thu Jan 1 00:00:00 1970 @@ -1,194 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: subset.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-20 - ----- Description: This file is part of t1lib. The program subset reads - a font file name and a string from the commandline - and creates a subset of the font which is sufficient - to display the string. It is an example of how to use - font subsetting. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#include -#include -/* Note: We include t1lib.h from lib/t1lib. That way the objectfile does only - need to be rebuild when the header itself changes and not each time the - library has been recompiled */ -#include "../lib/t1lib/t1lib.h" - - -void printusage( void); - - -int main(int argc, char *argv[]) -{ - - int i, j, result; - int realargs=0; - int logfile=0; - char mask[256]; - int flags=T1_SUBSET_DEFAULT; - char *subset=NULL; - unsigned long ofsize=0; - FILE *ofp=stdout; - - - if (argc==1){ - printusage(); - return(0); - } - - /* If we want to log anything, then log all */ - T1_SetLogLevel(T1LOG_DEBUG); - - realargs=argc-1; - - for (j=1; j [ ...] string\n"); - fprintf(stdout, "\n"); - fprintf(stdout, "Subset fontfile(s) according to `string' and write result to stdout (T1Lib-%s)!\n", - T1_GetLibIdent()); - fprintf(stdout, "Options: -l Write a log-file t1lib.log\n"); - fprintf(stdout, " -a Create ASCII-encrypted file (default)\n"); - fprintf(stdout, " -b Create Binary-enrypted file\n"); - fprintf(stdout, " -f Force reencoding of the font\n"); - fprintf(stdout, " -s Skip reencoding of the font\n"); -} - diff -Naur xdvik-22.40l/libs/t1lib/examples/t1example1.c xdvik-22.40n/libs/t1lib/examples/t1example1.c --- xdvik-22.40l/libs/t1lib/examples/t1example1.c Wed Apr 18 23:23:15 2001 +++ xdvik-22.40n/libs/t1lib/examples/t1example1.c Thu Jan 1 00:00:00 1970 @@ -1,39 +0,0 @@ -#include -#include -#include /* All needed declarations */ - -int main( void) -{ - - GLYPH *glyph; - int i; - - /* Set our environment to an existent config file directory */ - putenv( "T1LIB_CONFIG=./t1lib.config"); - - /* Pad bitmaps to 16 bits, the default being 8 bits */ - T1_SetBitmapPad( 16); - - /* Initialize t1lib and return if error occurs. No logfile will be - generated */ - if ((T1_InitLib(NO_LOGFILE)==NULL)){ - fprintf(stderr, "Initialization of t1lib failed\n"); - return(-1); - } - - /* For every font in the database, generate a glyph for the string - "Test" at 25 bp. Use Kerning. Then dump an ASCII representation - of the glyph to stdout */ - for( i=0; i .dependencies - -clean: dummy - -$(RM) *.lo *.o .libs/* - -$(RM) *~ *.bak \#*\# - -rmdir .libs - - -install: dummy - - -dummy: - - -# Dependencies of object files -include .dependencies diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/parseAFM.c xdvik-22.40n/libs/t1lib/lib/t1lib/parseAFM.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/parseAFM.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/parseAFM.c Thu Jan 1 00:00:00 1970 @@ -1,1292 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: parseAFM.c - ----- Author: Adobe Systems Inc., modifications by - Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-11-01 - ----- Description: This file is part of the t1-library. It is the original - parseAFM.h modified at a few points, especially for - reading MSDOS-style AFM files.. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -/* - * (C) 1988, 1989, 1990 by Adobe Systems Incorporated. All rights reserved. - * - * This file may be freely copied and redistributed as long as: - * 1) This entire notice continues to be included in the file, - * 2) If the file has been modified in any way, a notice of such - * modification is conspicuously indicated. - * - * PostScript, Display PostScript, and Adobe are registered trademarks of - * Adobe Systems Incorporated. - * - * ************************************************************************ - * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT - * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS - * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR - * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY - * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, - * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - * ************************************************************************ - */ - -/* parseAFM.c - * - * This file is used in conjuction with the parseAFM.h header file. - * This file contains several procedures that are used to parse AFM - * files. It is intended to work with an application program that needs - * font metric information. The program can be used as is by making a - * procedure call to "parseFile" (passing in the expected parameters) - * and having it fill in a data structure with the data from the - * AFM file, or an application developer may wish to customize this - * code. - * - * There is also a file, parseAFMclient.c, that is a sample application - * showing how to call the "parseFile" procedure and how to use the data - * after "parseFile" has returned. - * - * Please read the comments in parseAFM.h and parseAFMclient.c. - * - * History: - * original: DSM Thu Oct 20 17:39:59 PDT 1988 - * modified: DSM Mon Jul 3 14:17:50 PDT 1989 - * - added 'storageProblem' return code - * - fixed bug of not allocating extra byte for string duplication - * - fixed typos - * modified: DSM Tue Apr 3 11:18:34 PDT 1990 - * - added free(ident) at end of parseFile routine - * modified: DSM Tue Jun 19 10:16:29 PDT 1990 - * - changed (width == 250) to (width = 250) in initializeArray - */ - -#include -#include -#include -#include /* this seems to be necessary on some SCO-systems */ -#if !defined(_MSC_VER) -# include -#endif -#include -#include -#include "parseAFM.h" - -#define lineterm EOL /* line terminating character */ -#define normalEOF 1 /* return code from parsing routines used only */ - /* in this module */ -#define Space "space" /* used in string comparison to look for the width */ - /* of the space character to init the widths array */ -#define False "false" /* used in string comparison to check the value of */ - /* boolean keys (e.g. IsFixedPitch) */ - -#define MATCH(A,B) (strncmp((A),(B), MAX_NAME) == 0) - - - -/* Note: The functions token and linetoken are extended to be able - to parse AFM files with DOS-style line-ends under UNIX. I don't know - why AFM files which according to Adobe are explicitly intended to - be used under UNIX have MSDOS-style line ends. - - However, we parse the tokens based on the following atoms. This should - work on any system. -*/ -#define CR '\r' /* a carriage return */ -#define LF '\n' /* a linefeed, which is a newline under UNIX */ -#define CTRL_Z 0x1A /* some AFM files have this characters as an end - of file indicator. Who know why :) ? */ - - -/*************************** GLOBALS ***********************/ - -static char *ident = NULL; /* storage buffer for keywords */ - - -/* "shorts" for fast case statement - * The values of each of these enumerated items correspond to an entry in the - * table of strings defined below. Therefore, if you add a new string as - * new keyword into the keyStrings table, you must also add a corresponding - * parseKey AND it MUST be in the same position! - * - * IMPORTANT: since the sorting algorithm is a binary search, the strings of - * keywords must be placed in lexicographical order, below. [Therefore, the - * enumerated items are not necessarily in lexicographical order, depending - * on the name chosen. BUT, they must be placed in the same position as the - * corresponding key string.] The NOPE shall remain in the last position, - * since it does not correspond to any key string, and it is used in the - * "recognize" procedure to calculate how many possible keys there are. - */ - -typedef enum { - ASCENDER, CHARBBOX, CODE, COMPCHAR, CAPHEIGHT, COMMENT, - DESCENDER, ENCODINGSCHEME, ENDCHARMETRICS, ENDCOMPOSITES, - ENDFONTMETRICS, ENDKERNDATA, ENDKERNPAIRS, ENDTRACKKERN, - FAMILYNAME, FONTBBOX, FONTNAME, FULLNAME, ISFIXEDPITCH, - ITALICANGLE, KERNPAIR, KERNPAIRXAMT, LIGATURE, CHARNAME, - NOTICE, COMPCHARPIECE, STARTCHARMETRICS, STARTCOMPOSITES, - STARTFONTMETRICS, STARTKERNDATA, STARTKERNPAIRS, - STARTTRACKKERN, TRACKKERN, UNDERLINEPOSITION, - UNDERLINETHICKNESS, VERSION, XYWIDTH, XWIDTH, WEIGHT, XHEIGHT, - NOPE} PARSEKEY; - - -/* keywords for the system: - * This a table of all of the current strings that are vaild AFM keys. - * Each entry can be referenced by the appropriate parseKey value (an - * enumerated data type defined above). If you add a new keyword here, - * a corresponding parseKey MUST be added to the enumerated data type - * defined above, AND it MUST be added in the same position as the - * string is in this table. - * - * IMPORTANT: since the sorting algorithm is a binary search, the keywords - * must be placed in lexicographical order. And, NULL should remain at the - * end. - */ - -static char *keyStrings[] = { - "Ascender", "B", "C", "CC", "CapHeight", "Comment", - "Descender", "EncodingScheme", "EndCharMetrics", "EndComposites", - "EndFontMetrics", "EndKernData", "EndKernPairs", "EndTrackKern", - "FamilyName", "FontBBox", "FontName", "FullName", "IsFixedPitch", - "ItalicAngle", "KP", "KPX", "L", "N", - "Notice", "PCC", "StartCharMetrics", "StartComposites", - "StartFontMetrics", "StartKernData", "StartKernPairs", - "StartTrackKern", "TrackKern", "UnderlinePosition", - "UnderlineThickness", "Version", "W", "WX", "Weight", "XHeight", - NULL }; - -/*************************** PARSING ROUTINES **************/ - -/*************************** token *************************/ - -/* A "AFM File Conventions" tokenizer. That means that it will - * return the next token delimited by white space. See also - * the `linetoken' routine, which does a similar thing but - * reads all tokens until the next end-of-line. - */ -static char *token(stream) - FILE *stream; -{ - int ch, idx; - - /* skip over white space, instead of the systems EOL-character we check - explicitly for CR and LF as well as for ^Z. */ - while ((ch = fgetc(stream)) == ' ' || ch == CR || ch == LF || ch == CTRL_Z || - ch == ',' || ch == '\t' || ch == ';'); - - idx = 0; - - while (ch != EOF && ch != ' ' && ch != CR && ch != LF && - ch != CTRL_Z && ch != '\t' && ch != ':' && ch != ';'){ - ident[idx++] = ch; - ch = fgetc(stream); - } /* while */ - - if (ch == EOF && idx < 1) { - return ((char *)NULL); - } - if (idx >= 1 && ch != ':' ) { - ungetc(ch, stream); - } - if (idx < 1 ) { - ident[idx++] = ch; /* single-character token */ - } - ident[idx] = 0; - - return(ident); /* returns pointer to the token */ - -} /* token */ - - -/*************************** linetoken *************************/ - -/* "linetoken" will get read all tokens until the EOL character from - * the given stream. This is used to get any arguments that can be - * more than one word (like Comment lines and FullName). - */ - -static char *linetoken(stream) - FILE *stream; -{ - int ch, idx; - - while ((ch = fgetc(stream)) == ' ' || ch == '\t' ); - - idx = 0; - while (ch != EOF && ch != CR && ch != LF && ch != CTRL_Z) - { - ident[idx++] = ch; - ch = fgetc(stream); - } /* while */ - - ungetc(ch, stream); - ident[idx] = 0; - - return(ident); /* returns pointer to the token */ - -} /* linetoken */ - - -/*************************** recognize *************************/ - -/* This function tries to match a string to a known list of - * valid AFM entries (check the keyStrings array above). - * "ident" contains everything from white space through the - * next space, tab, or ":" character. - * - * The algorithm is a standard Knuth binary search. - */ - -static PARSEKEY recognize(ident) - register char *ident; -{ - int lower = 0, upper = (int) NOPE, midpoint=NOPE, cmpvalue; - BOOL found = T1LIB_FALSE; - - while ((upper >= lower) && !found) - { - midpoint = (lower + upper)/2; - if (keyStrings[midpoint] == NULL) break; - cmpvalue = strncmp(ident, keyStrings[midpoint], MAX_NAME); - if (cmpvalue == 0) found = T1LIB_TRUE; - else if (cmpvalue < 0) upper = midpoint - 1; - else lower = midpoint + 1; - } /* while */ - - if (found) return (PARSEKEY) midpoint; - else return NOPE; - -} /* recognize */ - - -/************************* parseGlobals *****************************/ - -/* This function is called by "parseFile". It will parse the AFM File - * up to the "StartCharMetrics" keyword, which essentially marks the - * end of the Global Font Information and the beginning of the character - * metrics information. - * - * If the caller of "parseFile" specified that it wanted the Global - * Font Information (as defined by the "AFM File Specification" - * document), then that information will be stored in the returned - * data structure. - * - * Any Global Font Information entries that are not found in a - * given file, will have the usual default initialization value - * for its type (i.e. entries of type int will be 0, etc). - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static BOOL parseGlobals(fp, gfi) - FILE *fp; - register GlobalFontInfo *gfi; -{ - BOOL cont = T1LIB_TRUE, save = (gfi != NULL); - int error = ok; - register char *keyword; - - while (cont) - { - keyword = token(fp); - - if (keyword == NULL) - /* Have reached an early and unexpected EOF. */ - /* Set flag and stop parsing */ - { - error = earlyEOF; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Global Font info section */ - /* without saving any of the data */ - switch (recognize(keyword)) - { - case STARTCHARMETRICS: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire global font info section, */ - /* saving the data */ - switch(recognize(keyword)) - { - case STARTFONTMETRICS: - keyword = token(fp); - gfi->afmVersion = (char *) malloc(strlen(keyword) + 1); - strcpy(gfi->afmVersion, keyword); - break; - case COMMENT: - keyword = linetoken(fp); - break; - case FONTNAME: - keyword = linetoken(fp); - gfi->fontName = (char *) malloc(strlen(keyword) + 1); - strcpy(gfi->fontName, keyword); - break; - case ENCODINGSCHEME: - keyword = linetoken(fp); - gfi->encodingScheme = (char *) - malloc(strlen(keyword) + 1); - strcpy(gfi->encodingScheme, keyword); - break; - case FULLNAME: - keyword = linetoken(fp); - gfi->fullName = (char *) malloc(strlen(keyword) + 1); - strcpy(gfi->fullName, keyword); - break; - case FAMILYNAME: - keyword = linetoken(fp); - gfi->familyName = (char *) malloc(strlen(keyword) + 1); - strcpy(gfi->familyName, keyword); - break; - case WEIGHT: - keyword = linetoken(fp); - gfi->weight = (char *) malloc(strlen(keyword) + 1); - strcpy(gfi->weight, keyword); - break; - case ITALICANGLE: - keyword = token(fp); - gfi->italicAngle = atof(keyword); - if (errno == ERANGE) error = parseError; - break; - case ISFIXEDPITCH: - keyword = token(fp); - if (MATCH(keyword, False)) - gfi->isFixedPitch = 0; - else - gfi->isFixedPitch = 1; - break; - case UNDERLINEPOSITION: - keyword = token(fp); - gfi->underlinePosition = atoi(keyword); - break; - case UNDERLINETHICKNESS: - keyword = token(fp); - gfi->underlineThickness = atoi(keyword); - break; - case VERSION: - keyword = linetoken(fp); - gfi->version = (char *) malloc(strlen(keyword) + 1); - strcpy(gfi->version, keyword); - break; - case NOTICE: - keyword = linetoken(fp); - gfi->notice = (char *) malloc(strlen(keyword) + 1); - strcpy(gfi->notice, keyword); - break; - case FONTBBOX: - keyword = token(fp); - gfi->fontBBox.llx = atoi(keyword); - keyword = token(fp); - gfi->fontBBox.lly = atoi(keyword); - keyword = token(fp); - gfi->fontBBox.urx = atoi(keyword); - keyword = token(fp); - gfi->fontBBox.ury = atoi(keyword); - break; - case CAPHEIGHT: - keyword = token(fp); - gfi->capHeight = atoi(keyword); - break; - case XHEIGHT: - keyword = token(fp); - gfi->xHeight = atoi(keyword); - break; - case DESCENDER: - keyword = token(fp); - gfi->descender = atoi(keyword); - break; - case ASCENDER: - keyword = token(fp); - gfi->ascender = atoi(keyword); - break; - case STARTCHARMETRICS: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - return(error); - -} /* parseGlobals */ - - - -/************************* initializeArray ************************/ - -/* Unmapped character codes are (at Adobe Systems) assigned the - * width of the space character (if one exists) else they get the - * value of 250 ems. This function initializes all entries in the - * char widths array to have this value. Then any mapped character - * codes will be replaced with the width of the appropriate character - * when parsing the character metric section. - - * This function parses the Character Metrics Section looking - * for a space character (by comparing character names). If found, - * the width of the space character will be used to initialize the - * values in the array of character widths. - * - * Before returning, the position of the read/write pointer of the - * file is reset to be where it was upon entering this function. - */ - -/* We comment out the following function since it is not needed in t1lib - and we don't want compiler warnings */ -/* -static int initializeArray(fp, cwi) - FILE *fp; - register int *cwi; -{ - BOOL cont = T1LIB_TRUE, found = T1LIB_FALSE; - long opos = ftell(fp); - int code = 0, width = 0, i = 0, error = 0; - register char *keyword; - - while (cont) - { - keyword = token(fp); - if (keyword == NULL) - { - error = earlyEOF; - break; - } - switch(recognize(keyword)) - { - case COMMENT: - keyword = linetoken(fp); - break; - case CODE: - code = atoi(token(fp)); - break; - case XWIDTH: - width = atoi(token(fp)); - break; - case CHARNAME: - keyword = token(fp); - if (MATCH(keyword, Space)) - { - cont = T1LIB_FALSE; - found = T1LIB_TRUE; - } - break; - case ENDCHARMETRICS: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } - } - - if (!found) - width = 250; - - for (i = 0; i < 256; ++i) - cwi[i] = width; - - fseek(fp, opos, 0); - - return(error); - -} -*/ - -/************************* parseCharWidths **************************/ - -/* This function is called by "parseFile". It will parse the AFM File - * up to the "EndCharMetrics" keyword. It will save the character - * width info (as opposed to all of the character metric information) - * if requested by the caller of parseFile. Otherwise, it will just - * parse through the section without saving any information. - * - * If data is to be saved, parseCharWidths is passed in a pointer - * to an array of widths that has already been initialized by the - * standard value for unmapped character codes. This function parses - * the Character Metrics section only storing the width information - * for the encoded characters into the array using the character code - * as the index into that array. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseCharWidths(fp, cwi) - FILE *fp; - register int *cwi; -{ - BOOL cont = T1LIB_TRUE, save = (cwi != NULL); - int pos = 0, error = ok; - register char *keyword; - - while (cont) - { - keyword = token(fp); - /* Have reached an early and unexpected EOF. */ - /* Set flag and stop parsing */ - if (keyword == NULL) - { - error = earlyEOF; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Char Metrics section without */ - /* saving any of the data*/ - switch (recognize(keyword)) - { - case ENDCHARMETRICS: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire char metrics section, saving */ - /* only the char x-width info */ - switch(recognize(keyword)) - { - case COMMENT: - keyword = linetoken(fp); - break; - case CODE: - keyword = token(fp); - pos = atoi(keyword); - break; - case XYWIDTH: - /* PROBLEM: Should be no Y-WIDTH when doing "quick & dirty" */ - keyword = token(fp); keyword = token(fp); /* eat values */ - error = parseError; - break; - case XWIDTH: - keyword = token(fp); - if (pos >= 0) /* ignore unmapped chars */ - cwi[pos] = atoi(keyword); - break; - case ENDCHARMETRICS: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - case CHARNAME: /* eat values (so doesn't cause parseError) */ - keyword = token(fp); - break; - case CHARBBOX: - keyword = token(fp); keyword = token(fp); - keyword = token(fp); keyword = token(fp); - break; - case LIGATURE: - keyword = token(fp); keyword = token(fp); - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - return(error); - -} /* parseCharWidths */ - - -/************************* parseCharMetrics ************************/ - -/* This function is called by parseFile if the caller of parseFile - * requested that all character metric information be saved - * (as opposed to only the character width information). - * - * parseCharMetrics is passed in a pointer to an array of records - * to hold information on a per character basis. This function - * parses the Character Metrics section storing all character - * metric information for the ALL characters (mapped and unmapped) - * into the array. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseCharMetrics(fp, fi) - FILE *fp; - register FontInfo *fi; -{ - BOOL cont = T1LIB_TRUE, firstTime = T1LIB_TRUE; - int error = ok, count = 0; - register CharMetricInfo *temp = fi->cmi; - register char *keyword; - - while (cont) - { - keyword = token(fp); - if (keyword == NULL) - { - error = earlyEOF; - break; /* get out of loop */ - } - switch(recognize(keyword)) - { - case COMMENT: - keyword = linetoken(fp); - break; - case CODE: - if (count < fi->numOfChars) - { - if (firstTime) firstTime = T1LIB_FALSE; - else temp++; - temp->code = atoi(token(fp)); - count++; - } - else - { - error = parseError; - cont = T1LIB_FALSE; - } - break; - case XYWIDTH: - temp->wx = atoi(token(fp)); - temp->wy = atoi(token(fp)); - break; - case XWIDTH: - temp->wx = atoi(token(fp)); - break; - case CHARNAME: - keyword = token(fp); - temp->name = (char *) malloc(strlen(keyword) + 1); - strcpy(temp->name, keyword); - break; - case CHARBBOX: - temp->charBBox.llx = atoi(token(fp)); - temp->charBBox.lly = atoi(token(fp)); - temp->charBBox.urx = atoi(token(fp)); - temp->charBBox.ury = atoi(token(fp)); - break; - case LIGATURE: { - Ligature **tail = &(temp->ligs); - Ligature *node = *tail; - - if (*tail != NULL) - { - while (node->next != NULL) - node = node->next; - tail = &(node->next); - } - - *tail = (Ligature *) calloc(1, sizeof(Ligature)); - keyword = token(fp); - (*tail)->succ = (char *) malloc(strlen(keyword) + 1); - strcpy((*tail)->succ, keyword); - keyword = token(fp); - (*tail)->lig = (char *) malloc(strlen(keyword) + 1); - strcpy((*tail)->lig, keyword); - break; } - case ENDCHARMETRICS: - cont = T1LIB_FALSE;; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if ((error == ok) && (count != fi->numOfChars)) - error = parseError; - - return(error); - -} /* parseCharMetrics */ - - - -/************************* parseTrackKernData ***********************/ - -/* This function is called by "parseFile". It will parse the AFM File - * up to the "EndTrackKern" or "EndKernData" keywords. It will save the - * track kerning data if requested by the caller of parseFile. - * - * parseTrackKernData is passed in a pointer to the FontInfo record. - * If data is to be saved, the FontInfo record will already contain - * a valid pointer to storage for the track kerning data. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseTrackKernData(fp, fi) - FILE *fp; - register FontInfo *fi; -{ - BOOL cont = T1LIB_TRUE, save = (fi->tkd != NULL); - int pos = 0, error = ok, tcount = 0; - register char *keyword; - - while (cont) - { - keyword = token(fp); - - if (keyword == NULL) - { - error = earlyEOF; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Track Kerning Data */ - /* section without saving any of the data */ - switch(recognize(keyword)) - { - case ENDTRACKKERN: - case ENDKERNDATA: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire Track Kerning Data section, */ - /* saving the data */ - switch(recognize(keyword)) - { - case COMMENT: - keyword = linetoken(fp); - break; - case TRACKKERN: - if (tcount < fi->numOfTracks) - { - keyword = token(fp); - fi->tkd[pos].degree = atoi(keyword); - keyword = token(fp); - fi->tkd[pos].minPtSize = atof(keyword); - if (errno == ERANGE) error = parseError; - keyword = token(fp); - fi->tkd[pos].minKernAmt = atof(keyword); - if (errno == ERANGE) error = parseError; - keyword = token(fp); - fi->tkd[pos].maxPtSize = atof(keyword); - if (errno == ERANGE) error = parseError; - keyword = token(fp); - fi->tkd[pos++].maxKernAmt = atof(keyword); - if (errno == ERANGE) error = parseError; - tcount++; - } - else - { - error = parseError; - cont = T1LIB_FALSE; - } - break; - case ENDTRACKKERN: - case ENDKERNDATA: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if (error == ok && tcount != fi->numOfTracks) - error = parseError; - - return(error); - -} /* parseTrackKernData */ - - -/************************* parsePairKernData ************************/ - -/* This function is called by "parseFile". It will parse the AFM File - * up to the "EndKernPairs" or "EndKernData" keywords. It will save - * the pair kerning data if requested by the caller of parseFile. - * - * parsePairKernData is passed in a pointer to the FontInfo record. - * If data is to be saved, the FontInfo record will already contain - * a valid pointer to storage for the pair kerning data. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parsePairKernData(fp, fi) - FILE *fp; - register FontInfo *fi; -{ - BOOL cont = T1LIB_TRUE, save = (fi->pkd != NULL); - int pos = 0, error = ok, pcount = 0; - register char *keyword; - - while (cont) - { - keyword = token(fp); - - if (keyword == NULL) - { - error = earlyEOF; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Pair Kerning Data */ - /* section without saving any of the data */ - switch(recognize(keyword)) - { - case ENDKERNPAIRS: - case ENDKERNDATA: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire Pair Kerning Data section, */ - /* saving the data */ - switch(recognize(keyword)) - { - case COMMENT: - keyword = linetoken(fp); - break; - case KERNPAIR: - if (pcount < fi->numOfPairs) - { - keyword = token(fp); - fi->pkd[pos].name1 = (char *) - malloc(strlen(keyword) + 1); - strcpy(fi->pkd[pos].name1, keyword); - keyword = token(fp); - fi->pkd[pos].name2 = (char *) - malloc(strlen(keyword) + 1); - strcpy(fi->pkd[pos].name2, keyword); - keyword = token(fp); - fi->pkd[pos].xamt = atoi(keyword); - keyword = token(fp); - fi->pkd[pos++].yamt = atoi(keyword); - pcount++; - } - else - { - error = parseError; - cont = T1LIB_FALSE; - } - break; - case KERNPAIRXAMT: - if (pcount < fi->numOfPairs) - { - keyword = token(fp); - fi->pkd[pos].name1 = (char *) - malloc(strlen(keyword) + 1); - strcpy(fi->pkd[pos].name1, keyword); - keyword = token(fp); - fi->pkd[pos].name2 = (char *) - malloc(strlen(keyword) + 1); - strcpy(fi->pkd[pos].name2, keyword); - keyword = token(fp); - fi->pkd[pos++].xamt = atoi(keyword); - pcount++; - } - else - { - error = parseError; - cont = T1LIB_FALSE; - } - break; - case ENDKERNPAIRS: - case ENDKERNDATA: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if (error == ok && pcount != fi->numOfPairs) - error = parseError; - - return(error); - -} /* parsePairKernData */ - - -/************************* parseCompCharData **************************/ - -/* This function is called by "parseFile". It will parse the AFM File - * up to the "EndComposites" keyword. It will save the composite - * character data if requested by the caller of parseFile. - * - * parseCompCharData is passed in a pointer to the FontInfo record, and - * a boolean representing if the data should be saved. - * - * This function will create the appropriate amount of storage for - * the composite character data and store a pointer to the storage - * in the FontInfo record. - * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by - * parseFile to determine if there is more file to parse. - */ - -static int parseCompCharData(fp, fi) - FILE *fp; - register FontInfo *fi; -{ - BOOL cont = T1LIB_TRUE, firstTime = T1LIB_TRUE, save = (fi->ccd != NULL); - int pos = 0, j = 0, error = ok, ccount = 0, pcount = 0; - register char *keyword; - - while (cont) - { - keyword = token(fp); - if (keyword == NULL) - /* Have reached an early and unexpected EOF. */ - /* Set flag and stop parsing */ - { - error = earlyEOF; - break; /* get out of loop */ - } - if (ccount > fi->numOfComps) - { - error = parseError; - break; /* get out of loop */ - } - if (!save) - /* get tokens until the end of the Composite Character info */ - /* section without saving any of the data */ - switch(recognize(keyword)) - { - case ENDCOMPOSITES: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - default: - break; - } /* switch */ - else - /* otherwise parse entire Composite Character info section, */ - /* saving the data */ - switch(recognize(keyword)) - { - case COMMENT: - keyword = linetoken(fp); - break; - case COMPCHAR: - if (ccount < fi->numOfComps) - { - keyword = token(fp); - if (pcount != fi->ccd[pos].numOfPieces) - error = parseError; - pcount = 0; - if (firstTime) firstTime = T1LIB_FALSE; - else pos++; - fi->ccd[pos].ccName = (char *) - malloc(strlen(keyword) + 1); - strcpy(fi->ccd[pos].ccName, keyword); - keyword = token(fp); - fi->ccd[pos].numOfPieces = atoi(keyword); - fi->ccd[pos].pieces = (Pcc *) - calloc(fi->ccd[pos].numOfPieces, sizeof(Pcc)); - j = 0; - ccount++; - } - else - { - error = parseError; - cont = T1LIB_FALSE; - } - break; - case COMPCHARPIECE: - if (pcount < fi->ccd[pos].numOfPieces) - { - keyword = token(fp); - fi->ccd[pos].pieces[j].pccName = (char *) - malloc(strlen(keyword) + 1); - strcpy(fi->ccd[pos].pieces[j].pccName, keyword); - keyword = token(fp); - fi->ccd[pos].pieces[j].deltax = atoi(keyword); - keyword = token(fp); - fi->ccd[pos].pieces[j++].deltay = atoi(keyword); - pcount++; - } - else - error = parseError; - break; - case ENDCOMPOSITES: - cont = T1LIB_FALSE; - break; - case ENDFONTMETRICS: - cont = T1LIB_FALSE; - error = normalEOF; - break; - case NOPE: - default: - error = parseError; - break; - } /* switch */ - } /* while */ - - if (error == ok && ccount != fi->numOfComps) - error = parseError; - - return(error); - -} /* parseCompCharData */ - - - - -/*************************** 'PUBLIC' FUNCTION ********************/ - - -/*************************** parseFile *****************************/ - -/* parseFile is the only 'public' procedure available. It is called - * from an application wishing to get information from an AFM file. - * The caller of this function is responsible for locating and opening - * an AFM file and handling all errors associated with that task. - * - * parseFile expects 3 parameters: a vaild file pointer, a pointer - * to a (FontInfo *) variable (for which storage will be allocated and - * the data requested filled in), and a mask specifying which - * data from the AFM File should be saved in the FontInfo structure. - * - * The file will be parsed and the requested data will be stored in - * a record of type FontInfo (refer to ParseAFM.h). - * - * parseFile returns an error code as defined in parseAFM.h. - * - * The position of the read/write pointer associated with the file - * pointer upon return of this function is undefined. - */ - -/* Note: function renamed to T1lib_parseFile in order to avoid name clushes - with other libraries that also use the Adobe parseAFM-package (RMz) */ -int T1lib_parseFile (fp, fi, flags) - FILE *fp; - FontInfo **fi; - FLAGS flags; -{ - - int code = ok; /* return code from each of the parsing routines */ - int error = ok; /* used as the return code from this function */ - - register char *keyword; /* used to store a token */ - - - /* storage data for the global variable ident */ - ident = (char *) calloc(MAX_NAME, sizeof(char)); - if (ident == NULL) {error = storageProblem; return(error);} - - (*fi) = (FontInfo *) calloc(1, sizeof(FontInfo)); - if ((*fi) == NULL) {error = storageProblem; return(error);} - - if (flags & P_G) - { - (*fi)->gfi = (GlobalFontInfo *) calloc(1, sizeof(GlobalFontInfo)); - if ((*fi)->gfi == NULL) {error = storageProblem; return(error);} - } - - /* The AFM File begins with Global Font Information. This section */ - /* will be parsed whether or not information should be saved. */ - code = parseGlobals(fp, (*fi)->gfi); - - if (code < 0) error = code; - - /* The Global Font Information is followed by the Character Metrics */ - /* section. Which procedure is used to parse this section depends on */ - /* how much information should be saved. If all of the metrics info */ - /* is wanted, parseCharMetrics is called. If only the character widths */ - /* is wanted, parseCharWidths is called. parseCharWidths will also */ - /* be called in the case that no character data is to be saved, just */ - /* to parse through the section. */ - - if ((code != normalEOF) && (code != earlyEOF)) - { - (*fi)->numOfChars = atoi(token(fp)); - if (flags & (P_M ^ P_W)) - { - (*fi)->cmi = (CharMetricInfo *) - calloc((*fi)->numOfChars, sizeof(CharMetricInfo)); - if ((*fi)->cmi == NULL) {error = storageProblem; return(error);} - code = parseCharMetrics(fp, *fi); - } - else - { - if (flags & P_W) - { - (*fi)->cwi = (int *) calloc(256, sizeof(int)); - if ((*fi)->cwi == NULL) - { - error = storageProblem; - return(error); - } - } - /* parse section regardless */ - code = parseCharWidths(fp, (*fi)->cwi); - } /* else */ - } /* if */ - - if ((error != earlyEOF) && (code < 0)) error = code; - - /* The remaining sections of the AFM are optional. This code will */ - /* look at the next keyword in the file to determine what section */ - /* is next, and then allocate the appropriate amount of storage */ - /* for the data (if the data is to be saved) and call the */ - /* appropriate parsing routine to parse the section. */ - - while ((code != normalEOF) && (code != earlyEOF)) { - keyword = token(fp); - if (keyword == NULL) - /* Have reached an early and unexpected EOF. */ - /* Set flag and stop parsing */ - { - code = earlyEOF; - break; /* get out of loop */ - } - switch(recognize(keyword)) - { - /* this case has been added for t1lib because otherwise comment line - between (i.e., outside) the main sections would lead to parse - errors. The Adobe spec does not seem to forbid comments at - such locations (2001-05-14, RMz) */ - case COMMENT: - keyword = linetoken(fp); - break; - case STARTKERNDATA: - break; - case ENDKERNDATA: - break; - case STARTTRACKKERN: - keyword = token(fp); - if (flags & P_T) - { - (*fi)->numOfTracks = atoi(keyword); - (*fi)->tkd = (TrackKernData *) - calloc((*fi)->numOfTracks, sizeof(TrackKernData)); - if ((*fi)->tkd == NULL) - { - error = storageProblem; - return(error); - } - } /* if */ - code = parseTrackKernData(fp, *fi); - break; - case STARTKERNPAIRS: - keyword = token(fp); - if (flags & P_P) - { - (*fi)->numOfPairs = atoi(keyword); - (*fi)->pkd = (PairKernData *) - calloc((*fi)->numOfPairs, sizeof(PairKernData)); - if ((*fi)->pkd == NULL) - { - error = storageProblem; - return(error); - } - } /* if */ - code = parsePairKernData(fp, *fi); - break; - case STARTCOMPOSITES: - keyword = token(fp); - if (flags & P_C) - { - (*fi)->numOfComps = atoi(keyword); - (*fi)->ccd = (CompCharData *) - calloc((*fi)->numOfComps, sizeof(CompCharData)); - if ((*fi)->ccd == NULL) - { - error = storageProblem; - return(error); - } - } /* if */ - code = parseCompCharData(fp, *fi); - break; - case ENDFONTMETRICS: - code = normalEOF; - break; - case NOPE: - default: - code = parseError; - break; - } /* switch */ - - if ((error != earlyEOF) && (code < 0)) error = code; - - } /* while */ - - if ((error != earlyEOF) && (code < 0)) error = code; - - if (ident != NULL) { free(ident); ident = NULL; } - - return(error); - -} /* parseFile */ diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/parseAFM.h xdvik-22.40n/libs/t1lib/lib/t1lib/parseAFM.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/parseAFM.h Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/parseAFM.h Thu Jan 1 00:00:00 1970 @@ -1,354 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: parseAFM.h - ----- Author: Adobe Systems Inc., modifications by - Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It is the original - parseAFM.h modified at a few points. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -/* - * (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved. - * - * This file may be freely copied and redistributed as long as: - * 1) This entire notice continues to be included in the file, - * 2) If the file has been modified in any way, a notice of such - * modification is conspicuously indicated. - * - * PostScript, Display PostScript, and Adobe are registered trademarks of - * Adobe Systems Incorporated. - * - * ************************************************************************ - * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT - * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS - * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR - * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY - * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, - * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - * ************************************************************************ - */ - -/* ParseAFM.h - * - * This header file is used in conjuction with the parseAFM.c file. - * Together these files provide the functionality to parse Adobe Font - * Metrics files and store the information in predefined data structures. - * It is intended to work with an application program that needs font metric - * information. The program can be used as is by making a procedure call to - * parse an AFM file and have the data stored, or an application developer - * may wish to customize the code. - * - * This header file defines the data structures used as well as the key - * strings that are currently recognized by this version of the AFM parser. - * This program is based on the document "Adobe Font Metrics Files, - * Specification Version 2.0". - * - * AFM files are separated into distinct sections of different data. Because - * of this, the parseAFM program can parse a specified file to only save - * certain sections of information based on the application's needs. A record - * containing the requested information will be returned to the application. - * - * AFM files are divided into five sections of data: - * 1) The Global Font Information - * 2) The Character Metrics Information - * 3) The Track Kerning Data - * 4) The Pair-Wise Kerning Data - * 5) The Composite Character Data - * - * Basically, the application can request any of these sections independent - * of what other sections are requested. In addition, in recognizing that - * many applications will want ONLY the x-width of characters and not all - * of the other character metrics information, there is a way to receive - * only the width information so as not to pay the storage cost for the - * unwanted data. An application should never request both the - * "quick and dirty" char metrics (widths only) and the Character Metrics - * Information since the Character Metrics Information will contain all - * of the character widths as well. - * - * There is a procedure in parseAFM.c, called parseFile, that can be - * called from any application wishing to get information from the AFM File. - * This procedure expects 3 parameters: a vaild file descriptor, a pointer - * to a (FontInfo *) variable (for which space will be allocated and then - * will be filled in with the data requested), and a mask specifying - * which data from the AFM File should be saved in the FontInfo structure. - * - * The flags that can be used to set the appropriate mask are defined below. - * In addition, several commonly used masks have already been defined. - * - * History: - * original: DSM Thu Oct 20 17:39:59 PDT 1988 - * modified: DSM Mon Jul 3 14:17:50 PDT 1989 - * - added 'storageProblem' return code - * - fixed typos - */ - -#include - - - -/* your basic constants */ -#define T1LIB_TRUE 1 -#define T1LIB_FALSE 0 -#define EOL '\n' /* end-of-line indicator */ -#define MAX_NAME 4096 /* max length for identifiers */ -#define BOOL int -#define FLAGS int - - - -/* Flags that can be AND'ed together to specify exactly what - * information from the AFM file should be saved. - */ -#define P_G 0x01 /* 0000 0001 */ /* Global Font Info */ -#define P_W 0x02 /* 0000 0010 */ /* Character Widths ONLY */ -#define P_M 0x06 /* 0000 0110 */ /* All Char Metric Info */ -#define P_P 0x08 /* 0000 1000 */ /* Pair Kerning Info */ -#define P_T 0x10 /* 0001 0000 */ /* Track Kerning Info */ -#define P_C 0x20 /* 0010 0000 */ /* Composite Char Info */ - - -/* Commonly used flags - */ -#define P_GW (P_G | P_W) -#define P_GM (P_G | P_M) -#define P_GMP (P_G | P_M | P_P) -#define P_GMK (P_G | P_M | P_P | P_T) -#define P_ALL (P_G | P_M | P_P | P_T | P_C) - - - -/* Possible return codes from the parseFile procedure. - * - * ok means there were no problems parsing the file. - * - * parseError means that there was some kind of parsing error, but the - * parser went on. This could include problems like the count for any given - * section does not add up to how many entries there actually were, or - * there was a key that was not recognized. The return record may contain - * vaild data or it may not. - * - * earlyEOF means that an End of File was encountered before expected. This - * may mean that the AFM file had been truncated, or improperly formed. - * - * storageProblem means that there were problems allocating storage for - * the data structures that would have contained the AFM data. - */ -#define ok 0 -#define parseError -1 -#define earlyEOF -2 -#define storageProblem -3 - - - -/************************* TYPES *********************************/ -/* Below are all of the data structure definitions. These structures - * try to map as closely as possible to grouping and naming of data - * in the AFM Files. - */ - - -/* Bounding box definition. Used for the Font BBox as well as the - * Character BBox. - */ -typedef struct -{ - int llx; /* lower left x-position */ - int lly; /* lower left y-position */ - int urx; /* upper right x-position */ - int ury; /* upper right y-position */ -} BBox; - - -/* Global Font information. - * The key that each field is associated with is in comments. For an - * explanation about each key and its value please refer to the AFM - * documentation (full title & version given above). - */ -typedef struct -{ - char *afmVersion; /* key: StartFontMetrics */ - char *fontName; /* key: FontName */ - char *fullName; /* key: FullName */ - char *familyName; /* key: FamilyName */ - char *weight; /* key: Weight */ - float italicAngle; /* key: ItalicAngle */ - BOOL isFixedPitch; /* key: IsFixedPitch */ - BBox fontBBox; /* key: FontBBox */ - int underlinePosition; /* key: UnderlinePosition */ - int underlineThickness; /* key: UnderlineThickness */ - char *version; /* key: Version */ - char *notice; /* key: Notice */ - char *encodingScheme; /* key: EncodingScheme */ - int capHeight; /* key: CapHeight */ - int xHeight; /* key: XHeight */ - int ascender; /* key: Ascender */ - int descender; /* key: Descender */ -} GlobalFontInfo; - - -/* Ligature definition is a linked list since any character can have - * any number of ligatures. - */ -typedef struct _t_ligature -{ - char *succ, *lig; - struct _t_ligature *next; -} Ligature; - - -/* Character Metric Information. This structure is used only if ALL - * character metric information is requested. If only the character - * widths is requested, then only an array of the character x-widths - * is returned. - * - * The key that each field is associated with is in comments. For an - * explanation about each key and its value please refer to the - * Character Metrics section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - int code, /* key: C */ - wx, /* key: WX */ - wy; /* together wx and wy are associated with key: W */ - char *name; /* key: N */ - BBox charBBox; /* key: B */ - Ligature *ligs; /* key: L (linked list; not a fixed number of Ls */ -} CharMetricInfo; - - -/* Track kerning data structure. - * The fields of this record are the five values associated with every - * TrackKern entry. - * - * For an explanation about each value please refer to the - * Track Kerning section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - int degree; - float minPtSize, - minKernAmt, - maxPtSize, - maxKernAmt; -} TrackKernData; - - -/* Pair Kerning data structure. - * The fields of this record are the four values associated with every - * KP entry. For KPX entries, the yamt will be zero. - * - * For an explanation about each value please refer to the - * Pair Kerning section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - char *name1; - char *name2; - int xamt, - yamt; -} PairKernData; - - -/* PCC is a piece of a composite character. This is a sub structure of a - * compCharData described below. - * These fields will be filled in with the values from the key PCC. - * - * For an explanation about each key and its value please refer to the - * Composite Character section of the AFM documentation (full title - * & version given above). - */ -typedef struct -{ - char *pccName; - int deltax, - deltay; -} Pcc; - - -/* Composite Character Information data structure. - * The fields ccName and numOfPieces are filled with the values associated - * with the key CC. The field pieces points to an array (size = numOfPieces) - * of information about each of the parts of the composite character. That - * array is filled in with the values from the key PCC. - * - * For an explanation about each key and its value please refer to the - * Composite Character section of the AFM documentation (full title - * & version given above). - - structure extended for use with t1lib. The fields "width" and bbox store - the composite characters escapement and its bounding box (2001-05-027, RMz) - */ -typedef struct -{ - int wx; /* these two will be filled by T1_LoadFont() */ - BBox charBBox; - char *ccName; - int numOfPieces; - Pcc *pieces; -} CompCharData; - - -/* FontInfo - * Record type containing pointers to all of the other data - * structures containing information about a font. - * A a record of this type is filled with data by the - * parseFile function. - */ -typedef struct -{ - GlobalFontInfo *gfi; /* ptr to a GlobalFontInfo record */ - int *cwi; /* ptr to 256 element array of just char widths */ - int numOfChars; /* number of entries in char metrics array */ - CharMetricInfo *cmi; /* ptr to char metrics array */ - int numOfTracks; /* number to entries in track kerning array */ - TrackKernData *tkd; /* ptr to track kerning array */ - int numOfPairs; /* number to entries in pair kerning array */ - PairKernData *pkd; /* ptr to pair kerning array */ - int numOfComps; /* number to entries in comp char array */ - CompCharData *ccd; /* ptr to comp char array */ -} FontInfo; - - - -/************************* PROCEDURES ****************************/ - -/* Call this procedure to do the grunt work of parsing an AFM file. - * - * "fp" should be a valid file pointer to an AFM file. - * - * "fi" is a pointer to a pointer to a FontInfo record sturcture - * (defined above). Storage for the FontInfo structure will be - * allocated in parseFile and the structure will be filled in - * with the requested data from the AFM File. - * - * "flags" is a mask with bits set representing what data should - * be saved. Defined above are valid flags that can be used to set - * the mask, as well as a few commonly used masks. - * - * The possible return codes from parseFile are defined above. - */ - -extern int T1lib_parseFile ( FILE *fp, FontInfo **fi, FLAGS flags ); diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/sysconf.h.in xdvik-22.40n/libs/t1lib/lib/t1lib/sysconf.h.in --- xdvik-22.40l/libs/t1lib/lib/t1lib/sysconf.h.in Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/sysconf.h.in Thu Jan 1 00:00:00 1970 @@ -1,40 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: sysconf.h.in - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. Some system - dependent definitions are stored here. sysconf.h - is generated from this file automatically by the - configure-script. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#undef __CHAR_UNSIGNED__ -#define SIZEOF_CHAR 0 -#define SIZEOF_SHORT 0 -#define SIZEOF_INT 0 -#define SIZEOF_LONG 0 -#define SIZEOF_LONG_LONG 0 -#define SIZEOF_FLOAT 0 -#define SIZEOF_DOUBLE 0 -#define SIZEOF_LONG_DOUBLE 0 -#define SIZEOF_VOID_P 0 diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1aaset.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1aaset.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1aaset.c Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1aaset.c Thu Jan 1 00:00:00 1970 @@ -1,1676 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1aaset.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - Subsampling based on code by Raph Levien (raph@acm.org) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - functions for antialiased setting of characters - and strings of characters. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1AASET_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" - -#include "t1types.h" -#include "t1extern.h" -#include "t1aaset.h" -#include "t1set.h" -#include "t1load.h" -#include "t1finfo.h" -#include "t1misc.h" -#include "t1base.h" -#include "t1outline.h" - - -#define DEFAULTBPP 8 - - -/* As a fall back */ -#ifndef T1_AA_TYPE16 -#define T1_AA_TYPE16 short -#endif -#ifndef T1_AA_TYPE32 -#define T1_AA_TYPE32 int -#endif - - -/* In the following arrays take the gray values. Entry 0 is associated - with the white (background) value and the max entry is the - black (foreground) value. */ -static unsigned T1_AA_TYPE32 gv[5]={0,0,0,0,0}; -static unsigned T1_AA_TYPE32 gv_h[17]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -static unsigned T1_AA_TYPE32 gv_n[2]={0,0}; - -static int T1aa_level=T1_AA_LOW; /* The default value */ -static T1_AA_TYPE32 T1aa_lut[625]; -static int T1aa_count[256]; -static T1_AA_TYPE32 T1aa_h_lut[289]; -static int T1aa_h_count[256]; -static T1_AA_TYPE32 T1aa_n_lut[64]; - -/* This global is for querying the current bg from other parts - of t1lib */ -unsigned T1_AA_TYPE32 T1aa_bg=0; - -/* The limit values for smart antialiasing */ -float T1aa_smartlimit1=T1_AA_SMARTLIMIT1; -float T1aa_smartlimit2=T1_AA_SMARTLIMIT2; -int T1aa_SmartOn=0; /* We do not enable smart AA by default */ - -/* T1_AAInit: This function must be called whenever the T1aa_gray_val - or T1aa_bpp variables change, or the level changes. */ -static int T1_AAInit ( int level ) -{ - int i; - int i0, i1, i2, i3; - int movelow=0, movehigh=0, indlow=0, indhigh=0; - - /* Note: movelow, movehigh, indlow and indhigh take care for proper - byte swapping in dependence of endianess for level=4 */ - if (level==T1_AA_NONE){ - if (T1aa_bpp==8){ - if (pFontBase->endian){ - movelow=3; - movehigh=2; - } - else{ - movelow=0; - movehigh=1; - } - } - else if (T1aa_bpp==16){ - if (pFontBase->endian){ - movelow=1; - movehigh=0; - } - else{ - movelow=0; - movehigh=1; - } - } - } - - if (level==T1_AA_HIGH){ - - if (T1aa_bpp==8){ - if (pFontBase->endian){ - indlow=17; - indhigh=1; - movelow=3; - movehigh=2; - } - else{ - indlow=1; - indhigh=17; - movelow=0; - movehigh=1; - } - } - else if (T1aa_bpp==16){ - if (pFontBase->endian){ - indlow=17; - indhigh=1; - movelow=1; - movehigh=0; - } - else{ - indlow=1; - indhigh=17; - movelow=0; - movehigh=1; - } - } - else if (T1aa_bpp==32){ - indlow=1; - indhigh=17; - } - for (i = 0; i < 256; i++) { - T1aa_h_count[i] = 0; - if (i & 0x80) T1aa_h_count[i] += indhigh; - if (i & 0x40) T1aa_h_count[i] += indhigh; - if (i & 0x20) T1aa_h_count[i] += indhigh; - if (i & 0x10) T1aa_h_count[i] += indhigh; - if (i & 0x08) T1aa_h_count[i] += indlow; - if (i & 0x04) T1aa_h_count[i] += indlow; - if (i & 0x02) T1aa_h_count[i] += indlow; - if (i & 0x01) T1aa_h_count[i] += indlow; - } - } - - if (level == 2 && T1aa_bpp == 8) { - for (i0 = 0; i0 < 5; i0++) - for (i1 = 0; i1 < 5; i1++) - for (i2 = 0; i2 < 5; i2++) - for (i3 = 0; i3 < 5; i3++) { - ((char *)T1aa_lut)[(((i0 * 5 + i1) * 5 + i2) * 5 + i3) * 4] = gv[i3]; - ((char *)T1aa_lut)[(((i0 * 5 + i1) * 5 + i2) * 5 + i3) * 4 + 1] = gv[i2]; - ((char *)T1aa_lut)[(((i0 * 5 + i1) * 5 + i2) * 5 + i3) * 4 + 2] = gv[i1]; - ((char *)T1aa_lut)[(((i0 * 5 + i1) * 5 + i2) * 5 + i3) * 4 + 3] = gv[i0]; - } - for (i = 0; i < 256; i++) { - T1aa_count[i] = 0; - if (i & 0x80) T1aa_count[i] += 125; - if (i & 0x40) T1aa_count[i] += 125; - if (i & 0x20) T1aa_count[i] += 25; - if (i & 0x10) T1aa_count[i] += 25; - if (i & 0x08) T1aa_count[i] += 5; - if (i & 0x04) T1aa_count[i] += 5; - if (i & 0x02) T1aa_count[i] += 1; - if (i & 0x01) T1aa_count[i] += 1; - } - return(0); - } else if (level == 2 && T1aa_bpp == 16) { - for (i0 = 0; i0 < 5; i0++) - for (i1 = 0; i1 < 5; i1++) { - ((T1_AA_TYPE16 *)T1aa_lut)[(i0 * 5 + i1) * 2] = gv[i1]; - ((T1_AA_TYPE16 *)T1aa_lut)[(i0 * 5 + i1) * 2 + 1] = gv[i0]; - } - for (i = 0; i < 256; i++) { - T1aa_count[i] = 0; - if (i & 0x80) T1aa_count[i] += 160; - if (i & 0x40) T1aa_count[i] += 160; - if (i & 0x20) T1aa_count[i] += 32; - if (i & 0x10) T1aa_count[i] += 32; - if (i & 0x08) T1aa_count[i] += 5; - if (i & 0x04) T1aa_count[i] += 5; - if (i & 0x02) T1aa_count[i] += 1; - if (i & 0x01) T1aa_count[i] += 1; - } - return(0); - } else if (level == 2 && T1aa_bpp == 32) { - for (i0 = 0; i0 < 5; i0++) - ((T1_AA_TYPE32 *)T1aa_lut)[i0] = gv[i0]; - for (i = 0; i < 256; i++) { - T1aa_count[i] = 0; - if (i & 0x80) T1aa_count[i] += 512; - if (i & 0x40) T1aa_count[i] += 512; - if (i & 0x20) T1aa_count[i] += 64; - if (i & 0x10) T1aa_count[i] += 64; - if (i & 0x08) T1aa_count[i] += 8; - if (i & 0x04) T1aa_count[i] += 8; - if (i & 0x02) T1aa_count[i] += 1; - if (i & 0x01) T1aa_count[i] += 1; - } - return(0); - } - else if (level == 4 && T1aa_bpp == 8) { - for (i0 = 0; i0 < 17; i0++){ /* i0 indexes higher nibble */ - for (i1 = 0; i1 < 17; i1++){ /* i1 indixes lower nibble */ - ((char *)T1aa_h_lut)[(i0 * 17 + i1) * 4 + movelow] = gv_h[i1]; - ((char *)T1aa_h_lut)[(i0 * 17 + i1) * 4 + movehigh] = gv_h[i0]; - } - } - return(0); - } - else if (level == 4 && T1aa_bpp == 16) { - for (i0 = 0; i0 < 17; i0++){ /* i0 indexes higher nibble */ - for (i1 = 0; i1 < 17; i1++){ /* i1 indixes lower nibble */ - ((T1_AA_TYPE16 *)T1aa_h_lut)[(i0 * 17 + i1) * 2 + movelow] = gv_h[i1]; - ((T1_AA_TYPE16 *)T1aa_h_lut)[(i0 * 17 + i1) * 2 + movehigh] = gv_h[i0]; - } - } - return(0); - } - else if (level == 4 && T1aa_bpp == 32) { - for (i0 = 0; i0 < 17; i0++){ /* i0 indexes higher nibble */ - for (i1 = 0; i1 < 17; i1++){ /* i1 indixes lower nibble */ - ((T1_AA_TYPE32 *)T1aa_h_lut)[(i0 * 17 + i1)] = gv_h[i1]; - } - } - return(0); - } - else if (level == 1 && T1aa_bpp == 8) { - for (i0=0; i0<16; i0++) { - ((char *)T1aa_n_lut)[i0*4+movelow]=gv_n[i0 & 0x01]; - ((char *)T1aa_n_lut)[i0*4+movelow+1]=gv_n[(i0>>1) & 0x01]; - ((char *)T1aa_n_lut)[i0*4+movelow+2]=gv_n[(i0>>2) & 0x01]; - ((char *)T1aa_n_lut)[i0*4+movelow+3]=gv_n[(i0>>3) & 0x01]; - } - return(0); - } - else if (level == 1 && T1aa_bpp == 16) { - for (i0=0; i0<4; i0++) { - ((T1_AA_TYPE16 *)T1aa_n_lut)[i0*2]=gv_n[i0 & 0x01]; - ((T1_AA_TYPE16 *)T1aa_n_lut)[i0*2+1]=gv_n[(i0>>1) & 0x01]; - } - return(0); - } - else if (level == 1 && T1aa_bpp == 32) { - for ( i0=0; i0<2; i0++) { - ((T1_AA_TYPE32 *)T1aa_n_lut)[i0]=gv_n[i0]; - } - return(0); - } - else { - /* unsupported combination of level and bpp -> we set T1_errno and - put an entry into the logfile! */ - T1_errno=T1ERR_INVALID_PARAMETER; - sprintf( err_warn_msg_buf, - "Unsupported AA specification: level=%d, bpp=%d", - level, T1aa_bpp); - T1_PrintLog( "T1_AAInit()", err_warn_msg_buf, T1LOG_WARNING); - } - return(1); -} - - -/* T1_AADoLine: Create a single scanline of antialiased output. The - (x, y) arguments refer to the number of pixels in the input image - to convert down. The width argument is the number of bytes - separating scanlines in the input. The quantity hcorr describes the - number of subpixels. It is the shift of the oversampled bitmap to - the right */ -static void T1_AADoLine ( int level, int x, int y, int width, - char *c_in_ptr, char *target_ptr, int hcorr ) -{ - int i=0; - int size; - int count=0; - int mod; - - unsigned char bcarry1=0, bcarry2=0, bcarry3=0, bcarry4=0; - - static char *align_buf = NULL; - static int align_buf_size = 0; - unsigned char *in_ptr; - - int new_size=55; - register char *optr; - - - - /* We convert the input pointer to unsigned since we use it as index! */ - in_ptr=(unsigned char*)c_in_ptr; - - - if ((long)target_ptr & 3){ - /* calculate new_size (size in bytes of output buffer */ - if (level == T1_AA_LOW){ - new_size=((x + hcorr + 1) >> 1) * (T1aa_bpp >> 3); - } - else{ /* T1_AA_HIGH */ - new_size = ((x + hcorr + 3) >> 2) * (T1aa_bpp >> 3); - } - if (new_size > align_buf_size) - { - if (align_buf) - free (align_buf); - /* Note: we allocate 12 more than necessary to have tolerance - at the end of line */ - align_buf = (char *)malloc(new_size+12); - align_buf_size = new_size; - } - optr = align_buf; - } - else - optr = target_ptr; - - - /* size: The number of valid byte in the input string, i.e., the number of bytes - partially filled with pixels before shifting with hcorr. - mod: Is 1 if after shifting with hcorr the last byte in the input line has an - overflow. - */ - - if (level == T1_AA_LOW) { - size=(x+7)>>3; - mod=(x+hcorr)>(size*8) ? 1 : 0; - - if (T1aa_bpp == 8) { - if (y == 2){ - for (i = 0; i < size; i++) { - ((T1_AA_TYPE32 *)optr)[i] = - T1aa_lut[(T1aa_count[(unsigned char)((in_ptr[i]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<> 5]; - bcarry1=in_ptr[i]>>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<> 5]; - bcarry1=in_ptr[i]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<> 5]; - } - } - else if (T1aa_bpp == 32) { - if (y == 2){ - for (i = 0; i < size; i++) { - count = T1aa_count[(unsigned char)((in_ptr[i]<> 3) & 7]; - ((T1_AA_TYPE32 *)optr)[i * 4 + 2] = T1aa_lut[(count >> 6) & 7]; - ((T1_AA_TYPE32 *)optr)[i * 4 + 3] = T1aa_lut[(count >> 9) & 7]; - bcarry1=in_ptr[i]>>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<> 3) & 7]; - ((T1_AA_TYPE32 *)optr)[i * 4 + 2] = T1aa_lut[(count >> 6) & 7]; - ((T1_AA_TYPE32 *)optr)[i * 4 + 3] = T1aa_lut[(count >> 9) & 7]; - bcarry1=in_ptr[i]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<> 3) & 7]; - ((T1_AA_TYPE32 *)optr)[i * 4 + 2] = T1aa_lut[(count >> 6) & 7]; - ((T1_AA_TYPE32 *)optr)[i * 4 + 3] = T1aa_lut[(count >> 9) & 7]; - } - } - } - else if (level==T1_AA_HIGH){ - size=(x+7)>>3; - mod=(x+hcorr)>(size*8) ? 1 : 0; - - if (T1aa_bpp == 8) { - if (y == 4){ - for (i = 0; i < size; i++) { - ((T1_AA_TYPE16 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - bcarry3=in_ptr[i+2*width]>>(8-hcorr); - bcarry4=in_ptr[i+3*width]>>(8-hcorr); - } - } - else if (y == 3){ - for (i = 0; i < size; i++) { - ((T1_AA_TYPE16 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - bcarry3=in_ptr[i+2*width]>>(8-hcorr); - } - } - else if (y == 2){ - for (i = 0; i < size; i++) { - ((T1_AA_TYPE16 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - } - } - else if (y == 1){ - for (i = 0; i < size; i++) { - ((T1_AA_TYPE16 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); - } - } - if (mod) { - if (y == 4) - ((T1_AA_TYPE16 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[bcarry1] + - T1aa_h_count[bcarry2] + - T1aa_h_count[bcarry3] + - T1aa_h_count[bcarry4])]; - else if (y == 3) - ((T1_AA_TYPE16 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[bcarry1] + - T1aa_h_count[bcarry2] + - T1aa_h_count[bcarry3])]; - else if (y == 2) - ((T1_AA_TYPE16 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[bcarry1] + - T1aa_h_count[bcarry2])]; - else if (y == 1) - ((T1_AA_TYPE16 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[bcarry1])]; - } - } else if (T1aa_bpp == 16) { - if (y == 4){ - for (i = 0; i < size; i++) { - ((T1_AA_TYPE32 *)optr)[i] = - T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - bcarry3=in_ptr[i+2*width]>>(8-hcorr); - bcarry4=in_ptr[i+3*width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>(8-hcorr); - bcarry2=in_ptr[i+2*width]>>(8-hcorr); - bcarry3=in_ptr[i+3*width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - bcarry3=in_ptr[i+2*width]>>(8-hcorr); - bcarry4=in_ptr[i+3*width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - bcarry3=in_ptr[i+2*width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>(8-hcorr); - bcarry2=in_ptr[i+width]>>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>(8-hcorr); - } - if (size==0){ - bcarry1=in_ptr[0]<>j%8)&0x0F]; - } - } - else if (T1aa_bpp==16) { - starget_ptr=(T1_AA_TYPE16 *)target_ptr; - for ( j=0; j>j%8)&0x03]; - } - } - else if (T1aa_bpp==32) { - ltarget_ptr=(T1_AA_TYPE32 *)target_ptr; - for ( j=0; j>j%8)&0x01]; - } - return; -} - - - -/* T1_AASetChar(...): Generate the anti-aliased bitmap for a character */ -GLYPH *T1_AASetChar( int FontID, char charcode, float size, - T1_TMATRIX *transform) -{ - - GLYPH *glyph; /* pointer to bitmap glyph */ - static GLYPH aaglyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */ - long asc, dsc, ht, wd; - long i; - long n_horz, n_horz_pad, n_vert, n_asc, n_dsc; - long v_start, v_end; - char *target_ptr; - long offset; - char *ptr; - int y; - long lsb, aalsb, aahstart; - int memsize; - LONG paddedW; - int savelevel; - FONTSIZEDEPS *font_ptr=NULL; - unsigned char ucharcode; - - - /* Reset character glyph, if necessary */ - if (aaglyph.bits!=NULL){ - free(aaglyph.bits); - aaglyph.bits=NULL; - } - aaglyph.metrics.leftSideBearing=0; - aaglyph.metrics.rightSideBearing=0; - aaglyph.metrics.advanceX=0; - aaglyph.metrics.advanceY=0; - aaglyph.metrics.ascent=0; - aaglyph.metrics.descent=0; - aaglyph.pFontCacheInfo=NULL; - aaglyph.bpp=T1aa_bpp; - - - ucharcode=charcode; - - /* Check for smart antialiasing */ - savelevel=T1aa_level; - if (T1aa_SmartOn){ - if (size>=T1aa_smartlimit2) { - T1aa_level=T1_AA_NONE; - } - else if (size>=T1aa_smartlimit1) { - T1aa_level=T1_AA_LOW; - } - else { - T1aa_level=T1_AA_HIGH; - } - } - - - /* The following code is only exectued if caching of antialiased - chracters is enabled. */ - /* Check if char is in cache */ - if ((pFontBase->t1lib_flags & T1_AA_CACHING)) { - if (transform==NULL){ - /* if size/aa is not existent we create it */ - if ((font_ptr=QueryFontSize( FontID, size, T1aa_level))==NULL){ - /* We create the required size struct and leave the rest - for T1_SetChar() */ - font_ptr=CreateNewFontSize( FontID, size, T1aa_level); - if (font_ptr==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - T1aa_level=savelevel; - return(NULL); - } - } - else {/* size is already existent in cache */ - if (font_ptr->pFontCache[ucharcode].bits != NULL){ - /* Character is already in Chache -> create a copy of cache - and return a pointer to the result: */ - memcpy( &aaglyph, &(font_ptr->pFontCache[ucharcode]), sizeof(GLYPH)); - memsize = (aaglyph.metrics.ascent-aaglyph.metrics.descent) * - PAD((aaglyph.metrics.rightSideBearing-aaglyph.metrics.leftSideBearing) * - T1aa_bpp,pFontBase->bitmap_pad)/8; - aaglyph.bits = (char *)malloc(memsize*sizeof( char)); - if (aaglyph.bits == NULL){ - T1_errno=T1ERR_ALLOC_MEM; - T1aa_level=savelevel; - return(NULL); - } - memcpy( aaglyph.bits, font_ptr->pFontCache[ucharcode].bits, memsize); - return(&(aaglyph)); - } - } - } /* (transform==NULL) */ - } /* T1_AA_CACHING */ - - - /* First, call routine to rasterize character, all error checking is - done in this function: */ - if ((glyph=T1_SetChar( FontID, charcode, T1aa_level*size, transform))==NULL){ - /* restore level */ - T1aa_level=savelevel; - return(NULL); /* An error occured */ - } - - /* In case there are no black pixels, we simply set the dimensions and - then return */ - if ( glyph->bits == NULL) { - aaglyph.bits=NULL; - aaglyph.metrics.leftSideBearing=0; - aaglyph.metrics.rightSideBearing=0; - aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); - aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); - aaglyph.metrics.ascent=0; - aaglyph.metrics.descent=0; - aaglyph.pFontCacheInfo=NULL; - /* restore level and return */ - T1aa_level=savelevel; - return(&aaglyph); - } - - /* Get dimensions of bitmap: */ - asc=glyph->metrics.ascent; - dsc=glyph->metrics.descent; - lsb=glyph->metrics.leftSideBearing; - ht=asc-dsc; - wd=glyph->metrics.rightSideBearing-lsb; - - - - if (T1aa_level==T1_AA_NONE){ - /* we only convert bitmap to bytemap */ - aaglyph=*glyph; - aaglyph.bpp=T1aa_bpp; - /* Compute scanline length and such */ - n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3; - /* Allocate memory for glyph */ - memsize = n_horz_pad*ht*8; - /* aaglyph.bits = (char *)malloc(memsize*sizeof( char)); */ - aaglyph.bits = (char *)malloc(memsize*sizeof( char)); - if (aaglyph.bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - /* restore level */ - T1aa_level=savelevel; - return(NULL); - } - paddedW=PAD(wd,pFontBase->bitmap_pad)>>3; - ptr=glyph->bits; - target_ptr=aaglyph.bits; - for (i = 0; i < ht; i++) { - T1_DoLine ( wd, paddedW, ptr, target_ptr ); - ptr += paddedW; - target_ptr += n_horz_pad; - } - /* restore level */ - T1aa_level=savelevel; - return(&aaglyph); - } - - - /* Set some looping parameters for subsampling */ - if (lsb<0){ - aalsb=lsb/T1aa_level-1; - aahstart=T1aa_level+(lsb%T1aa_level); - } - else{ - aalsb=lsb/T1aa_level; - aahstart=lsb%T1aa_level; - } - - /* The horizontal number of steps: */ - n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level; - /* And the padded value */ - n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3; - - /* vertical number of steps: */ - if (asc % T1aa_level){ /* not aligned */ - if ( asc > 0){ - n_asc=asc/T1aa_level+1; - v_start=asc % T1aa_level; - } - else{ - n_asc=asc/T1aa_level; - v_start=T1aa_level + (asc % T1aa_level); - } - } - else{ - n_asc=asc/T1aa_level; - v_start=T1aa_level; - } - if (dsc % T1aa_level){ /* not aligned */ - if ( dsc < 0){ - n_dsc=dsc/T1aa_level-1; - v_end=-(dsc % T1aa_level); - } - else{ - n_dsc=dsc/T1aa_level; - v_end=T1aa_level - (dsc % T1aa_level); - } - } - else{ - n_dsc=dsc/T1aa_level; - v_end=T1aa_level; - } - /* the total number of lines: */ - n_vert=n_asc-n_dsc; - - /* Allocate memory for glyph */ - memsize = n_horz_pad*n_vert; - - /* Note: we allocate 12 bytes more than necessary */ - aaglyph.bits = (char *)malloc(memsize*sizeof( char) +12); - if (aaglyph.bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - /* restore level */ - T1aa_level=savelevel; - return(NULL); - } - - - paddedW=PAD(wd,pFontBase->bitmap_pad)/8; - offset=0; - target_ptr=aaglyph.bits; - - /* We must check for n_vert==1 because the computation above is not - valid in this case */ - if (n_vert==1) - v_start=v_start < v_end ? v_start : v_end; - - ptr = glyph->bits; - for (i = 0; i < n_vert; i++) { - if (i==0) - y=v_start; - else if (i==n_vert-1) - y=v_end; - else - y=T1aa_level; - T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart ); - ptr += y * paddedW; - target_ptr += n_horz_pad; - } - - /* .. and set them in aaglyph */ - aaglyph.metrics.leftSideBearing=aalsb; - aaglyph.metrics.rightSideBearing=aalsb + n_horz; - aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); - aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); - aaglyph.metrics.ascent=n_asc; - aaglyph.metrics.descent=n_dsc; - aaglyph.pFontCacheInfo=NULL; - - - if ((pFontBase->t1lib_flags & T1_AA_CACHING) && (transform==NULL)) { - /* Put char into cache area */ - memcpy( &(font_ptr->pFontCache[ucharcode]), &aaglyph, sizeof(GLYPH)); - font_ptr->pFontCache[ucharcode].bits = (char *)malloc(memsize*sizeof( char)); - if (font_ptr->pFontCache[ucharcode].bits == NULL){ - T1_errno=T1ERR_ALLOC_MEM; - T1aa_level=savelevel; - return(NULL); - } - memcpy( font_ptr->pFontCache[ucharcode].bits, aaglyph.bits, memsize); - } - - /* restore level */ - T1aa_level=savelevel; - - return(&aaglyph); -} - - - -/* T1_AASetString(...): Generate the antialiased bitmap for a - string of characters */ -GLYPH *T1_AASetString( int FontID, char *string, int len, - long spaceoff, int modflag, float size, - T1_TMATRIX *transform) -{ - GLYPH *glyph; /* pointer to bitmap glyph */ - static GLYPH aastring_glyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */ - long asc, dsc, ht, wd; - long i; - long n_horz, n_horz_pad, n_vert, n_asc, n_dsc; - long v_start, v_end; - char *target_ptr; - long offset; - char *ptr; - int y; - long lsb, aalsb, aahstart; - int memsize; - LONG paddedW; - int savelevel; - - - /* Reset character glyph, if necessary */ - if (aastring_glyph.bits!=NULL){ - free(aastring_glyph.bits); - aastring_glyph.bits=NULL; - } - aastring_glyph.metrics.leftSideBearing=0; - aastring_glyph.metrics.rightSideBearing=0; - aastring_glyph.metrics.advanceX=0; - aastring_glyph.metrics.advanceY=0; - aastring_glyph.metrics.ascent=0; - aastring_glyph.metrics.descent=0; - aastring_glyph.pFontCacheInfo=NULL; - aastring_glyph.bpp=T1aa_bpp; - - - /* Check for smart antialiasing */ - savelevel=T1aa_level; - if (T1aa_SmartOn){ - if (size>=T1aa_smartlimit2) { - T1aa_level=T1_AA_NONE; - } - else if (size>=T1aa_smartlimit1) { - T1aa_level=T1_AA_LOW; - } - else { - T1aa_level=T1_AA_HIGH; - } - } - - /* First, call routine to rasterize character, all error checking is - done in this function: */ - if ((glyph=T1_SetString( FontID, string, len, spaceoff, - modflag, T1aa_level*size, transform))==NULL){ - /* restore level */ - T1aa_level=savelevel; - return(NULL); /* An error occured */ - } - - /* In case there are no black pixels, we simply set the dimensions and - then return */ - if ( glyph->bits == NULL) { - aastring_glyph.bits=NULL; - aastring_glyph.metrics.leftSideBearing=0; - aastring_glyph.metrics.rightSideBearing=0; - aastring_glyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); - aastring_glyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); - aastring_glyph.metrics.ascent=0; - aastring_glyph.metrics.descent=0; - aastring_glyph.pFontCacheInfo=NULL; - /* restore level and return */ - T1aa_level=savelevel; - return(&aastring_glyph); - } - - - /* Get dimensions of bitmap: */ - asc=glyph->metrics.ascent; - dsc=glyph->metrics.descent; - lsb=glyph->metrics.leftSideBearing; - ht=asc-dsc; - wd=glyph->metrics.rightSideBearing-lsb; - - if (T1aa_level==T1_AA_NONE){ - /* we only convert bitmap to bytemap */ - aastring_glyph=*glyph; - aastring_glyph.bpp=T1aa_bpp; - /* Compute scanline length and such */ - n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3; - /* Allocate memory for glyph */ - memsize = n_horz_pad*ht*8; - aastring_glyph.bits = (char *)malloc(memsize*sizeof( char)); - if (aastring_glyph.bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - /* restore level */ - T1aa_level=savelevel; - return(NULL); - } - paddedW=PAD(wd,pFontBase->bitmap_pad)>>3; - ptr=glyph->bits; - target_ptr=aastring_glyph.bits; - for (i = 0; i < ht; i++) { - T1_DoLine ( wd, paddedW, ptr, target_ptr ); - ptr += paddedW; - target_ptr += n_horz_pad; - } - /* restore level */ - T1aa_level=savelevel; - return(&aastring_glyph); - } - - - /* Set some looping parameters for subsampling */ - if (lsb<0){ - aalsb=lsb/T1aa_level-1; - aahstart=T1aa_level+(lsb%T1aa_level); - } - else{ - aalsb=lsb/T1aa_level; - aahstart=lsb%T1aa_level; - } - - /* The horizontal number of steps: */ - n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level; - /* And the padded value */ - n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3; - - /* vertical number of steps: */ - if (asc % T1aa_level){ /* not aligned */ - if ( asc > 0){ - n_asc=asc/T1aa_level+1; - v_start=asc % T1aa_level; - } - else{ - n_asc=asc/T1aa_level; - v_start=T1aa_level + (asc % T1aa_level); - } - } - else{ - n_asc=asc/T1aa_level; - v_start=T1aa_level; - } - if (dsc % T1aa_level){ /* not aligned */ - if ( dsc < 0){ - n_dsc=dsc/T1aa_level-1; - v_end=-(dsc % T1aa_level); - } - else{ - n_dsc=dsc/T1aa_level; - v_end=T1aa_level - (dsc % T1aa_level); - } - } - else{ - n_dsc=dsc/T1aa_level; - v_end=T1aa_level; - } - /* the total number of lines: */ - n_vert=n_asc-n_dsc; - - /* Allocate memory for glyph */ - memsize = n_horz_pad*n_vert; - - /* Note: we allocate 12 bytes more than necessary */ - aastring_glyph.bits = (char *)malloc(memsize*sizeof( char) +12); - if (aastring_glyph.bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - paddedW=PAD(wd,pFontBase->bitmap_pad)/8; - offset=0; - target_ptr=aastring_glyph.bits; - - /* We must check for n_vert==1 because the computation above is not - valid in this case */ - if (n_vert==1) - v_start=v_start < v_end ? v_start : v_end; - - ptr = glyph->bits; - for (i = 0; i < n_vert; i++) { - if (i==0) - y=v_start; - else if (i==n_vert-1) - y=v_end; - else - y=T1aa_level; - T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart ); - ptr += y * paddedW; - target_ptr += n_horz_pad; - } - - /* .. and set them in aastring_glyph */ - aastring_glyph.metrics.leftSideBearing=aalsb; - aastring_glyph.metrics.rightSideBearing=aalsb + n_horz; - aastring_glyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); - aastring_glyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); - aastring_glyph.metrics.ascent=n_asc; - aastring_glyph.metrics.descent=n_dsc; - aastring_glyph.pFontCacheInfo=NULL; - - /* restore level */ - T1aa_level=savelevel; - - return(&aastring_glyph); -} - - - -/* T1_AASetGrayValues(): Sets the byte values that are put into the - pixel position for the respective entries: - Returns 0 if successfull. - */ -int T1_AASetGrayValues(unsigned long white, - unsigned long gray75, - unsigned long gray50, - unsigned long gray25, - unsigned long black) -{ - - if (CheckForInit()){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - gv[4]=(unsigned T1_AA_TYPE32)black; /* black value */ - gv[3]=(unsigned T1_AA_TYPE32)gray25; /* gray 25% value */ - gv[2]=(unsigned T1_AA_TYPE32)gray50; /* gray 50% value */ - gv[1]=(unsigned T1_AA_TYPE32)gray75; /* gray 75% value */ - gv[0]=(unsigned T1_AA_TYPE32)white; /* white value */ - - T1aa_bg=white; - - if ((T1_AAInit( T1_AA_LOW))) - return(-1); - return(0); - -} - - - -/* T1_AAHSetGrayValues(): Sets the byte values that are put into the - pixel position for the respective entries (for 17 gray levels): - Returns 0 if successfull. - */ -int T1_AAHSetGrayValues( unsigned long *grayvals) -{ - int i; - - if (CheckForInit()){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - /* 0==white(background) ... 16==black(foreground) */ - for (i=0; i<17; i++){ - gv_h[i]=(unsigned T1_AA_TYPE32)grayvals[i]; - } - - - T1aa_bg=grayvals[0]; - - if ((T1_AAInit( T1_AA_HIGH))) - return(-1); - return(0); - -} - - - -/* T1_AANSetGrayValues(): Sets the byte values that are put into the - pixel position for the respective entries (for 2 gray levels): - Returns 0 if successfull. This is for the case the non-antialiased - "bytemaps" should be generated. - */ -int T1_AANSetGrayValues( unsigned long bg, unsigned long fg) -{ - - if (CheckForInit()){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - gv_n[0]=bg; - gv_n[1]=fg; - - T1aa_bg=bg; - - if ((T1_AAInit( T1_AA_NONE))) - return(-1); - return(0); - -} - - - -/* Get the current setting of graylevels for 2x antialiasing. The 5 - values are stored at address pgrayvals in order from background to - foreground */ -int T1_AAGetGrayValues( long *pgrayvals) -{ - int i; - - if (CheckForInit()) { - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - if (pgrayvals==NULL) { - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - } - - for ( i=0; i<5; i++) { /* bg (i=0) to fg (i=4) */ - pgrayvals[i]=gv[i]; - } - return( 0); - -} - - - -/* Get the current setting of graylevels for 2x antialiasing. The 17 - values are stored at address pgrayvals in order from background to - foreground */ -int T1_AAHGetGrayValues( long *pgrayvals) -{ - int i; - - if (CheckForInit()) { - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - if (pgrayvals==NULL) { - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - } - - for ( i=0; i<17; i++) { /* bg (i=0) to fg (i=16) */ - pgrayvals[i]=gv[i]; - } - return( 0); -} - - - -/* Get the current setting of graylevels for 2x antialiasing. The 2 - values are stored at address pgrayvals in order from background to - foreground */ -int T1_AANGetGrayValues( long *pgrayvals) -{ - - if (CheckForInit()) { - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - if (pgrayvals==NULL) { - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - } - pgrayvals[0]=gv[0]; /* background */ - pgrayvals[1]=gv[1]; /* foreground */ - return( 0); -} - - -/* T1_AASetBitsPerPixel(): Sets the depths of the antialiased glyph - pixel. Returns 0 if bpp is valid and -1 otherwise. If 24 is - specified, meaning to be the depth rather than the bpp-value, - automatically 32 bpp is chosen. */ -int T1_AASetBitsPerPixel( int bpp) -{ - - if (CheckForInit()){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - - /* T1aa_level = 0; */ - - if (bpp==8){ - T1aa_bpp=8; - return(0); - } - if (bpp==16){ - T1aa_bpp=16; - return(0); - } - if ((bpp==32)|(bpp==24)){ - T1aa_bpp=32; - return(0); - } - - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); -} - - -/* T1_AAGetBitsPerPixel(): Return the number of bits per pixel set in - t1lib. -*/ -int T1_AAGetBitsPerPixel( void) -{ - return( T1aa_bpp); - -} - - -/* Set the Subsampling level for subsequent operations: */ -int T1_AASetLevel( int level) -{ - - if (CheckForInit()){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - if (level==T1_AA_LOW){ - T1aa_level=T1_AA_LOW; - return(0); - } - else if (level==T1_AA_HIGH){ - T1aa_level=T1_AA_HIGH; - return(0); - } - else if (level==T1_AA_NONE){ - T1aa_level=T1_AA_NONE; - return(0); - } - - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - -} - - -/* Get the current subsampling level */ -int T1_AAGetLevel( void) -{ - return( T1aa_level); -} - - -/* T1_AAFillOutline(): Create a filled glyph from an outline description */ -GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag) -{ - - GLYPH *glyph; /* pointer to bitmap glyph */ - static GLYPH aaglyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */ - long asc, dsc, ht, wd; - long i; - long n_horz, n_horz_pad, n_vert, n_asc, n_dsc; - long v_start, v_end; - char *target_ptr; - long offset; - char *ptr; - int y; - long lsb, aalsb, aahstart; - int memsize; - LONG paddedW; - - - /* Reset character glyph, if necessary */ - if (aaglyph.bits!=NULL){ - free(aaglyph.bits); - aaglyph.bits=NULL; - } - aaglyph.metrics.leftSideBearing=0; - aaglyph.metrics.rightSideBearing=0; - aaglyph.metrics.advanceX=0; - aaglyph.metrics.advanceY=0; - aaglyph.metrics.ascent=0; - aaglyph.metrics.descent=0; - aaglyph.pFontCacheInfo=NULL; - aaglyph.bpp=T1aa_bpp; - - - /* First, scale outline appropriately: */ - path=T1_ScaleOutline( path, T1aa_level); - - /* Second, call routine to fill outline, all error checking is - done in this function: */ - if ((glyph=T1_FillOutline( path, modflag))==NULL) - return(NULL); /* An error occured */ - - /* In case there are no black pixels, we simply set the dimensions and - then return */ - if ( glyph->bits == NULL) { - aaglyph.bits=NULL; - aaglyph.metrics.leftSideBearing=0; - aaglyph.metrics.rightSideBearing=0; - aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); - aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); - aaglyph.metrics.ascent=0; - aaglyph.metrics.descent=0; - aaglyph.pFontCacheInfo=NULL; - return(&aaglyph); - } - - /* Get dimensions of bitmap: */ - asc=glyph->metrics.ascent; - dsc=glyph->metrics.descent; - lsb=glyph->metrics.leftSideBearing; - ht=asc-dsc; - wd=glyph->metrics.rightSideBearing-lsb; - - - if (T1aa_level==T1_AA_NONE){ - /* we only convert bitmap to bytemap */ - aaglyph=*glyph; - aaglyph.bpp=T1aa_bpp; - /* Compute scanline length and such */ - n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3; - /* Allocate memory for glyph, we alloc 12 bytes more to simplify - subsampling! */ - memsize = n_horz_pad*ht*8; - aaglyph.bits = (char *)malloc(memsize*sizeof( char) +12); - if (aaglyph.bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - paddedW=PAD(wd,pFontBase->bitmap_pad)>>3; - ptr=glyph->bits; - target_ptr=aaglyph.bits; - for (i = 0; i < ht; i++) { - T1_DoLine ( wd, paddedW, ptr, target_ptr ); - ptr += paddedW; - target_ptr += n_horz_pad; - } - return(&aaglyph); - } - - - /* Set some looping parameters for subsampling */ - if (lsb<0){ - aalsb=lsb/T1aa_level-1; - aahstart=T1aa_level+(lsb%T1aa_level); - } - else{ - aalsb=lsb/T1aa_level; - aahstart=lsb%T1aa_level; - } - - /* The horizontal number of steps: */ - n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level; - /* And the padded value */ - n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3; - - /* vertical number of steps: */ - if (asc % T1aa_level){ /* not aligned */ - if ( asc > 0){ - n_asc=asc/T1aa_level+1; - v_start=asc % T1aa_level; - } - else{ - n_asc=asc/T1aa_level; - v_start=T1aa_level + (asc % T1aa_level); - } - } - else{ - n_asc=asc/T1aa_level; - v_start=T1aa_level; - } - if (dsc % T1aa_level){ /* not aligned */ - if ( dsc < 0){ - n_dsc=dsc/T1aa_level-1; - v_end=-(dsc % T1aa_level); - } - else{ - n_dsc=dsc/T1aa_level; - v_end=T1aa_level - (dsc % T1aa_level); - } - } - else{ - n_dsc=dsc/T1aa_level; - v_end=T1aa_level; - } - /* the total number of lines: */ - n_vert=n_asc-n_dsc; - - /* Allocate memory for glyph */ - memsize = n_horz_pad*n_vert; - - aaglyph.bits = (char *)malloc(memsize*sizeof( char)+12); - if (aaglyph.bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - paddedW=PAD(wd,pFontBase->bitmap_pad)/8; - offset=0; - target_ptr=aaglyph.bits; - - /* We must check for n_vert==1 because the computation above is not - valid in this case */ - if (n_vert==1) - v_start=v_start < v_end ? v_start : v_end; - - ptr = glyph->bits; - for (i = 0; i < n_vert; i++) { - if (i==0) - y=v_start; - else if (i==n_vert-1) - y=v_end; - else - y=T1aa_level; - T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart ); - ptr += y * paddedW; - target_ptr += n_horz_pad; - } - - /* .. and set them in aaglyph */ - aaglyph.metrics.leftSideBearing=aalsb; - aaglyph.metrics.rightSideBearing=aalsb + n_horz; - aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); - aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); - aaglyph.metrics.ascent=n_asc; - aaglyph.metrics.descent=n_dsc; - aaglyph.pFontCacheInfo=NULL; - - return(&aaglyph); -} - - - -/* T1_AASetSmartLimits(): Set the limit-values for smart - antialiasing. Returns 0 if OK, and -1 else. */ -int T1_AASetSmartLimits( float limit1, float limit2) -{ - - if (limit1 > 0.0 && limit2 > 0.0 && limit2 >= limit2) { - T1aa_smartlimit1=limit1; - T1aa_smartlimit2=limit2; - return( 0); - } - else{ - T1_errno=T1ERR_INVALID_PARAMETER; - return( -1); - } -} - - - -/* T1_AASetSmartMode(): Enable or disable smart anialiasing */ -int T1_AASetSmartMode( int smart) -{ - - if (smart==T1_YES) { - T1aa_SmartOn=1; - } - else if (smart==T1_NO) { - T1aa_SmartOn=0; - } - else { - T1_errno=T1ERR_INVALID_PARAMETER; - return( -1); - } - return( 0); -} - - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1aaset.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1aaset.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1aaset.h Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1aaset.h Thu Jan 1 00:00:00 1970 @@ -1,79 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1aaset.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - definitions and declarations for t1set.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#ifdef T1AASET_C - -GLYPH *T1_AASetChar( int FontID, char charcode, - float size, T1_TMATRIX *transform); -GLYPH *T1_AASetString( int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -int T1_AASetGrayValues( unsigned long white, - unsigned long gray75, - unsigned long gray50, - unsigned long gray25, - unsigned long black); -int T1_AAHSetGrayValues( unsigned long *grayvals); -int T1_AANSetGrayValues( unsigned long fg, unsigned long bg); -int T1_AAGetGrayValues( long *pgrayvals); -int T1_AAHGetGrayValues( long *pgrayvals); -int T1_AANGetGrayValues( long *pgrayvals); -int T1_AASetBitsPerPixel( int bpp); -int T1_AAGetBitsPerPixel( void); -int T1_AASetLevel( int level); -int T1_AAGetLevel( void); -GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag); -int T1_AASetSmartLimits( float limit1, float limit2); -int T1_AASetSmartMode( int smart); - -#else - -extern GLYPH *T1_AASetChar( int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_AASetString( int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern int T1_AASetGrayValues( unsigned long white, - unsigned long gray75, - unsigned long gray50, - unsigned long gray25, - unsigned long black); -extern int T1_AAHSetGrayValues( unsigned long *grayvals); -extern int T1_AANSetGrayValues( unsigned long bg, unsigned long fg); -extern int T1_AAGetGrayValues( long *pgrayvals); -extern int T1_AAHGetGrayValues( long *pgrayvals); -extern int T1_AANGetGrayValues( long *pgrayvals); -extern int T1_AASetBitsPerPixel( int bpp); -extern int T1_AAGetBitsPerPixel( void); -extern int T1_AASetLevel( int level); -extern int T1_AAGetLevel( void); -extern GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag); -extern int T1_AASetSmartLimits( float limit1, float limit2); -extern int T1_AASetSmartMode( int smart); - -#endif - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1afmtool.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1afmtool.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1afmtool.c Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1afmtool.c Thu Jan 1 00:00:00 1970 @@ -1,548 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1afmtool.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - functions for generating a fallback set of afm data - from type 1 font files. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1AFMTOOL_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" -#include "../type1/blues.h" - - -#include "t1types.h" -#include "t1extern.h" -#include "t1finfo.h" -#include "t1base.h" -#include "t1misc.h" -#include "t1set.h" -#include "t1load.h" -#include "t1afmtool.h" - - -#define DELTA_MAX 30 -#define ENCODINGSIZE (int) 256 -#ifndef T1LIB_IDENT -#define T1LIB_IDENT "???.???" -#endif - - -extern char *t1_get_abort_message( int number); - - -/* T1_GenerateAFMFallbackInfo(): Generate fallback information from - Type 1 font file by rasterizing every character at 1000 bp. Returns - a pointer to a generated FontInfo struct or NULL in case of an error. - */ -FontInfo *T1_GenerateAFMFallbackInfo( int FontID) -{ - int i, j; - struct region *area; - struct XYspace *S; - int mode=0; - char **charnames; - int nochars=0; - FontInfo *pAFMData; - - - /* We return to this if something goes wrong deep in the rasterizer */ - if ((i=setjmp( stck_state))!=0) { - T1_errno=T1ERR_TYPE1_ABORT; - sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", - t1_get_abort_message( i)); - T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, - T1LOG_ERROR); - return( NULL); - } - - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - sprintf( err_warn_msg_buf, - "Can't generate AFM Info from Font %d (invalid ID)\n", FontID); - T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - /* Setup apropriate charspace matrix */ - S=(struct XYspace *)IDENTITY; - /* Make this permanent so that scaling it in fontfcnB_ByName will - make a duplicate of it, and this duplicate can thus be safely - destroyed. Fixes the somewhat smaller memory leak */ - S=(struct XYspace *)Permanent - (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0], - pFontBase->pFontArray[FontID].FontTransform[1], - pFontBase->pFontArray[FontID].FontTransform[2], - pFontBase->pFontArray[FontID].FontTransform[3])); - - /* Alloc memory for FontInfo: */ - if ((pAFMData=(FontInfo *)malloc( sizeof(FontInfo)))==NULL){ - sprintf( err_warn_msg_buf, - "Failed to allocate memory for FontInfo in Font %d!", FontID); - T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_ALLOC_MEM; - /* make sure to free S */ - if (S) { - KillSpace (S); - } - return( NULL); - } - /* Initialize pointers */ - pAFMData->gfi=NULL; - pAFMData->cwi=NULL; - pAFMData->numOfChars=0; - pAFMData->cmi=NULL; - pAFMData->numOfTracks=0; - pAFMData->tkd=NULL; - pAFMData->numOfPairs=0; - pAFMData->pkd=NULL; - pAFMData->numOfComps=0; - pAFMData->ccd=NULL; - - /* Get list of character name */ - charnames=T1_GetAllCharNames( FontID); - /* and count number of characters */ - nochars=0; - - while (charnames[nochars]!=NULL) - nochars++; - pAFMData->numOfChars=nochars; - /* Allocate memory for CharMetricInfo area */ - if ((pAFMData->cmi=(CharMetricInfo *) - malloc( nochars * sizeof( CharMetricInfo)))==NULL){ - sprintf( err_warn_msg_buf, - "Failed to allocate memory for CharMetricsInfo area in Font %d!", - FontID); - T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, - T1LOG_WARNING); - free( pAFMData); - T1_errno=T1ERR_ALLOC_MEM; - /* make sure to free S */ - if (S) { - KillSpace (S); - } - return( NULL); - } - /* Get metrics values */ - for (i=0; ipFontArray[FontID].pType1Data, DO_RASTER); - - if (area==NULL){ - sprintf( err_warn_msg_buf, - "Could not get charspace representation of character %d (%s) Font %d!", - i, charnames[i], FontID); - T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, - T1LOG_WARNING); - /* Return since we don't know how to fill the values */ - for (j=i-1; j>=0; j--) - free( pAFMData->cmi[j].name); - if (pAFMData->cmi!=NULL) - free( pAFMData->cmi); - if (pAFMData!=NULL) - free( pAFMData); - T1_errno=mode; - /* make sure to free S */ - if (S) { - KillSpace (S); - } - return( NULL); - } - else if ((pAFMData->cmi[i].name=(char *) - malloc( (size_t)(strlen( charnames[i])+1)))==NULL){ - sprintf( err_warn_msg_buf, - "Failed to allocate memory for CharName %d (%s) Font %d!", - i, charnames[i], FontID); - T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, - T1LOG_WARNING); - /* NULL-ptr in charnames is prone to SIGSEGV-errors, thus, - we have to return: */ - for (j=i; j>=0; j--) - free( pAFMData->cmi[j].name); - free( pAFMData->cmi); - free( pAFMData); - T1_errno=T1ERR_ALLOC_MEM; - /* make sure to free S */ - if (S) { - KillSpace (S); - } - return( NULL); - } - else{ - strcpy( pAFMData->cmi[i].name, charnames[i]); - pAFMData->cmi[i].code=T1_GetEncodingIndex( FontID, charnames[i]); - pAFMData->cmi[i].wx=NEARESTPEL(area->ending.x); - pAFMData->cmi[i].wy=NEARESTPEL(area->ending.y); - /* We check for a valid BBox and set it to zero otherwise */ - if ((int)area->xmax > (int)area->xmin){ - pAFMData->cmi[i].charBBox.llx =(int)area->xmin; - pAFMData->cmi[i].charBBox.urx =(int)area->xmax; - pAFMData->cmi[i].charBBox.lly =(int)area->ymin; - pAFMData->cmi[i].charBBox.ury =(int)area->ymax; - } - else{ - pAFMData->cmi[i].charBBox.llx =0; - pAFMData->cmi[i].charBBox.urx =0; - pAFMData->cmi[i].charBBox.lly =0; - pAFMData->cmi[i].charBBox.ury =0; - } - pAFMData->cmi[i].ligs=NULL; - /* We are done with area, so get rid of it. Solves the REALLY - HUGE memory leak */ - KillRegion (area); - } - } - sprintf( err_warn_msg_buf, - "Generated metric information for %d characters of font %d!", - nochars, FontID); - T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, - T1LOG_STATISTIC); - - /* make sure to free S */ - if (S) { - KillSpace (S); - } - return( pAFMData); -} - - -/* T1_WriteAFMFallbackFile(): Write a fallback AFM-file from AFM data - genarated for font FontID. returns - 0 if successful - -1 if afm-data was loaded from existent AFM-file - -2 if font is not loaded (invalid FontID) - -3 if for some reason the fonts' AFM-data has not been generated - -4 if the file could not be openend - -5 if an error occurred during write - -6 other error. - */ -int T1_WriteAFMFallbackFile( int FontID) -{ - - int i, j, k, l; - - int nochars; - int capheight, ascender, xheight, descender; - int min=0, delta; - time_t s_clock, *tp; - - char *afmfilename; - FILE *afmfile; - CharMetricInfo **cmi; - - - /* Check for valid font */ - if (CheckForFontID(FontID)!=1){ - sprintf( err_warn_msg_buf, - "Warning: Invalid FontID, font %d not loaded!", - FontID); - T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_INVALID_FONTID; - return(-2); - } - - /* Check for AFM-data to be existent */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL){ - sprintf( err_warn_msg_buf, - "Warning: No AFM-Data available for font %d", - FontID); - T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, - T1LOG_WARNING); - return(-3); - } - - /* Check if AFM data has been generated from existent afm file --> - no need to generate a new one. */ - if ((pFontBase->pFontArray[FontID].info_flags & AFM_SUCCESS) - || (pFontBase->pFontArray[FontID].info_flags & AFM_SLOPPY_SUCCESS)){ - sprintf( err_warn_msg_buf, - "Alert: Available AFM-Data for font %d is generated from existent AFM-file!", - FontID); - T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, - T1LOG_STATISTIC); - return(-1); - } - - /* Construct AFM-filename */ - i=strlen(pFontBase->pFontArray[FontID].pFontFileName); - if ((afmfilename=(char *)malloc((size_t)(i + 1) ))==NULL){ - sprintf( err_warn_msg_buf, - "Memory allocation error (fontID = %d)", - FontID); - T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_ALLOC_MEM; - return(-6); - } - strcpy( afmfilename, pFontBase->pFontArray[FontID].pFontFileName); - while (afmfilename[i]!='.') - i--; - afmfilename[i+1]='a'; - afmfilename[i+2]='f'; - afmfilename[i+3]='m'; - - if ((afmfile=fopen( afmfilename, "w"))==NULL){ - sprintf( err_warn_msg_buf, - "Could not open %s, (FontID = %d)", - afmfilename, FontID); - T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, - T1LOG_WARNING); - free( afmfilename); - T1_errno=T1ERR_FILE_OPEN_ERR; - return(-4); - } - - /* Set the creation time of afm file */ - tp=&s_clock; - s_clock=time( tp); - - /* Allocate a pointer-array to the metrics information, - of the size 256 + number of characters. */ - nochars=pFontBase->pFontArray[FontID].pAFMData->numOfChars; - if ((cmi=(CharMetricInfo **)calloc( nochars+ENCODINGSIZE, - sizeof(CharMetricInfo *)))==NULL){ - sprintf( err_warn_msg_buf, - "Memory allocation error (fontID = %d)", - FontID); - T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_ALLOC_MEM; - return(-6); - } - /* Reset area */ - for ( i=0; i<(nochars+ENCODINGSIZE); i++) - cmi[i]=NULL; - /* First half of array is dedicated to encoded characters, the - second half for unencoded characters */ - k=ENCODINGSIZE; - for ( i=0; ipFontArray[FontID].pAFMData->cmi[i].name); - if (j>=0) - cmi[j]=&(pFontBase->pFontArray[FontID].pAFMData->cmi[i]); - else - cmi[k++]=&(pFontBase->pFontArray[FontID].pAFMData->cmi[i]); - } - - fprintf(afmfile, "StartFontMetrics 4.0\n"); - fprintf(afmfile, "Comment This is %s created from %s by t1lib V. %s.\n", - afmfilename, pFontBase->pFontArray[FontID].pFontFileName, - T1LIB_IDENT); - fprintf(afmfile, "Comment File creation date: %s", ctime(&s_clock)); - fprintf(afmfile, "Comment t1lib is copyright (c) Rainer Menzner, 1996-2001.\n"); - fprintf(afmfile, "Comment t1lib is distributed under the GNU General Public Library License (LGPL)\n"); - fprintf(afmfile, "FontName %s\n", T1_GetFontName( FontID)); - fprintf(afmfile, "FullName %s\n", T1_GetFullName( FontID)); - fprintf(afmfile, "FamilyName %s\n", T1_GetFamilyName( FontID)); - fprintf(afmfile, "Weight %s\n", T1_GetWeight( FontID)); - fprintf(afmfile, "ItalicAngle %d\n", (int)T1_GetItalicAngle( FontID)); - fprintf(afmfile, "IsFixedPitch %s\n", T1_GetIsFixedPitch( FontID) ? "true" : "false" ); - fprintf(afmfile, "FontBBox %d %d %d %d\n", - T1_GetFontBBox( FontID).llx, - T1_GetFontBBox( FontID).lly, - T1_GetFontBBox( FontID).urx, - T1_GetFontBBox( FontID).ury); - fprintf(afmfile, "UnderlinePosition %d\n", - (int)T1_GetUnderlinePosition( FontID)); - fprintf(afmfile, "UnderlineThickness %d\n", - (int)T1_GetUnderlineThickness( FontID)); - - fprintf(afmfile, "Version %s\n", T1_GetVersion( FontID)); - fprintf(afmfile, "Notice %s\n", T1_GetNotice( FontID)); - /* Encoding */ - if (pFontBase->pFontArray[FontID].pFontEnc==NULL){ - if (pFontBase->pFontArray[FontID].info_flags & USES_STANDARD_ENCODING){ - fprintf( afmfile, "EncodingScheme AdobeStandardEncoding\n"); - } - else{ - fprintf( afmfile, "EncodingScheme FontSpecific\n"); - } - } - else - fprintf( afmfile, "EncodingScheme FontSpecific\n"); - /* Values like capheight ascender xheight and descender */ - /* We start with the overshoot positions */ - i=pFontBase->pFontArray[FontID].pType1Data->BluesP->numBlueValues; - if (i>0){ - /* Capheight */ - if ((k=T1_GetEncodingIndex( FontID, "H"))!=-1){ - l=T1_GetCharBBox( FontID, (char) k).ury; - delta=10000; - for (j=0; j abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l)){ - min=j; - delta=abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l); - } - } - if (min % 2) /* index is odd */ - min--; - /* Check for plausibility */ - if (abs( pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min] - l) - > DELTA_MAX) /* We probably did not found the right position */ - capheight=0; - else - capheight=pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min]; - } - else - capheight=0; - /* XHeight */ - if ((k=T1_GetEncodingIndex( FontID, "x"))!=-1){ - l=T1_GetCharBBox( FontID, (char) k).ury; - delta=10000; - for (j=0; j abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l)){ - min=j; - delta=abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l); - } - } - if (min % 2) /* index is odd */ - min--; - /* Check for plausibility */ - if (abs( pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min] - l) - > DELTA_MAX) /* We probably did not found the right position */ - xheight=0; - else - xheight=pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min]; - } - else{ - xheight=0; - } - /* Ascender */ - if ((k=T1_GetEncodingIndex( FontID, "d"))!=-1){ - l=T1_GetCharBBox( FontID, (char) k).ury; - delta=10000; - for (j=0; j abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l)){ - min=j; - delta=abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l); - } - } - if (min % 2) /* index is odd */ - min--; - /* Check for plausibility */ - if (abs( pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min] - l) - > DELTA_MAX) /* We probably did not found the right position */ - ascender=0; - else - ascender=pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min]; - } - else{ - ascender=0; - } - } - else{ - capheight=0; - xheight=0; - ascender=0; - } - /* And now comes under shoot alignment position */ - i=pFontBase->pFontArray[FontID].pType1Data->BluesP->numOtherBlues; - if (i>0){ - /* Descender */ - if ((k=T1_GetEncodingIndex( FontID, "p"))!=-1){ - l=T1_GetCharBBox( FontID, (char) k).lly; - delta=10000; - for (j=0; j abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->OtherBlues[j] - l)){ - min=j; - delta=abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->OtherBlues[j] - l); - } - } - if ((min % 2)==0) /* index is even */ - min++; - /* Check for plausibility */ - if (abs( pFontBase->pFontArray[FontID].pType1Data->BluesP->OtherBlues[min] - l) - > DELTA_MAX) /* We probably did not found the right position */ - descender=0; - else - descender=pFontBase->pFontArray[FontID].pType1Data->BluesP->OtherBlues[min]; - } - else{ - descender=0; - } - } - else{ - descender=0; - } - if (capheight != 0) - fprintf( afmfile, "CapHeight %d\n", capheight); - if (xheight != 0) - fprintf( afmfile, "XHeight %d\n", xheight); - if (ascender != 0) - fprintf( afmfile, "Ascender %d\n", ascender); - if (descender != 0) - fprintf( afmfile, "Descender %d\n", descender); - if (pFontBase->pFontArray[FontID].pType1Data->BluesP->StdHW != 0.0) - fprintf( afmfile, "StdHW %d\n", - (int) pFontBase->pFontArray[FontID].pType1Data->BluesP->StdHW); - if (pFontBase->pFontArray[FontID].pType1Data->BluesP->StdVW != 0.0) - fprintf( afmfile, "StdVW %d\n", - (int) pFontBase->pFontArray[FontID].pType1Data->BluesP->StdVW); - - /* Now fill in the values (we omit the .notdef) */ - fprintf(afmfile, "StartCharMetrics %d\n", nochars-1); - for ( i=0; i<(nochars+ENCODINGSIZE); i++){ - if (cmi[i]!=NULL && strcmp(cmi[i]->name,".notdef")) - fprintf( afmfile, "C %3d ; WX %4d ; N %-20s ; B %5d %5d %5d %5d ;\n", - cmi[i]->code, cmi[i]->wx, cmi[i]->name, - cmi[i]->charBBox.llx, cmi[i]->charBBox.lly, - cmi[i]->charBBox.urx, cmi[i]->charBBox.ury); - } - fprintf(afmfile, "EndCharMetrics\nEndFontMetrics\n"); - - free(cmi); - fclose( afmfile); - return(0); -} - - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1afmtool.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1afmtool.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1afmtool.h Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1afmtool.h Thu Jan 1 00:00:00 1970 @@ -1,43 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1afmtool.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - declarations and definitions for t1afmtool.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#ifdef T1AFMTOOL_C - -FontInfo *T1_GenerateAFMFallbackInfo( int FontID); -int T1_WriteAFMFallbackFile( int FontID); -extern struct region *fontfcnB_ByName( int FontID, int modflag, - struct XYspace *S, - char *charname, - int *mode, psfont *Font_Ptr, - int do_raster); - -#else - -extern FontInfo *T1_GenerateAFMFallbackInfo( int FontID); -extern int T1_WriteAFMFallbackFile( int FontID); - -#endif diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1base.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1base.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1base.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1base.c Thu Jan 1 00:00:00 1970 @@ -1,1267 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1base.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-03 - ----- Description: This file is part of the t1-library. It contains basic - routines to initialize the data structures used - by the t1-library. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independ from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#define T1BASE_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" - - -#include "sysconf.h" -#include "t1base.h" -#include "t1types.h" -#include "t1global.h" -#include "t1env.h" -#include "t1delete.h" - - -static int T1_pad=0; - - -/* This function is to be called by the user to initialize - the font mechanism */ -void *T1_InitLib( int log) -{ - int result; - int i; - - char *usershome=NULL; - char *logfilepath=NULL; - char *envlogreq=NULL; - int usrforcelog=0; - - - - /* Reset T1_errno */ - T1_errno=0; - - /* Assign pointer to global struct and set entry padding: */ - pFontBase=&FontBase; - if (T1_pad) - pFontBase->bitmap_pad=T1_pad; - else - pFontBase->bitmap_pad=T1GLYPH_PAD; - - pFontBase->pFontArray = NULL; - pFontBase->t1lib_flags=0; - /* Check for AA-caching */ - if ((log & T1_AA_CACHING)){ - pFontBase->t1lib_flags |= T1_AA_CACHING; - } - /* Check for AFM disable */ - if ((log & T1_NO_AFM)) { - pFontBase->t1lib_flags |= T1_NO_AFM; - } - - /* Check environment variable ENV_LOG_STRING. By this means, a user may - generate a log file even if at compile time log file creation has - been suppressed. Of course, if the loglevel is reduced after - initialization by the programmer, this environment variable takes - no effect! */ - if ((envlogreq=getenv(ENV_LOG_STRING))!=NULL) { - if (strcmp( envlogreq, "logDebug")==0) - T1_SetLogLevel( T1LOG_DEBUG); - else if (strcmp( envlogreq, "logStatistic")==0) - T1_SetLogLevel( T1LOG_STATISTIC); - else if (strcmp( envlogreq, "logWarning")==0) - T1_SetLogLevel( T1LOG_WARNING); - else if (strcmp( envlogreq, "logError")==0) - T1_SetLogLevel( T1LOG_ERROR); - usrforcelog=1; - } - - /* Open log-file: */ - t1lib_log_file=NULL; - if ((log & LOGFILE) || (usrforcelog!=0)) { - pFontBase->t1lib_flags |= LOGFILE; - /* Try first opening in current directory: */ - if ((t1lib_log_file=fopen( T1_LOG_FILE, "w"))==NULL) { - if ((usershome=getenv("HOME"))!=NULL) { - logfilepath=(char *)malloc((strlen(usershome) + - strlen(T1_LOG_FILE) + 2 - ) * sizeof(char)); - strcpy( logfilepath, usershome); - strcat( logfilepath, DIRECTORY_SEP); - strcat( logfilepath, T1_LOG_FILE); - if ((t1lib_log_file=fopen( logfilepath, "w"))==NULL){ - t1lib_log_file=stderr; - } - free( logfilepath); - } - else { - t1lib_log_file=stderr; - } - } - if (t1lib_log_file==stderr) { - T1_PrintLog( "T1_InitLib()", "Unable to open a logfile, using stderr", - T1LOG_ERROR); - } - } - - T1_PrintLog( "T1_InitLib()", "Initialization started", - T1LOG_STATISTIC); - /* Check for representation of data in memory: */ - if ((pFontBase->endian=T1_CheckEndian())){ - T1_PrintLog( "T1_InitLib()", "Using Big Endian data presentation (MSBFirst)", - T1LOG_DEBUG); - pFontBase->endian=1; - } - else{ - T1_PrintLog( "T1_InitLib()", "Using Little Endian data presentation (LSBFirst)", - T1LOG_DEBUG); - pFontBase->endian=0; - } - - /* Save version identifier */ - sprintf( err_warn_msg_buf, "Version Identifier: %s", T1LIB_IDENT); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, - T1LOG_DEBUG); - /* Save how t1lib is initialized */ - sprintf( err_warn_msg_buf, "Initialization flags: 0x%X", log); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, - T1LOG_DEBUG); - /* Save padding value in log file */ - sprintf( err_warn_msg_buf, "Glyphs are padded to %d bits", - pFontBase->bitmap_pad); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, - T1LOG_DEBUG); -#ifdef __CHAR_UNSIGNED__ - T1_PrintLog( "T1_InitLib()", "System-Info: char is unsigned", - T1LOG_DEBUG); -#else - T1_PrintLog( "T1_InitLib()", "System-Info: char is signed", - T1LOG_DEBUG); -#endif - sprintf( err_warn_msg_buf, "System-Info: sizeof(char): %d", - SIZEOF_CHAR); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "System-Info: sizeof(short): %d", - SIZEOF_SHORT); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "System-Info: sizeof(int): %d", - SIZEOF_INT); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "System-Info: sizeof(long): %d", - SIZEOF_LONG); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "System-Info: sizeof(long long): %d", - SIZEOF_LONG_LONG); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "System-Info: sizeof(float): %d", - SIZEOF_FLOAT); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "System-Info: sizeof(double): %d", - SIZEOF_DOUBLE); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "System-Info: sizeof(long double): %d", - SIZEOF_LONG_DOUBLE); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "System-Info: sizeof(void *): %d", - SIZEOF_VOID_P); - T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); - - intT1_SetupDefaultSearchPaths(); - if (log & IGNORE_CONFIGFILE) { - pFontBase->t1lib_flags |= IGNORE_CONFIGFILE; - T1_PrintLog( "T1_InitLib()", "Skipping configuration file search!", - T1LOG_STATISTIC); - } - else { - if ((result=intT1_ScanConfigFile())==0) - T1_PrintLog( "T1_InitLib()", "Warning t1lib configuration file not found!", - T1LOG_WARNING); - } - - - /* Set the default encoding to the fonts' internal encoding */ - pFontBase->default_enc=NULL; - - /* Initialize the no_fonts... values */ - pFontBase->no_fonts=0; - pFontBase->no_fonts_ini=pFontBase->no_fonts; - pFontBase->no_fonts_limit=pFontBase->no_fonts; - - - /* Check whether to read font database */ - if ((log & IGNORE_FONTDATABASE)){ - pFontBase->t1lib_flags |= IGNORE_FONTDATABASE; - - T1_Up=1; /* System has been initialized ! */ - T1_PrintLog( "T1_InitLib()", "Initialization successfully finished (Database empty)", - T1LOG_STATISTIC); - - return((void *) pFontBase); - } - - result=0; - /* Read fontdatabase(s) */ - i=0; - while (T1_FDB_ptr[i]!=NULL) { - if ((result=intT1_scanFontDBase(T1_FDB_ptr[i]))==-1){ - T1_PrintLog( "T1_InitLib()", "Fatal error scanning Font Database File %s", - T1LOG_WARNING, T1_FDB_ptr[i]); - } - if (result>-1) - pFontBase->no_fonts+=result; - i++; - - } - if (result == 0){ - T1_PrintLog( "T1_InitLib()", "No fonts from Font Database File(s) found (T1_errno=%d)", - T1LOG_ERROR, T1_errno); - return(NULL); - } - - /* Initialize the no_fonts... values */ - pFontBase->no_fonts_ini=pFontBase->no_fonts; - pFontBase->no_fonts_limit=pFontBase->no_fonts; - - T1_Up=1; /* System has been initialized ! */ - T1_PrintLog( "T1_InitLib()", "Initialization successfully finished", - T1LOG_STATISTIC); - - return((void *) pFontBase); -} - - - -/* intT1_scanFontDBase(): - - opens the file with the font definitions, - - reads the number of fonts defined and saves this in FontBase, - - allocates memory for all the filenames of the Type1 files - - tests for .pfa und .pfb files and saves the name found - - initializes an array that allows to acces these names by an - index number, the font_ID - - returns -1 on fatal error and the number of fonts located - successfullly - */ -int intT1_scanFontDBase( char *filename) -{ - int fd; - int filesize, i, j, k, m; - int found=0, located=0; - char *filebuffer; - int nofonts=0; - FONTPRIVATE* fontarrayP=NULL; - - - if ((fd=open( filename, O_RDONLY))<3){ - T1_PrintLog( "intT1_scanFontDBase()", "Font Database File %s not found!", - T1LOG_WARNING, filename); - T1_errno=T1ERR_FILE_OPEN_ERR; - return(-1); - } - - /* Get the file size */ - filesize=lseek( fd, 0, 2); - /* Reset fileposition to start */ - lseek (fd, 0, 0); - - if ((filebuffer=(char *)malloc(filesize*sizeof(char) - )) == NULL){ - T1_PrintLog( "intT1_scanFontDBase()", - "Couldn't allocate memory for loading font database file %s", - T1LOG_ERROR, filename); - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - - i=read( fd, filebuffer, filesize); - close(fd); /* Close font database file */ - - i=j=m=0; - - while (inofonts) /* to ignore especially white space at end */ - break; - i++; /* Step further in file position */ - } - /* Return the memory for file reading */ - free(filebuffer); - - return( found); -} - - -/* T1_CloseLib(): Close the library and free all associated memory */ -int T1_CloseLib( void) -{ - - int i, j, error=0; - - if (T1_Up){ - for (i=pFontBase->no_fonts; i; i--){ - /* Free filename only if not NULL and if the font is physical! - Do it before removing the font since the physical information - is no more available afterwards. If necessary, an explicitly - specified AFM filename is also freed. - */ - if ((pFontBase->pFontArray[i-1].pFontFileName!=NULL) - && (pFontBase->pFontArray[i-1].physical==1)){ - free( pFontBase->pFontArray[i-1].pFontFileName); - pFontBase->pFontArray[i-1].pFontFileName=NULL; - if (pFontBase->pFontArray[i-1].pAfmFileName!=NULL){ - free( pFontBase->pFontArray[i-1].pAfmFileName); - pFontBase->pFontArray[i-1].pAfmFileName=NULL; - } - } - - /* Now, remove font: */ - if ((j=T1_DeleteFont( i-1))){ - error=1; - sprintf( err_warn_msg_buf, "T1_DeleteFont() returned %d for Font %d", - j, i-1); - T1_PrintLog( "T1_CloseLib()", err_warn_msg_buf, T1LOG_ERROR); - } - } - /* Free the FONTPRIVATE area */ - if (pFontBase->pFontArray) - free( pFontBase->pFontArray); - else - error=1; - - /* Free search paths */ - intT1_FreeSearchPaths(); - - /* Reset the flags */ - pFontBase->t1lib_flags=0; - - /* Indicate Library is no longer initialized */ - pFontBase=NULL; - T1_Up=0; - T1_PrintLog( "T1_CloseLib()", "Library closed", T1LOG_STATISTIC); - if ((t1lib_log_file!=NULL) && (t1lib_log_file!=stderr)) - fclose(t1lib_log_file); - t1lib_log_file=NULL; - } - - return( error); -} - - -/* T1_AddFont(): Add a new fontfile to the fontdatabase. - Return values: >0: Assigned FontID - -1: Fontfile not found - -2: Error allocating memory for FONTPRIVATE-area - -3: No memory for saving font filename - */ -int T1_AddFont( char *fontfilename) -{ - - char *FullName; - FONTPRIVATE *save_ptr; - int i; - int new_ID; - - - if (fontfilename==NULL){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - } - - /* Check for existence of fontfile */ - if ((FullName=intT1_Env_GetCompletePath(fontfilename,T1_PFAB_ptr))==NULL) { - T1_errno=T1ERR_FILE_OPEN_ERR; - return(-1); - } - free(FullName); - - /* Check if free space for a new FONTPRIVATE is available; if not, - realloc memory some amount larger */ - save_ptr=pFontBase->pFontArray; - if (pFontBase->no_fonts==pFontBase->no_fonts_limit){ - if (pFontBase->pFontArray == NULL) { - /* In case this is the first font */ - pFontBase->pFontArray=(FONTPRIVATE *)calloc(pFontBase->no_fonts_limit - + ADVANCE_FONTPRIVATE, - sizeof(FONTPRIVATE)); - } - else { - /* We already have some fonts */ - pFontBase->pFontArray=(FONTPRIVATE *)realloc(pFontBase->pFontArray, - (pFontBase->no_fonts_limit - + ADVANCE_FONTPRIVATE) - * sizeof(FONTPRIVATE)); - if (pFontBase->pFontArray==NULL){ - /* Restore pointer */ - pFontBase->pFontArray=save_ptr; - T1_errno=T1ERR_ALLOC_MEM; - return(-2); /* No memory available */ - } - } - pFontBase->no_fonts_limit += ADVANCE_FONTPRIVATE; - /* First, initialize newly allocated to be not used */ - for ( i=pFontBase->no_fonts; - ino_fonts+ADVANCE_FONTPRIVATE; i++){ - pFontBase->pFontArray[i].pFontFileName=NULL; - pFontBase->pFontArray[i].pAfmFileName=NULL; - pFontBase->pFontArray[i].pAFMData=NULL; - pFontBase->pFontArray[i].pType1Data=NULL; - pFontBase->pFontArray[i].pEncMap=NULL; - pFontBase->pFontArray[i].pKernMap=NULL; - pFontBase->pFontArray[i].pFontEnc=NULL; - pFontBase->pFontArray[i].pFontSizeDeps=NULL; - pFontBase->pFontArray[i].vm_base=NULL; - pFontBase->pFontArray[i].FontMatrix[0]=0.0; - pFontBase->pFontArray[i].FontMatrix[1]=0.0; - pFontBase->pFontArray[i].FontMatrix[2]=0.0; - pFontBase->pFontArray[i].FontMatrix[3]=0.0; - pFontBase->pFontArray[i].FontTransform[0]=0.0; - pFontBase->pFontArray[i].FontTransform[1]=0.0; - pFontBase->pFontArray[i].FontTransform[2]=0.0; - pFontBase->pFontArray[i].FontTransform[3]=0.0; - pFontBase->pFontArray[i].slant=0.0; - pFontBase->pFontArray[i].extend=0.0; - pFontBase->pFontArray[i].physical=0; - pFontBase->pFontArray[i].refcount=0; - pFontBase->pFontArray[i].space_position=0; - pFontBase->pFontArray[i].info_flags=0; - } - } - /* no_fonts-1 was the largest allowed font ID */ - new_ID=pFontBase->no_fonts; - pFontBase->no_fonts++; - - if ((FontBase.pFontArray[new_ID].pFontFileName=(char *) - calloc( strlen( fontfilename)+1, sizeof(char))) == NULL){ - T1_PrintLog( "T1_AddFont()", - "Failed to allocate memory for Filename %s (FontID=%d)", - T1LOG_ERROR, fontfilename, new_ID); - T1_errno=T1ERR_ALLOC_MEM; - return(-3); - } - strcpy( FontBase.pFontArray[new_ID].pFontFileName, fontfilename); - - /* Generate logfile entry */ - sprintf( err_warn_msg_buf, "Assigned FontID %d to fontfile %s", - new_ID, FontBase.pFontArray[new_ID].pFontFileName); - T1_PrintLog( "T1_AddFont()", err_warn_msg_buf, - T1LOG_STATISTIC); - /* Return FontID of newly declared font */ - return( new_ID); - -} - - -/* T1_PrintLog() generates entries in the log file. msg_txt is subject to scan - conversion and ... signifies a accordingly lrge variable list. */ -void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...) -{ - va_list vararg; - static char levelid[4]={ 'E', 'W', 'S', 'D'}; - time_t s_clock, *tp; - - if (t1lib_log_file==NULL) - return; - if ((level>t1lib_log_level) || (level<1)){ - return; - } - else{ - /* initialize argument list */ - va_start( vararg, level); - - tp=&s_clock; - s_clock=time( tp); - /* - fprintf( t1lib_log_file, "(%c) (%.24s) %s: ", - levelid[level-1], ctime(&s_clock), func_ident); - */ - /* Don't print the time stamp */ - fprintf( t1lib_log_file, "(%c) %s: ", levelid[level-1], func_ident ); - vfprintf( t1lib_log_file, msg_txt, vararg ); - fprintf( t1lib_log_file, "\n"); - fflush( t1lib_log_file); - - /* cleanup variable list */ - va_end( vararg); - - return; - } -} - - -/* T1_SetLogLevel(): Set the level which a message must have so - that it is printed into the logfile. This function may be called - before T1_InitLib(). */ -void T1_SetLogLevel( int level) -{ - if ((level>0) && (level<5)) - t1lib_log_level=level; - return; -} - - - -/* CheckForInit(): If no initialization of font mechanism has been - done, return -1, indicating an error. */ -int CheckForInit(void) -{ - if(T1_Up) - return(0); - else - return(-1); - -} - - - -/* CheckForFontID(): Checks the font mechanism concerning the specified - ID. It returns: - 0 if font belonging to FontID has not yet been loaded - 1 if font belonging to FontID has already been loaded - -1 if FontID is an invalid specification or t1lib not - initialized - */ -int CheckForFontID( int FontID) -{ - - /* FontID is invalid */ - if ((FontID<0)||(FontID>(pFontBase->no_fonts - 1))||(T1_Up==0)) - return(-1); - - if (pFontBase->pFontArray[FontID].pType1Data==NULL) - return(0); /* has not yet been loaded */ - else - return(1); /* has already been loaded */ -} - - - - -/* test_for_t1_file returns 0 if a file "name.pfa" or "name.pfb" - was found. Else, -1 is returned. If successful, buffer contains the - found filename string */ -int test_for_t1_file( char *buffer ) -{ - int i=0; - char *FullName; - - /* First case: A PostScript Font ASCII File without extension - (according to some UNIX-conventions) */ - if ((FullName=intT1_Env_GetCompletePath(buffer,T1_PFAB_ptr))!=NULL) { - free(FullName); - return(0); - } - - while (buffer[i]!=0){ - i++; - } - buffer[i]='.'; - buffer[i+1]='p'; - buffer[i+2]='f'; - buffer[i+4]=0; - - - /* Second case: A PostScript Font ASCII File */ - buffer[i+3]='a'; - if ((FullName=intT1_Env_GetCompletePath(buffer,T1_PFAB_ptr))!=NULL) { - free(FullName); - return(0); - } - /* Third case: A PostScript Font Binary File */ - buffer[i+3]='b'; - if ((FullName=intT1_Env_GetCompletePath(buffer,T1_PFAB_ptr))!=NULL) { - free(FullName); - return(0); - } - - /* If we get here no file was found => Set buffer - to an empty string and return -1 */ - - buffer[0]=0; - return(-1); -} - - -/* T1_GetFontFileName() returns a pointer to the filename of the font, - associated with FontID. This filename does not contain a full path. - */ -char *T1_GetFontFileName( int FontID) -{ - - static char filename[MAXPATHLEN+1]; - - if (CheckForInit())return(NULL); - - /* Check first for valid FontID */ - if ((FontID<0) || (FontID>FontBase.no_fonts)){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - strcpy( filename, pFontBase->pFontArray[FontID].pFontFileName); - - return( filename); - -} - - - -/* As suggested by Nicolai Langfeldt, we make it possible to specify - a completely independent path for the afm filename. This should - make t1lib usable in context with using the kpathsearch-library. - We allow setting those path´s after initialization, but before a - font is loaded. - returns 0: OK - -1: Operation could not be performed -*/ -int T1_SetAfmFileName( int FontID, char *afm_name) -{ - - if (CheckForFontID(FontID)!=0){ - /* Operation may not be applied because FontID is invalid - or font is loaded */ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - if (afm_name==NULL) { - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - } - if (pFontBase->pFontArray[FontID].pAfmFileName!=NULL){ - /* we first free the current name */ - free( pFontBase->pFontArray[FontID].pAfmFileName); - pFontBase->pFontArray[FontID].pAfmFileName=NULL; - } - - if ((pFontBase->pFontArray[FontID].pAfmFileName= - (char *)malloc( (strlen(afm_name)+1)*sizeof( char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return( -1); - } - strcpy( pFontBase->pFontArray[FontID].pAfmFileName, afm_name); - - return(0); - -} - - - -/* We have a function for querying the name. Returns a pointer - to the string or NULL if name was not explicitly set .*/ -char *T1_GetAfmFileName( int FontID) -{ - - static char filename[MAXPATHLEN+1]; - - if (CheckForInit())return(NULL); - - /* Check first for valid FontID */ - if ((FontID<0) || (FontID>FontBase.no_fonts)){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - if (pFontBase->pFontArray[FontID].pAfmFileName==NULL) { - return( NULL); - } - - strcpy( filename, pFontBase->pFontArray[FontID].pAfmFileName); - return( filename); - -} - - - -/* T1_Get_no_fonts(): Return the number of declared fonts */ -int T1_Get_no_fonts(void) -{ - if (CheckForInit())return(-1); - return(FontBase.no_fonts); -} - - - -/* T1_SetDeviceResolutions( x_res, y_res): Set the device's physical - resolution in horizontal and vertical direction, mesured in DPI - (Dots Per Inch). This should be done before the first font is - loaded! */ -int T1_SetDeviceResolutions( float x_res, float y_res) -{ - - int i; - - if (CheckForInit()) - ; /* Not initialized -> no size dependent data -> OK */ - else - /* Check if size-dependent data is existent */ - for ( i=T1_Get_no_fonts(); i; i--) - if (pFontBase->pFontArray[i-1].pFontSizeDeps!=NULL){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); /* There's is size dependent data for a font */ - } - - /* Save resolutions and calculate horizontal and vertical - scale factors to map desired bp to device pixel */ - DeviceSpecifics.x_resolution=(float) x_res; - DeviceSpecifics.y_resolution=(float) y_res; - DeviceSpecifics.scale_x=(float)(((float)x_res)/BIGPOINTSPERINCH); - DeviceSpecifics.scale_y=(float)(((float)y_res)/BIGPOINTSPERINCH); - return(0); -} - - -/* T1_QueryX11Support(): Check at runtime to see if t1lib was compiled - with X11 interface: */ -int T1_QueryX11Support( void) -{ -#ifndef T1LIB_NO_X11_SUPPORT - return(1); -#else - return(0); -#endif -} - - - - -/* int T1_CopyFont(): Copies the font associated with FontID to another - location. The pointers to type1- , afm- and encoding data as well as - the matrices remain completely untouched. However, size dependent data - is not copied. The produced font is marked as a "logical" font. - If no memory is available in the FONTPRIVATE-array, there's realloc'ed - some more memory. The FontID which is assigned to the newly generated - font is given as the return value, or < 0 if an error occurs. Also, - the refcount entry of the source font is incremented by one. - - Return value -1: invalid FontID specified - -2: source font is not a "physical" font - -3: no memory for reallocation of FONTPRIVATEs - -4: no memory for one of the mapping tables - */ -int T1_CopyFont( int FontID) -{ - FONTPRIVATE *save_ptr; - int k; - int new_ID; - - - /* Check for a valid source font */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - - /* Check if the font in question is a "physical" font, otherwise it may - not be copied */ - if (pFontBase->pFontArray[FontID].physical==0){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-2); - } - - - /* Check if free space for a new FONTPRIVATE is available; if not, - realloc memory some amount larger */ - save_ptr=pFontBase->pFontArray; - if (pFontBase->no_fonts==pFontBase->no_fonts_limit){ - pFontBase->pFontArray=(FONTPRIVATE *)realloc(pFontBase->pFontArray, - (pFontBase->no_fonts_limit - + ADVANCE_FONTPRIVATE) - * sizeof(FONTPRIVATE)); - if (pFontBase->pFontArray==NULL){ - /* Restore pointer */ - pFontBase->pFontArray=save_ptr; - T1_errno=T1ERR_ALLOC_MEM; - return(-3); - } - /* We zero the newly allocated memory */ - if (pFontBase->pFontArray != NULL) { - memset( pFontBase->pFontArray + pFontBase->no_fonts_limit, 0, - ADVANCE_FONTPRIVATE * sizeof(FONTPRIVATE)); - } - pFontBase->no_fonts_limit += ADVANCE_FONTPRIVATE; - } - /* no_fonts-1 was the largest allowed font ID */ - new_ID=pFontBase->no_fonts; - /* Copy FONTPRIVATE-structure: */ - pFontBase->pFontArray[new_ID]=pFontBase->pFontArray[FontID]; - /* (Re)Set some values explicitly, others remain untouched: */ - pFontBase->pFontArray[new_ID].pFontSizeDeps=NULL; - pFontBase->pFontArray[new_ID].physical=0; - /* AFM-mapping tables are to be setup for logical fonts separately - (if AFM data is there) */ - /* first, kerning map */ - if (pFontBase->pFontArray[new_ID].pAFMData) { - k=pFontBase->pFontArray[new_ID].pAFMData->numOfPairs; - if (k>0){ /* kern map exists only if kerning pairs exist! */ - if ((pFontBase->pFontArray[new_ID].pKernMap= - (METRICS_ENTRY *)malloc( k*sizeof( METRICS_ENTRY)))==NULL){ - sprintf( err_warn_msg_buf, "Error allocating memory for kerning map (new_ID=%d)", - new_ID); - T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_ALLOC_MEM; - return(-4); - } - memcpy( pFontBase->pFontArray[new_ID].pKernMap, - pFontBase->pFontArray[FontID].pKernMap, - k*sizeof( METRICS_ENTRY)); - } - else { /* no kerning pairs, bu AFM data present */ - pFontBase->pFontArray[new_ID].pKernMap=NULL; - } - } - else { /* AFM data not present at all */ - pFontBase->pFontArray[new_ID].pKernMap=NULL; - } - - /* second, encoding map */ - if (pFontBase->pFontArray[FontID].pEncMap!=NULL) { - if ((pFontBase->pFontArray[new_ID].pEncMap= - (int *)calloc(256,sizeof(int)))==NULL){ - sprintf( err_warn_msg_buf, - "Error allocating memory for encoding map (new_ID=%d)", - new_ID); - T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_ALLOC_MEM; - return(-4); - } - memcpy( pFontBase->pFontArray[new_ID].pEncMap, - pFontBase->pFontArray[FontID].pEncMap, - 256*sizeof( int)); - } - - /* New font is logical --> indicate to which physical font it - refers by setting refcount: */ - pFontBase->pFontArray[new_ID].refcount=FontID; - - /* Now the struct is setup; increment no_fonts by 1 because - new_ID is a valid font specification from now on. */ - pFontBase->no_fonts++; - /* Increment refcount in source font */ - pFontBase->pFontArray[FontID].refcount++; - - /* Generate logfile entry */ - sprintf( err_warn_msg_buf, "Assigned FontID %d to fontfile %s", - new_ID, FontBase.pFontArray[new_ID].pFontFileName); - T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf, - T1LOG_STATISTIC); - return(new_ID); -} - - - -/* T1_SetBitmapPad(): Set the value to which bitmap-scanlines are padded. - This has to be done before initialization because it is a very - rudimentary operation. - */ -int T1_SetBitmapPad( int pad) -{ - if (T1_Up){ - /* Library is initialized --> return error */ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - else{ - switch (pad){ - case 8: - T1_pad=8; - return(0); - case 16: - T1_pad=16; - return(0); -#ifdef T1_AA_TYPE64 - case 32: - T1_pad=32; - return(0); -#endif - default: - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - } - } -} - - - -/* T1_GetBitmapPad(): Read the value to which scanlines of bitmap are - padded. This can be done before or after initialization. */ -int T1_GetBitmapPad( void) -{ - if (pFontBase) /* T1lib initialized --> return value from struct */ - return( pFontBase->bitmap_pad); - else{ - if (T1_pad) - return(T1_pad); /* pad is explicitly set --> return that value */ - else - return( T1GLYPH_PAD); /* not expl. set --> return compilation default */ - } -} - - - -/* bin_dump(): Print a binary dump of a byte, short and - long variable (used for debug purposes only): */ -void bin_dump_c(unsigned char value, char space_flag) -{ - int i,j; - - for (i=0;i<=7;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - if (space_flag) - printf(" "); - -} - -void bin_dump_s(unsigned short value, char space_flag) -{ - int i,j; - - if (T1_CheckEndian()){ - for (i=8;i<=15;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - for (i=0;i<=7;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - } - else{ - for (i=0;i<=15;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - } - if (space_flag) - printf(" "); - -} - -void bin_dump_l(unsigned long value, char space_flag) -{ - int i,j; - - if (T1_CheckEndian()){ - for (i=24;i<=31;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - for (i=16;i<=23;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - for (i=8;i<=15;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - for (i=0;i<=7;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - } - else{ - for (i=0;i<=31;i++){ - if ((j=((value)>>i)&0x01)) - printf("X"); - else - printf("."); - } - } - if (space_flag) - printf(" "); - -} - - - -/* CheckEndian(): Checks whether the current machine is of little or big - endian architecture. This is important for concatenating bitmaps. - Function returns 0 if LittleEndian and 1 if BigEndian representation - is used on the current hardware. - */ -int T1_CheckEndian() -{ - unsigned char *charptr; - - /* Generate test value */ - unsigned short test=0x0001; - - /* Read out memory as unsigned char */ - charptr=(unsigned char *)(&test)+1; - - /* Return value will be 1 if Big- and 0 if Little Endian */ - return((int) *charptr); - -} - - - -/* T1_GetLibIdent(): Return the identifier string for the current version - of t1lib */ -char *T1_GetLibIdent( void) -{ - static char buf[15]; - - sprintf( buf, "%s", T1LIB_IDENT); - - return( (char *)buf); -} - - - -/* T1_SetRasterFlags(): Enable/Disable certain features in - the rasterizer */ -extern void T1_SetRasterFlags( int flags) -{ - - T1_Type1OperatorFlags=flags; - return; - -} - - - -/* T1_GetFontFileName(): returns a pointer to the complete path filename - of the font, associated with FontID as it is in use by t1lib. - */ -char *T1_GetFontFilePath( int FontID) -{ - - static char filepath[MAXPATHLEN+1]; - char *FileNamePath=NULL; - - /* is initialzed? */ - if (CheckForInit()) { - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - /* Check first for valid FontID */ - if ((FontID<0) || (FontID>FontBase.no_fonts)){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - /* lib is initialized and FontID is valid -> - we can really expect a name */ - if ((FileNamePath=intT1_Env_GetCompletePath( pFontBase->pFontArray[FontID].pFontFileName, - T1_PFAB_ptr))==NULL) { - T1_PrintLog( "T1_GetFontFilePath()", "Couldn't locate font file for font %d in %s", - T1LOG_WARNING, FontID, T1_GetFileSearchPath(T1_PFAB_PATH)); - T1_errno=T1ERR_FILE_OPEN_ERR; - return(NULL); - } - - strcpy( filepath, FileNamePath); - free( FileNamePath); - - return( filepath); - -} - - - -/* We have a function for querying the name. Returns a pointer - to the string or NULL if name was not explicitly set .*/ -char *T1_GetAfmFilePath( int FontID) -{ - - static char filepath[MAXPATHLEN+1]; - char *FontFileName; - char *AFMFilePath; - int i, j; - - /* is initialized? */ - if ((CheckForInit())) { - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - /* Check first for valid FontID */ - if ((FontID<0) || (FontID>FontBase.no_fonts)){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - /* Check wether AFM-file loading was suppressed on user's request */ - if ((pFontBase->t1lib_flags & T1_NO_AFM)!=0) { - /* this is no error condition, we simply return (NULL) */ - return( NULL); - } - - /* Check for explicitly associated metrics filename (via - "T1_SetAfmFileName()"). If it exists, we return it! */ - if (pFontBase->pFontArray[FontID].pAfmFileName!=NULL) { - strcpy( filepath, pFontBase->pFontArray[FontID].pAfmFileName); - sprintf( err_warn_msg_buf, "Returning explicitly specified path %s for Font %d", - filepath, FontID); - T1_PrintLog( "T1_GetAfmFilePath()", err_warn_msg_buf, T1LOG_DEBUG); - return( filepath); - } - - /* we have the usual case that the name of the metrics file has to be - deduced from the font file name */ - FontFileName=T1_GetFontFileName( FontID); - i=strlen(FontFileName); - j=i; - strcpy( filepath, FontFileName); - while ( filepath[i] != '.'){ - if (i==0) break; - else i--; - } - if (i==0){ - /* We have a filename without extension -> append extension */ - filepath[j]='.'; - filepath[j+1]='a'; - filepath[j+2]='f'; - filepath[j+3]='m'; - filepath[j+4]='\0'; - } - else{ - /* we found a '.' -> replace extension */ - filepath[i+1]='a'; - filepath[i+2]='f'; - filepath[i+3]='m'; - filepath[i+4]='\0'; - } - /* Get full path of the afm file (The case of a full path name - name specification is valid */ - AFMFilePath=intT1_Env_GetCompletePath( filepath, T1_AFM_ptr); - strcpy( filepath, AFMFilePath); - free( AFMFilePath); - - return( filepath); - -} diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1base.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1base.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1base.h Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1base.h Thu Jan 1 00:00:00 1970 @@ -1,88 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1base.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-03 - ----- Description: This file is part of the t1-library. It contains - declarations and definitions for t1base.c - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independ from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#ifdef T1BASE_C - -void *T1_InitLib( int log); -int intT1_scanFontDBase( char *filename); -int T1_CloseLib( void); -int T1_AddFont( char *fontfilename); -void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...); -void T1_SetLogLevel( int level); -int CheckForInit(void); -int CheckForFontID( int FontID); -int test_for_t1_file( char *buffer ); -char *T1_GetFontFileName( int FontID); -int T1_Get_no_fonts(void); -int T1_SetDeviceResolutions( float x_res, float y_res); -int T1_CopyFont( int FontID); -int T1_QueryX11Support( void); -void bin_dump_c(unsigned char value, char space_flag); -void bin_dump_s(unsigned short value, char space_flag); -void bin_dump_l(unsigned long value, char space_flag); -int T1_CheckEndian(void); -int T1_SetBitmapPad( int pad); -int T1_GetBitmapPad( void); -char *T1_GetLibIdent( void); -void T1_SetRasterFlags( int flags); -char *T1_GetAfmFileName( int FontID); -int T1_SetAfmFileName( int FontId, char *afm_name); -char *T1_GetFontFilePath( int FontID); -char *T1_GetAfmFilePath( int FontID); - -extern int T1_Type1OperatorFlags; - -#else - -extern void *T1_InitLib( int log); -extern int intT1_scanFontDBase( char *filename); -extern int T1_CloseLib( void); -extern int T1_AddFont( char *fontfilename); -extern void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...); -extern void T1_SetLogLevel( int level); -extern int CheckForInit(void); -extern int CheckForFontID( int FontID); -extern int test_for_t1_file( char *buffer ); -extern char *T1_GetFontFileName( int FontID); -extern int T1_Get_no_fonts(void); -extern int T1_SetDeviceResolutions( float x_res, float y_res); -extern int T1_QueryX11Support( void); -extern int T1_CopyFont( int FontID); -extern void bin_dump_c(unsigned char value, char space_flag); -extern void bin_dump_s(unsigned short value, char space_flag); -extern void bin_dump_l(unsigned long value, char space_flag); -extern int T1_CheckEndian(void); -extern int T1_SetBitmapPad( int pad); -extern int T1_GetBitmapPad( void); -extern char *T1_GetLibIdent( void); -extern void T1_SetRasterFlags( int flags); -extern char *T1_GetAfmFileName( int FontID); -extern int T1_SetAfmFileName( int FontId, char *afm_name); -extern char *T1_GetFontFilePath( int FontID); -extern char *T1_GetAfmFilePath( int FontID); - -#endif diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1delete.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1delete.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1delete.c Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1delete.c Thu Jan 1 00:00:00 1970 @@ -1,362 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1delete.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-06-03 - ----- Description: This file is part of the t1-library. It contains - functions for giving free previously allocated - memory areas and similar things. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1DELETE_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include - - -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" - -#include "t1types.h" -#include "t1extern.h" -#include "t1delete.h" -#include "t1load.h" -#include "t1finfo.h" -#include "t1base.h" - - - -/* T1_DeleteSize(): Gives back all the memory allocated for size to the - system. If size is somewhere in the middle of a linked list of sizes, - it further takes care that the remaining list is linked in a proper - way. Function returns 0 if successful and otherwise -1*/ -int T1_DeleteSize( int FontID, float size) -{ - int i, j; - FONTSIZEDEPS *ptr, *next_ptr, *prev_ptr; - int jobs=0; - int antialias; - int level[4]={0,T1_AA_NONE,T1_AA_LOW,T1_AA_HIGH}; - - - for ( j=0; j<4; j++){ - antialias=level[j]; - /* Check if size exists; if not, return 1 */ - if ((ptr=QueryFontSize( FontID, size, antialias))!=NULL){ - /* We have to remove a size-> */ - jobs++; - /* Get pointers to structure which is before/after the structure - to be deleted in the linked list and properly relink - structures */ - next_ptr=((FONTSIZEDEPS *)ptr)->pNextFontSizeDeps; - prev_ptr=((FONTSIZEDEPS *)ptr)->pPrevFontSizeDeps; - - if ((prev_ptr==NULL)&&(next_ptr==NULL)){ - /* There's only one single size, no relink is necessary - => reset the initial pointer to indicate that no size - dependent data is available */ - pFontBase->pFontArray[FontID].pFontSizeDeps=NULL; - } - else{ - if (prev_ptr!=NULL) - /* We are at the first size of the linked list and - there are still some sizes left after removing the - current */ - prev_ptr->pNextFontSizeDeps=next_ptr; - else - pFontBase->pFontArray[FontID].pFontSizeDeps=next_ptr; - if (next_ptr!=NULL) - /* We are at the end of an list of at least two sizes: */ - next_ptr->pPrevFontSizeDeps=prev_ptr; - } - - /* Now, that the list is properly linked, free the memory used by size: */ - /* Free the bitmaps memory: */ - for (i=0; i<256; i++) - if (ptr->pFontCache[i].bits) - free(ptr->pFontCache[i].bits); - - /* Free memory for glyphs: */ - free(ptr->pFontCache); - /* Free the structure itself: */ - free(ptr); - /* Print log: */ - sprintf( err_warn_msg_buf, "Size %f deleted for FontID %d (antialias=%d)", - size, FontID, antialias); - T1_PrintLog( "T1_DeleteSize()", err_warn_msg_buf, T1LOG_STATISTIC); - } - } - - /* Return the appropriate value */ - if (jobs==0) - return(-1); - else - return(0); - -} - - -/* T1_DeleteAllSizes(): Gives back all the memory allocated for all sizes - to the system. Function returns the number of removed sizes or -1 if an - error ocurred. */ -int T1_DeleteAllSizes( int FontID) -{ - int sizecount; - float currsize; - - FONTSIZEDEPS *ptr; - - if (CheckForFontID(FontID)!=1) - return(-1); - - /* Start deleting at the end of the linked list: */ - sizecount=0; - if ((ptr=GetLastFontSize( FontID))==NULL){ - /* There has not been any size dependent data: */ - return(0); - } - - while (((ptr=GetLastFontSize(FontID)) != NULL)){ - currsize=ptr->size; - T1_DeleteSize( FontID, currsize); - sizecount++; - - } - - return(sizecount); -} - - -/* T1_FreeGlyph(): Gives the memory used by a glyph back to the system. */ -int T1_FreeGlyph( GLYPH *glyph) -{ - if (glyph!=NULL) { - if (glyph->bits!=NULL) { - free(glyph->bits); - } - free(glyph); - } - return(0); -} - - -/* T1_FreeCompCharData(): Return emory used by a composite character - data information structure to the system */ -int T1_FreeCompCharData( T1_COMP_CHAR_INFO *cci) -{ - - if (cci!=NULL) { - if (cci->pieces!=NULL) { - free( cci->pieces); - } - free( cci); - } - return( 0); -} - - -/* T1_DeleteFont(): Gives all memory used by a font back to the system. - If the font is successfully deinstalled 0 is returned. A positive value - indicates an error. */ -int T1_DeleteFont( int FontID) -{ - - int result; - - - if (CheckForFontID(FontID)==-1){ /* Invalid ID */ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - if (CheckForFontID(FontID)==0) /* Font is not loaded */ - return(0); - - /* Memory freeing must be done hierachical, start with size dependent - data: */ - result=T1_DeleteAllSizes(FontID); - - /* Next we delete the AFM-mapping tables */ - if (pFontBase->pFontArray[FontID].pEncMap!=NULL) - free( pFontBase->pFontArray[FontID].pEncMap); - if (pFontBase->pFontArray[FontID].pKernMap!=NULL) - free( pFontBase->pFontArray[FontID].pKernMap); - - /* We do not touch the file name because this is only to be done by - T1_CloseLib(): */ - - /* The Type-1 area and tyhe AFM-area may only be free'ed, if the - font is a "physical" font and if its reference counter is 1, or - if it is a logical font. Otherwise, other logical font use this - physical one and it may not be free'ed. In this case, return the - number of logical fonts which refer to this physical font. */ - if ((pFontBase->pFontArray[FontID].physical==1)&& - (pFontBase->pFontArray[FontID].refcount==1)){ - /* Now handle the type 1 data: */ - if (pFontBase->pFontArray[FontID].pType1Data!=NULL){ - /* First: VM, which includes CharStrings, Private, .... */ - free(pFontBase->pFontArray[FontID].vm_base); - /* .. then the struct itself: */ - free(pFontBase->pFontArray[FontID].pType1Data); - pFontBase->pFontArray[FontID].pType1Data=NULL; - } - - /* afm-data is yet there -> */ - if (pFontBase->pFontArray[FontID].pAFMData!=NULL){ - result=FreeAFMData(pFontBase->pFontArray[FontID].pAFMData); - pFontBase->pFontArray[FontID].pAFMData=NULL; - } - } - else{ - if (pFontBase->pFontArray[FontID].physical==1){ - /* font is physical and is referred to by other fonts -> - Do nothing further and return number of references: */ - - return(pFontBase->pFontArray[FontID].refcount - 1); - } - } - - /* If we get here and the font is logical, we have to - decrement the refcount of the referred physical font */ - if (pFontBase->pFontArray[FontID].physical==0){ - pFontBase->pFontArray[pFontBase->pFontArray[FontID].refcount].refcount--; - } - - - /* Set remaining area explicitly to 0 (all but pFontFileName and - pAfmFileName!) */ - pFontBase->pFontArray[FontID].pAFMData=NULL; - pFontBase->pFontArray[FontID].pType1Data=NULL; - pFontBase->pFontArray[FontID].pEncMap=NULL; - pFontBase->pFontArray[FontID].pKernMap=NULL; - pFontBase->pFontArray[FontID].pFontEnc=NULL; - pFontBase->pFontArray[FontID].pFontSizeDeps=NULL; - pFontBase->pFontArray[FontID].vm_base=NULL; - pFontBase->pFontArray[FontID].FontMatrix[0]=0.0; - pFontBase->pFontArray[FontID].FontMatrix[1]=0.0; - pFontBase->pFontArray[FontID].FontMatrix[2]=0.0; - pFontBase->pFontArray[FontID].FontMatrix[3]=0.0; - pFontBase->pFontArray[FontID].FontTransform[0]=0.0; - pFontBase->pFontArray[FontID].FontTransform[1]=0.0; - pFontBase->pFontArray[FontID].FontTransform[2]=0.0; - pFontBase->pFontArray[FontID].FontTransform[3]=0.0; - pFontBase->pFontArray[FontID].slant=0.0; - pFontBase->pFontArray[FontID].extend=0.0; - pFontBase->pFontArray[FontID].UndrLnPos=0.0; - pFontBase->pFontArray[FontID].UndrLnThick=0.0; - pFontBase->pFontArray[FontID].OvrLnPos=0.0; - pFontBase->pFontArray[FontID].OvrLnThick=0.0; - pFontBase->pFontArray[FontID].OvrStrkPos=0.0; - pFontBase->pFontArray[FontID].OvrStrkThick=0.0; - pFontBase->pFontArray[FontID].physical=0; - pFontBase->pFontArray[FontID].refcount=0; - pFontBase->pFontArray[FontID].space_position=0; - pFontBase->pFontArray[FontID].info_flags=0; - - return(0); - -} - - - -/* FreeAFMData(): Give all memory used by afm-Information back to the - system. */ -int FreeAFMData( FontInfo *pAFMData) -{ - if (pAFMData != NULL){ - if (pAFMData->gfi != NULL){ - free(pAFMData->gfi->afmVersion); pAFMData->gfi->afmVersion = NULL; - free(pAFMData->gfi->fontName); pAFMData->gfi->fontName = NULL; - free(pAFMData->gfi->fullName); pAFMData->gfi->fullName = NULL; - free(pAFMData->gfi->familyName); pAFMData->gfi->familyName = NULL; - free(pAFMData->gfi->weight); pAFMData->gfi->weight = NULL; - free(pAFMData->gfi->version); pAFMData->gfi->version = NULL; - free(pAFMData->gfi->notice); pAFMData->gfi->notice = NULL; - free(pAFMData->gfi->encodingScheme); pAFMData->gfi->encodingScheme = NULL; - free(pAFMData->gfi); pAFMData->gfi = NULL; - } - - if (pAFMData->cwi != NULL){ - free(pAFMData->cwi); pAFMData->cwi = NULL; - } - - if (pAFMData->cmi != NULL){ - int i = 0; - CharMetricInfo *temp = pAFMData->cmi; - Ligature *node = temp->ligs; - for (i = 0; i < pAFMData->numOfChars; ++i){ - for (node = temp->ligs; node != NULL; node = node->next){ - free(node->succ); node->succ = NULL; - free(node->lig); node->lig = NULL; - } - free(temp->name); temp->name = NULL; - temp++; - } - free(pAFMData->cmi); pAFMData->cmi = NULL; - } - - if (pAFMData->tkd != NULL){ - free(pAFMData->tkd); pAFMData->tkd = NULL; - } - - if (pAFMData->pkd != NULL){ - int i = 0; - for (i = 0; i < pAFMData->numOfPairs; ++i){ - free(pAFMData->pkd[i].name1); pAFMData->pkd[i].name1 = NULL; - free(pAFMData->pkd[i].name2); pAFMData->pkd[i].name2 = NULL; - } - free(pAFMData->pkd); pAFMData->pkd = NULL; - } - - if (pAFMData->ccd != NULL){ - int i = 0, j = 0; - CompCharData *ccd = pAFMData->ccd; - for (i = 0; i < pAFMData->numOfComps; ++i){ - for (j = 0; j < ccd[i].numOfPieces; ++j){ - free(ccd[i].pieces[j].pccName); - ccd[i].pieces[j].pccName = NULL; - } - free(ccd[i].ccName); ccd[i].ccName = NULL; - } - free(pAFMData->ccd); pAFMData->ccd = NULL; - } - free(pAFMData); - } - return(0); - -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1delete.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1delete.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1delete.h Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1delete.h Thu Jan 1 00:00:00 1970 @@ -1,49 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1delete.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-06-03 - ----- Description: This file is part of the t1-library. It contains - functions for setting characters and strings of - characters. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#ifdef T1DELETE_C - -int T1_DeleteSize( int FontID, float size); -int T1_DeleteAllSizes( int FontID); -int T1_FreeGlyph( GLYPH *glyph); -int T1_FreeCompCharData( T1_COMP_CHAR_INFO *cci); -int T1_DeleteFont( int FontID); -int FreeAFMData( FontInfo *pAFMData); - -#else - -extern int T1_DeleteSize( int FontID, float size); -extern int T1_DeleteAllSizes( int FontID); -extern int T1_FreeGlyph( GLYPH *glyph); -extern int T1_FreeCompCharData( T1_COMP_CHAR_INFO *cci); -extern int T1_DeleteFont( int FontID); -extern int FreeAFMData( FontInfo *pAFMData); - -#endif - - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1enc.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1enc.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1enc.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1enc.c Thu Jan 1 00:00:00 1970 @@ -1,807 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1enc.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-18 - ----- Description: This file is part of the t1-library. It contains - functions encoding handling at runtime. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independ from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1ENC_C - - -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include - - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" - - -#include "t1types.h" -#include "t1extern.h" -#include "t1enc.h" -#include "t1env.h" -#include "t1base.h" -#include "t1finfo.h" - - -static char defaultencodingname[]="Unspecified"; - -/* This struct is retunred by the tokenizer. It contains indices - in linebuf for the first and the last character in a token */ -typedef struct -{ - int first; - int last; -} CNTOKEN; - - - -/* ScanForWord(): Tokenizer for ScanEncodingFile. - - - and return the first and last index in linebuf of the token - - - skips whitespace and comments - - - the vector marks [ and ] are considered token-delimiters - and also treated as independent tokens - - - the literal escape char "/" is also considered as a token - delimiter but is not returned as a token. - - This function leaves linebuf unmodified so that in case of a - failure, TryT1LibEncoding() will receive a clean buffer! */ -static CNTOKEN *ScanForWord( char *lb, int size) -{ - static int i=-1; - int j; - int comment; - - static CNTOKEN currtoken={-1,-1}; - - /* Reset tokenizer */ - if (lb==NULL) { - i=-1; - currtoken.first=-1; - currtoken.last=-1; - return NULL; - } - - comment=0; - j=-1; - - while (++i word */ - if (j==-1) { - j=i; - currtoken.first=j; - continue; - } - } - - /* We're at the end of the buffer. Do we have a word? */ - if (j!=-1) { - currtoken.last=i-1; - return &currtoken; - } - - /* We have nothing */ - return NULL; -} - - -/* tokcpy(): Copy a token from linebuf and append \0 */ -static char *tokcpy( char *dest, const char *src, - int first, int last) -{ - /* we do not do any range or error checking in this function */ - memcpy( dest, &(src[first]), last-first+1); - dest[last-first+1]='\0'; - return dest; -} - - -/* TryDVIPSEncoding(): Try to read an encoding file conforming to the - dvips specification. The file's contents is expected in a buffer - "linebuf" of size "filesize". Function returns the actual size of the - charnames memory or -1. */ -static int TryDVIPSEncoding( char *linebuf, int filesize, char *charnames) -{ - - char token[256]; - char *encname; - int charname_count=0; - int k=0; - CNTOKEN *currtokenP; - - - /* Initialize tokenizer */ - currtokenP=ScanForWord( NULL, filesize); - - - currtokenP=ScanForWord(linebuf,filesize); - if ( (currtokenP!=NULL) && - (linebuf[currtokenP->first]=='/')) { - /* / indicates start of postscript string literal, so this - could be a postscript .enc file */ - if ((encname=(char *)malloc( (currtokenP->last - currtokenP->first + 1 + 1) * - sizeof( char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return -1; - } - else { - /* store encoding name */ - if (currtokenP->first==currtokenP->last) { - /* PostScript encoding requires an identifier - so this does not seem to be a valid encoding file */ - free( encname); - return( -1); - } - tokcpy( encname, linebuf, currtokenP->first+1, currtokenP->last); - - } - - - /* Next, the PostScript "mark" character is expected */ - if ( ((currtokenP=ScanForWord(linebuf,filesize))!=NULL) && - (currtokenP->first==currtokenP->last) && - (linebuf[currtokenP->first]!='[') ) { - /* Since we got up to here, there is a certain probability that - we have a PostScript encoding definition, but with invalid - syntax. So put log message. */ - sprintf( err_warn_msg_buf, - "Expected encoding definition after %s, but did not find \"[\"-character", - encname); - T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); - if (encname!=NULL) - free( encname); - return( -1); - } - - /* now, try to read 256 literal character names. We do not check - for charname count because this would bypass error checking. */ - while((currtokenP=ScanForWord(linebuf,filesize))!=NULL) { - - /* End of vector operator? */ - if ( (currtokenP->first==currtokenP->last) && /* one character? */ - (linebuf[currtokenP->first]==']')) { - break; - } - /* We drop the escape character if it is present. However, - non-literal name specifications are not allowed in - encoding vectors. */ - if (linebuf[currtokenP->first]!='/') { - sprintf( err_warn_msg_buf, - "Found non-literal name (c=%c (first=%d, last=%d)) at slot %d while scanning encoding vector %s.", - linebuf[currtokenP->first], - currtokenP->first, currtokenP->last, - charname_count, encname); - T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); - if (encname!=NULL) - free( encname); - return( -1); - } - else { - /* OK, first char in token is "/". Does there follow a name? */ - if ( currtokenP->first==currtokenP->last) { - sprintf( err_warn_msg_buf, - "Empty literal name at slot %d while scanning encoding vector %s.", - charname_count, encname); - T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); - if (encname!=NULL) - free( encname); - return( -1); - } - } - - /* We seem to have a valid name -> copy name to *charnames-array */ - tokcpy( &(charnames[k]), linebuf, - currtokenP->first+1, currtokenP->last); - k+=currtokenP->last-currtokenP->first+1; /* note: we have omitted "/"! */ - /* Increment character counter */ - charname_count++; - /* set index to start of next word/line */ - } /* end of loop scanning character names */ - - if (currtokenP==NULL) { - /* In this case loop has been stopped because buffer end has been - reached. Since we did not alreay read the ]-character, this is - an error condition. */ - sprintf( err_warn_msg_buf, - "Premature end of encoding definition encountered." ); - T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); - free(encname); - return( -1); - } - /* Since the above loop has not been finished due to a NULL-ptr, - the token ] must have been encountered. Thus, read ahead and look - for def: */ - if ((currtokenP=ScanForWord(linebuf,filesize))==NULL) { - sprintf( err_warn_msg_buf, - "Premature end of encoding definition encountered."); - T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); - free(encname); - return( -1); - } - - if (strcmp(tokcpy( &(charnames[k]), linebuf, - currtokenP->first, currtokenP->last), "def")!=0) { - /* we store the current token in charnames only temporarily, so we - do not increment k! */ - sprintf( err_warn_msg_buf, - "Closing token \"def\" expected but found \"%s\".", - &(charnames[k])); - T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); - free(encname); - return( -1); - } - /* Encoding definition is complete. we do not allow any further tokens - except comments. */ - if ((currtokenP=ScanForWord(linebuf,filesize))!=NULL) { - tokcpy( token, linebuf, currtokenP->first, currtokenP->last); - sprintf( err_warn_msg_buf, - "Token \"%s\" after closing \"def\" in successfully scanned encoding file makes encoding definition file invalid", token); - T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); - free(encname); - return( -1); - } - - /* we allow less than 256 character names. The missing ones are filled - now with .notdef */ - for ( ; charname_count<256; charname_count++) { - tokcpy( &(charnames[k]), ".notdef", 0, 6); - k+=8; - } - - /* Append the string for the encoding's name */ - strcpy( &(charnames[k]), encname); - k +=strlen(encname)+1; - - free(encname); - - return( k); - - } /* file does not start with / -> no dvips-encoding file */ - - return( -1); - -} - - - -/* TryT1LibEncoding(): Try to read an encoding file conforming to the - t1lib specification. The file's contents is expected in a buffer - "linebuf" of size "filesize". Function returns the actual size of the - charnames memory or -1. */ -static int TryT1LibEncoding( char *linebuf, int filesize, char *charnames) -{ - int i=0, j=0, k=0, l=0; - - char save_char; - int charname_count=0; - - while(i no encoding read */ - } - - - /* enc_fp points now to a (hopefully) valid encoding file */ - /* Get the file size */ - fseek( enc_fp, 0, SEEK_END); - filesize=ftell(enc_fp); - /* Reset fileposition to start */ - fseek( enc_fp, 0, SEEK_SET); - - if ((linebuf=(char *)calloc( filesize, - sizeof(char)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - /* Allocate space for character names, assume the worst case and realloc - later. The DVIPS-parser requires one more char in order to work properly */ - if ((charnames=(char *)calloc( filesize + strlen(defaultencodingname+1), - sizeof(char)))==NULL){ - free( linebuf); - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - fread((char *)linebuf, sizeof(char), filesize, enc_fp); - fclose(enc_fp); - - - /* file is read. Operate now on the buffer. */ - - - /* try dvips encoding file */ - cnsize=TryDVIPSEncoding( linebuf, filesize, charnames); - if ( cnsize>-1) { - /* a debug message to log file */ - sprintf( err_warn_msg_buf, - "Scanned file %s (%d bytes) as dvips-encoding file.", - FileName, filesize); - T1_PrintLog( "ScanEncodingFile()", err_warn_msg_buf, T1LOG_DEBUG); - } - else { - /* try t1lib encoding file */ - cnsize=TryT1LibEncoding( linebuf, filesize, charnames); - if ( cnsize>-1) { - /* write a debug message to log file */ - sprintf( err_warn_msg_buf, - "Scanned file %s (%d bytes) as t1lib-encoding file.", - FileName, filesize); - T1_PrintLog( "ScanEncodingFile()", err_warn_msg_buf, T1LOG_DEBUG); - } - else { - /* write a warning message because loading encoding - entirely failed */ - sprintf( err_warn_msg_buf, - "Scanning file %s (%d bytes) as encoding file failed.", - FileName, filesize); - T1_PrintLog( "ScanEncodingFile()", err_warn_msg_buf, T1LOG_WARNING); - } - } - - if ( cnsize<0) { - /* T1_errno is already set from the respective function */ - if ( charnames!=NULL) { - free(charnames); - } - free(linebuf); - return( NULL); - } - - - /* cnsize contains the size of the charnames' memory, so let's - now realloc charnames */ - charnames=(char *)realloc( charnames, cnsize*sizeof(char)); - /* Now initialize the array with the start-addresses of the character - name strings */ - /* We alloc 257 to save the encoding's name at the 257th entry */ - if ((encoding=(char **)malloc(257*sizeof(char *)))==NULL) { - if ( charnames!=NULL) { - free(charnames); - } - free(linebuf); - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - while (i<257) { - encoding[i]=&charnames[j]; - while (charnames[j]) - j++; - j++; - i++; - } - - free( linebuf); - return(encoding); - -} - - - -/* T1_LoadEncoding(): Load an encoding file to have a new encoding - available. If successful, the pointer to the encoding array is - returned. In case of an error, the return value is NULL. - */ -char **T1_LoadEncoding( char *FileName) -{ - char **Encoding; - char *EncFileName; - - if( FileName==NULL){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - if ((EncFileName=intT1_Env_GetCompletePath( FileName, T1_ENC_ptr))==NULL){ - T1_errno=T1ERR_FILE_OPEN_ERR; - return(NULL); - } - Encoding=ScanEncodingFile(EncFileName); - free(EncFileName); - - return(Encoding); -} - - - -/* T1_DeleteEncoding() free a previously loaded encoding */ -int T1_DeleteEncoding( char **encoding) -{ - if (encoding){ - /* First free character names memory */ - free( encoding[0]); - /* then, free pointer array */ - free( encoding); - } - return(0); - -} - - - -/* T1_ReencodeFont(): Assign a new encoding to an existent font. This is - only allowed if no size dependent data exists for the font in question. - Moreover, the font must be loaded already since must get the position - of the space-character. Function returns 0 if successful, and -1 otherwise. - */ -int T1_ReencodeFont( int FontID, char **Encoding) -{ - int i, j, k, l, m; - char *charname; - PairKernData *pkd; - METRICS_ENTRY *kern_tbl; - int char1, char2; - - - /* First, check for valid font ID residing in memory: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - /* Second, check whether size-dependent data exists: */ - if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - pFontBase->pFontArray[FontID].pFontEnc=Encoding; - - - /* We have to update the space_position-entry in the FONTPRIVATE. - If space is not found (not encoded), set it to -1: */ - pFontBase->pFontArray[FontID].space_position=-1; - i=0; - if (Encoding){ /* external encoding */ - while (i<256){ - if (strcmp( (char *)pFontBase->pFontArray[FontID].pFontEnc[i], - "space")==0){ - /* space found at position i: */ - pFontBase->pFontArray[FontID].space_position=i; - break; - } - i++; - } - } - else{ /* reencoding to internal encoding */ - while (i<256){ - if (strcmp( (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[i].data.arrayP, - "space")==0){ - /* space found at position i: */ - pFontBase->pFontArray[FontID].space_position=i; - break; - } - i++; - } - } - - /* Now update afm index mapping: */ - if (pFontBase->pFontArray[FontID].pAFMData != NULL){ - for (i=0; i<256; i++) { - charname=T1_GetCharName( FontID, i); - /* in a first loop check for ordinary characters */ - for ( j=0; jpFontArray[FontID].pAFMData->numOfChars; j++) { - if (strcmp( charname, - pFontBase->pFontArray[FontID].pAFMData->cmi[j].name)==0) { - pFontBase->pFontArray[FontID].pEncMap[i]=j+1; /* index 0 is reserved! */ - continue; - } - } - /* if nothing has been found, check for composite characters */ - for ( j=0; jpFontArray[FontID].pAFMData->numOfComps; j++) { - if (strcmp( charname, - pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName)==0) { - pFontBase->pFontArray[FontID].pEncMap[i]=-(j+1); /* index 0 is reserved! */ - /* Note: Metrics of composite characters already exist so that there is - no need to recalculate them! */ - continue; - } - } - } - /* Update kerning table */ - k=pFontBase->pFontArray[FontID].pAFMData->numOfPairs; - if (k>0){ /* i.e., there are any pairs */ - /* OK, it does not suffice to alloc numOfPairs METRICS_ENTRYs, because - a given character might be encoded at several locations and kerning - should still work. As a worst case estimation, we allocate 256^2 - and realloc later. */ - if ((pFontBase->pFontArray[FontID].pKernMap= - (METRICS_ENTRY *)malloc( (256*256) *sizeof( METRICS_ENTRY)))==NULL){ - sprintf( err_warn_msg_buf, "Error allocating memory for metrics map (FontID=%d)", - FontID); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - kern_tbl=pFontBase->pFontArray[FontID].pKernMap; - pkd=pFontBase->pFontArray[FontID].pAFMData->pkd; - j=0; - for ( i=0; i - Put char1 in higher byte and char2 in LSB: */ - kern_tbl[j].chars=(char1 << 8) | char2; - /* We only make use of horizontal kerning */ - kern_tbl[j].hkern=pkd[i].xamt; - j++; - } /* while (char2) */ - } /* while (char1) */ - } /* for */ - /* We are done, realloc memory: */ - kern_tbl=(METRICS_ENTRY*) realloc( kern_tbl, j*sizeof(METRICS_ENTRY)); - /* We now sort the kerning array with respect to char indices */ - qsort( kern_tbl, (size_t) j, sizeof(METRICS_ENTRY), - &cmp_METRICS_ENTRY ); - /* Finally write back pointer for the case that realloc changed the - pointer */ - pFontBase->pFontArray[FontID].pKernMap=kern_tbl; - pFontBase->pFontArray[FontID].KernMapSize=j; - } - else { - pFontBase->pFontArray[FontID].pKernMap=NULL; - } - } - return(0); -} - - - -/* T1_SetDefaultEncoding(): Set the default encoding vector that's - used when fonts are loaded. - */ -int T1_SetDefaultEncoding( char **encoding) -{ - - if (CheckForInit()){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - pFontBase->default_enc=encoding; - return(0); -} - - -/* T1_GetEncodingScheme(): Get the name associated with the current - encoding vector of font FontID */ -char *T1_GetEncodingScheme( int FontID) -{ - - static char enc_scheme[256]; - - /* First, check for valid font ID residing in memory: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - if (pFontBase->pFontArray[FontID].pFontEnc==NULL){ - if (pFontBase->pFontArray[FontID].info_flags & USES_STANDARD_ENCODING){ - strcpy( enc_scheme, "StandardEncoding"); - } - else { - strcpy( enc_scheme, "FontSpecific"); - } - } - else - strcpy( enc_scheme, pFontBase->pFontArray[FontID].pFontEnc[256]); - - return(enc_scheme); - -} - - -/* A function for comparing METRICS_ENTRY structs */ -static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2) -{ - if (((METRICS_ENTRY *)entry1)->chars < - ((METRICS_ENTRY *)entry2)->chars) - return(-1); - if (((METRICS_ENTRY *)entry1)->chars > - ((METRICS_ENTRY *)entry2)->chars) - return(1); - return(0); /* This should not happen */ -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1enc.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1enc.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1enc.h Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1enc.h Thu Jan 1 00:00:00 1970 @@ -1,47 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1enc.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-06-16 - ----- Description: This file is part of the t1-library. It contains - declarations and definitions for t11enc.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independ from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#ifdef T1ENC_C - -static char **ScanEncodingFile( char *FileName); -char **T1_LoadEncoding( char *FileName); -int T1_DeleteEncoding( char **encoding); -int T1_ReencodeFont( int FontID, char **Encoding); -int T1_SetDefaultEncoding( char **encoding); -char *T1_GetEncodingScheme( int FontID); -static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2); - -#else - -extern char **T1_LoadEncoding( char *FileName); -extern int T1_DeleteEncoding( char **encoding); -extern int T1_ReencodeFont( int FontID, char **Encoding); -extern int T1_SetDefaultEncoding( char **encoding); -extern char *T1_GetEncodingScheme( int FontID); - -#endif - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1env.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1env.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1env.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1env.c Thu Jan 1 00:00:00 1970 @@ -1,1040 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1env.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-11-12 - ----- Description: This file is part of the t1-library. It implements - the reading of a configuration file and path-searching - of type1-, afm- and encoding files. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independ from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#define T1ENV_C - - -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include - - -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/fontmisc.h" - -#include "sysconf.h" -#include "t1types.h" -#include "t1extern.h" -#include "t1env.h" -#include "t1misc.h" -#include "t1base.h" - - -/* The following static variables are used to store information on the distinct - file search paths: - - -1 t1lib has not yet been initialized! - 0 t1lib has been initialized and default paths have been setup - n (>0) there are n path elements for current search path type, either built - from a FontDataBase file or from explicit fucntion calls. -*/ - -static int pfab_no=-1; -static int afm_no=-1; -static int enc_no=-1; -static int fdb_no=-1; - -static char path_sep_char='\0'; -static char path_sep_string[2]; - -static char pathbuf[2048]; - -/* Define some default search paths */ -#ifndef VMS -static char T1_pfab[]="."; -static char T1_afm[]="."; -static char T1_enc[]="."; -#else -static char T1_pfab[]="sys$disk:[]"; -static char T1_afm[]="sys$disk:[]"; -static char T1_enc[]="sys$disk:[]"; -#endif -char T1_fdb[]="FontDataBase"; - - -/* keywords recognized in config file */ -static const char enc_key[]="ENCODING"; -static const char pfab_key[]="TYPE1"; -static const char afm_key[]="AFM"; -static const char fdb_key[]="FONTDATABASE"; - - -/* qstrncpy(): Copy bytes from srcP to to destP. srcP is count bytes long - and destP is the number of quoted characters shorter. That is, count - refers to the number of characters including the escapement chars in - srcP! */ -static void qstrncpy( char *destP, const char *srcP, long nochars) -{ - long i; - long j; - - i=0; /* dest-index */ - j=0; /* src-index */ - - while (j omit escape char. */ - } - } - else { /* normal character */ - destP[i++]=srcP[j++]; - } - } -} - - - - -/* Setup the default paths for searching the distinct file types. If - paths have been setup explicitly, skip the step of setting up a default path. */ -void intT1_SetupDefaultSearchPaths( void) -{ - - path_sep_char=PATH_SEP_CHAR; - sprintf( path_sep_string, "%c", path_sep_char); - - /* We set the number of stored path elements 0 so that we can distiguish - between explicitly setup paths and default paths in intT1_ScanConfigFile(). */ - if (pfab_no==-1) { - T1_PFAB_ptr=(char**) calloc( 2, sizeof(char*)); - T1_PFAB_ptr[0]=(char*)malloc(strlen(T1_pfab)+1); - strcpy(T1_PFAB_ptr[0],T1_pfab); - pfab_no=0; - } - - if (afm_no==-1) { - T1_AFM_ptr=(char**) calloc( 2, sizeof(char*)); - T1_AFM_ptr[0]=(char*)malloc(strlen(T1_afm)+1); - strcpy(T1_AFM_ptr[0],T1_afm); - afm_no=0; - } - - if (enc_no==-1) { - T1_ENC_ptr=(char**) calloc( 2, sizeof(char*)); - T1_ENC_ptr[0]=(char*)malloc(strlen(T1_enc)+1); - strcpy(T1_ENC_ptr[0],T1_enc); - enc_no=0; - } - - if (fdb_no==-1) { - T1_FDB_ptr=(char**) calloc( 2, sizeof(char*)); - T1_FDB_ptr[0]=(char*)malloc(strlen(T1_fdb)+1); - strcpy(T1_FDB_ptr[0],T1_fdb); - fdb_no=0; - } -} - - -/* This function is called from T1_CloseLib(). We have to indicate the state - of a non-initialzed t1lib! */ -void intT1_FreeSearchPaths( void) -{ - int i; - - i=0; - if (T1_PFAB_ptr!=NULL) { - while (T1_PFAB_ptr[i]!=NULL) { - free(T1_PFAB_ptr[i]); - T1_PFAB_ptr[i]=NULL; - } - free( T1_PFAB_ptr); - } - i=0; - if (T1_AFM_ptr!=NULL) { - while (T1_AFM_ptr[i]!=NULL) { - free(T1_AFM_ptr[i]); - T1_AFM_ptr[i]=NULL; - } - free( T1_AFM_ptr); - } - i=0; - if (T1_ENC_ptr!=NULL) { - while (T1_ENC_ptr[i]!=NULL) { - free(T1_ENC_ptr[i]); - T1_ENC_ptr[i]=NULL; - } - free( T1_ENC_ptr); - } - i=0; - if (T1_FDB_ptr!=NULL) { - while (T1_FDB_ptr[i]!=NULL) { - free(T1_FDB_ptr[i]); - T1_FDB_ptr[i]=NULL; - } - free( T1_FDB_ptr); - } - /* indicate t1lib non-initialized */ - pfab_no=-1; - afm_no=-1; - enc_no=-1; - fdb_no=-1; - - return; -} - - -/* ScanConfigFile(): Read a configuration file and scan and save the - environment strings used for searching pfa/pfb-, afm- and encoding - files as well as the name of the font database file. */ -int intT1_ScanConfigFile( void) -{ - - char *env_str; - char *linebuf; - char *usershome; - char *cnffilepath; - char *globalcnffilepath; - static int linecnt; - char local_path_sep_char; - int quoted=0; - int quotecnt=0; - FILE *cfg_fp; - int filesize, i, j, k; - int ignoreline=0; - - char*** destP=NULL; - int *idestP=NULL; - char* curr_key=NULL; - - /* First, get the string stored in the environment variable: */ - env_str=getenv(ENV_CONF_STRING); - linecnt=1; - - if (env_str==NULL) { - /* environment variable not set, try to open default file - in user's home directory and afterwards global config file */ - if ((usershome=getenv("HOME"))!=NULL) { - cnffilepath=(char *)malloc((strlen(usershome) + - strlen(T1_CONFIGFILENAME) + 2 - ) * sizeof(char)); - if (cnffilepath==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - strcpy( cnffilepath, usershome); - } - else { - cnffilepath=(char *)malloc((strlen(T1_CONFIGFILENAME) + 2 - ) * sizeof(char)); - } - strcat( cnffilepath, DIRECTORY_SEP); - strcat( cnffilepath, T1_CONFIGFILENAME); - - globalcnffilepath=(char*)malloc((strlen(GLOBAL_CONFIG_DIR) + - strlen(GLOBAL_CONFIG_FILE) + 2 - ) * sizeof(char)); - if (globalcnffilepath==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - strcpy( globalcnffilepath, GLOBAL_CONFIG_DIR); - strcat( globalcnffilepath, DIRECTORY_SEP); - strcat( globalcnffilepath, GLOBAL_CONFIG_FILE); - - if ((cfg_fp=fopen( cnffilepath, "r"))==NULL){ - sprintf( err_warn_msg_buf, "Could not open configfile %s", - cnffilepath); - T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_STATISTIC); - /* Try global config file */ - if ((cfg_fp=fopen( globalcnffilepath, "r"))==NULL){ - sprintf( err_warn_msg_buf, "Could not open global configfile %s", - globalcnffilepath); - T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_WARNING); - } - else{ - sprintf( err_warn_msg_buf, "Using %s as Configfile (global)", - cnffilepath); - T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_STATISTIC); - } - } - else{ - sprintf( err_warn_msg_buf, "Using %s as Configfile (user's)", - cnffilepath); - T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_STATISTIC); - } - free( cnffilepath); - free( globalcnffilepath); - if (cfg_fp==NULL){ - T1_PrintLog( "ScanConfigFile()", - "Neither user's nor global Configfile has been found", - T1LOG_WARNING); - return(0); - } - } - else { - /* open specified file for reading the configuration */ - if ((cfg_fp=fopen(env_str,"r"))==NULL){ - T1_PrintLog( "ScanConfigFile()", - "Configfile as specified by Environment has not been found", - T1LOG_WARNING); - return(0); /* specified file could not be openend - => no config paths read */ - } - else { - sprintf( err_warn_msg_buf, "Using %s as Configfile (environment)", - env_str); - T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_STATISTIC); - } - } - - - /* cfg_fp points now to a valid config file */ - /* Get the file size */ - fseek( cfg_fp, 0, SEEK_END); - filesize=ftell(cfg_fp); - /* Reset fileposition to start */ - fseek( cfg_fp, 0, SEEK_SET); - - if ((linebuf=(char *)calloc( filesize+1, - sizeof(char)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - - fread((char *)linebuf, sizeof(char), filesize, cfg_fp); - fclose(cfg_fp); - - i=0; - - /* this might be overwritten on a per file basis */ - local_path_sep_char=path_sep_char; - - while(i end of path specification */ - else - quotecnt++; - } /* some other char */ - if (linebuf[i]=='\n') { /* a newline in a quoted string? Perhabs, quotes do not match! */ - T1_PrintLog( "ScanConfigFile()", - "Newline in quoted %s-string in line %d, column %d, of config file! Closing quote missing?", - T1LOG_WARNING, curr_key, linecnt, i-j+1); - j=i+1; /* resynchronize linecount */ - linecnt++; - } - if (i1) && (FileName[0]=='.') && - (FileName[1]==DIRECTORY_SEP_CHAR)) - || - ((fnamelen>2) && (FileName[0]=='.') && - (FileName[1]=='.') && (FileName[2]==DIRECTORY_SEP_CHAR)) -#if defined(MSDOS) | defined(_WIN32) | defined (__EMX__) - || - ((isalpha(FileName[0])) && (FileName[1]==':')) -#endif -#ifdef VMS - || (strchr(FileName,':') != NULL) -#endif - ) - { - /* Check for existence of the path: */ - if (!stat( FileName, &filestats)) { - if (t1lib_log_file!=NULL) { - sprintf( err_warn_msg_buf, "stat()'ing complete path %s successful", - FileName); - T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, - T1LOG_DEBUG); - } - /* Return a copy of the string */ - if ((FullPathName=(char *)malloc( fnamelen + 1))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - strcpy( FullPathName, FileName); - return(FullPathName); - } - if (t1lib_log_file!=NULL){ - sprintf( err_warn_msg_buf, "stat()'ing complete path %s failed", - FileName); - T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, - T1LOG_DEBUG); - } - /* Trying to locate absolute path spec. failed. We try to recover - by removing the path component and searching in the remaining search - path entries. This depends on the OS. */ - i=fnamelen-1; - StrippedName=&(FileName[i]); - while ( FileName[i]!=DIRECTORY_SEP_CHAR -#if defined(VMS) - /* What exactly to do for VMS? */ -#elif defined(MSDOS) | defined(_WIN32) | defined (__EMX__) | defined(_MSC_VER) - /* We take a drive specification into account. This means we - step back until the directory separator or a drive specifier - appears! */ - && FileName[i]!=':' -#endif - ) { - i--; - } - i++; - StrippedName=&FileName[i]; - if (t1lib_log_file!=NULL){ - sprintf( err_warn_msg_buf, "path %s stripped to %s", - FileName, StrippedName); - T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, - T1LOG_DEBUG); - } - } - else{ /* We have a relative path name */ - StrippedName=&FileName[0]; - } - - i=0; - while (env_ptr[i]!=NULL) { - /* Copy current path element: */ - strcpy( pathbuf, env_ptr[i]); - /* cut a trailing directory separator */ - j=strlen(pathbuf); - if (pathbuf[j-1]==DIRECTORY_SEP_CHAR) - pathbuf[j--]='\0'; - /* Add the directory separator: */ -#ifdef VMS - { char *p= strrchr(pathbuf, DIRECTORY_SEP_CHAR); - if (p && *(p+1) == '\0') - *p = '\0'; - } -#endif - strcat( pathbuf, DIRECTORY_SEP); - /* And finally the filename: */ - strcat( pathbuf, StrippedName); - - /* Check for existence of the path: */ - if (!stat( pathbuf, &filestats)) { - if ((FullPathName=(char*)malloc( (j+fnamelen+2)*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - strcpy( FullPathName, pathbuf); - if (t1lib_log_file!=NULL){ - sprintf( err_warn_msg_buf, "stat()'ing %s successful", - FullPathName); - T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, - T1LOG_DEBUG); - } - return(FullPathName); - } - if (t1lib_log_file!=NULL){ - sprintf( err_warn_msg_buf, "stat()'ing %s failed", - pathbuf); - T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, - T1LOG_DEBUG); - } - /* We didn't find the file --> try next path entry */ - i++; - } - /* If we get here, no file was found at all, so return a NULL-pointer */ - return(NULL); -} - - - -/* T1_SetFileSearchPath(): Set the search path to find files of the - specified type and return 0 if successful and -1 otherwise. An existing - path is overwritten rigorously, unless the database already contains fonts. - In the latter case the function returns with an error status. - Multiple path types may be specified as a bitmask! -*/ -int T1_SetFileSearchPath( int type, char *pathname) -{ - - int i; - int pathlen; - - - if (pathname==NULL){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - } - - /* We do not allow to change the searchpath if the database already - contains one or more entries. */ - if (T1_Get_no_fonts()>0){ - sprintf( err_warn_msg_buf, "Path %s not set, database is not empty", - pathname); - T1_PrintLog( "T1_SetFileSearchPath()", err_warn_msg_buf, - T1LOG_STATISTIC); - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - pathlen=strlen(pathname)+1; - /* Throw away a possibly existing path */ - if (type & T1_PFAB_PATH){ - if (pfab_no==-1) { - T1_PFAB_ptr=NULL; /* realloc() will do a malloc() */ - } - else { - /* throw away current paths */ - i=0; - while (T1_PFAB_ptr[i]!=NULL) { - free (T1_PFAB_ptr[i++]); - } - } - if ((T1_PFAB_ptr=(char**)realloc( T1_PFAB_ptr, 2*sizeof(char*)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - if ((T1_PFAB_ptr[0]=(char*)malloc(pathlen*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - strcpy( T1_PFAB_ptr[0], pathname); - T1_PFAB_ptr[1]=NULL; - pfab_no=1; - } - if (type & T1_AFM_PATH){ - if (afm_no==-1) { - T1_AFM_ptr=NULL; /* realloc() will do a malloc() */ - } - else { - /* throw away current paths */ - i=0; - while (T1_AFM_ptr[i]!=NULL) { - free (T1_AFM_ptr[i++]); - } - } - if ((T1_AFM_ptr=(char**)realloc( T1_AFM_ptr, 2*sizeof(char*)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - if ((T1_AFM_ptr[0]=(char*)malloc(pathlen*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - strcpy( T1_AFM_ptr[0], pathname); - T1_AFM_ptr[1]=NULL; - afm_no=1; - } - if (type & T1_ENC_PATH){ - if (enc_no==-1) { - T1_ENC_ptr=NULL; /* realloc() will do a malloc() */ - } - else { - /* throw away current paths */ - i=0; - while (T1_ENC_ptr[i]!=NULL) { - free (T1_ENC_ptr[i++]); - } - } - if ((T1_ENC_ptr=(char**)realloc( T1_ENC_ptr, 2*sizeof(char*)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - if ((T1_ENC_ptr[0]=(char*)malloc(pathlen*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - strcpy( T1_ENC_ptr[0], pathname); - T1_ENC_ptr[1]=NULL; - enc_no=1; - } - - return(0); - -} - - - -/* T1_GetFileSearchPath(): Return the specified file search path - or NULL if an error occurred. Note: We do only one path at a - time, so that if a bitmask is specified, the first match wins. - The returned path is formatted using the actual PATH_SEP_CHAR. */ -char *T1_GetFileSearchPath( int type) -{ - static char *out_ptr; - int i; - int pathlen; - char **src_ptr=NULL; - - - if (out_ptr!=NULL) - free( out_ptr); - out_ptr=NULL; - - if (type & T1_PFAB_PATH) { - src_ptr=T1_PFAB_ptr; - } - else if (type & T1_AFM_PATH) { - src_ptr=T1_AFM_ptr; - } - else if (type & T1_ENC_PATH) { - src_ptr=T1_ENC_ptr; - } - else if (type & T1_FDB_PATH) { - src_ptr=T1_FDB_ptr; - } - - - i=0; - pathlen=0; - while (src_ptr[i]!=NULL) { - pathlen +=strlen( src_ptr[i++]); - pathlen+=1; /* path separator */ - } - if ((out_ptr=(char *)malloc(pathlen+1))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - strcpy( out_ptr, src_ptr[0]); - i=1; - while (src_ptr[i]!=NULL) { - strcat( out_ptr, path_sep_string); - strcat( out_ptr, src_ptr[i++]); - } - - return( out_ptr); - -} - - -/* T1_AddToFileSearchPath(): Add the specified path element to - the specified search path. If the existing path is the default path, - it will not be replaced by the new path element. Since this function might - be called before initialization, we have to be aware that even the default - path could be missing. Multiple path types may be specified as a bitmask! - Return value is 0 if successful and -1 otherwise */ -int T1_AddToFileSearchPath( int pathtype, int mode, char *pathname) -{ - int i; - int pathlen; - char* newpath; - int nofonts; - - - - if (pathname==NULL) - return(-1); - - nofonts=T1_Get_no_fonts(); - - pathlen=strlen(pathname); - - if (pathtype & T1_PFAB_PATH){ - /* Allocate meory for string */ - if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - /* Check for and handle the existing path configuration */ - if (pfab_no==0) { /* do not free the default path but establish it - as a regularly setup path, if database not empty! */ - if (nofonts>0) { - pfab_no++; - } - else { - free( T1_AFM_ptr[0]); - } - } - if (pfab_no==-1) { /* not initialized! */ - pfab_no=0; - T1_PFAB_ptr=NULL; /* realloc() will do the malloc()! */ - } - if ((T1_PFAB_ptr=(char**)realloc( T1_PFAB_ptr, (++pfab_no+1)*sizeof(char*)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - /* Insert the new path element: */ - if (mode & T1_PREPEND_PATH){ /* prepend */ - i=pfab_no-2; - while (i>=0) { - T1_PFAB_ptr[i+1]=T1_PFAB_ptr[i]; - i--; - } - T1_PFAB_ptr[0]=newpath; - } - else{ /* append */ - T1_PFAB_ptr[pfab_no-1]=newpath; - } - T1_PFAB_ptr[pfab_no]=NULL; - } - if (pathtype & T1_AFM_PATH){ - /* Allocate meory for string */ - if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - /* Check for and handle the existing path configuration */ - if (afm_no==0) { /* do not free the default path but establish it - as a regularly setup path, if database not empty! */ - if (nofonts>0) { - afm_no++; - } - else { - free( T1_AFM_ptr[0]); - } - } - if (afm_no==-1) { /* not initialized! */ - afm_no=0; - T1_AFM_ptr=NULL; /* realloc() will do the malloc()! */ - } - if ((T1_AFM_ptr=(char**)realloc( T1_AFM_ptr, (++afm_no+1)*sizeof(char*)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - /* Insert the new path element */ - if (mode & T1_PREPEND_PATH){ /* prepend */ - i=afm_no-2; - while (i>=0) { - T1_AFM_ptr[i+1]=T1_AFM_ptr[i]; - i--; - } - T1_AFM_ptr[0]=newpath; - } - else{ /* append */ - T1_AFM_ptr[afm_no-1]=newpath; - } - T1_AFM_ptr[afm_no]=NULL; - } - if (pathtype & T1_ENC_PATH){ - /* Allocate meory for string */ - if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - /* Check for and handle the existing path configuration */ - if (enc_no==0) { /* do not free the default path but establish it - as a regularly setup path, if database not empty! */ - if (nofonts>0) { - enc_no++; - } - else { - free( T1_ENC_ptr[0]); - } - } - if (enc_no==-1) { /* not initialized! */ - enc_no=0; - T1_ENC_ptr=NULL; /* realloc() will do the malloc()! */ - } - if ((T1_ENC_ptr=(char**)realloc( T1_ENC_ptr, (++enc_no+1)*sizeof(char*)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - /* Insert the new path element: */ - if (mode & T1_PREPEND_PATH){ /* prepend */ - i=enc_no-2; - while (i>=0) { - T1_ENC_ptr[i+1]=T1_ENC_ptr[i]; - i--; - } - T1_ENC_ptr[0]=newpath; - } - else{ /* append */ - T1_ENC_ptr[enc_no-1]=newpath; - } - T1_ENC_ptr[enc_no]=NULL; - } - return(0); - -} - - - -/* T1_SetFontDataBase(): Set a new name for the font database. It replaces the default - name and any names specified previously with this function. - Return value: 0 if OK, and -1 if filename not valid or an allocation - error occurred */ -int T1_SetFontDataBase( char *filename) -{ - int pathlen; - int i; - int result=0; - - - /* chekc filename */ - if (filename==NULL) { - T1_errno=T1ERR_INVALID_PARAMETER; - return -1; - } - - /* this function must be called before any font is in the database, that is, usually, - before initialization! */ - if ( pFontBase!=NULL && pFontBase->no_fonts>0) { - T1_errno=T1ERR_OP_NOT_PERMITTED; - return -1; - } - - - pathlen=strlen(filename)+1; - /* Throw away a possibly existing font database-statement */ - if (fdb_no==-1) { - T1_FDB_ptr=NULL; /* realloc() will do a malloc() */ - } - else { - /* throw away current paths */ - i=0; - while (T1_FDB_ptr[i]!=NULL) { - free (T1_FDB_ptr[i++]); - } - } - - if ((T1_FDB_ptr=(char**)realloc( T1_FDB_ptr, 2*sizeof(char*)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return -1; - } - - if ((T1_FDB_ptr[0]=(char*)malloc(pathlen*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return -1; - } - strcpy( T1_FDB_ptr[0], filename); - T1_FDB_ptr[1]=NULL; - fdb_no=1; - - /* Load database immediately if t1lib already is initailzed */ - if (CheckForInit()==0) { - if ((result=intT1_scanFontDBase(T1_FDB_ptr[0]))==-1) { - T1_PrintLog( "T1_AddFontDataBase()", "Fatal error scanning Font Database File %s (T1_errno=%d)", - T1LOG_WARNING, T1_FDB_ptr[0], T1_errno); - } - if (result>-1) - pFontBase->no_fonts+=result; - result=pFontBase->no_fonts; - } - return result; - -} - - -/* T1_AddFontDataBase(): Add a new font database file to the list. If the - lib is already initialzed, then the new database is immediately loaded. - Otherwise it is simply appended to the list and loaded at the time of - initialization. - Returns: -1 an error occured - 0 successfully inserted but not loaded because lib not initilized - n>0 the highest defined FontID -*/ -int T1_AddFontDataBase( int mode, char *filename) -{ - int i; - int pathlen; - int result=0; - char* newpath; - - - if (filename==NULL) { - T1_errno=T1ERR_INVALID_PARAMETER; - return(-1); - } - - pathlen=strlen(filename); - - /* Allocate memory for string */ - if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - strcpy( newpath, filename); - /* Check for and handle the existing path configuration */ - if (fdb_no==0) { /* defauls setup, free the path */ - free( T1_FDB_ptr[0]); - } - if (fdb_no==-1) { /* not initialized! */ - fdb_no=0; - T1_FDB_ptr=NULL; /* realloc() will do the malloc()! */ - } - - if ((T1_FDB_ptr=(char**)realloc( T1_FDB_ptr, (++fdb_no+1)*sizeof(char*)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - /* Insert the new database. If t1lib is already initialzed, the database can only - be appended. Otherwise. prepending is also possible.*/ - if ((mode & T1_PREPEND_PATH) && (CheckForInit()!=0) ) { /* prepend */ - i=fdb_no-2; - while (i>=0) { - T1_FDB_ptr[i+1]=T1_FDB_ptr[i]; - i--; - } - T1_FDB_ptr[0]=newpath; - result=0; - } - else { /* append */ - T1_FDB_ptr[fdb_no-1]=newpath; - if (CheckForInit()==0) { - if ((result=intT1_scanFontDBase(T1_FDB_ptr[fdb_no-1]))==-1) { - T1_PrintLog( "T1_AddFontDataBase()", "Fatal error scanning Font Database File %s (T1_errno=%d)", - T1LOG_WARNING, T1_FDB_ptr[fdb_no-1], T1_errno); - } - if (result>-1) - pFontBase->no_fonts+=result; - result=pFontBase->no_fonts; - } - } - T1_FDB_ptr[fdb_no]=NULL; - return result; - -} - - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1env.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1env.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1env.h Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1env.h Thu Jan 1 00:00:00 1970 @@ -1,54 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1env.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-09-26 - ----- Description: This file is part of the t1-library. It contains - declarations and definitions for t1env.c - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independ from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#ifdef T1ENV_C - -void intT1_FreeSearchPaths( void); -void intT1_SetupDefaultSearchPaths( void); -int intT1_ScanConfigFile( void); -char *intT1_Env_GetCompletePath( char *FileName, char **env_ptr ); -int T1_SetFileSearchPath( int type, char *pathname); -int T1_AddToFileSearchPath( int pathtype, int mode, char *pathname); -char *T1_GetFileSearchPath( int type); -int T1_SetFontDataBase( char *filename); -int T1_AddFontDataBase( int mode, char *filename); - -#else - -extern void intT1_FreeSearchPaths( void); -extern void intT1_SetupDefaultSearchPaths( void); -extern int intT1_ScanConfigFile( void); -extern char *intT1_Env_GetCompletePath( char *FileName, char **env_ptr ); -extern int T1_SetFileSearchPath( int type, char *pathname); -extern int T1_AddToFileSearchPath( int pathtype, int mode, char *pathname); -extern char *T1_GetFileSearchPath( int type); -extern int T1_SetFontDataBase( char *filename); -extern int T1_AddFontDataBase( int mode, char *filename); - -#endif - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1extern.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1extern.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1extern.h Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1extern.h Thu Jan 1 00:00:00 1970 @@ -1,105 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1extern.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-03 - ----- Description: This file is part of the t1-library. It contains - external declarations used by the t1-library. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#include "t1misc.h" - - -/* Following struct will allow all accesses to font data! */ -extern struct FONTBASE -{ - int t1lib_flags; /* Global library flags */ - int no_fonts_ini; /* The number of fonts initially declared in - Font database file. */ - int no_fonts; /* The number of currently allocated fonts including - logical fonts produced by T1_CopyFont() */ - int no_fonts_limit; /* The maximum number of font for which is memory - currently available. */ - int bitmap_pad; /* The value to which bitmap-scanlines are padded */ - int endian; /* 1 if little endian representation and 0 otherwise */ - char **default_enc; /* The default encoding vector */ - FONTPRIVATE *pFontArray; /* Points to first element of font pointer array */ -} FontBase; -extern struct FONTBASE *pFontBase; - - -/* Further we need a struct where to save device dependent data such as - resolution. The values in this struct may be altered using - T1_SetDeviceRes(x_res,y_res). Generally, the fontsize is to be specified - in BigPoints ("bp")---this is the default PostScript unit. It is - 1in=72bp. - */ -extern struct -{ - float x_resolution; /* Value must be specified in DPI */ - float y_resolution; /* Value must be specified in DPI */ - float scale_x; /* horizontal scale-value to get a - matrix scaled to 1b */ - float scale_y; /* vertical scale-value to get a - matrix scaled to 1b */ -} DeviceSpecifics; - - -extern struct stat filestats; /* A structure where fileinfo is stored */ -extern char linebuf[BUF_SIZE]; /* A buffer for reading files line - by line */ -extern int T1_Up; /* This one is for initialization-checking */ - -/* The width of AA-pixels */ -extern int T1aa_bpp; - -/* The follwoing variable allows the primary rastering functions - to check for the caller */ -extern int SetFuncRequestID; - -/* The following variable allows to suppress rastering at 1000 bp - for getting a correct bounding box for slanted characters --> - should only internally be used */ -extern int ForceAFMBBox; - -extern struct XYspace *IDENTITY; - -extern int errornumber; /* for debugging purposes */ - -extern char **T1_PFAB_ptr; -extern char **T1_AFM_ptr; -extern char **T1_ENC_ptr; -extern char **T1_FDB_ptr; - -/* We use a uchar buffer for error and warning messages: */ -extern char err_warn_msg_buf[1024]; - -/* file pointer for log-file */ -extern FILE *t1lib_log_file; -extern int t1lib_log_level; - -/* The errno for t1lib */ -extern int T1_errno; - -/* A variable for saving stack info */ -extern jmp_buf stck_state; - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1finfo.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1finfo.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1finfo.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1finfo.c Thu Jan 1 00:00:00 1970 @@ -1,1341 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1finfo.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-06-10 - ----- Description: This file is part of the t1-library. It contains - functions for accessing afm-data and some other - fontinformation data. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1FINFO_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" - - -#include "t1types.h" -#include "t1extern.h" -#include "t1finfo.h" -#include "t1base.h" -#include "t1misc.h" -#include "t1set.h" -#include "t1load.h" - - -/* The following variable controls the computation of the bbox internal - to T1_GetMetricsInfo(). Its influence may be overridden by the - global variable ForceAFMBBox: */ -static int ForceAFMBBoxInternal=0; - - -extern int ForceAFMBBox; -extern char *t1_get_abort_message( int number); - - -/* int T1_GetKerning(): This function returns the amount of kerning that - is specified in the afm-file for the supplied character-pair. If an - an extension has been applied to the font in question, this is taken - into account. - If for whatever reason there's no afm information available (that's not - deadly), simply 0 is returned, indicating that no kerning should be used. - The value returned is meant to be in character space coordinates. Thus, - it must be transformed to be applicable in device space. - */ -int T1_GetKerning( int FontID, char char1, char char2) -{ - METRICS_ENTRY entry; - METRICS_ENTRY *target_pair=NULL; - - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0); - } - - /* If no AFM info is present, we return an error */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( 0); - } - - /* if there's no kerning info, return immediately */ - if (pFontBase->pFontArray[FontID].KernMapSize==0) - return( 0); - - entry.chars=(char1<<8) | char2; - if ((target_pair=(METRICS_ENTRY *) - bsearch( &entry, pFontBase->pFontArray[FontID].pKernMap, - (size_t) pFontBase->pFontArray[FontID].KernMapSize, - sizeof(METRICS_ENTRY), - &cmp_METRICS_ENTRY))==NULL) - return(0); - else - return( target_pair->hkern * pFontBase->pFontArray[FontID].extend); - -} - - - -/* int T1_GetCharWidth(): This function returns the characterwidth - specified in the .afm-file. If no .afm-file is loaded for that font, - 0 is returned. Note that if one tries to raster strings, afm data - must always be available. The returned character width is corrected - using a possibly applied font extension! - */ -int T1_GetCharWidth( int FontID, char char1) -{ - unsigned char uchar1; - - uchar1=(unsigned char) char1; - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0); - } - - /* If no AFM info is present, we return an error */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( 0); - } - - /* return appriate value */ - if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]>0) { /* ordinary character */ - return((int) ((pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]-1].wx) * pFontBase->pFontArray[FontID].extend)); - } - else if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]<0) { /* composite character */ - return((int) ((pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1)].wx) * pFontBase->pFontArray[FontID].extend)); - } - else { /* undefined or .notdef */ - return(0); - } - -} - - - -/* T1_GetCharBBox(): Get the BoundingBox of specified character. If an - extension factor has been applied to the font in question, this - is taken into account. However, a slant factor which has been applied - to the font, also affects the bounding box of a character. The - only way to determine its influence on the character bounding box - is to compute the exact shape of that slanted character. There's no - simple way to extract the new bounding box from the former bounding - box. Thus, if a font has been slanted, the characters outline itself - is examined. Since this must be done at 1000 bp it takes considerably - longer than reading afm data. */ -BBox T1_GetCharBBox( int FontID, char char1) -{ - - struct region *area; - struct XYspace *S; - int mode=0; - int i; - - BBox NullBBox= { 0, 0, 0, 0}; /* A bounding box containing all 0's. */ - BBox ResultBox= { 0, 0, 0, 0}; /* The Box returned if char is found */ - - unsigned char uchar1; - - - /* We return to this if something goes wrong deep in the rasterizer */ - if ((i=setjmp( stck_state))!=0) { - T1_errno=T1ERR_TYPE1_ABORT; - sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", - t1_get_abort_message( i)); - T1_PrintLog( "T1_GetCharBBox()", err_warn_msg_buf, - T1LOG_ERROR); - return( NullBBox); - } - - - uchar1=(unsigned char) char1; - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NullBBox); - } - - /* If no AFM info is present, we return an error */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( NullBBox); - } - - - /* Check for a font slant */ - if ((pFontBase->pFontArray[FontID].slant!=0.0) - &&(ForceAFMBBox==0) - &&(ForceAFMBBoxInternal==0)){ - /* We have a font slant -> character outline must be examined in order - to determine bounding box */ - /* Set up an identity charspace matrix - and take a slant and an extension into account */ - /* And make it permanent, to plug a memory leak */ - S=(struct XYspace *)IDENTITY; - S=(struct XYspace *)Permanent - (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0], - pFontBase->pFontArray[FontID].FontTransform[1], - pFontBase->pFontArray[FontID].FontTransform[2], - pFontBase->pFontArray[FontID].FontTransform[3])); - /* Genrate an edgelist for the current character at size 1000bp - using current transformation and encoding: */ - area=fontfcnB( FontID, 0, S, - pFontBase->pFontArray[FontID].pFontEnc, - (int) uchar1, &mode, - pFontBase->pFontArray[FontID].pType1Data, - DO_RASTER); - /* Read out bounding box */ - ResultBox.llx =area->xmin; - ResultBox.urx =area->xmax; - ResultBox.lly =area->ymin; - ResultBox.ury =area->ymax; - - /* Reset AFM-switch and return BBox */ - ForceAFMBBoxInternal=0; - /* make sure to destroy 'area' before leaving! */ - KillRegion (area); - /* make sure to free S */ - if (S) { - KillSpace (S); - } - return(ResultBox); - } - else{ - /* Assign bounding box for the different cases: */ - /* Check if character is */ - if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]>0) { /* ordinary char */ - ResultBox=(pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]-1].charBBox); - } - else if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]<0) { /* composite char */ - ResultBox=(pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1)].charBBox); - } - else { /* undefined char */ - return(NullBBox); - } - - /* .. and apply transformations: */ - ResultBox.llx *=pFontBase->pFontArray[FontID].extend; - ResultBox.urx *=pFontBase->pFontArray[FontID].extend; - - return(ResultBox); - } -} - - - -/* int T1_GetUnderlinePosition(): Return underline position of specified - font in charspace units. If 0 is returned, it indicated that the font - is not yet loaded into memory. or an invalid ID has been specified. */ -float T1_GetUnderlinePosition( int FontID) -{ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0.0); - } - - return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINEPOSITION].value.data.real)); -} - - - -/* int T1_GetUnderlineThickness(): Return underline thickness of specified - font in charspace units. If 0 is returned, it indicated that the font - is not yet loaded into memory. or an invalid ID has been specified. */ -float T1_GetUnderlineThickness( int FontID) -{ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0.0); - } - - return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINETHICKNESS].value.data.real)); -} - - -/* int T1_ItalicAngle(): Return underline position of specified - font in charspace units. If 0.0 is returned, it indicated that the font - is not yet loaded into memory. or an invalid ID has been specified. */ -float T1_GetItalicAngle( int FontID) -{ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0.0); - } - - return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ITALICANGLE].value.data.real)); -} - - - -/* int T1_GetUnderlinePosition(): Return underline position of specified - font in charspace units. If 0 is returned, it indicated that the font - is not yet loaded into memory. or an invalid ID has been specified. */ -int T1_GetIsFixedPitch( int FontID) -{ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0.0); - } - - return((int)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ISFIXEDPITCH].value.data.boolean)); -} - - - -/* char *T1_GetFontName( FontID): Get the PostScript FontName of - the font dictionary associated with the specified font, or NULL if - an error occurs. */ -char *T1_GetFontName( int FontID) -{ - static char fontname[MAXPSNAMELEN]; - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - strncpy(fontname, - (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.data.nameP), - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.len); - fontname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.len]=0; - - return(fontname); - -} - - -/* char *T1_GetFullName( FontID): Get the Full Name from - the font dictionary associated with the specified font, or NULL if - an error occurs. */ -char *T1_GetFullName( int FontID) -{ - static char fullname[MAXPSNAMELEN]; - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - strncpy(fullname, - (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.data.nameP), - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.len); - fullname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.len]=0; - - return(fullname); - -} - - -/* char *T1_GetFamilyName( FontID): Get the Family Name of - the font dictionary associated with the specified font, or NULL if - an error occurs. */ -char *T1_GetFamilyName( int FontID) -{ - static char familyname[MAXPSNAMELEN]; - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - strncpy(familyname, - (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.data.nameP), - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.len); - familyname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.len]=0; - - return(familyname); - -} - - -/* char *T1_GetWeight( FontID): Get the Weight entry from - the font dictionary associated with the specified font, or NULL if - an error occurs. */ -char *T1_GetWeight( int FontID) -{ - static char weight[128]; - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - strncpy(weight, - (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.data.nameP), - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.len); - weight[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.len]=0; - - return(weight); - -} - - -/* char *T1_GetFontName( FontID): Get the Version entry from - the font dictionary associated with the specified font, or NULL if - an error occurs. */ -char *T1_GetVersion( int FontID) -{ - static char version[2048]; - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - strncpy(version, - (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.data.nameP), - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.len); - version[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.len]=0; - - return(version); - -} - - -/* char *T1_GetNotice( FontID): Get the Notice entry from - the font dictionary associated with the specified font, or NULL if - an error occurs. */ -char *T1_GetNotice( int FontID) -{ - static char notice[2048]; - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - strncpy(notice, - (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.data.nameP), - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.len); - notice[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.len]=0; - - return(notice); - -} - - - - -/* char *T1_GetCharName(): Get the PostScript character name of - the character indexed by char1. */ -char *T1_GetCharName( int FontID, char char1) -{ - static char cc_name1[256]; - char *c1; - - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - if (pFontBase->pFontArray[FontID].pFontEnc==NULL){ - /* We have to get the names from the fonts internal encoding */ - c1= (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP; - strncpy(cc_name1, - (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP, - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len); - cc_name1[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len]=0; - } - else{ - /* Take names from explicitly loaded and assigned encoding */ - c1=pFontBase->pFontArray[FontID].pFontEnc[(unsigned char)char1]; - strcpy(cc_name1,c1); - } - - /* Return address of charname */ - return(cc_name1); - -} - - - -/* T1_QueryLigs(): Get the number of ligatures defined in the font FontID for - the character which is located at position char1 in the current encoding - vector! - Function returns the number of defined ligs (including 0) or -1 if an - error occured. - */ -int T1_QueryLigs( int FontID, char char1, char **successors, - char **ligatures) -{ - - FontInfo *afm_ptr; - CharMetricInfo *m_ptr; - char *c_name; - char cc_name[128]; - static char succ[MAX_LIGS]; - int succ_index; - static char lig[MAX_LIGS]; - int lig_index; - - Ligature *ligs; - int i,j; - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - /* If no AFM info is present, we return an error */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( -1); - } - - /* All OK, ... */ - afm_ptr=pFontBase->pFontArray[FontID].pAFMData; - m_ptr=afm_ptr->cmi; - - /* Get the name of the character: */ - if (pFontBase->pFontArray[FontID].pFontEnc==NULL){ - /* We have to get the name from the fonts internal encoding */ - c_name=(char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP; - strncpy(cc_name, - (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP, - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len); - cc_name[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len]=0; - } - else{ - /* Take name from explicitly loaded and assigned encoding */ - c_name=pFontBase->pFontArray[FontID].pFontEnc[(unsigned char)char1]; - strcpy(cc_name,c_name); - } - - for (i=0; inumOfChars; i++){ - if (strcmp(m_ptr[i].name,cc_name)==0) - break; - } - - - if (i==afm_ptr->numOfChars) /* we didn't find the characters name */ - return(-1); - - ligs=m_ptr[i].ligs; - - j=0; - if (ligs==NULL) - return(0); - - while (ligs!=NULL) { - /* Get indices of the two characters: */ - if ((succ_index=T1_GetEncodingIndex( FontID, (char*) ligs->succ))==-1) { - /* successor is not current encoding */ - ligs=ligs->next; - continue; - } - if ((lig_index=T1_GetEncodingIndex( FontID, (char*) ligs->lig))==-1) { - /* Specified ligature is not in current encoding */ - ligs=ligs->next; - continue; - } - succ[j]=(char)succ_index; - lig[j]=(char)lig_index; - j++; - ligs=ligs->next; - } - - *successors=succ; - *ligatures=lig; - - return(j); -} - - - -/* T1_GetEncodingIndex(): Return the Index of char1 in the current - encoding vector of font FontID */ -int T1_GetEncodingIndex( int FontID, char *char1) -{ - int i; - int len1; - int result_index; - char **extern_enc; - psobj *objptr; - - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - extern_enc=pFontBase->pFontArray[FontID].pFontEnc; - - len1=strlen( char1); - - /* The default return-value if character is not found: */ - result_index=-1; - - if (extern_enc==NULL) { - objptr=&(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[0]); - /* We have to search the fonts internal encoding */ - for (i=0;i<256;i++){ - if (len1==objptr[i].len){ - if (strncmp((char *)objptr[i].data.arrayP, - char1, objptr[i].len)==0){ - result_index=i; - break; - } - } - } - - } - else { - /* Take name from explicitly loaded and assigned encoding */ - for (i=0;i<256;i++){ - if (strcmp(extern_enc[i], char1)==0){ - result_index=i; - break; - } - } - } - - return(result_index); -} - - -/* T1_GetEncodingIndices(): Return all indices of char1 in the current - encoding vector of font FontID. */ -int *T1_GetEncodingIndices( int FontID, char *char1) -{ - int i; - int endmark=0; - int len1; - char **extern_enc; - psobj *objptr; - /* the following array suffices for the extreme unlikely case of a font - where one single fillsthe whole encoding vector */ - static int indices[257]; - - - if (CheckForFontID(FontID)!=1) { - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - extern_enc=pFontBase->pFontArray[FontID].pFontEnc; - - len1=strlen( char1); - - if (extern_enc==NULL) { - objptr=&(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[0]); - /* We have to search the fonts internal encoding */ - for (i=0;i<256;i++){ - if (len1==objptr[i].len){ - if (strncmp((char *)objptr[i].data.arrayP, - char1, objptr[i].len)==0){ - indices[endmark++]=i; - } - } - } - } - else { - /* Take name from explicitly loaded and assigned encoding */ - for (i=0;i<256;i++){ - if (strcmp(extern_enc[i], char1)==0){ - indices[endmark++]=i; - } - } - } - - indices[endmark]=-1; - return((int *)indices); -} - - -/* int T1_GetStringWidth(): This function returns the width of string - in .afm-file units. If no .afm-file is loaded for font FontID, - 0 is returned. Note that if one tries to raster strings, afm data - should always be available. The returned character width is corrected - using a possibly applied font extension! - */ -int T1_GetStringWidth( int FontID, char *string, - int len, long spaceoff, int kerning) -{ - - int no_chars; /* Number of chars in string */ - int i; - int *kern_pairs; - int *charwidths; - int spacewidth; - int stringwidth; - - unsigned char *ustring; - - ustring=(unsigned char *) string; - - /* First, check for a correct ID */ - i=CheckForFontID(FontID); - if (i!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0); - } - - /* If no AFM info is present, we return an error */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( 0); - } - - /* Get length of string: */ - if (len<0 || ustring == NULL){ /* invalid length or NULL-pointer */ - T1_errno=T1ERR_INVALID_PARAMETER; - return(0); - } - if (len==0) /* should be computed assuming "normal" 0-terminated string */ - no_chars=strlen(string); - else /* use value given on command line */ - no_chars=len; - - /* Allocate room for temporary arrays of kerning and width arrays: */ - kern_pairs=(int *)calloc(no_chars -1, sizeof(int)); - if (kern_pairs==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(0); - } - charwidths=(int *)calloc(no_chars, sizeof(int)); - if (charwidths==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(0); - } - - /* If kerning is requested, get kerning amounts and fill the array: */ - if (kerning){ - for (i=0; ipFontArray[FontID].space_position)+spaceoff; - - /* Fill the width-array: */ - for (i=0; ipFontArray[FontID].space_position) - charwidths[i]=(int)spacewidth; - else - charwidths[i]=T1_GetCharWidth(FontID,ustring[i]); - } - - /* Accumulate width: */ - stringwidth=0; - for (i=0; ipFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( NullBBox); - } - - /* Get length of string: */ - if (len<0 || string==NULL) { /* invalid length or NULL-pointer */ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NullBBox); - } - if (len==0) /* should be computed assuming "normal" 0-terminated string */ - no_chars=strlen(string); - else /* use value given on command line */ - no_chars=len; - - spacewidth= - T1_GetCharWidth(FontID,pFontBase->pFontArray[FontID].space_position)+spaceoff; - - /* Accumulate metrics: */ - for (i=0; ipFontArray[FontID].space_position) - curr_width +=spacewidth; - else{ - tmp_BBox=T1_GetCharBBox( FontID, string[i]); - if (curr_width+tmp_BBox.llx < lsb_min) - lsb_min=curr_width+tmp_BBox.llx; - if (curr_width+tmp_BBox.urx > rsb_max) - rsb_max=curr_width+tmp_BBox.urx; - if (tmp_BBox.lly < overalldescent) - overalldescent=tmp_BBox.lly; - if (tmp_BBox.ury > overallascent) - overallascent=tmp_BBox.ury; - curr_width +=T1_GetCharWidth( FontID, string[i]); - if ((ipFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( metrics); - } - - /* Get length of string: */ - if (len<0 || ustring==NULL ) { /* invalid length or NULL_pointer */ - T1_errno=T1ERR_INVALID_PARAMETER; - return(metrics); - } - - if (len==0) /* should be computed assuming "normal" 0-terminated string */ - no_chars=strlen(string); - else /* use value given on command line */ - no_chars=len; - - /* Compute the correct spacewidth value (in charspace units): */ - spacewidth=T1_GetCharWidth(FontID,pFontBase->pFontArray[FontID].space_position)+spaceoff; - - /* Allocate memory for character positions array: */ - metrics.charpos=(int *)calloc(no_chars, sizeof(int)); - - metrics.numchars=no_chars; - - /* Accumulate metrics: */ - for (i=0; ipFontArray[FontID].space_position) - curr_width +=spacewidth; - else{ - tmp_BBox=T1_GetCharBBox( FontID, string[i]); - if (curr_width+tmp_BBox.llx < lsb_min) - lsb_min=curr_width+tmp_BBox.llx; - if (curr_width+tmp_BBox.urx > rsb_max) - rsb_max=curr_width+tmp_BBox.urx; - if (tmp_BBox.lly < overalldescent) - overalldescent=tmp_BBox.lly; - if (tmp_BBox.ury > overallascent) - overallascent=tmp_BBox.ury; - curr_width +=T1_GetCharWidth( FontID, string[i]); - if ((ipFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[0]); - outbox.llx = - objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ? - (int) ceil(obj->data.real) : (int) floor(obj->data.real); - obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[1]); - outbox.lly = - objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ? - (int) ceil(obj->data.real) : (int) floor(obj->data.real); - obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[2]); - outbox.urx = - objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ? - (int) ceil(obj->data.real) : (int) floor(obj->data.real); - obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[3]); - outbox.ury = - objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ? - (int) ceil(obj->data.real) : (int) floor(obj->data.real); - - return( outbox); -} - - - -/* T1_GetAllCharNames(): Get a list of all defined character names in - in the font FontID: */ -char **T1_GetAllCharNames( int FontID) -{ - static char **bufmem=NULL; - register char *namedest; - psdict *pCharStrings; - int len, i, j; - long nameoffset; - - int bufmemsize=0; - - /* return NULL if font not loaded */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return( NULL); - } - - pCharStrings=pFontBase->pFontArray[FontID].pType1Data->CharStringsP; - - /* First, get number of charstrings: */ - len=pCharStrings[0].key.len; - - /* We must be careful here: size of the charstrings dict might be larger - than the actual number of charstrings. We correct for this by reducing - the value of len appropriately */ - for ( i=1; i<=len; i++){ - /* calculate room for each characters name plus the prepending \0 */ - if ((j=pCharStrings[i].key.len)){ - bufmemsize += j + 1; - } - else{ /* we skip this (the remaining) entries */ - len--; - i--; - } - } - /* Now we reserve memory for the pointers (including final NULL) */ - nameoffset=(len+1)*sizeof( char *); - bufmemsize += nameoffset; - - /* Now allocate memory, copy strings and initialize pointers */ - if (bufmem!=NULL) - free(bufmem); - if ((bufmem=(char **)malloc( bufmemsize))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - namedest=(char *)((long)bufmem + nameoffset); - j=0; - for ( i=0; ipFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( -1); - } - - return( pFontBase->pFontArray[FontID].pAFMData->numOfPairs); - -} - - - -/* A function for comparing METRICS_ENTRY structs */ -static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2) -{ - if (((METRICS_ENTRY *)entry1)->chars < - ((METRICS_ENTRY *)entry2)->chars) - return(-1); - if (((METRICS_ENTRY *)entry1)->chars > - ((METRICS_ENTRY *)entry2)->chars) - return(1); - return(0); /* This should not happen */ -} - - - -/* A few functions for accessing composite character data: */ -/* T1_GetNoCompositeChars(): Return the number of characters for - for which composite character information is available - for font FontID */ -int T1_GetNoCompositeChars( int FontID) -{ - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return( -1); - } - - /* If no AFM info is present, we return an error */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( -1); - } - - return( pFontBase->pFontArray[FontID].pAFMData->numOfComps); - -} - - - -/* T1_QueryCompositeChar(): Query whether char1 from font FontID - is a composite character. If so, the index of the composite - character data within the afm array is returned. The index can - be used to retrieve the retrieve the composite character data. - - retval>=0: index into AFM-array where the corresponding - composite char data is located - retval=-1: No composite character, but result is valid, - retval=-2: No composite character, but result is invalid. - T1_errno indicated the reason. -*/ -int T1_QueryCompositeChar( int FontID, char char1) -{ - unsigned char uchar1; - - uchar1=char1; - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return( -2); - } - - /* If no AFM info is present, we return -2 */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( -2); - } - - if (pFontBase->pFontArray[FontID].pEncMap[ uchar1]<0) { /* composite char */ - return( -(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1)); - } - - return(-1); - -} - - - -/* T1_GetCompCharData(): Retrieve data to construct composite - character char1 from font FontID. In case of an error NULL is returned - and T1_errno is set appropriately. */ -T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1) -{ - T1_COMP_CHAR_INFO *cci=NULL; - CompCharData *ccd=NULL; - int afmind=-1; - int i; - unsigned char uchar1; - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return( cci); - } - - /* If no AFM info is present, we return -2 */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( cci); - } - - if ((cci=(T1_COMP_CHAR_INFO*)malloc( sizeof(T1_COMP_CHAR_INFO)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return( cci); - } - - uchar1=(unsigned char)char1; - - /* set default values */ - cci->compchar=uchar1; - cci->numPieces=1; - cci->pieces=NULL; - - /* check char1 */ - if ((afmind=pFontBase->pFontArray[FontID].pEncMap[uchar1]) >= 0) { - /* char is no composite char */ - return(cci); - } - - /* character is a composite char-> retrieve index and pointer into - AFM data */ - afmind=-(afmind+1); - ccd=&(pFontBase->pFontArray[FontID].pAFMData->ccd[afmind]); - - /* cci->compchar is already setup correctly because char1 is a - composite character */ - cci->numPieces=ccd->numOfPieces; - /* we expect numPieces to be >1 */ - if ((cci->pieces=(T1_COMP_PIECE *)malloc( sizeof(T1_COMP_PIECE)* - cci->numPieces))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - free( cci); - return( NULL); - } - /* Copy information */ - for (i=0; inumPieces; i++) { - cci->pieces[i].piece=T1_GetEncodingIndex( FontID, ccd->pieces[i].pccName); - cci->pieces[i].deltax=ccd->pieces[i].deltax; - cci->pieces[i].deltay=ccd->pieces[i].deltay; - } - return( cci); - -} - - - -/* T1_GetCompCharDataByIndex(): Retrieve data to construct composite - characters form font FontID. The data is addressed by index which - may, for example, have been obtained by a call to - T1_QueryCompositeChar(). - In case of error NULL is returned and T1_errno is set appropriately. -*/ -T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index) -{ - T1_COMP_CHAR_INFO *cci=NULL; - CompCharData *ccd=NULL; - int i; - - /* Check whether font is loaded: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return( cci); - } - - /* If no AFM info is present, we return -2 */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return( cci); - } - - /* range check for index */ - if ((index < 0) || - (index >= pFontBase->pFontArray[FontID].pAFMData->numOfComps)) { - T1_errno=T1ERR_INVALID_PARAMETER; - return( cci); - } - - /* Alloc mem */ - if ((cci=(T1_COMP_CHAR_INFO*)malloc( sizeof(T1_COMP_CHAR_INFO)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return( cci); - } - - /* set source pointer */ - ccd=&(pFontBase->pFontArray[FontID].pAFMData->ccd[index]); - /* and copy information */ - cci->compchar=T1_GetEncodingIndex( FontID, ccd->ccName); - cci->numPieces=ccd->numOfPieces; - /* we expect numPieces to be >1 */ - if ((cci->pieces=(T1_COMP_PIECE *)malloc( sizeof(T1_COMP_PIECE)* - cci->numPieces))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - free( cci); - return( NULL); - } - /* Copy information */ - for (i=0; inumPieces; i++) { - cci->pieces[i].piece=T1_GetEncodingIndex( FontID, ccd->pieces[i].pccName); - cci->pieces[i].deltax=ccd->pieces[i].deltax; - cci->pieces[i].deltay=ccd->pieces[i].deltay; - } - return( cci); - -} - - - -/* T1_IsInternalChar(): Query whether the character in encoding slot - char1 of font FontID has an internal definition (CharString) or - whether it is constructed by t1lib from elementary units */ -int T1_IsInternalChar( int FontID, char char1) -{ - unsigned char uchar1; - char *charname; - psdict *pCharStrings; - int len, i, j; - - /* return NULL if font not loaded */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return( -1); - } - - pCharStrings=pFontBase->pFontArray[FontID].pType1Data->CharStringsP; - uchar1=(unsigned char)char1; - - charname=T1_GetCharName( FontID, uchar1); - - /* First, get the maximum number of charstrings: */ - len=pCharStrings[0].key.len; - - /* Check all CharString definitions */ - for ( i=1; i<=len; i++) { - /* if len=0, then the CharStrings dict is larger that required which - is valid and allowed by the spec.*/ - if ((j=pCharStrings[i].key.len)!=0) { - if ( (j==strlen(charname)) && - (strncmp( charname, pCharStrings[i].key.data.nameP, j)==0) ) { - /* we have found an internal definition */ - return( 1); - } - } - } - return( 0); -} diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1finfo.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1finfo.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1finfo.h Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1finfo.h Thu Jan 1 00:00:00 1970 @@ -1,104 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1finfo.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-06-03 - ----- Description: This file is part of the t1-library. It contains - declarations and definitions for t1finfo.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#ifdef T1FINFO_C - - -int T1_GetKerning( int FontID, char char1, char char2); -int T1_GetCharWidth( int FontID, char char1); -BBox T1_GetCharBBox( int FontID, char char1); -float T1_GetUnderlinePosition( int FontID); -float T1_GetUnderlineThickness( int FontID); -float T1_GetItalicAngle( int FontID); -int T1_GetIsFixedPitch( int FontID); -char *T1_GetFontName( int FontID); -char *T1_GetFullName( int FontID); -char *T1_GetFamilyName( int FontID); -char *T1_GetWeight( int FontID); -char *T1_GetVersion( int FontID); -char *T1_GetNotice( int FontID); -char *T1_GetCharName( int FontID, char char1); -int T1_QueryLigs( int FontID, char char1, char **successors, char **ligatures); -int T1_GetEncodingIndex( int FontID, char *char1); -int *T1_GetEncodingIndices( int FontID, char *char1); -int T1_GetStringWidth( int FontID, char *string, - int len, long spaceoff,int kerning); -BBox T1_GetStringBBox( int FontID, char *string, - int len, long spaceoff, int kerning); -METRICSINFO T1_GetMetricsInfo( int FontID, char *string, - int len, long spaceoff, int kerning); -BBox T1_GetFontBBox( int FontID); -char **T1_GetAllCharNames( int FontID); -int T1_GetNoKernPairs( int FontID); -static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2); -int T1_GetNoCompositeChars( int FontID); -int T1_QueryCompositeChar( int FontID, char char1); -T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1); -T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index); -int T1_IsInternalChar( int FontID, char char1); - - -#else - - -extern int T1_GetKerning( int FontID, char char1, - char char2); -extern int T1_GetCharWidth( int FontID, char char1); -extern BBox T1_GetCharBBox( int FontID, char char1); -extern float T1_GetUnderlinePosition( int FontID); -extern float T1_GetUnderlineThickness( int FontID); -extern float T1_GetItalicAngle( int FontID); -extern int T1_GetIsFixedPitch( int FontID); -extern char *T1_GetFontName( int FontID); -extern char *T1_GetFullName( int FontID); -extern char *T1_GetFamilyName( int FontID); -extern char *T1_GetWeight( int FontID); -extern char *T1_GetVersion( int FontID); -extern char *T1_GetNotice( int FontID); -extern char *T1_GetCharName( int FontID, char char1); -extern int T1_QueryLigs( int FontID, char char1, char **successors, char **ligatures); -extern int T1_GetEncodingIndex( int FontID, char *char1); -extern int *T1_GetEncodingIndices( int FontID, char *char1); -extern int T1_GetStringWidth( int FontID, char *string, - int len, long spaceoff,int kerning); -extern BBox T1_GetStringBBox( int FontID, char *string, - int len, long spaceoff, int kerning); -extern METRICSINFO T1_GetMetricsInfo( int FontID, char *string, - int len, long spaceoff, int kerning); -extern BBox T1_GetFontBBox( int FontID); -extern int T1_GetNoKernPairs( int FontID); -extern char **T1_GetAllCharNames( int FontID); -extern int T1_GetNoCompositeChars( int FontID); -extern int T1_QueryCompositeChar( int FontID, char char1); -extern T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1); -extern T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index); -extern int T1_IsInternalChar( int FontID, char char1); - - -#endif - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1global.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1global.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1global.h Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1global.h Thu Jan 1 00:00:00 1970 @@ -1,115 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1global.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - global declarations used by the t1-library. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#include "t1misc.h" - - -/* Following struct will allow all accesses to font data! */ -struct FONTBASE -{ - int t1lib_flags; /* Global library flags */ - int no_fonts_ini; /* The number of fonts initially declared in - Font database file. */ - int no_fonts; /* The number of currently allocated fonts including - logical fonts produced by T1_CopyFont() */ - int no_fonts_limit; /* The maximum number of font for which is memory - currently available. */ - int bitmap_pad; /* The value to which bitmap-scanlines are padded */ - int endian; /* 1 if little endian representation and 0 otherwise */ - char **default_enc; /* The default encoding vector */ - FONTPRIVATE *pFontArray; /* Points to first element of font pointer array */ -} FontBase; -struct FONTBASE *pFontBase=NULL; - - - -/* Further we need a struct where to save device dependent data such as - resolution. The values in this struct may be altered using - T1_SetDeviceRes(x_res,y_res). Generally, the fontsize is to be specified - in BigPoints ("bp")---this is the default PostScript unit. It is - 1in=72bp. - */ -typedef struct -{ - float x_resolution; /* Value must be specified in DPI */ - float y_resolution; /* Value must be specified in DPI */ - float scale_x; /* horizontal scale-value to get a - matrix scaled to 1b */ - float scale_y; /* vertical scale-value to get a - matrix scaled to 1b */ -} DEVICESPECIFICS; - -DEVICESPECIFICS DeviceSpecifics = { DEFAULT_RES, - DEFAULT_RES, - DEFAULT_RES/BIGPOINTSPERINCH, - DEFAULT_RES/BIGPOINTSPERINCH -}; - - - -struct stat filestats; /* A structure where fileinfo is stored */ -char linebuf[BUF_SIZE]; /* A buffer for reading files line - by line */ -int T1_Up=0; /* This one is for initialization-checking */ - -/* The width of AA-pixels */ -int T1aa_bpp; - -/* The follwoing variable allows the primary rastering functions - to check for the caller */ -int SetFuncRequestID=0; - -/* The following variable allows to suppress rastering at 1000 bp - for getting a correct bounding box for slanted characters --> - should only internally be used */ -int ForceAFMBBox=0; - -extern struct XYspace *IDENTITY; - -int errornumber; /* for debugging purposes */ - -/* The following pointers should be set to path-strings--used for locating - type1, afm and encoding files */ -char** T1_PFAB_ptr=NULL; -char** T1_AFM_ptr=NULL; -char** T1_ENC_ptr=NULL; -char** T1_FDB_ptr=NULL; - -/* We use a uchar buffer for error and warning messages: */ -char err_warn_msg_buf[1024]; - -/* file pointer for log-file */ -FILE *t1lib_log_file=NULL; -int t1lib_log_level=2; - -/* The errno for t1lib */ -int T1_errno=0; - -/* A variable for saving stack info */ -jmp_buf stck_state; - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1lib.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1lib.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1lib.h Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1lib.h Thu Jan 1 00:00:00 1970 @@ -1,452 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1lib.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-03 - ----- Description: This file is part of the t1-library. It must be - included by the user of the t1lib. It contains - function declarations and some basic data types, the - user must deal with. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#ifndef T1LIB_H_INCLUDED - -#define T1LIB_H_INCLUDED - -/* type definitions, needed by the user: */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - - -/* the data structure which contains the character bitmap description */ -typedef struct -{ - char *bits; /* A pointer to the characters local bitmap */ - struct /* A struct containing diverse metric information */ - { - int ascent; - int descent; - int leftSideBearing; - int rightSideBearing; - int advanceX; - int advanceY; - } metrics; - void *pFontCacheInfo; - unsigned long bpp; -} GLYPH; - - -/* A structure representing a matrix */ -typedef struct -{ - double cxx; - double cyx; - double cxy; - double cyy; -} T1_TMATRIX; - - -/* the bounding box data structure: */ -typedef struct -{ - int llx; /* lower left x-position */ - int lly; /* lower left y-position */ - int urx; /* upper right x-position */ - int ury; /* upper right y-position */ -} BBox; - - -/* A data that makes most important information available to user. */ -typedef struct -{ - int width; /* The glyph's width */ - BBox bbox; /* The glyph's bounding box */ - int numchars; /* The number of characters in the glyph (string) */ - int *charpos; /* A pointer to an integer array were the horizontal - positions in (afm units) of the individual - characters in the string are stored */ -} METRICSINFO; - - -#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad)) - - -/* def's for T1_InitLib() */ -#define NO_LOGFILE 0x0 -#define LOGFILE 0x1 -#define IGNORE_FONTDATABASE 0x2 /* Default is to read database */ -#define IGNORE_CONFIGFILE 0x4 /* Default is to read config file */ -#define T1_AA_CACHING 0x8 /* Cache aa-bytes */ -#define T1_NO_AFM 0x10 /* Do not load or generate AFM data */ - - - -/* common 'yes'/'no' */ -#define T1_YES 0x1 -#define T1_NO 0x0 - - -/* logfile levels: */ -#define T1LOG_ERROR 1 -#define T1LOG_WARNING 2 -#define T1LOG_STATISTIC 3 -#define T1LOG_DEBUG 4 - - -/* #define's for manipulating searchpaths */ -#define T1_PFAB_PATH 0x01 -#define T1_AFM_PATH 0x02 -#define T1_ENC_PATH 0x04 -#define T1_FDB_PATH 0x08 -#define T1_APPEND_PATH 0x00 -#define T1_PREPEND_PATH 0x01 - - -/* #define's for character/string properties (not all implemented) */ -#define T1_DEFAULT 0x0000 -#define T1_UNDERLINE 0x0001 -#define T1_OVERLINE 0x0002 -#define T1_OVERSTRIKE 0x0004 -#define T1_DOUBLEOVERSTRIKE 0x0008 -#define T1_RIGHT_TO_LEFT 0x0010 -#define T1_SUBSCRIPT 0x0100 -#define T1_SUPERSCRIPT 0x0200 -#define T1_STROKED 0x1000 -#define T1_KERNING 0x2000 - - -/* Setting the subsampling value */ -#define T1_AA_NONE 1 -#define T1_AA_LOW 2 -#define T1_AA_HIGH 4 - - -/* Error handling: */ -extern int T1_errno; - -/* These are from scanning a font file */ -#define T1ERR_SCAN_FONT_FORMAT -5 -#define T1ERR_SCAN_FILE_OPEN_ERR -4 -#define T1ERR_SCAN_OUT_OF_MEMORY -3 -#define T1ERR_SCAN_ERROR -2 -#define T1ERR_SCAN_FILE_EOF -1 -/* These are from generating paths */ -#define T1ERR_PATH_ERROR 1 -#define T1ERR_PARSE_ERROR 2 -#define T1ERR_TYPE1_ABORT 3 -/* These are from t1lib */ -#define T1ERR_INVALID_FONTID 10 -#define T1ERR_INVALID_PARAMETER 11 -#define T1ERR_OP_NOT_PERMITTED 12 -#define T1ERR_ALLOC_MEM 13 -#define T1ERR_FILE_OPEN_ERR 14 -#define T1ERR_UNSPECIFIED 15 -#define T1ERR_NO_AFM_DATA 16 -#define T1ERR_X11 17 -#define T1ERR_COMPOSITE_CHAR 18 - - -/* Flags to control the rasterizer */ -#define T1_IGNORE_FORCEBOLD 0x0001 -#define T1_IGNORE_FAMILYALIGNMENT 0x0002 -#define T1_IGNORE_HINTING 0x0004 - -#define T1_DEBUG_LINE 0x0100 -#define T1_DEBUG_REGION 0x0200 -#define T1_DEBUG_PATH 0x0400 -#define T1_DEBUG_FONT 0x0800 -#define T1_DEBUG_HINT 0x1000 - - -/* definitions for outline handling */ -#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ -/* From/to conversion of pels/fractpels */ -#define T1_TOPATHPOINT(p) (((long)p)<>FRACTBITS) - -/* A fractional point */ -typedef struct { - long x; - long y; -} T1_PATHPOINT; - - -/* A straight outline segment, stroked or not stroked */ -typedef struct pathsegment { - char type; /* type of segment (line or move) */ - unsigned char flag; /* type1 rasterizer internal stuff */ - short references; /* type1 rasterizer internal stuff */ - unsigned char size; /* size of the structure */ - unsigned char context; /* index to device context */ - struct pathsegment *link; /* pointer to next structure in linked list */ - struct pathsegment *last; /* pointer to last structure in list */ - T1_PATHPOINT dest; /* relative ending location of path segment */ -} T1_PATHSEGMENT; - -/* A third order bezier segment */ -typedef struct bezierpathsegment { - char type; /* type of segment (bezier) */ - unsigned char flag; /* type1 rasterizer internal stuff */ - short references; /* type1 rasterizer internal stuff */ - unsigned char size; /* as with any 'segment' type */ - unsigned char context; /* as with any 'segment' type */ - T1_PATHSEGMENT *link; /* as with any 'segment' type */ - T1_PATHSEGMENT *last; /* as with any 'segment' type */ - T1_PATHPOINT dest; /* ending point (D) */ - T1_PATHPOINT B; /* control point B */ - T1_PATHPOINT C; /* control point C */ -} T1_BEZIERSEGMENT; - -typedef T1_PATHSEGMENT T1_OUTLINE; - -#define T1_PATHTYPE_LINE 0x10 -#define T1_PATHTYPE_BEZIER 0x12 -#define T1_PATHTYPE_MOVE 0x15 - - -/* Definitions for font subsetting */ -#define T1_SUBSET_DEFAULT 0x00 -#define T1_SUBSET_FORCE_REENCODE 0x01 -#define T1_SUBSET_SKIP_REENCODE 0x02 -#define T1_SUBSET_ENCRYPT_BINARY 0x04 -/* This is only for debugging, it does not produce valid font-files! - This flag is not in the documented API!. */ -#define T1_SUBSET_ENCRYPT_NONE 0x08 - - -/* Two structures for handling composite character data */ -/* One structure for each symbol of the composite character */ -typedef struct -{ - int piece; /* the index of the current symbol */ - int deltax; /* horizontal displacement of current symbol in CS */ - int deltay; /* vertical displacement of current symbol in CS */ -} T1_COMP_PIECE; - -/* This one defines the composite character, the number of pieces and how to - access their data. */ -typedef struct -{ - int compchar; /* the base character in the current encoding */ - int numPieces; /* the number of defined pieces including the base char */ - T1_COMP_PIECE *pieces; /* a pointer to the pieces' information */ -} T1_COMP_CHAR_INFO; - - - -/* function declarations: */ - -/* from t1base.c */ -extern void *T1_InitLib( int log); -extern int T1_CloseLib( void); -extern int T1_AddFont( char *fontfilename); -extern void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...); -extern void T1_SetLogLevel( int level); -extern int CheckForInit(void); -extern int CheckForFontID( int FontID); -extern int test_for_t1_file( char *buffer ); -extern char *T1_GetFontFileName( int FontID); -extern int T1_Get_no_fonts(void); -extern int T1_SetDeviceResolutions( float x_res, float y_res); -extern int T1_CopyFont( int FontID); -extern int T1_QueryX11Support( void); -extern void bin_dump_c(unsigned char value); -extern void bin_dump_s(unsigned short value); -extern void bin_dump_l(unsigned long value); -extern int T1_CheckEndian(void); -extern int T1_SetBitmapPad( int pad); -extern int T1_GetBitmapPad( void); -extern char *T1_GetLibIdent( void); -extern void T1_SetRasterFlags( int flags); -extern char *T1_GetAfmFileName( int FontID); -extern int T1_SetAfmFileName( int FontId, char *afm_name); -extern char *T1_GetFontFilePath( int FontID); -extern char *T1_GetAfmFilePath( int FontID); - -/* from t1delete.c */ -extern int T1_DeleteSize( int FontID, float size); -extern int T1_DeleteAllSizes( int FontID); -extern int T1_FreeGlyph( GLYPH *glyph); -extern int T1_FreeCompCharData( T1_COMP_CHAR_INFO *cci); -extern int T1_DeleteFont( int FontID); - -/* from t1enc.c */ -extern char **T1_LoadEncoding( char *FileName); -extern int T1_DeleteEncoding( char **encoding); -extern int T1_ReencodeFont( int FontID, char **Encoding); -extern int T1_SetDefaultEncoding( char **encoding); -extern char *T1_GetEncodingScheme( int FontID); - -/* from t1env.c */ -extern int T1_SetFileSearchPath( int type, char *pathname); -extern int T1_AddToFileSearchPath( int pathtype, int mode, char *pathname); -extern char *T1_GetFileSearchPath( int type); -extern int T1_SetFontDataBase( char *filename); -extern int T1_AddFontDataBase( int mode, char *filename); - -/* from t1finfo.c */ -extern int T1_GetKerning( int FontID, char char1, - char char2); -extern int T1_GetCharWidth( int FontID, char char1); -extern BBox T1_GetCharBBox( int FontID, char char1); -extern float T1_GetUnderlinePosition( int FontID); -extern float T1_GetUnderlineThickness( int FontID); -extern float T1_GetItalicAngle( int FontID); -extern int T1_GetIsFixedPitch( int FontID); -extern char *T1_GetFontName( int FontID); -extern char *T1_GetFullName( int FontID); -extern char *T1_GetFamilyName( int FontID); -extern char *T1_GetWeight( int FontID); -extern char *T1_GetVersion( int FontID); -extern char *T1_GetNotice( int FontID); -extern char *T1_GetCharName( int FontID, char char1); -extern int T1_QueryLigs( int FontID, - char char1, - char **successors, - char **ligatures); -extern int T1_GetEncodingIndex( int FontID, char *char1); -extern int *T1_GetEncodingIndices( int FontID, char *char1); -extern int T1_GetStringWidth( int FontID, char *string, - int len, long spaceoff, int kerning); -extern BBox T1_GetStringBBox( int FontID, char *string, - int len, long spaceoff, int kerning); -extern METRICSINFO T1_GetMetricsInfo( int FontID, char *string, - int len, long spaceoff, int kerning); -extern BBox T1_GetFontBBox( int FontID); -extern char **T1_GetAllCharNames( int FontID); -extern int T1_GetNoKernPairs( int FontID); -extern int T1_GetNoCompositeChars( int FontID); -extern int T1_QueryCompositeChar( int FontID, char char1); -extern T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1); -extern T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index); -extern int T1_IsInternalChar( int FontID, char char1); - -/* from t1load.c */ -extern int T1_LoadFont( int FontID); -extern int openFontMetricsFile( int FontID); -extern void *CreateNewFontSize( int FontID, float size, int aa); -extern void *GetLastFontSize( int FontID); -extern void *QueryFontSize( int FontID, float size, int aa); - -/* from t1set.c */ -extern GLYPH *T1_SetChar( int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_SetString( int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_CopyGlyph(GLYPH *glyph); -extern void T1_DumpGlyph( GLYPH *glyph); -extern GLYPH *T1_ConcatGlyphs( GLYPH *glyph1, GLYPH *glyph2, - int x_off, int y_off, int modflag); -extern void T1_DumpPixmap( GLYPH *glyph); -extern GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag); - -/* from t1trans.c */ -extern int T1_ExtendFont( int FontID, double extend); -extern int T1_SlantFont( int FontID, double slant); -extern int T1_TransformFont( int FontID, T1_TMATRIX *matrix); -extern double T1_GetExtend( int FontID); -extern double T1_GetSlant( int FontID); -extern T1_TMATRIX T1_GetTransform( int FontID); -extern int T1_SetLinePosition( int FontID, int linetype, float value); -extern int T1_SetLineThickness( int FontID, int linetype, float value); -extern float T1_GetLinePosition( int FontID, int linetype); -extern float T1_GetLineThickness( int FontID, int linetype); -extern T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, double angle); -extern T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix); -extern T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix); -extern T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, double shear); -extern T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, double shear); -extern T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, double extent); -extern T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, double extent); -extern T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, - double cxx, double cyx, - double cxy, double cyy); - - -/* from t1aaset.c */ -extern GLYPH *T1_AASetChar( int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_AASetString( int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern int T1_AASetGrayValues(unsigned long white, - unsigned long gray75, - unsigned long gray50, - unsigned long gray25, - unsigned long black); -extern int T1_AAHSetGrayValues( unsigned long *grayvals); -extern int T1_AANSetGrayValues( unsigned long bg, unsigned long fg); -extern int T1_AAGetGrayValues( long *pgrayvals); -extern int T1_AAHGetGrayValues( long *pgrayvals); -extern int T1_AANGetGrayValues( long *pgrayvals); -extern int T1_AASetBitsPerPixel( int bpp); -extern int T1_AAGetBitsPerPixel( void); -extern int T1_AASetLevel( int level); -extern int T1_AAGetLevel( void); -extern GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag); -extern int T1_AASetSmartLimits( float limit1, float limit2); -extern int T1_AASetSmartMode( int smart); - - -/* from t1afmtool.c */ -extern int T1_WriteAFMFallbackFile( int FontID); - -/* from t1outline.c */ -extern T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1, - T1_OUTLINE *path2); -extern T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale); -extern T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag, - float size, T1_TMATRIX *transform); -extern void T1_DumpPath( T1_OUTLINE *path); -extern void T1_AbsolutePath( T1_OUTLINE *rpath); -extern void T1_RelativePath( T1_OUTLINE *apath); -extern void T1_ManipulatePath( T1_OUTLINE *path, - void (*manipulate)(long *x,long *y,int type)); -extern T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path); -extern void T1_FreeOutline( T1_OUTLINE *path); - - -/* from t1subset.c */ -extern char *T1_SubsetFont( int FontID, - char *mask, - unsigned int flags, - int linewidth, - unsigned long maxblocksize, - unsigned long *bufsize); -extern char *T1_GetCharString( int FontID, char *charname, int *len); -extern int T1_GetlenIV( int FontID); - - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* T1LIB_H_INCLUDED */ diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1libx.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1libx.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1libx.h Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1libx.h Thu Jan 1 00:00:00 1970 @@ -1,85 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1libx.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-30 - ----- Description: This file is part of the t1-library. It must be - included by the user of the t1lib. It contains - function declarations for the X11 wrapper. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#ifndef T1LIBX_H_INCLUDED - -#define T1LIBX_H_INCLUDED - - -#ifndef _XLIB_H_ -#include -#endif - - -#define T1LIB_X11_SUPPORT - -/* For paint mode of X-rastering functions */ -#define T1_OPAQUE 0x1 -#define T1_TRANSPARENT 0x0 - - -/* type definitions, needed by the user: */ - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - - -/* from t1x11.c */ -extern int T1_SetX11Params( Display *display, - Visual *visual, - unsigned int depth, - Colormap colormap); -extern GLYPH *T1_SetCharX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_SetStringX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_AASetCharX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_AASetStringX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern int T1_ComputeAAColorsX( unsigned long fg, - unsigned long bg, - int nolevels); -extern int T1_GetDepthOfDrawable( Drawable drawable); -extern void T1_LogicalPositionX( int pos_switch); -extern XImage *T1_XImageFromGlyph( GLYPH *pglyph); - - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* T1LIBX_H_INCLUDED */ diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1load.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1load.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1load.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1load.c Thu Jan 1 00:00:00 1970 @@ -1,1007 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1load.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-03 - ----- Description: This file is part of the t1-library. It contains - functions for loading fonts and for managing size - dependent data. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1LOAD_C - -#define ANSI_REALLOC_VM - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/blues.h" -#include "../type1/regions.h" - - -#include "t1types.h" -#include "t1extern.h" -#include "t1load.h" -#include "t1env.h" -#include "t1set.h" -#include "t1base.h" -#include "t1finfo.h" -#include "t1afmtool.h" - - - -extern psobj *StdEncArrayP; /* For checking of a fonts encoding */ -extern char not_def[]; /* for checking the ".notdef"-string */ - - - -/* T1_LoadFont(FontID): Loads a Type1 font into memory and allocates all - memory, necessary for this. */ - -int T1_LoadFont( int FontID) -{ - int i, j, k, l, m; - char *FileName, *FileNamePath; - int mode; /* This is used by the type1-library for error reporting */ - char *charname; - - /* The following vars are used for reallocation of VM */ - long tmp_size; - float ascender; -#ifdef ANSI_REALLOC_VM - unsigned long shift; - unsigned long ldummy; - char *tmp_ptr; -#endif - - struct region *area; - struct XYspace *S; - - /* These are for constructing the kerning lookup table: */ - PairKernData *pkd; - METRICS_ENTRY *kern_tbl; - int char1, char2; - - - if (CheckForInit()){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - - i=CheckForFontID(FontID); - if (i==1) - return(0); /* Font already loaded */ - if (i==-1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); /* illegal FontID */ - } - - /* Allocate memory for ps_font structure: */ - if ((pFontBase->pFontArray[FontID].pType1Data=(psfont *)malloc(sizeof(psfont)))==NULL){ - T1_PrintLog( "T1_LoadFont()", "Failed to allocate memory for psfont-struct (FontID=%d)", - T1LOG_ERROR, FontID); - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - - /* Check for valid filename */ - if ((FileName=T1_GetFontFileName(FontID))==NULL){ - T1_PrintLog( "T1_LoadFont()", "No font file name for font %d", T1LOG_ERROR, FontID); - return(-1); - } - - /* Fetch the full path of type1 font file */ - if ((FileNamePath=intT1_Env_GetCompletePath( FileName, - T1_PFAB_ptr))==NULL){ - T1_PrintLog( "T1_LoadFont()", "Couldn't locate font file for font %d in %s", - T1LOG_ERROR, FontID, T1_GetFileSearchPath(T1_PFAB_PATH)); - T1_errno=T1ERR_FILE_OPEN_ERR; - return(-1); - } - - /* And load all PostScript information into memory */ - if (fontfcnA( FileNamePath, &mode, - pFontBase->pFontArray[FontID].pType1Data) == FALSE){ - T1_PrintLog( "T1_LoadFont()", "Loading font with ID = %d failed! (mode = %d)", - T1LOG_ERROR, FontID, mode); - free(FileNamePath); - pFontBase->pFontArray[FontID].pType1Data=NULL; - T1_errno=mode; - return(-1); - } - free(FileNamePath); - - - /* Store the base address of virtual memory and realloc in order not - to waste too much memory: */ - pFontBase->pFontArray[FontID].vm_base=vm_base; -#ifdef ANSI_REALLOC_VM - /* We first get the size of pointers on the current system */ - /* Get size of VM, ... */ - tmp_size=((unsigned long)vm_used - (unsigned long)vm_base); - /* ... realloc to that size ... */ - tmp_ptr=(char *)realloc(vm_base, tmp_size); - /* ... and shift all pointers refering to that area */ - if (tmp_ptr > vm_base){ - shift= (unsigned long)tmp_ptr - (unsigned long)vm_base; - sprintf( err_warn_msg_buf, - "Old VM at 0x%lX, new VM at 0x%lX, shifting up by %lu", - (unsigned long)vm_base, (unsigned long)tmp_ptr, tmp_size); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - - /* We start by shifting the topmost pointers: */ - pFontBase->pFontArray[FontID].vm_base=tmp_ptr; - - ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->vm_start); - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->vm_start=(char *)ldummy; - - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->CharStringsP=(psdict *)ldummy; - - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->Private=(psdict *)ldummy; - - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP=(psdict *)ldummy; - - ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->BluesP); - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->BluesP=(struct blues_struct *)ldummy; - - /* We now have to care for correcting all pointers which are in the VM - and refer to some place in the VM! Note: Instead of selecting the - appropriate pointer-elements of the union we simply shift the - unspecified pointer "valueP". - Note: The filename entry does not need to be modified since it does not - need to be shifted since it points to memory managed by t1lib. - */ - /* FontInfo-dictionary: All name-pointers and the pointers to all array - types have to be shifted: */ - i=pFontBase->pFontArray[FontID].pType1Data->fontInfoP[0].key.len; - for (j=1; j<=i; j++){ - if ((pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ARRAY) || - (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_STRING) || - (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_NAME) || - (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_FILE)){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy; - } - /* The encoding needs special treatment: */ - if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ENCODING){ - /* If a builtin encoding is used, it is sufficient to shift the pointer - to the Encoding since the character-namestrings of builtin encodings - are static and thus located on the heap. - For font-specific encoding, character-namestrings reside in VM and - thus each entry has to be shifted. - Caution: We still have to shift the builtin encoding-pointer, since - they also point to are located in VM: */ - ldummy=(long)StdEncArrayP; - ldummy +=shift; - StdEncArrayP=(psobj *)ldummy; - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy; - if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP - == StdEncArrayP){ /* Font uses builtin standard encoding */ - ; - } - else{ /* Font-specific encoding */ - for (k=0; k<256; k++){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP; - /* The ".notdef" is also static and may not be shifted (Thanks, Derek ;) */ - if (ldummy != (unsigned long)not_def) { - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP=(struct ps_obj *)ldummy; - } - } - } - } /* end of encoding-handling */ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP=(char *)ldummy; - } /* fontinfo-dict done */ - - /* Private-dictionary: All name-pointers and the pointers to all array - types have to be shifted: */ - i=pFontBase->pFontArray[FontID].pType1Data->Private[0].key.len; - for (j=1; j<=i; j++){ - if ((pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_ARRAY) || - (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_STRING) || - (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_NAME) || - (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_FILE)){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP=(char *)ldummy; - } - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP=(char *)ldummy; - } - - /* BluesP: The entry "next" is the only pointer in blues_struct. Although it is - not used anywhere we should shift it for correctness reasons (in case its not - NULL)! */ - if (pFontBase->pFontArray[FontID].pType1Data->BluesP->next != NULL){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->BluesP->next; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->BluesP->next=(struct blues_struct *)ldummy; - } - - /* The CharStrings-dictionary: Every namepointer and its corresponding - charstring has to be shifted: */ - i=pFontBase->pFontArray[FontID].pType1Data->CharStringsP[0].key.len; - for (j=1; j<=i; j++){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP=(char *)ldummy; - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP=(char *)ldummy; - } - - /* The Subroutines have also to be reorganized: */ - i=pFontBase->pFontArray[FontID].pType1Data->Subrs.len; - /* First, shift pointer to array-start and after that the pointers to - each command string: */ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP=(struct ps_obj *)ldummy; - for (j=0; jpFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP; - ldummy +=shift; - pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP=(char *)ldummy; - } - } /* end of if( tmp_ptr > vm_base ) */ - else if ( vm_base > tmp_ptr){ - shift= (unsigned long)vm_base - (unsigned long)tmp_ptr; - sprintf( err_warn_msg_buf, - "Old VM at 0x%lX, new VM at 0x%lX, shifting down by %lu", - (unsigned long)vm_base, (unsigned long)tmp_ptr, tmp_size); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - - /* We start by shifting the topmost pointers: */ - pFontBase->pFontArray[FontID].vm_base=tmp_ptr; - - ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->vm_start); - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->vm_start=(char *)ldummy; - - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->CharStringsP=(psdict *)ldummy; - - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->Private=(psdict *)ldummy; - - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP=(psdict *)ldummy; - - ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->BluesP); - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->BluesP=(struct blues_struct *)ldummy; - - /* We now have to care for correcting all pointers which are in the VM - and refer to some place in the VM! Note: Instead of selecting the - appropriate pointer-elements of the union we simply shift the - unspecified pointer "valueP". - Note: The filename entry does not need to be modified since it does not - need to be shifted since it points to memory managed by t1lib. - */ - /* FontInfo-dictionary: All name-pointers and the pointers to all array - types have to be shifted: */ - i=pFontBase->pFontArray[FontID].pType1Data->fontInfoP[0].key.len; - for (j=1; j<=i; j++){ - if ((pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ARRAY) || - (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_STRING) || - (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_NAME) || - (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_FILE)){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy; - } - /* The encoding needs special treatment: */ - if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ENCODING){ - /* If a builtin encoding is used, it is sufficient to shift the pointer - to the Encoding since the character-namestrings of builtin encodings - are static and thus located on the heap. - For font-specific encoding, character-namestrings reside in VM and - thus each entry has to be shifted. - Caution: We still have to shift the builtin encoding-pointer, since - they also point to are located in VM: */ - ldummy=(long)StdEncArrayP; - ldummy -=shift; - StdEncArrayP=(psobj *)ldummy; - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy; - if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP - == StdEncArrayP){ /* Font uses builtin encoding */ - ; - } - else{ /* Font-specific encoding */ - for (k=0; k<256; k++){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP; - /* The ".notdef" is also static and may not be shifted (Thanks, Derek ;) */ - if (ldummy != (unsigned long)not_def) { - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP=(struct ps_obj *)ldummy; - } - } - } - } /* end of encoding-handling */ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP=(char *)ldummy; - } /* fontinfo-dict done */ - - /* Private-dictionary: All name-pointers and the pointers to all array - types have to be shifted: */ - i=pFontBase->pFontArray[FontID].pType1Data->Private[0].key.len; - for (j=1; j<=i; j++){ - if ((pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_ARRAY) || - (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_STRING) || - (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_NAME) || - (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_FILE)){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP=(char *)ldummy; - } - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP=(char *)ldummy; - } - - /* BluesP: The entry "next" is the only pointer in blues_struct. Although it is - not used anywhere we should shift it for correctness reasons (in case its not - NULL)! */ - if (pFontBase->pFontArray[FontID].pType1Data->BluesP->next != NULL){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->BluesP->next; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->BluesP->next=(struct blues_struct *)ldummy; - } - - /* The CharStrings-dictionary: Every namepointer and its corresponding - charstring has to be shifted: */ - i=pFontBase->pFontArray[FontID].pType1Data->CharStringsP[0].key.len; - for (j=1; j<=i; j++){ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP=(char *)ldummy; - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP=(char *)ldummy; - } - - /* The Subroutines have also to be reorganized: */ - i=pFontBase->pFontArray[FontID].pType1Data->Subrs.len; - /* First, shift pointer to array-start and after that the pointers to - each command string: */ - ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP=(struct ps_obj *)ldummy; - for (j=0; jpFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP; - ldummy -=shift; - pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP=(char *)ldummy; - } - } /* end of if( vm_base > tmp_ptr ) */ - else{ /* VM addess has not changed during reallocation */ - sprintf( err_warn_msg_buf, - "Old VM and new VM at 0x%lX, no pointer-shifting", - (unsigned long)vm_base); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - } -#endif - - /* Generate a message how much VM the current font consumes */ - sprintf( err_warn_msg_buf, - "VM for Font %d: %d bytes", FontID, (int) tmp_size); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC); - - - /* Set the matrix for common transformations to "no transformations" */ - pFontBase->pFontArray[FontID].FontTransform[0]=1.0; - pFontBase->pFontArray[FontID].FontTransform[1]=0.0; - pFontBase->pFontArray[FontID].FontTransform[2]=0.0; - pFontBase->pFontArray[FontID].FontTransform[3]=1.0; - - /* Now, that the font has been loaded into memory, try to find the - FontMatrix in the font info dictionary. If it exists, load it into - our local fontmatrix, otherwise use a default matrix which scales to - 1/1000 (since font outlines are defined in a 1000 point space) - and does no further transformations. */ - if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP == NULL){ - pFontBase->pFontArray[FontID].FontMatrix[0]=0.001; - pFontBase->pFontArray[FontID].FontMatrix[1]=0.0; - pFontBase->pFontArray[FontID].FontMatrix[2]=0.0; - pFontBase->pFontArray[FontID].FontMatrix[3]=0.001; - } - else{ - pFontBase->pFontArray[FontID].FontMatrix[0]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[0].data.real; - pFontBase->pFontArray[FontID].FontMatrix[1]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[1].data.real; - pFontBase->pFontArray[FontID].FontMatrix[2]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[2].data.real; - pFontBase->pFontArray[FontID].FontMatrix[3]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[3].data.real; - } - - /* Set the default values for transformation: */ - pFontBase->pFontArray[FontID].slant=0.0; - pFontBase->pFontArray[FontID].extend=1.0; - - - /* Now try to load afm-structures from corresponding .afm-file (if - not suppressed by the user). */ - if ((pFontBase->t1lib_flags & T1_NO_AFM)!=0) { - pFontBase->pFontArray[FontID].pAFMData = NULL; - T1_PrintLog( "T1_LoadFont()", - "Suppressing AFM data handling on user request", - T1LOG_STATISTIC); - } - else { - if ((i=openFontMetricsFile( FontID, 0))){ - /* Try a fallback, opening sloppy: */ - if ((i=openFontMetricsFile( FontID, 1))) { - sprintf( err_warn_msg_buf, - "Alert: Error (%d) sloppy-processing afm-file for Font %d!", - i ,FontID); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC); - if ((pFontBase->pFontArray[FontID].pAFMData= - T1_GenerateAFMFallbackInfo(FontID))==NULL){ - sprintf( err_warn_msg_buf, - "Ultimately failed to generate metrics information Font %d!", - FontID); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_WARNING); - } - else { - pFontBase->pFontArray[FontID].info_flags |=AFM_SELFGEN_SUCCESS; - T1_PrintLog( "T1_LoadFont()", - "Generating AFM-information from fontfile successful!", - T1LOG_STATISTIC); - } - } - else { - pFontBase->pFontArray[FontID].info_flags |=AFM_SLOPPY_SUCCESS; - sprintf( err_warn_msg_buf, - "Alert: Limited afm-information for Font %d",FontID); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC); - } - } - else { - pFontBase->pFontArray[FontID].info_flags |=AFM_SUCCESS; - } - } - - - /* Now, set Encodingvector entry to default if the font's - internal encoding is "StandardEncoding". - */ - if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP - == StdEncArrayP) { - pFontBase->pFontArray[FontID].info_flags |=USES_STANDARD_ENCODING; - pFontBase->pFontArray[FontID].pFontEnc=pFontBase->default_enc; - sprintf( err_warn_msg_buf, - "Font %d reencoded to default",FontID); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - } - else { - sprintf( err_warn_msg_buf, - "Font %d not reencoded to default",FontID); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - pFontBase->pFontArray[FontID].pFontEnc = NULL; - } - - - /* If AFM-Info available we try to speed up some things: */ - if (pFontBase->pFontArray[FontID].pAFMData != NULL) { - /* We have to fill the array that maps the current encodings' indices to the - indices used in afm file. The interpretation has been changed in - in t1lib-1.2. We now use positive values for indexing into the charmetrics - array and negative values for indexing into the composite character array. - an index of zero indicates that no metrics are defined for this character. - This may happen because (a) not all AFM-files define metrics for the .notdef - character, and (b) because font and AFM-file do not match. */ - if ((pFontBase->pFontArray[FontID].pEncMap= - (int *)calloc(256,sizeof(int)))==NULL) { - sprintf( err_warn_msg_buf, "Error allocating memory for encoding map (FontID=%d)", - FontID); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - for (i=0; i<256; i++) { - charname=T1_GetCharName( FontID, i); - /* in a first loop check for ordinary characters */ - for ( j=0; jpFontArray[FontID].pAFMData->numOfChars; j++) { - if (strcmp( charname, - pFontBase->pFontArray[FontID].pAFMData->cmi[j].name)==0) { - pFontBase->pFontArray[FontID].pEncMap[i]=j+1; /* index 0 is reserved! */ - continue; - } - } - /* if nothing has been found, check for composite characters */ - for ( j=0; jpFontArray[FontID].pAFMData->numOfComps; j++) { - if (strcmp( charname, - pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName)==0) { - pFontBase->pFontArray[FontID].pEncMap[i]=-(j+1); /* index 0 is reserved! */ - continue; - } - } - } - - /* For composite characters, we still have to compute the width and bbox */ - for ( j=0; jpFontArray[FontID].pAFMData->numOfComps; j++) { - /*and bounding box by ourselves. First, set up an identity charspace - matrix and then generate an edgelist for the composite character at - size 1000bp using no transformation and current encoding. Note: This - action is only required when loading a font at first time, but not - when reencoding a font. */ - S=(struct XYspace *)IDENTITY; - S=(struct XYspace *)Permanent - (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0], - pFontBase->pFontArray[FontID].FontTransform[1], - pFontBase->pFontArray[FontID].FontTransform[2], - pFontBase->pFontArray[FontID].FontTransform[3])); - - area=fontfcnB_ByName( FontID, 0, S, - pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName, - &mode, pFontBase->pFontArray[FontID].pType1Data, - DO_RASTER); - /* Store bounding box ... */ - pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.llx=area->xmin; - pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.urx=area->xmax; - pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.lly=area->ymin; - pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.ury=area->ymax; - /* ... and character width. This should be the width of the base character - of the composite! */ - pFontBase->pFontArray[FontID].pAFMData->ccd[j].wx=NEARESTPEL(area->ending.x); - /* clean up. */ - KillRegion (area); - if (S!=NULL) { - KillSpace (S); - S=NULL; - } - } - /* We now create an encoding-specific kerning table which will speed up - looking for kerning pairs! */ - /* First, get number of defined kerning pairs: */ - k=pFontBase->pFontArray[FontID].pAFMData->numOfPairs; - if (k>0){ /* i.e., there are any pairs */ - /* OK, it does not suffice to alloc numOfPairs METRICS_ENTRYs, because - a given character might be encoded at several locations and kerning - should still work. As a worst case estimation, we allocate 256^2 - and realloc later. */ - if ((pFontBase->pFontArray[FontID].pKernMap= - (METRICS_ENTRY *)malloc( (256*256) *sizeof( METRICS_ENTRY)))==NULL){ - sprintf( err_warn_msg_buf, "Error allocating memory for metrics map (FontID=%d)", - FontID); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, - T1LOG_WARNING); - T1_errno=T1ERR_ALLOC_MEM; - return(-1); - } - kern_tbl=pFontBase->pFontArray[FontID].pKernMap; - pkd=pFontBase->pFontArray[FontID].pAFMData->pkd; - j=0; - for ( i=0; i - Put char1 in higher byte and char2 in LSB: */ - kern_tbl[j].chars=(char1 << 8) | char2; - /* We only make use of horizontal kerning */ - kern_tbl[j].hkern=pkd[i].xamt; - j++; - } /* while (char2) */ - } /* while (char1) */ - } /* for */ - /* We are done, realloc memory: */ - kern_tbl=(METRICS_ENTRY*) realloc( kern_tbl, j*sizeof(METRICS_ENTRY)); - /* We now sort the kerning array with respect to char indices */ - qsort( kern_tbl, (size_t) j, sizeof(METRICS_ENTRY), - &cmp_METRICS_ENTRY ); - /* Finally write back pointer for the case that realloc changed the - pointer */ - pFontBase->pFontArray[FontID].pKernMap=kern_tbl; - pFontBase->pFontArray[FontID].KernMapSize=j; - } - else - pFontBase->pFontArray[FontID].pKernMap=NULL; - } - else { /* no AFM data */ - pFontBase->pFontArray[FontID].pKernMap=NULL; - pFontBase->pFontArray[FontID].pEncMap=NULL; - } - /* End of "if (AFM-info ..)" */ - - - /* We have just loaded a physical font into memory, thus .... */ - pFontBase->pFontArray[FontID].physical=1; - - /* Set reference-counter to 1: */ - pFontBase->pFontArray[FontID].refcount=1; - - /* Get the index into encoding vector where the space character is - found. If not encoded, set space_position to -1. */ - pFontBase->pFontArray[FontID].space_position=-1; - i=0; - if (pFontBase->pFontArray[FontID].pFontEnc) { /* external default encoding */ - while (i<256) { - if (strcmp( (char *)pFontBase->pFontArray[FontID].pFontEnc[i], - "space")==0){ - /* space found at position i: */ - pFontBase->pFontArray[FontID].space_position=i; - break; - } - i++; - } - } - else { /* internal encoding */ - while (i<256) { - if (strcmp( (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[i].data.arrayP, - "space")==0){ - /* space found at position i: */ - pFontBase->pFontArray[FontID].space_position=i; - break; - } - i++; - } - } - - - /* Set the lining rule parameters to default values */ - pFontBase->pFontArray[FontID].UndrLnPos= - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINEPOSITION].value.data.real; - pFontBase->pFontArray[FontID].UndrLnThick= - pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINETHICKNESS].value.data.real; - - /* We have to set the value for the typographic ascender. If possible, - we get it from the afm-File. But be aware this value might be undefined! - This value should in any acse explicitly be set later by the user! */ - if (pFontBase->pFontArray[FontID].pAFMData!=NULL && - pFontBase->pFontArray[FontID].pAFMData->gfi!=NULL) { - ascender=(float) pFontBase->pFontArray[FontID].pAFMData->gfi->ascender; - } - else { - ascender=(float) T1_GetCharBBox( FontID, T1_GetEncodingIndex( FontID, "d")).ury; - } - - pFontBase->pFontArray[FontID].OvrLnPos=ascender - + (float) abs( (double)pFontBase->pFontArray[FontID].UndrLnPos); - pFontBase->pFontArray[FontID].OvrStrkPos=ascender / 2.0; - pFontBase->pFontArray[FontID].OvrLnThick=pFontBase->pFontArray[FontID].UndrLnThick; - pFontBase->pFontArray[FontID].OvrStrkThick=pFontBase->pFontArray[FontID].UndrLnThick; - - - /* Finally, set the font size dependencies pointer to NULL since we can - assume, that at load time of a font, no size specific data of this - font is available. - */ - - pFontBase->pFontArray[FontID].pFontSizeDeps=NULL; - - /* If wanted, some debugging information is put into logfile */ - sprintf( err_warn_msg_buf, "Pointer vm_base: 0x%lX", - (long)pFontBase->pFontArray[FontID].vm_base); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "Pointer vm_start: 0x%lX", - (long)pFontBase->pFontArray[FontID].pType1Data->vm_start); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "Pointer CharStringsP: 0x%lX", - (long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "Pointer Private: 0x%lX", - (long)pFontBase->pFontArray[FontID].pType1Data->Private); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - sprintf( err_warn_msg_buf, "Pointer fontInfoP: 0x%lX", - (long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP); - T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); - - return(0); -} - - -/* openFontMetricsFile( FontID, open_sloppy): Gets the fontfilename - corresponding to FontID, opens the corresponding afm-file and fills - the data structures. return-value is the value returned by the - T1lib_parseFile() function. If open_sloppy is set, the minimum - information needed is read from AFM file. This can be considered a - fallback for problematic AFM files. */ -static int openFontMetricsFile( int FontID, int open_sloppy) -{ - char *FontFileName; - char *AFMFileName; - char *afm_name; - char *AFMFileNamePath; - - int i, j; - FILE *metricsfile; - - - afm_name=T1_GetAfmFileName(FontID); - - if (afm_name!=NULL) { /* We have name explicitly specified */ - /* It needs to be freeable */ - if ((AFMFileName= - (char *)malloc( (strlen(afm_name)+1)*sizeof( char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return( -6); - } - strcpy( AFMFileName, afm_name); - } - else { - FontFileName=T1_GetFontFileName( FontID); - i=strlen(FontFileName); - j=i; - AFMFileName=(char *)malloc( i+5); - strcpy( AFMFileName, FontFileName); - while ( AFMFileName[i] != '.'){ - if (i==0) break; - else i--; - } - if (i==0){ - /* We have a filename without extension -> append extension */ - AFMFileName[j]='.'; - AFMFileName[j+1]='a'; - AFMFileName[j+2]='f'; - AFMFileName[j+3]='m'; - AFMFileName[j+4]='\0'; - } - else{ - /* we found a '.' -> replace extension */ - AFMFileName[i+1]='a'; - AFMFileName[i+2]='f'; - AFMFileName[i+3]='m'; - AFMFileName[i+4]='\0'; - } - } - - /* Get full path of the afm file (The case of a full path name - name specification is valid */ - AFMFileNamePath=intT1_Env_GetCompletePath( AFMFileName, T1_AFM_ptr); - free( AFMFileName); - - /* open afm-file: */ - if (AFMFileNamePath!=NULL){ - if ((metricsfile=fopen(AFMFileNamePath,"r"))==NULL){ - free(AFMFileNamePath); - return(-4); - } - else { - free(AFMFileNamePath); - } - } - else{ - return( -5); - } - - /* Call procedure to read afm-file and store the data formatted. - Flags used here: P_M All Metrics Information - P_P Pair Kerning Information - P_C Composite Character Data (since t1lib V.1.2) - The P_G flag to get global font information should not be used - if not absolutely needed. When parsing an unknown keyword, which - may be harmless, the T1lib_parseFile function returns the error code - -1 (parseError). On the other hand, all other really relevant - data may habe been parsed and stored correctly. In such a case, - There's no way to make a serious decision whether an error has - occured or not. - */ - if (open_sloppy!=0) - i=T1lib_parseFile( (FILE *) metricsfile, - (FontInfo **) &(FontBase.pFontArray[FontID].pAFMData), - P_M ); - else - i=T1lib_parseFile( (FILE *) metricsfile, - (FontInfo **) &(FontBase.pFontArray[FontID].pAFMData), - P_G | P_M | P_P | P_C ); - fclose(metricsfile); - return(i); -} - - - -/* CreateNewFontSize( FontID, size): Create a new size "size" of font - "FontID" and allocate all data necessary for this. The data - structure is connected to the linked list of FontSizeDeps for this - font. Returns a pointer to the newly created FontSizeDeps-struct - if all went correct and NULL otherwise. - Since of version 0.3 a member antialias has been added to the - FONTSIZEDEPS structure! This can be: - - 0: bitmaps are stored in this struct - 1: non-antialiased bytemaps are stored in this struct - 2: low-antialiased bytemaps are stored in this struct - 4: high-antialiased bytemaps are stored in this struct - */ -FONTSIZEDEPS *CreateNewFontSize( int FontID, float size, int aa) -{ - - FONTSIZEDEPS *pFontSizeDeps, *pPrev; - - - /* First, get to the last font size in the linked list for this font. - The following routine returns the address of the last struct in the - linked list of FONTSIZEDEPS or NULL if none exists. */ - pFontSizeDeps=GetLastFontSize( FontID); - pPrev=pFontSizeDeps; - - - if (pFontSizeDeps==NULL){ - /* Allocate memory for first FontSizeDeps-structure: */ - if ((pFontBase->pFontArray[FontID].pFontSizeDeps=(FONTSIZEDEPS *)malloc(sizeof(FONTSIZEDEPS)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - pFontSizeDeps=pFontBase->pFontArray[FontID].pFontSizeDeps; - } - else{ - /* A valid address of an existing structure was found */ - if ((pFontSizeDeps->pNextFontSizeDeps=(FONTSIZEDEPS *)malloc(sizeof(FONTSIZEDEPS)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - pFontSizeDeps=pFontSizeDeps->pNextFontSizeDeps; - } - - /* The pointer to the previous struct */ - pFontSizeDeps->pPrevFontSizeDeps=pPrev; - /* Put the size into this structure */ - pFontSizeDeps->size=size; - /* Set the antialias mark: */ - pFontSizeDeps->antialias=aa; - - /* Just the current becomes now the last item in the linked list: */ - pFontSizeDeps->pNextFontSizeDeps=NULL; - /* Setup CharSpaceMatrix for this font: */ - pFontSizeDeps->pCharSpaceLocal=(struct XYspace *) IDENTITY; - /* Apply transformation with font matrix: */ - pFontSizeDeps->pCharSpaceLocal=(struct XYspace *) - Transform(pFontSizeDeps->pCharSpaceLocal, - pFontBase->pFontArray[FontID].FontMatrix[0], - pFontBase->pFontArray[FontID].FontMatrix[1], - pFontBase->pFontArray[FontID].FontMatrix[2], - pFontBase->pFontArray[FontID].FontMatrix[3]); - /* Apply a further transformation (optionally): */ - pFontSizeDeps->pCharSpaceLocal=(struct XYspace *) - Transform(pFontSizeDeps->pCharSpaceLocal, - pFontBase->pFontArray[FontID].FontTransform[0], - pFontBase->pFontArray[FontID].FontTransform[1], - pFontBase->pFontArray[FontID].FontTransform[2], - pFontBase->pFontArray[FontID].FontTransform[3]); - /* Apply desired scaling factor, and make it Permanent */ - pFontSizeDeps->pCharSpaceLocal=(struct XYspace *) Permanent - (Scale(pFontSizeDeps->pCharSpaceLocal, size, size)); - - /* We should now allocate memory for the glyph area of the font - cache: */ - if ((pFontSizeDeps->pFontCache=(GLYPH *)calloc(256,sizeof(GLYPH))) - ==NULL) - return(NULL); - - sprintf( err_warn_msg_buf, "New Size %f created for FontID %d (antialias=%d)", - pFontSizeDeps->size, FontID, pFontSizeDeps->antialias); - T1_PrintLog( "CreateNewFontSize()", err_warn_msg_buf, T1LOG_STATISTIC); - /* We are done */ - return(pFontSizeDeps); - -} - - - - -/* QueryFontSize( FontID, size, aa): Search if a requested size of font - FontID is already existing. If so, it returns a pointer to the - respective FontSizeDeps-structure, otherwise NULL is returned: */ -FONTSIZEDEPS *QueryFontSize( int FontID, float size, int aa) -{ - - FONTSIZEDEPS *link_ptr; - - - /* There's not yet one size: */ - if (pFontBase->pFontArray[FontID].pFontSizeDeps == NULL) - return(pFontBase->pFontArray[FontID].pFontSizeDeps); - - - /* There's already existing one or more size */ - link_ptr=pFontBase->pFontArray[FontID].pFontSizeDeps; - - while (((link_ptr->size != size)||(link_ptr->antialias != aa)) - &&(link_ptr->pNextFontSizeDeps != NULL)) - link_ptr=link_ptr->pNextFontSizeDeps; - - if ((link_ptr->size != size)||(link_ptr->antialias != aa)) - return( NULL); /* requested size/aa-combination was not found */ - else - return(link_ptr); /* return pointer to requested struct */ - -} - -/* FONTSIZEDEPS *GetLastFontSize( FontID): Get the address of the - last struct in the linked list of FontSizeDeps or NULL if there is - no existing size dependent data. */ -FONTSIZEDEPS *GetLastFontSize( int FontID) -{ - FONTSIZEDEPS *link_ptr, *result_ptr; - - - /* There's not yet one size: */ - if (pFontBase->pFontArray[FontID].pFontSizeDeps == NULL) - return((FONTSIZEDEPS *) (pFontBase->pFontArray[FontID].pFontSizeDeps)); - - - /* There's already existing one or more size */ - link_ptr=pFontBase->pFontArray[FontID].pFontSizeDeps; - - while (link_ptr != NULL){ - result_ptr=link_ptr; - link_ptr=link_ptr->pNextFontSizeDeps; - } - - return((FONTSIZEDEPS *)(result_ptr)); -} - - -/* A function for comparing METRICS_ENTRY structs */ -static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2) -{ - if (((METRICS_ENTRY *)entry1)->chars < - ((METRICS_ENTRY *)entry2)->chars) - return(-1); - if (((METRICS_ENTRY *)entry1)->chars > - ((METRICS_ENTRY *)entry2)->chars) - return(1); - return(0); /* This should not happen */ -} - - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1load.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1load.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1load.h Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1load.h Thu Jan 1 00:00:00 1970 @@ -1,48 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1load.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - declarations and definitions for t1load.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independ from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#ifdef T1LOAD_C - -int T1_LoadFont( int FontID); -static int openFontMetricsFile( int FontID, int open_sloppy); -FONTSIZEDEPS *CreateNewFontSize( int FontID, float size, int aa); -FONTSIZEDEPS *GetLastFontSize( int FontID); -FONTSIZEDEPS *QueryFontSize( int FontID, float size, int aa); -int fontfcnA( char *env, int *mode, psfont *Font_Ptr); -static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2); -extern char *vm_base; /* from fontfcn.c in initfont()! */ -extern char *vm_used; /* from fontfcn.c in fontfcnA()! */ - -#else - -extern int T1_LoadFont( int FontID); -extern FONTSIZEDEPS *CreateNewFontSize( int FontID, float size, int aa); -extern FONTSIZEDEPS *GetLastFontSize( int FontID); -extern FONTSIZEDEPS *QueryFontSize( int FontID, float size, int aa); - -#endif diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1misc.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1misc.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1misc.h Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1misc.h Thu Jan 1 00:00:00 1970 @@ -1,212 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1misc.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-03 - ----- Description: This file is part of the t1-library. It contains - some miscellaneous definitions. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#include - -#define LINE_BUF 512 -#define BUF_SIZE 512 -#define NULLPTR (void *) 0 - - -/* t1lib-glyphs are padded to this value by default: */ -#define T1GLYPH_PAD 8 -#define T1GLYPH_BIT 0 -#define T1GLYPH_BYTE 0 -#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad)) - - -/* For debugging purposes: */ -#define SLEEP for(j=0; j<50; j++){for (k=0; k<65536; k++);} - - -#define KERN_FLAG 0x01 -#define LIGATURE_FLAG 0x02 - - -/* common 'yes'/'no' */ -#define T1_YES 0x1 -#define T1_NO 0x0 - - -/* The maximum length of a PostScript name of a font: */ -#define MAXPSNAMELEN 256 -#define MAXPATHLEN 1024 - -/* The default resolution used by the library */ -#define DEFAULT_RES 72.0 -#define BIGPOINTSPERINCH 72.0 - -/* Defaults for configuration file searching: */ -/* (Note: The directory where the global config will be located is - determined by configure at compile time) */ -#define T1_CONFIGFILENAME ".t1librc" -#define ENV_CONF_STRING "T1LIB_CONFIG" -#define GLOBAL_CONFIG_FILE "t1lib.config" -/* Directory separator is operating system dependent */ -#if defined(VMS) -# define DIRECTORY_SEP "]" -# define DIRECTORY_SEP_CHAR ']' -#elif defined(MSDOS) | defined(_WIN32) | defined(__EMX__) | defined(_MSC_VER) -# define DIRECTORY_SEP "\\" -# define DIRECTORY_SEP_CHAR '\\' -#else -# define DIRECTORY_SEP "/" -# define DIRECTORY_SEP_CHAR '/' -#endif -/* For EMX-, WIN32-, MSDOS-environment, we define the default path separator to - be ';' instead of ':' */ -#if defined(MSDOS) | defined(_WIN32) | defined(__EMX__) | defined(_MSC_VER) | defined(VMS) -#define PATH_SEP ";" -#define PATH_SEP_CHAR ';' -#else -#define PATH_SEP ":" -#define PATH_SEP_CHAR ':' -#endif -/* This non printable character is used internally */ -#define INTERNAL_PATH_SEP "\001" -#define INTERNAL_PATH_SEP_CHAR '\1' - - -/* Default name for t1lib-logfile: */ -#define ENV_LOG_STRING "T1LIB_LOGMODE" -#define T1_LOG_FILE "t1lib.log" -/* logfile levels: */ -#define T1LOG_ERROR 1 -#define T1LOG_WARNING 2 -#define T1LOG_STATISTIC 3 -#define T1LOG_DEBUG 4 - - -/* def's for T1_InitLib() */ -#define NO_LOGFILE 0x0 -#define LOGFILE 0x1 -#define IGNORE_FONTDATABASE 0x2 /* Default is to read database */ -#define IGNORE_CONFIGFILE 0x4 /* Default is to read config file */ -#define T1_AA_CACHING 0x8 /* Cache aa-bytes */ -#define T1_NO_AFM 0x10 /* Don't load AFM files or generate AFM data */ - - -/* How may ligatures a character may have at maximum: */ -#define MAX_LIGS 20 - - -/* The maximum number of gray-levels in antialiasing */ -#define AAMAXPLANES 17 -#define T1_AA_NONE 1 -#define T1_AA_LOW 2 -#define T1_AA_HIGH 4 - -/* The default limits for no/low/high AA */ -#define T1_AA_SMARTLIMIT1 20.0 -#define T1_AA_SMARTLIMIT2 60.0 - -/* How much to advance the number of FONTPRIVATE structures when - reallocating for new fonts? */ -#define ADVANCE_FONTPRIVATE 10 - -#define NO_ANTIALIAS 0 -#define ANTIALIAS 1 - - -/* #define's for manipulating searchpaths */ -#define T1_PFAB_PATH 0x01 -#define T1_AFM_PATH 0x02 -#define T1_ENC_PATH 0x04 -#define T1_FDB_PATH 0x08 -#define T1_APPEND_PATH 0x00 -#define T1_PREPEND_PATH 0x01 - - -/* #define's for character/string properties (not all implemented) */ -#define T1_DEFAULT 0x0000 -#define T1_UNDERLINE 0x0001 -#define T1_OVERLINE 0x0002 -#define T1_OVERSTRIKE 0x0004 -#define T1_DOUBLEOVERSTRIKE 0x0008 -#define T1_RIGHT_TO_LEFT 0x0010 -#define T1_SUBSCRIPT 0x0100 -#define T1_SUPERSCRIPT 0x0200 -#define T1_STROKED 0x1000 -#define T1_KERNING 0x2000 - - -/* Error handling: */ -/* These are from scanning a font file */ -#define T1ERR_SCAN_FONT_FORMAT -5 -#define T1ERR_SCAN_FILE_OPEN_ERR -4 -#define T1ERR_SCAN_OUT_OF_MEMORY -3 -#define T1ERR_SCAN_ERROR -2 -#define T1ERR_SCAN_FILE_EOF -1 -/* These are from generating paths */ -#define T1ERR_PATH_ERROR 1 -#define T1ERR_PARSE_ERROR 2 -#define T1ERR_TYPE1_ABORT 3 -/* These are from t1lib */ -#define T1ERR_INVALID_FONTID 10 -#define T1ERR_INVALID_PARAMETER 11 -#define T1ERR_OP_NOT_PERMITTED 12 -#define T1ERR_ALLOC_MEM 13 -#define T1ERR_FILE_OPEN_ERR 14 -#define T1ERR_UNSPECIFIED 15 -#define T1ERR_NO_AFM_DATA 16 -#define T1ERR_X11 17 -#define T1ERR_COMPOSITE_CHAR 18 - - -/* The info_flags meaning */ -#define AFM_SUCCESS (short)0x0001 -#define AFM_SLOPPY_SUCCESS (short)0x0002 -#define AFM_SELFGEN_SUCCESS (short)0x0004 -#define USES_STANDARD_ENCODING (short)0x0008 -#define FONT_NOCACHING (short)0x0100 - - -#ifndef PI -#define PI 3.1415927 -#endif - - -/* Flags to control the rasterizer */ -#define T1_IGNORE_FORCEBOLD 0x0001 -#define T1_IGNORE_FAMILYALIGNMENT 0x0002 -#define T1_IGNORE_HINTING 0x0004 - -#define T1_DEBUG_LINE 0x0100 -#define T1_DEBUG_REGION 0x0200 -#define T1_DEBUG_PATH 0x0400 -#define T1_DEBUG_FONT 0x0800 -#define T1_DEBUG_HINT 0x1000 - - -/* */ -#define DO_RASTER 0x1 -#define DO_NOT_RASTER 0x0 - - -/* this definition reports a character substitution from fontfcn */ -#define FF_NOTDEF_SUBST -1 diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1outline.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1outline.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1outline.c Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1outline.c Thu Jan 1 00:00:00 1970 @@ -1,766 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1outline.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-05-27 - ----- Description: This file is part of the t1-library. It contains - functions for getting glyph outline descriptions of - strings and characters. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1OUTLINE_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" -#include "../type1/paths.h" - - -#include "t1types.h" -#include "t1extern.h" -#include "t1set.h" -#include "t1load.h" -#include "t1finfo.h" -#include "t1misc.h" -#include "t1base.h" -#include "t1outline.h" - - -/* As a fall back */ -#ifndef T1_AA_TYPE16 -#define T1_AA_TYPE16 short -#endif -#ifndef T1_AA_TYPE32 -#define T1_AA_TYPE32 int -#endif - - -extern char *t1_get_abort_message( int number); -extern struct segment *Type1Line(psfont *env, struct XYspace *S, - float line_position, - float line_thickness, - float line_length); -extern struct segment *t1_Join( struct segment *path1, - struct segment *path2); -extern struct segment *CopyPath( struct segment *p); -extern void KillPath( struct segment *p); - - - - -/* T1_SetChar(...): Generate the bitmap for a character */ -T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode, float size, - T1_TMATRIX *transform) -{ - int i; - int mode; - T1_PATHSEGMENT *charpath; - struct XYspace *Current_S; - unsigned char ucharcode; - - - FONTSIZEDEPS *font_ptr; - FONTPRIVATE *fontarrayP; - - /* We don't implement underlining for characters, but the rasterer - implements it. Thus, we use a modflag of constant 0 */ - int modflag=0; - - - /* We return to this if something goes wrong deep in the rasterizer */ - if ((i=setjmp( stck_state))!=0) { - T1_errno=T1ERR_TYPE1_ABORT; - sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", - t1_get_abort_message( i)); - T1_PrintLog( "T1_GetCharOutline()", err_warn_msg_buf, - T1LOG_ERROR); - return( NULL); - } - - ucharcode=(unsigned char)charcode; - - - /* First, check for a correct ID */ - i=CheckForFontID(FontID); - if (i==-1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - /* if necessary load font into memory */ - if (i==0) - if (T1_LoadFont(FontID)) - return(NULL); - - /* Check for valid size */ - if (size<=0.0){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - fontarrayP=&(pFontBase->pFontArray[FontID]); - - /* font is now loaded into memory => - Check for size: */ - if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ - font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); - if (font_ptr==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - } - - /* Setup an appropriate charspace matrix. Note that the rasterizer - assumes vertical values with inverted sign! Transformation should - create a copy of the local charspace matrix which then still has - to be made permanent. */ - if (transform!=NULL) { - Current_S=(struct XYspace *) - Permanent(Scale(Transform (font_ptr->pCharSpaceLocal, - transform->cxx, - transform->cxy, - transform->cyx, - transform->cyy), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - else{ - Current_S=(struct XYspace *) - Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, - 1.0, 0.0, 0.0, -1.0), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - - - /* fnt_ptr now points to the correct FontSizeDeps-struct => - lets now raster the character */ - mode=0; - charpath=(T1_PATHSEGMENT *)fontfcnB( FontID, modflag, Current_S, - fontarrayP->pFontEnc, - ucharcode, &mode, - fontarrayP->pType1Data, - DO_NOT_RASTER); - KillSpace (Current_S); - - return((T1_OUTLINE *)charpath); -} - - - -/* T1_GetStringOutline(...): Generate the outline for a string of - characters */ -T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, - long spaceoff, int modflag, float size, - T1_TMATRIX *transform) -{ - int i; - int mode; - /* initialize this to NULL just to be on the safe side */ - T1_PATHSEGMENT *charpath = NULL; - struct XYspace *Current_S; - int *kern_pairs; /* use for accessing the kern pairs if kerning is - requested */ - int no_chars=0; /* The number of characters in the string */ - static int lastno_chars=0; - long spacewidth; /* This is given to fontfcnb_string() */ - - - FONTSIZEDEPS *font_ptr; - FONTPRIVATE *fontarrayP; - - static int *pixel_h_anchor_corr=NULL; - static int *flags=NULL; - - unsigned char *ustring; - - - /* We return to this if something goes wrong deep in the rasterizer */ - if ((i=setjmp( stck_state))!=0) { - T1_errno=T1ERR_TYPE1_ABORT; - sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", - t1_get_abort_message( i)); - T1_PrintLog( "T1_GetStringOutline()", err_warn_msg_buf, - T1LOG_ERROR); - return( NULL); - } - - /* force string elements into unsigned */ - ustring=(unsigned char*)string; - - /* First, check for a correct ID */ - i=CheckForFontID(FontID); - if (i==-1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - /* if necessary load font into memory */ - if (i==0) - if (T1_LoadFont(FontID)) - return(NULL); - - /* If no AFM info is present, we return an error */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return(NULL); - } - - /* Check for valid size */ - if (size<=0.0){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - fontarrayP=&(pFontBase->pFontArray[FontID]); - - /* font is now loaded into memory => - Check for size: */ - if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ - font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); - if (font_ptr==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - } - - /* Now comes string specific stuff: Get length of string and create an - array of integers where to store the bitmap positioning dimens: */ - if (len<0){ /* invalid length */ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - if (len==0) /* should be computed assuming "normal" 0-terminated string */ - no_chars=strlen(string); - else /* use value given on command line */ - no_chars=len; - - /* If necessary, allocate memory */ - if (no_chars>lastno_chars){ - if (pixel_h_anchor_corr!=NULL){ - free(pixel_h_anchor_corr); - } - if (flags!=NULL){ - free(flags); - } - - pixel_h_anchor_corr=(int *)calloc(no_chars, sizeof(int)); - flags=(int *)calloc(no_chars, sizeof(int)); - lastno_chars=no_chars; - } - else{ - /* Reset flags and position array */ - for (i=0; ipCharSpaceLocal, - transform->cxx, - transform->cxy, - transform->cyx, - transform->cyy), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - else{ - Current_S=(struct XYspace *) - Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, - 1.0, 0.0, 0.0, -1.0), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - - /* Compute the correct spacewidth value (in charspace units). The - value supplied by the user is interpreted as an offset in - char space units: - */ - spacewidth=T1_GetCharWidth(FontID,fontarrayP->space_position)+spaceoff; - - mode=0; - kern_pairs=(int *)calloc(no_chars, sizeof(int)); - if ((modflag & T1_KERNING)) - for (i=0; ipFontEnc, - (unsigned char *)string, - no_chars, &mode, - fontarrayP->pType1Data, - kern_pairs, spacewidth, - DO_NOT_RASTER); - KillSpace (Current_S); - - /* In all cases, free memory for kerning pairs */ - free(kern_pairs); - - /* fill the string_glyph-structure */ - if (mode != 0) { - sprintf( err_warn_msg_buf, "fontfcnB_string() set mode=%d", mode); - T1_PrintLog( "T1_GetStringOutline()", err_warn_msg_buf, T1LOG_WARNING); - T1_errno=mode; - /* make sure to get rid of path if it's there */ - if (charpath){ - KillRegion (charpath); - } - return(NULL); - } - if (charpath == NULL){ - T1_PrintLog( "T1_GetStringOutline()", "path=NULL returned by fontfcnB_string()", T1LOG_WARNING); - T1_errno=mode; - return(NULL); - } - - return( (T1_OUTLINE *)charpath); -} - - -/* T1_GetMoveOutline(...): Generate the "outline" for a movement - */ -T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag, - float size, T1_TMATRIX *transform) -{ - int i; - FONTSIZEDEPS *font_ptr; - struct segment *path, *tmppath; - struct XYspace *Current_S; - psfont *FontP; - float length; - - - /* We return to this if something goes wrong deep in the rasterizer */ - if ((i=setjmp( stck_state))!=0) { - T1_errno=T1ERR_TYPE1_ABORT; - sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", - t1_get_abort_message( i)); - T1_PrintLog( "T1_GetMoveOutline()", err_warn_msg_buf, - T1LOG_ERROR); - return( NULL); - } - - - /* First, check for a correct ID */ - i=CheckForFontID(FontID); - if (i==-1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - /* if necessary load font into memory */ - if (i==0) - if (T1_LoadFont(FontID)) - return(NULL); - - /* Check for valid size */ - if (size<=0.0){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - FontP=pFontBase->pFontArray[i].pType1Data; - - /* font is now loaded into memory => - Check for size: */ - if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ - font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); - if (font_ptr==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - } - - /* Setup an appropriate charspace matrix. Note that the rasterizer - assumes vertical values with inverted sign! Transformation should - create a copy of the local charspace matrix which then still has - to be made permanent. */ - if (transform!=NULL){ - Current_S=(struct XYspace *) - Permanent(Scale(Transform (font_ptr->pCharSpaceLocal, - transform->cxx, - transform->cxy, - transform->cyx, - transform->cyy), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - else{ - Current_S=(struct XYspace *) - Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, - 1.0, 0.0, 0.0, -1.0), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - - - path=(struct segment *)ILoc( Current_S, deltax, deltay); - - /* Take care for underlining and such */ - length=(float) deltax; - if (modflag & T1_UNDERLINE){ - tmppath=(struct segment *)Type1Line(FontP,Current_S, - pFontBase->pFontArray[FontID].UndrLnPos, - pFontBase->pFontArray[FontID].UndrLnThick, - length); - path=(struct segment *)Join(path,tmppath); - } - if (modflag & T1_OVERLINE){ - tmppath=(struct segment *)Type1Line(FontP,Current_S, - pFontBase->pFontArray[FontID].OvrLnPos, - pFontBase->pFontArray[FontID].OvrLnThick, - length); - path=(struct segment *)Join(path,tmppath); - } - if (modflag & T1_OVERSTRIKE){ - tmppath=(struct segment *)Type1Line(FontP,Current_S, - pFontBase->pFontArray[FontID].OvrStrkPos, - pFontBase->pFontArray[FontID].OvrStrkThick, - length); - path=(struct segment *)Join(path,tmppath); - } - - KillSpace( Current_S); - - return( (T1_OUTLINE *)path); - -} - - -/* T1_ConcatOutlines(): Concatenate two outline to one path */ -T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1, T1_OUTLINE *path2) -{ - - return( (T1_OUTLINE *) t1_Join( (struct segment *) path1, - (struct segment *) path2)); - -} - - -/* T1_ScaleOutline(): Scale an outline */ -T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale) -{ - struct segment *ipath; - - /* Step through the path list */ - ipath=(struct segment *)path; - - do { - if (ipath->type==LINETYPE){ - ipath->dest.x = (fractpel) (ipath->dest.x * scale); - ipath->dest.y = (fractpel) (ipath->dest.y * scale); - } - if (ipath->type==CONICTYPE){ - ((struct conicsegment *)ipath)->dest.x = - (fractpel) ((struct conicsegment *)ipath)->dest.x * scale; - ((struct conicsegment *)ipath)->dest.y = - (fractpel) ((struct conicsegment *)ipath)->dest.y * scale; - ((struct conicsegment *)ipath)->M.x = - (fractpel) ((struct conicsegment *)ipath)->M.x * scale; - ((struct conicsegment *)ipath)->M.y = - (fractpel) ((struct conicsegment *)ipath)->M.y * scale; - } - if (ipath->type==MOVETYPE){ - ipath->dest.x = (fractpel) (ipath->dest.x * scale); - ipath->dest.y = (fractpel) (ipath->dest.y * scale); - } - if (ipath->type==BEZIERTYPE){ - ((struct beziersegment *)ipath)->B.x = - (fractpel) (((struct beziersegment *)ipath)->B.x * scale); - ((struct beziersegment *)ipath)->B.y = - (fractpel) (((struct beziersegment *)ipath)->B.y * scale); - ((struct beziersegment *)ipath)->C.x = - (fractpel) (((struct beziersegment *)ipath)->C.x * scale); - ((struct beziersegment *)ipath)->C.y = - (fractpel) (((struct beziersegment *)ipath)->C.y * scale); - ((struct beziersegment *)ipath)->dest.x = - (fractpel) (((struct beziersegment *)ipath)->dest.x * scale); - ((struct beziersegment *)ipath)->dest.y = - (fractpel) (((struct beziersegment *)ipath)->dest.y * scale); - } - if (ipath->type==HINTTYPE){ - ((struct hintsegment *)ipath)->dest.x = - (fractpel) (((struct hintsegment *)ipath)->dest.x * scale); - ((struct hintsegment *)ipath)->dest.y = - (fractpel) (((struct hintsegment *)ipath)->dest.y * scale); - ((struct hintsegment *)ipath)->ref.x = - (fractpel) (((struct hintsegment *)ipath)->ref.x * scale); - ((struct hintsegment *)ipath)->ref.y = - (fractpel) (((struct hintsegment *)ipath)->ref.y * scale); - ((struct hintsegment *)ipath)->width.x = - (fractpel) (((struct hintsegment *)ipath)->width.x * scale); - ((struct hintsegment *)ipath)->width.y = - (fractpel) (((struct hintsegment *)ipath)->width.y * scale); - } - if (ipath->type==TEXTTYPE) - ; - ipath=ipath->link; - - } while (ipath!=NULL); - - return( path); - -} - - -/* dump a description of path elements to stdout */ -void T1_DumpPath( T1_OUTLINE *path) -{ - - struct segment *ipath; - - /* Step through the path list */ - ipath=(struct segment *)path; - - do { - if (ipath->type==LINETYPE){ - printf("Line-Segment: -> (%f,%f)\n", - (ipath->dest.x)/(double)(0xFFFF), - -(ipath->dest.y)/(double)(0xFFFF)); - } - if (ipath->type==MOVETYPE){ - printf("Move-Segment: -> (%f,%f)\n", - (ipath->dest.x)/(double)(0xFFFF), - -(ipath->dest.y)/(double)(0xFFFF)); - } - if (ipath->type==BEZIERTYPE){ - printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n", - (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF), - (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF), - (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF)); - } - ipath=ipath->link; - } while (ipath!=NULL); - -} - - -/* convert a relative path to an absolute path */ -void T1_AbsolutePath( T1_OUTLINE *rpath) -{ - - struct segment *ipath; - fractpel xcurr=0, ycurr=0; - - /* Step through the path list */ - ipath=(struct segment *)rpath; - - do { - if (ipath->type==LINETYPE){ - ipath->dest.x +=xcurr; - ipath->dest.y +=ycurr; -#ifdef PRINT_PATHS_TO_STDOUT - printf("Line-Segment: -> (%f,%f)\n", - (ipath->dest.x)/(double)(0xFFFF), - -(ipath->dest.y)/(double)(0xFFFF)); -#endif - xcurr=ipath->dest.x; - ycurr=ipath->dest.y; - } - if (ipath->type==MOVETYPE){ - ipath->dest.x +=xcurr; - ipath->dest.y +=ycurr; -#ifdef PRINT_PATHS_TO_STDOUT - printf("Move-Segment: -> (%f,%f)\n", - (ipath->dest.x)/(double)(0xFFFF), - -(ipath->dest.y)/(double)(0xFFFF)); -#endif - xcurr=ipath->dest.x; - ycurr=ipath->dest.y; - } - if (ipath->type==BEZIERTYPE){ - ((struct beziersegment *)ipath)->B.x +=xcurr; - ((struct beziersegment *)ipath)->B.y +=ycurr; - ((struct beziersegment *)ipath)->C.x +=xcurr; - ((struct beziersegment *)ipath)->C.y +=ycurr; - ipath->dest.x +=xcurr; - ipath->dest.y +=ycurr; -#ifdef PRINT_PATHS_TO_STDOUT - printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n", - (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF), - (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF), - (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF)); -#endif - xcurr=ipath->dest.x; - ycurr=ipath->dest.y; - } - ipath=ipath->link; - } while (ipath!=NULL); - -} - - - -/* convert path into a relative path as needed by the rasterizer */ -void T1_RelativePath( T1_OUTLINE *apath) -{ - - struct segment *ipath; - fractpel xcurr=0, ycurr=0; - - - /* Step through the path list */ - ipath=(struct segment *)apath; - - do { - if (ipath->type==LINETYPE){ - ipath->dest.x -=xcurr; - ipath->dest.y -=ycurr; - xcurr +=ipath->dest.x; - ycurr +=ipath->dest.y; -#ifdef PRINT_PATHS_TO_STDOUT - printf("Line-Segment: -> (%f,%f), curr=(%f,%f)\n", - (ipath->dest.x)/(double)(0xFFFF), - -(ipath->dest.y)/(double)(0xFFFF), - xcurr/(double)(0xFFFF), -ycurr/(double)(0xFFFF)); -#endif - } - if (ipath->type==MOVETYPE){ - ipath->dest.x -=xcurr; - ipath->dest.y -=ycurr; - xcurr +=ipath->dest.x; - ycurr +=ipath->dest.y; -#ifdef PRINT_PATHS_TO_STDOUT - printf("Move-Segment: -> (%f,%f), curr=(%f,%f)\n", - (ipath->dest.x)/(double)(0xFFFF), - -(ipath->dest.y)/(double)(0xFFFF), - xcurr/(double)(0xFFFF), -ycurr/(double)(0xFFFF)); -#endif - } - if (ipath->type==BEZIERTYPE){ - ipath->dest.x -=xcurr; - ipath->dest.y -=ycurr; - ((struct beziersegment *)ipath)->C.x -=xcurr; - ((struct beziersegment *)ipath)->C.y -=ycurr; - ((struct beziersegment *)ipath)->B.x -=xcurr; - ((struct beziersegment *)ipath)->B.y -=ycurr; - xcurr +=ipath->dest.x; - ycurr +=ipath->dest.y; -#ifdef PRINT_PATHS_TO_STDOUT - printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n", - (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF), - (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF), - (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF)); -#endif - } - ipath=ipath->link; - } while (ipath!=NULL); - -} - - -/* maniuplate the coordinata points of a path */ -void T1_ManipulatePath( T1_OUTLINE *path, - void (*manipulate)(fractpel *x,fractpel *y,int type)) -{ - - struct segment *ipath; - - - /* Step through the path list */ - ipath=(struct segment *)path; - - do { - if (ipath->type==LINETYPE){ - manipulate( &(ipath->dest.x), &ipath->dest.y, LINETYPE); -#ifdef PRINT_PATHS_TO_STDOUT - printf("Line-Segment: -> (%f,%f)\n", - (ipath->dest.x)/(double)(0xFFFF), - -(ipath->dest.y)/(double)(0xFFFF)); -#endif - } - if (ipath->type==MOVETYPE){ - manipulate( &(ipath->dest.x), &ipath->dest.y, MOVETYPE); -#ifdef PRINT_PATHS_TO_STDOUT - printf("Move-Segment: -> (%f,%f)\n", - (ipath->dest.x)/(double)(0xFFFF), - -(ipath->dest.y)/(double)(0xFFFF)); -#endif - } - if (ipath->type==BEZIERTYPE){ - manipulate( &((struct beziersegment *)ipath)->B.x, - &((struct beziersegment *)ipath)->B.y, - BEZIERTYPE); - manipulate( &((struct beziersegment *)ipath)->C.x, - &((struct beziersegment *)ipath)->C.y, - BEZIERTYPE); - manipulate( &((struct beziersegment *)ipath)->dest.x, - &((struct beziersegment *)ipath)->dest.y, - BEZIERTYPE); -#ifdef PRINT_PATHS_TO_STDOUT - printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n", - (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF), - (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF), - (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF), - -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF)); -#endif - } - ipath=ipath->link; - } while (ipath!=NULL); - -} - - - -/* T1_CopyOutline(): Copy an outline physically. - Returns a pointer to the path or NULL */ -T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path) -{ - - return( (T1_OUTLINE *) CopyPath( (struct segment *)path)); - -} - - - -/* T1_FreeOutline(): Free an outline. */ -void T1_FreeOutline( T1_OUTLINE *path) -{ - - KillPath( (struct segment *)path); - return; - -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1outline.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1outline.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1outline.h Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1outline.h Thu Jan 1 00:00:00 1970 @@ -1,88 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1outline.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-05-27 - ----- Description: This file is part of the t1-library. It contains - definitions and declarations for t1outline.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#ifdef T1OUTLINE_C - -T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode, float size, - T1_TMATRIX *transform); -T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, - long spaceoff, int modflag, float size, - T1_TMATRIX *transform); -T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1, T1_OUTLINE *path2); -T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale); -T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag, - float size, T1_TMATRIX *transform); -void T1_DumpPath( T1_OUTLINE *path); -void T1_AbsolutePath( T1_OUTLINE *rpath); -void T1_RelativePath( T1_OUTLINE *apath); -void T1_ManipulatePath( T1_OUTLINE *path, - void (*manipulate)(fractpel *x,fractpel *y,int type)); -T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path); -void T1_FreeOutline( T1_OUTLINE *path); - - -#else - -extern T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode, float size, - T1_TMATRIX *transform); -extern T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, - long spaceoff, int modflag, float size, - T1_TMATRIX *transform); -extern T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1, - T1_OUTLINE *path2); -extern T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale); -extern T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag, - float size, T1_TMATRIX *transform); -extern void T1_DumpPath( T1_OUTLINE *path); -extern void T1_AbsolutePath( T1_OUTLINE *rpath); -extern void T1_RelativePath( T1_OUTLINE *apath); -extern void T1_ManipulatePath( T1_OUTLINE *path, - void (*manipulate)(fractpel *x,fractpel *y,int type)); -extern T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path); -extern void T1_FreeOutline( T1_OUTLINE *path); - -#endif - - -extern struct region *fontfcnB(int FontID, int modflag, - struct XYspace *S, char **ev, - unsigned char index, int *mode, - psfont *Font_Ptr, - int do_raster); -extern struct region *fontfcnB_string( int FontID, int modflag, - struct XYspace *S, char **ev, - unsigned char *string, int no_chars, - int *mode, psfont *Font_Ptr, - int *kern_pairs, long spacewidth, - int do_raster); -extern struct region *fontfcnB_ByName( int FontID, int modflag, - struct XYspace *S, - char *charname, - int *mode, psfont *Font_Ptr, - int do_raster); - - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1set.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1set.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1set.c Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1set.c Thu Jan 1 00:00:00 1970 @@ -1,1904 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1set.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-05-27 - ----- Description: This file is part of the t1-library. It contains - functions for setting characters and strings of - characters. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1SET_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" - - -#include "t1types.h" -#include "t1extern.h" -#include "t1set.h" -#include "t1load.h" -#include "t1finfo.h" -#include "t1misc.h" -#include "t1base.h" - - -/* As a fall back */ -#ifndef T1_AA_TYPE16 -#define T1_AA_TYPE16 short -#endif -#ifndef T1_AA_TYPE32 -#define T1_AA_TYPE32 int -#endif - - -extern char *t1_get_abort_message( int number); -extern struct region *Interior(struct segment *path, int fillrule); -extern unsigned T1_AA_TYPE32 T1aa_bg; /* white value */ - - - -static int T1_bit=T1GLYPH_BIT; -static int T1_byte; -static int T1_pad; -static int T1_wordsize; - -static int c_shift=8; -static int s_shift=16; -static int l_shift=32; - - - -/* T1_SetChar(...): Generate the bitmap for a character */ -GLYPH *T1_SetChar( int FontID, char charcode, float size, - T1_TMATRIX *transform) -{ - int i; - int mode; - struct region *area; - struct XYspace *Current_S; - int cache_flag=1; - int rot_flag=0; - unsigned char ucharcode; - - - FONTSIZEDEPS *font_ptr; - FONTPRIVATE *fontarrayP; - - volatile int memsize=0; - LONG h,w; - LONG paddedW; - - /* We don't implement underlining for characters, but the rasterer - implements it. Thus, we use a modflag of constant 0 */ - int modflag=0; - - static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1}; - - - /* We return to this if something goes wrong deep in the rasterizer */ - if ((i=setjmp( stck_state))!=0) { - T1_errno=T1ERR_TYPE1_ABORT; - sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", - t1_get_abort_message( i)); - T1_PrintLog( "T1_SetChar()", err_warn_msg_buf, - T1LOG_ERROR); - return( NULL); - } - - ucharcode=(unsigned char)charcode; - - - /* Reset character glyph, if necessary */ - if (glyph.bits!=NULL){ - free(glyph.bits); - glyph.bits=NULL; - } - glyph.metrics.leftSideBearing=0; - glyph.metrics.rightSideBearing=0; - glyph.metrics.advanceX=0; - glyph.metrics.advanceY=0; - glyph.metrics.ascent=0; - glyph.metrics.descent=0; - glyph.pFontCacheInfo=NULL; - glyph.bpp=1; - - /* First, check for a correct ID */ - i=CheckForFontID(FontID); - if (i==-1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - /* if necessary load font into memory */ - if (i==0) - if (T1_LoadFont(FontID)) - return(NULL); - - /* Check for valid size */ - if (size<=0.0){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - /* Assign padding value */ - T1_pad=pFontBase->bitmap_pad; - if (pFontBase->endian) - T1_byte=1; - else - T1_byte=0; - T1_wordsize=T1_pad; - - fontarrayP=&(pFontBase->pFontArray[FontID]); - - /* Check if rotation is requested */ - if (transform!=NULL){ - /* there's rotation requested => do not cache the resulting bitmap */ - rot_flag=1; - cache_flag=0; - } - else { - rot_flag=0; - cache_flag=1; - } - /* font is now loaded into memory => - Check for size: */ - if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ - font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); - if (font_ptr==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - } - else {/* size is already existent in cache */ - /* If no rotation, try to get character from cache */ - if (rot_flag==0){ - /* we don't use the .bits entry to check because in newer releases - also white glyphs (bits=NULL) are allowed. Rather, we check - whether bpp > 0! */ - if (font_ptr->pFontCache[ucharcode].bpp > 0){ - /* Character is already in Chache -> create a copy of cache - and return a pointer to the result: */ - memcpy( &glyph, &(font_ptr->pFontCache[ucharcode]), sizeof(GLYPH)); - paddedW = PAD((glyph.metrics.rightSideBearing-glyph.metrics.leftSideBearing), - T1_pad); - if (font_ptr->pFontCache[ucharcode].bits!=NULL) { - memsize = (glyph.metrics.ascent-glyph.metrics.descent)*paddedW / 8; - glyph.bits = (char *)malloc(memsize*sizeof( char)); - if (glyph.bits == NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - memcpy( glyph.bits, font_ptr->pFontCache[ucharcode].bits, memsize); - } - return(&(glyph)); - } - } - } - /* Setup an appropriate charspace matrix. Note that the rasterizer - assumes vertical values with inverted sign! Transformation should - create a copy of the local charspace matrix which then still has - to be made permanent. */ - if (rot_flag){ - Current_S=(struct XYspace *) - Permanent(Scale(Transform (font_ptr->pCharSpaceLocal, - transform->cxx, - transform->cxy, - transform->cyx, - transform->cyy), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - else{ - Current_S=(struct XYspace *) - Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, - 1.0, 0.0, 0.0, -1.0), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - - /* fnt_ptr now points to the correct FontSizeDeps-struct => - lets now raster the character */ - mode=0; - area=fontfcnB( FontID, modflag, Current_S, - fontarrayP->pFontEnc, - ucharcode, &mode, - fontarrayP->pType1Data, - DO_RASTER); - KillSpace (Current_S); - - /* fill the glyph-structure */ - if (mode > 0) { - sprintf( err_warn_msg_buf, "fontfcnB() set mode=%d", mode); - T1_PrintLog( "T1_SetChar()", err_warn_msg_buf, T1LOG_WARNING); - T1_errno=mode; - return(NULL); - } - if (area == NULL){ - T1_PrintLog( "T1_SetChar()", "area=NULL returned by fontfcnB()", T1LOG_WARNING); - T1_errno=mode; - return(NULL); - } - h = area->ymax - area->ymin; - w = area->xmax - area->xmin; - - if (mode == FF_NOTDEF_SUBST) { - sprintf( err_warn_msg_buf, - "\".notdef\" substituted for character %d from font %d", - ucharcode, FontID); - T1_PrintLog( "T1_SetChar()", err_warn_msg_buf, T1LOG_WARNING); - mode=0; - } - - paddedW = PAD(w, T1_pad); - - if (h > 0 && w > 0) { - memsize = h * paddedW / 8 + 1; - /* This is for the users copy of the character, for security-reasons - the original pointer to the cache area is not used. The entry glyph.bits - is free'ed every time this function is called: */ - glyph.bits = (char *)malloc(memsize*sizeof( char)); - if (glyph.bits == NULL){ - T1_errno=T1ERR_ALLOC_MEM; - /* make sure to get rid of 'area' before leaving! */ - KillRegion (area); - return(NULL); - } - } - else { - h = w = 0; - area->xmin = area->xmax = 0; - area->ymin = area->ymax = 0; - } - - /* Assign metrics */ - glyph.metrics.leftSideBearing = area->xmin; - glyph.metrics.advanceX = NEARESTPEL(area->ending.x - area->origin.x); - glyph.metrics.advanceY = - NEARESTPEL(area->ending.y - area->origin.y); - glyph.metrics.rightSideBearing = area->xmax; - glyph.metrics.descent = - area->ymax; - glyph.metrics.ascent = - area->ymin; - - - if (h > 0 && w > 0) { - (void) memset(glyph.bits, 0, memsize); - fill(glyph.bits, h, paddedW, area, T1_byte, T1_bit, T1_wordsize ); - } - - /* make sure to get rid of 'area' before leaving! */ - KillRegion (area); - - /* Cache glyph if requested, also if it contains only white space */ - if (cache_flag){ - /* Copy glyph to cache but be careful not to modify the pixmap - entry */ - font_ptr->pFontCache[ucharcode].metrics.leftSideBearing=glyph.metrics.leftSideBearing; - font_ptr->pFontCache[ucharcode].metrics.rightSideBearing=glyph.metrics.rightSideBearing; - font_ptr->pFontCache[ucharcode].metrics.advanceX=glyph.metrics.advanceX; - font_ptr->pFontCache[ucharcode].metrics.advanceY=glyph.metrics.advanceY; - font_ptr->pFontCache[ucharcode].metrics.ascent=glyph.metrics.ascent; - font_ptr->pFontCache[ucharcode].metrics.descent=glyph.metrics.descent; - font_ptr->pFontCache[ucharcode].pFontCacheInfo=glyph.pFontCacheInfo; - font_ptr->pFontCache[ucharcode].bpp=glyph.bpp; - if (glyph.bits==NULL) { - font_ptr->pFontCache[ucharcode].bits=NULL; - } - else { - font_ptr->pFontCache[ucharcode].bits = (char *)malloc(memsize*sizeof( char)); - if (font_ptr->pFontCache[ucharcode].bits == NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - /* ... and copy bitmap to cache area: */ - memcpy( font_ptr->pFontCache[ucharcode].bits, glyph.bits, memsize); - } - - } - - - return(&glyph); -} - - - -/* T1_SetString(...): Generate the bitmap for a string of characters */ -GLYPH *T1_SetString( int FontID, char *string, volatile int len, - long spaceoff, int modflag, float size, - T1_TMATRIX *transform) -{ - volatile int i, j=0, k; - int mode; - /* initialize this to NULL just to be on the safe side */ - struct region *area = NULL; - struct XYspace *Current_S, *S; - int cache_flag=1; - volatile int rot_flag=0; - int *kern_pairs; /* use for accessing the kern pairs if kerning is - requested */ - int no_chars=0; /* The number of characters in the string */ - static int lastno_chars=0; - float factor; - long spacewidth; /* This is given to fontfcnb_string() */ - - - FONTSIZEDEPS *font_ptr; - FONTPRIVATE *fontarrayP; - - - volatile int memsize=0; - - long h,w; - long paddedW, char_paddedW; - int h_anchor, v_anchor; - static int *pixel_h_anchor_corr=NULL; - static int *flags=NULL; - int lsb_min, rsb_max; - long overallwidth=0; - long overallascent=0; - long overalldescent=0; - - int underline_startx, underline_starty, underline_endx, underline_endy; - int overline_startx, overline_starty, overline_endx, overline_endy; - int overstrike_startx, overstrike_starty, overstrike_endx, overstrike_endy; - int start, middle; - int afm_ind; - - char startmask, endmask; - static unsigned char *r2lstring; - static int r2l_len=0; - - static GLYPH string_glyph={NULL,{0,0,0,0,0,0},NULL,1}; - GLYPH *currchar; - - - - /* The following are for bitmap blitting */ - long BitShift; - long ByteOffset; - /* pad=8 */ - unsigned T1_AA_TYPE16 BitBuf_c; - unsigned char *p_c; - unsigned char *Target_c; - /* pad=16 */ - unsigned T1_AA_TYPE32 BitBuf_s; - unsigned T1_AA_TYPE16 *p_s; - unsigned T1_AA_TYPE16 *Target_s; -#ifdef T1_AA_TYPE64 - /* pad=32 */ - unsigned T1_AA_TYPE64 BitBuf_l; - unsigned T1_AA_TYPE32 *p_l; - unsigned T1_AA_TYPE32 *Target_l; -#endif - unsigned char *ustring; - - - /* We return to this if something goes wrong deep in the rasterizer */ - if ((i=setjmp( stck_state))!=0) { - T1_errno=T1ERR_TYPE1_ABORT; - sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", - t1_get_abort_message( i)); - T1_PrintLog( "T1_SetString()", err_warn_msg_buf, - T1LOG_ERROR); - return( NULL); - } - - /* force string elements into unsigned */ - ustring=(unsigned char*)string; - - - /* Check for valid string */ - if (string==NULL){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - /* Reorganize if required */ - if (modflag & T1_RIGHT_TO_LEFT){ - if (len) - i=len; - else - i=j=strlen( string); - if (i+1>r2l_len){ - if (r2lstring!=NULL) - free( r2lstring); - r2lstring=(unsigned char *)malloc( (i+1)*sizeof(char)); - r2l_len=i+1; - } - j--; - while ( i--) { - r2lstring[j-i]=ustring[i]; - } - ustring=r2lstring; - len=j+1; - } - - - /* Reset string glyph, if necessary */ - if (string_glyph.bits!=NULL){ - free(string_glyph.bits); - string_glyph.bits=NULL; - } - string_glyph.metrics.leftSideBearing=0; - string_glyph.metrics.rightSideBearing=0; - string_glyph.metrics.advanceX=0; - string_glyph.metrics.advanceY=0; - string_glyph.metrics.ascent=0; - string_glyph.metrics.descent=0; - string_glyph.pFontCacheInfo=NULL; - string_glyph.bpp=1; - - /* We don't want to cache the resulting bitmap: */ - cache_flag=0; - - /* First, check for a correct ID */ - i=CheckForFontID(FontID); - if (i==-1){ - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - /* if necessary load font into memory */ - if (i==0) - if (T1_LoadFont(FontID)) - return(NULL); - - /* If no AFM info is present, we return an error */ - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - T1_errno=T1ERR_NO_AFM_DATA; - return(NULL); - } - - /* Check for valid size */ - if (size<=0.0){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - /* Assign padding value */ - T1_pad=pFontBase->bitmap_pad; - if (pFontBase->endian) - T1_byte=1; - else - T1_byte=0; - T1_wordsize=T1_pad; - - fontarrayP=&(pFontBase->pFontArray[FontID]); - - /* Check if rotation is requested */ - if (transform!=NULL){ - /* there's rotation requested => do not cache the resulting bitmap */ - rot_flag=1; - cache_flag=0; - } - - /* font is now loaded into memory => - Check for size: */ - if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ - font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); - if (font_ptr==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - } - - /* Now comes string specific stuff: Get length of string and create an - array of integers where to store the bitmap positioning dimens: */ - if (len<0){ /* invalid length */ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - if (len==0) /* should be computed assuming "normal" 0-terminated string, - or R2L-part has already been computed! */ - no_chars=strlen(string); - else /* use value given on command line */ - no_chars=len; - - /* If necessary, allocate memory */ - if (no_chars>lastno_chars){ - if (pixel_h_anchor_corr!=NULL){ - free(pixel_h_anchor_corr); - } - if (flags!=NULL){ - free(flags); - } - pixel_h_anchor_corr=(int *)calloc(no_chars, sizeof(int)); - flags=(int *)calloc(no_chars, sizeof(int)); - lastno_chars=no_chars; - } - else{ - /* Reset flags and position array */ - for (i=0; ipCharSpaceLocal, - transform->cxx, - transform->cxy, - transform->cyx, - transform->cyy), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - else{ - Current_S=(struct XYspace *) - Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, - 1.0, 0.0, 0.0, -1.0), - DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); - } - - /* Compute the correct spacewidth value (in charspace units). The - value supplied by the user is interpreted as an offset in - char space units: - */ - spacewidth=T1_GetCharWidth(FontID,fontarrayP->space_position)+spaceoff; - - - /* The following if (rot_flag==0){ ... } contains the whole code - to execute when the string is oriented horizontal. Then, there's - the possibility of concatenating most probably existent bitmaps - from the Cache, which should be much faster than every time raster - all the characters. - */ - /* First, ensure that all needed characters are in the Cache; if not, - generate them */ - if ((rot_flag==0)){ - overallwidth=0; - for (i=0; ipFontCache[ustring[i]]); - if (currchar->bpp<1) { - flags[i]=0; - mode=0; - /* Don't try to generate space-character: */ - if (ustring[i]!=fontarrayP->space_position){ - /* Note: Never underline etc. cached chars --> modflag=0 */ - area=fontfcnB( FontID, 0, Current_S, - fontarrayP->pFontEnc, - ustring[i], &mode, - fontarrayP->pType1Data, - DO_RASTER); - - /* fill the glyph-structure */ - if (mode > 0) { - sprintf( err_warn_msg_buf, "fontfcnB() set mode=%d", mode); - T1_PrintLog( "T1_SetString()", err_warn_msg_buf, T1LOG_WARNING); - T1_errno=mode; - /* Make sure to free the region if it's non-NULL */ - if (area){ - KillRegion (area); - } - return(NULL); - } - if (area == NULL){ - T1_PrintLog( "T1_SetString()", "area=NULL returned by fontfcnB()", T1LOG_WARNING); - T1_errno=mode; - return(NULL); - } - - if (mode == FF_NOTDEF_SUBST) { - sprintf( err_warn_msg_buf, - "\".notdef\" substituted in string[%d] (=character %d) from font %d", - i, ustring[i], FontID); - T1_PrintLog( "T1_SetString()", err_warn_msg_buf, T1LOG_WARNING); - mode=0; - flags[i]=1; /* indicates that .notdef has been substituted */ - } - - h = area->ymax - area->ymin; - w = area->xmax - area->xmin; - - if (h > 0 && w > 0) { /* bitmap contains pixels */ - paddedW = PAD(w, T1_pad); - memsize = h * paddedW / 8 + 1; - currchar->bits = (char *)malloc(memsize*sizeof( char)); - if (currchar->bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - /* Make sure to free up the region if it's non-NULL */ - if (area){ - KillRegion (area); - } - return(NULL); - } - (void) memset(currchar->bits, 0, memsize); - fill(currchar->bits, h, paddedW, area, - T1_byte, T1_bit, T1_wordsize ); - } - /* area valid -> set metrics in cache for that character */ - currchar->metrics.leftSideBearing = area->xmin; - currchar->metrics.advanceX = NEARESTPEL(area->ending.x - area->origin.x); - currchar->metrics.advanceY = - NEARESTPEL(area->ending.y - area->origin.y); - currchar->metrics.rightSideBearing = area->xmax; - currchar->metrics.descent = - area->ymax; - currchar->metrics.ascent = - area->ymin; - currchar->bpp=1; - - /* By this point, it's clear that the 'area' struct exists, - and that we no longer need it, so free it up. */ - KillRegion (area); - } - } /* end of if ( ... ), needed characters are now in cache! */ - } /* end of for (ipFontArray[FontID].pEncMap[(int) ustring[i]]; - /* Advance to next character in high resolution */ - if (ustring[i]==fontarrayP->space_position) - h_anchor +=(int)spacewidth; - /* check for a substituted char or notdef and get missing escapement */ - else if (afm_ind==0) { - /* Setup apropriate charspace matrix */ - S=(struct XYspace *)IDENTITY; - /* Make this permanent so that scaling it in fontfcnB_ByName will - make a duplicate of it, and this duplicate can thus be safely - destroyed. Fixes the somewhat smaller memory leak */ - S=(struct XYspace *)Permanent - (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0], - pFontBase->pFontArray[FontID].FontTransform[1], - pFontBase->pFontArray[FontID].FontTransform[2], - pFontBase->pFontArray[FontID].FontTransform[3])); - /* Get metrics values */ - area=fontfcnB_ByName( FontID, 0, S, ".notdef", &mode, - pFontBase->pFontArray[FontID].pType1Data, DO_RASTER); - if (area==NULL || mode!=0){ - sprintf( err_warn_msg_buf, - "Could not get charspace representation of \".notdef\", Font %d, mode=%d!", - FontID, mode); - T1_PrintLog( "T1_SetString()", err_warn_msg_buf, - T1LOG_ERROR); - T1_errno=mode; - return( NULL); - } - /* value to add to hanchor */ - h_anchor +=NEARESTPEL(area->ending.x); - /* make sure to free S */ - if (S) { - KillSpace (S); - } - /* make sure to free area */ - if (area) { - KillRegion (area); - } - } - else{ - currchar=&(font_ptr->pFontCache[ustring[i]]); - pixel_h_anchor_corr[i]=((int)floor(h_anchor*factor+0.5)); - /* Store maximum rsb ...*/ - if ( pixel_h_anchor_corr[i]+currchar->metrics.rightSideBearing > rsb_max){ - rsb_max=pixel_h_anchor_corr[i]+currchar->metrics.rightSideBearing; - } - /* ... and minimum lsb */ - if ( pixel_h_anchor_corr[i]+currchar->metrics.leftSideBearing < lsb_min){ - lsb_min=pixel_h_anchor_corr[i]+currchar->metrics.leftSideBearing; - } - /* Advance by current chars width */ - /* h_anchor +=T1_GetCharWidth( FontID, ustring[i]); */ - if (afm_ind>0) { /* we have a standard character */ - h_anchor +=(fontarrayP->pAFMData->cmi[afm_ind-1].wx) * fontarrayP->extend; - } - else { /* afm_ind must be negative so that we have a composite char */ - h_anchor +=(fontarrayP->pAFMData->ccd[-(afm_ind+1)].wx) * fontarrayP->extend; - } - /* If kerning, insert kerning amount */ - if ((imetrics.ascent>overallascent) - overallascent=currchar->metrics.ascent; - if (currchar->metrics.descentmetrics.descent; - } - } - string_glyph.metrics.advanceX=(int)floor(h_anchor*factor+0.5); - - /* We have to check for underlining and such things. They may affect the - bounding box of the glyph */ - if (modflag & T1_UNDERLINE){ - T1_ComputeLineParameters( FontID, T1_UNDERLINE, - string_glyph.metrics.advanceX, - size, - &underline_startx, &underline_endx, - &underline_starty, &underline_endy); - /* Check whether rsb is affected ...*/ - if ( underline_endx > rsb_max){ - rsb_max=underline_endx; - } - /* ... and for lsb */ - if ( underline_startx < lsb_min){ - lsb_min=underline_startx; - } - - /* Vertical metrics may also be affected. */ - if (underline_starty > overallascent) - overallascent=underline_starty; - if (underline_endy < overalldescent) - overalldescent=underline_endy; - } - if (modflag & T1_OVERLINE){ - T1_ComputeLineParameters( FontID, T1_OVERLINE, - string_glyph.metrics.advanceX, - size, - &overline_startx, &overline_endx, - &overline_starty, &overline_endy); - /* Check whether rsb is affected ...*/ - if ( overline_endx > rsb_max){ - rsb_max=overline_endx; - } - /* ... and for lsb */ - if ( overline_startx < lsb_min){ - lsb_min=overline_startx; - } - - /* Vertical metrics may also be affected. */ - if (overline_starty > overallascent) - overallascent=overline_starty; - if (overline_endy < overalldescent) - overalldescent=overline_endy; - } - if (modflag & T1_OVERSTRIKE){ - T1_ComputeLineParameters( FontID, T1_OVERSTRIKE, - string_glyph.metrics.advanceX, - size, - &overstrike_startx, &overstrike_endx, - &overstrike_starty, &overstrike_endy); - /* Check whether rsb is affected ...*/ - if ( overstrike_endx > rsb_max){ - rsb_max=overstrike_endx; - } - /* ... and for lsb */ - if ( overstrike_startx < lsb_min){ - lsb_min=overstrike_startx; - } - - /* Vertical metrics may also be affected. */ - if (overstrike_starty > overallascent) - overallascent=overstrike_starty; - if (overstrike_endy < overalldescent) - overalldescent=overstrike_endy; - } - - - - /* Set the string-glyphs' metrics: */ - /* Bearings: */ - string_glyph.metrics.rightSideBearing=rsb_max; - string_glyph.metrics.leftSideBearing=lsb_min; - /* ascent and descent: */ - string_glyph.metrics.ascent=overallascent; - string_glyph.metrics.descent=overalldescent; - - - - /* Now, allocate memory for the resulting bitmap and set it to 0: */ - h=overallascent - overalldescent; - w=string_glyph.metrics.rightSideBearing-string_glyph.metrics.leftSideBearing; - - paddedW = PAD( w, T1_pad); - if ( h > 0 && w > 0){ - memsize = h * paddedW / 8; - /* We alloc some amount more in order to avoid alignment check in - bit-blitting loop */ - memsize += T1_pad/8; - string_glyph.bits = (char *)malloc( memsize); - if (string_glyph.bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - } - else { - /* We have only characters without pixels in the string -> - we allow this and only set the advance width in the glyph. - The bits pointer will be NULL. We reset rsb and lsb */ - string_glyph.metrics.rightSideBearing=0; - string_glyph.metrics.leftSideBearing=0; - string_glyph.metrics.ascent=0; - string_glyph.metrics.descent=0; - } - - if (string_glyph.bits != NULL) { - - memset(string_glyph.bits, 0, memsize); - - /* Now comes the loop for bitmap blitting: */ - for (i=0;ipFontCache[ustring[i]]); - - /* First, we have to correct the positioning values to refer to - the bitmap BBox */ - pixel_h_anchor_corr[i] -= lsb_min; - pixel_h_anchor_corr[i] += currchar->metrics.leftSideBearing; - - /* Compute vertical anchor for current char-bitmap: */ - v_anchor=overallascent - currchar->metrics.ascent; - char_paddedW=PAD( currchar->metrics.rightSideBearing - - currchar->metrics.leftSideBearing , T1_pad); - /* We have to check for Big Endian. In that case, we have to - act on byte-level */ - if (T1_byte){ - BitShift = pixel_h_anchor_corr[i] % 8; - ByteOffset = pixel_h_anchor_corr[i] / 8; - } - else { - BitShift = pixel_h_anchor_corr[i] % T1_pad; - ByteOffset = pixel_h_anchor_corr[i] / T1_pad; - if (T1_pad==32) - ByteOffset *=4; - else if (T1_pad==16) - ByteOffset *=2; - } -#ifdef T1_AA_TYPE64 - /* We compile this part only if long is 64 bits to be conform to ANSI C */ - if (T1_pad==32 && T1_byte==0){ - /* The following loop steps through the lines of the character bitmap: */ - for (j=0;jmetrics.ascent-currchar->metrics.descent;j++){ - Target_l= (unsigned T1_AA_TYPE32 *)(string_glyph.bits +((v_anchor+j)*paddedW/8) - +ByteOffset); - /* The following loop copies the scanline of a character bitmap: */ - if (currchar->bits != NULL) { - p_l = (unsigned T1_AA_TYPE32 *)(currchar->bits+(char_paddedW/8*j)); - if (BitShift == 0) { - for (k=char_paddedW >> 5; k; k--) - *Target_l++ |= *p_l++; - } else { - for (k=0; k < char_paddedW / 32 ; k++){ - BitBuf_l= ((T1_AA_TYPE64)(*p_l++)) << BitShift; - *Target_l++ |= BitBuf_l; - *Target_l |= BitBuf_l>>l_shift; - } /* End of for ( .. ) stepping through columns */ - } - } /* End of if(currchar->bits != NULL) */ - } /* End of for( .. ) steppin' through lines of char bitmap */ - }/* end if (T1_pad==32) */ - else -#endif - if (T1_pad==16 && T1_byte==0){ - /* The following loop steps through the lines of the character bitmap: */ - for (j=0;jmetrics.ascent-currchar->metrics.descent;j++){ - Target_s= (unsigned T1_AA_TYPE16 *)(string_glyph.bits +((v_anchor+j)*paddedW/8) - +ByteOffset); - /* The following loop copies the scanline of a character bitmap: */ - if (currchar->bits != NULL) { - p_s = (unsigned T1_AA_TYPE16 *)(currchar->bits+(char_paddedW/8*j)); - if (BitShift == 0) { - for (k=char_paddedW >> 4; k; k--) - *Target_s++ |= *p_s++; - } - else{ - for (k=char_paddedW >> 4; k; k--){ - BitBuf_s= ((T1_AA_TYPE32)(*p_s++))<>s_shift; - } /* End of for ( .. ) stepping through columns */ - } - } /* End of if(currchar->bits != NULL) */ - } /* End of for( .. ) steppin' through lines of char bitmap */ - }/* end if (T1_pad==16 */ - else{ /* T1_pad = 8 or Big Endian machine */ - /* The following loop steps through the lines of the character bitmap: */ - for (j=0;jmetrics.ascent-currchar->metrics.descent;j++){ - Target_c= (unsigned char *)(string_glyph.bits +((v_anchor+j)*paddedW/8) - +ByteOffset); - /* The following loop copies the scanline of a character bitmap: */ - if (currchar->bits != NULL) { - p_c = (unsigned char *)(currchar->bits+(char_paddedW/8*j)); - if (BitShift == 0){ - for (k=char_paddedW >> 3; k; k--) - *Target_c++ |= *p_c++; - } - else{ - for (k=char_paddedW >> 3; k; k--){ - BitBuf_c = ((T1_AA_TYPE16)(*p_c++)) << BitShift; - *Target_c++ |= BitBuf_c; - *Target_c |= BitBuf_c>>c_shift; - } /* End of for ( .. ) stepping through columns */ - } - } /* End of if(currchar->bits != NULL) */ - } /* End of for( .. ) steppin' through lines of char bitmap */ - } /* end if (T1_pad==8) and/or BigEndian */ - } - } /* if (string_glyph.bits != NULL) */ - - - /* We now put the underlining rule on the glyph */ - if (modflag & T1_UNDERLINE){ - start=-string_glyph.metrics.leftSideBearing; - for (i=string_glyph.metrics.ascent-underline_starty; - islant+0.5); - middle = ((start+string_glyph.metrics.advanceX) / 8) - (start / 8); - startmask = 0xFF << (start % 8); - endmask = (char) ~(0xFF << ((start+string_glyph.metrics.advanceX) % 8)); - Target_c= (unsigned char *)(string_glyph.bits +(i*paddedW/8) - + (start / 8)); - j=middle; - if (j == 0) - *Target_c++ |= startmask & endmask; - else { - *Target_c++ |= startmask; - while (--j > 0) - *Target_c++ = (unsigned char) 0xFF; - if ((endmask)) - *Target_c |= endmask; - } - } - } - /* Put an overstrike rule on the glyph */ - if (modflag & T1_OVERSTRIKE){ - start=-string_glyph.metrics.leftSideBearing; - for (i=string_glyph.metrics.ascent-overstrike_starty; - islant+0.5); - middle = ((start+string_glyph.metrics.advanceX) / 8) - (start / 8); - startmask = 0xFF << (start % 8); - endmask = (char) ~(0xFF << ((start+string_glyph.metrics.advanceX) % 8)); - Target_c= (unsigned char *)(string_glyph.bits +(i*paddedW/8) - + (start / 8)); - j=middle; - if (j == 0) - *Target_c++ |= startmask & endmask; - else { - *Target_c++ |= startmask; - while (--j > 0) - *Target_c++ = (unsigned char) 0xFF; - if ((endmask)) - *Target_c |= endmask; - } - } - } - /* Put an overline rule */ - if (modflag & T1_OVERLINE){ - start=-string_glyph.metrics.leftSideBearing; - for (i=string_glyph.metrics.ascent-overline_starty; - islant+0.5); - middle = ((start+string_glyph.metrics.advanceX) / 8) - (start / 8); - startmask = 0xFF << (start % 8); - endmask = (char) ~(0xFF << ((start+string_glyph.metrics.advanceX) % 8)); - Target_c= (unsigned char *)(string_glyph.bits +(i*paddedW/8) - + (start / 8)); - j=middle; - if (j == 0) - *Target_c++ |= startmask & endmask; - else { - *Target_c++ |= startmask; - while (--j > 0) - *Target_c++ = (unsigned char) 0xFF; - if ((endmask)) - *Target_c |= endmask; - } - } - } - - /* Check for writing direction and re-compute dimensions appropriately: */ - if (modflag & T1_RIGHT_TO_LEFT){ - string_glyph.metrics.advanceX *= -1; - string_glyph.metrics.leftSideBearing += string_glyph.metrics.advanceX; - string_glyph.metrics.rightSideBearing += string_glyph.metrics.advanceX; - } - - return(&string_glyph); - } /* end of "if (rot_flag==0.0)" */ - - - /* fnt_ptr now points to the correct FontSizeDeps-struct => - lets now raster the character */ - mode=0; - kern_pairs=(int *)calloc(no_chars, sizeof(int)); - if ((modflag & T1_KERNING)) - for (i=0; ipFontEnc, - ustring, no_chars, &mode, - fontarrayP->pType1Data, - kern_pairs, spacewidth, - DO_RASTER); - KillSpace (Current_S); - - /* In all cases, free memory for kerning pairs */ - free(kern_pairs); - - /* fill the string_glyph-structure */ - if (mode > 0) { - sprintf( err_warn_msg_buf, "fontfcnB() set mode=%d", mode); - T1_PrintLog( "T1_SetString()", err_warn_msg_buf, T1LOG_WARNING); - T1_errno=mode; - /* make sure to get rid of area if it's there */ - if (area){ - KillRegion (area); - } - return(NULL); - } - if (area == NULL){ - T1_PrintLog( "T1_SetString()", "area=NULL returned by fontfcnB()", T1LOG_WARNING); - T1_errno=mode; - return(NULL); - } - - if (mode == FF_NOTDEF_SUBST) { - sprintf( err_warn_msg_buf, - "\".notdef\" substituted somewhere in string from font %d", - FontID); - T1_PrintLog( "T1_SetString()", err_warn_msg_buf, T1LOG_WARNING); - mode=0; - } - - h = area->ymax - area->ymin; - w = area->xmax - area->xmin; - paddedW = PAD(w, T1_pad); - if (h > 0 && w > 0) { - memsize = h * paddedW / 8 + 1; - /* This is for the users copy of the character, for security-reasons - the original pointer to the cache area is not used. The entry string_glyph.bits - is free'ed every time this function is called: */ - string_glyph.bits = (char *)malloc(memsize*sizeof( char)); - if (string_glyph.bits == NULL) { - T1_errno=T1ERR_ALLOC_MEM; - /* make sure to get rid of area if it's there */ - if (area){ - KillRegion (area); - } - /* it's safe to free this, since this is a rotated glyph and - therefore it's a copy of the original one */ - return(NULL); - } - } - else { - h = w = 0; - area->xmin = area->xmax = 0; - area->ymin = area->ymax = 0; - } - - string_glyph.metrics.leftSideBearing=area->xmin; - string_glyph.metrics.advanceX=NEARESTPEL(area->ending.x - area->origin.x); - string_glyph.metrics.advanceY=-NEARESTPEL(area->ending.y - area->origin.y); - string_glyph.metrics.rightSideBearing=area->xmax; - string_glyph.metrics.descent=-area->ymax; - string_glyph.metrics.ascent=-area->ymin; - - if (h > 0 && w > 0) { - (void) memset(string_glyph.bits, 0, memsize); - fill(string_glyph.bits, h, paddedW, area, T1_byte, T1_bit, T1_wordsize ); - } - else { /* We have no black pixels */ - string_glyph.metrics.leftSideBearing=0; - string_glyph.metrics.advanceX=NEARESTPEL(area->ending.x - area->origin.x); - string_glyph.metrics.advanceY=-NEARESTPEL(area->ending.y - area->origin.y); - string_glyph.metrics.rightSideBearing=0; - string_glyph.metrics.descent=0; - string_glyph.metrics.ascent=0; - } - - - /* make sure to get rid of area if it's there */ - if (area){ - KillRegion (area); - } - /* Check for writing direction and re-compute dimensions appropriately: */ - if (modflag & T1_RIGHT_TO_LEFT){ - string_glyph.metrics.advanceX *= -1; - string_glyph.metrics.advanceY *= -1; - string_glyph.metrics.leftSideBearing += string_glyph.metrics.advanceX; - string_glyph.metrics.rightSideBearing += string_glyph.metrics.advanceX; - string_glyph.metrics.descent += string_glyph.metrics.advanceY; - string_glyph.metrics.ascent += string_glyph.metrics.advanceY; - } - return(&string_glyph); -} - - - -void fill(dest, h, w, area, byte, bit, wordsize) - register char *dest; /* destination bitmap */ - int h,w; /* dimensions of 'dest', w padded */ - register struct region *area; /* region to write to 'dest' */ - int byte,bit; /* flags; LSBFirst or MSBFirst */ - int wordsize; /* number of bits per word for LSB/MSB purposes */ -{ - register struct edgelist *edge; /* for looping through edges */ - register char *p; /* current scan line in 'dest' */ - register int y; /* for looping through scans */ - register int wbytes = w / 8; /* number of bytes in width */ - register pel *leftP,*rightP; /* pointers to X values, left and right */ - int xmin = area->xmin; /* upper left X */ - int ymin = area->ymin; /* upper left Y */ - - for (edge = area->anchor; VALIDEDGE(edge); edge = edge->link->link) { - - p = dest + (edge->ymin - ymin) * wbytes; - leftP = edge->xvalues; - rightP = edge->link->xvalues; - - for (y = edge->ymin; y < edge->ymax; y++) { - fillrun(p, *leftP++ - xmin , *rightP++ - xmin, bit); - p += wbytes; - } - } - /* - Now, as an afterthought, we'll go reorganize if odd byte order requires - it: - */ - /* We do not reorganize since t1lib internally always uses LSBFirst */ - /* - if ( 0 && wordsize != 8) { - register int i; - printf("Reorganizing data ..\n"); - - switch (wordsize) { - case 16: - { - register unsigned short data,*p; - p = (unsigned short *) dest; - for (i = h * w /16; --i >= 0;) { - data = *p; - *p++ = (data << 8) + (data >> 8); - } - break; - } - case 64: - case 32: - { - register ULONG data,*p; - p = (ULONG *) dest; - for (i = h * w / 32; --i >= 0;) { - data = *p; - *p++ = (data << 24) + (data >> 24) - + (0xFF00 & (data >> 8)) - + (0xFF0000 & (data << 8)); - } - if (wordsize == 64) { - p = (ULONG *) dest; - for (i = h * w / 64; --i >= 0;) { - data = *p++; - p[-1] = p[0]; - *p++ = data; - } - } - break; - } - default: - abort("xiFill: unknown format"); - } - } - */ -} - -#define ALLONES 0xFF - -void fillrun(register char *p, pel x0, pel x1, int bit) -{ - register int startmask,endmask; /* bits to set in first and last char*/ - register int middle; /* number of chars between start and end + 1 */ - - if (x1 <= x0) - return; - middle = x1/8 - x0/8; - p += x0/8; - x0 &= 7; x1 &= 7; - if (bit == LSBFirst) { - startmask = ALLONES << x0; - endmask = ~(ALLONES << x1); - } - else { - startmask = ALLONES >> x0; - endmask = ~(ALLONES >> x1); - } - if (middle == 0) - *p++ |= startmask & endmask; - else { - *p++ |= startmask; - while (--middle > 0){ - *p++ = (unsigned char)ALLONES; - } - if (endmask) - *p |= endmask; - } -} - - -/* outline */ -#undef CHECK_OUTLINEFILL -#ifdef CHECK_OUTLINEFILL -void fill(dest, h, w, area, byte, bit, wordsize) - register char *dest; /* destination bitmap */ - int h,w; /* dimensions of 'dest', w padded */ - register struct region *area; /* region to write to 'dest' */ - int byte,bit; /* flags; LSBFirst or MSBFirst */ - int wordsize; /* number of bits per word for LSB/MSB purposes */ -{ - register struct edgelist *edge; /* for looping through edges */ - register char *p; /* current scan line in 'dest' */ - register int y; /* for looping through scans */ - register int wbytes = w / 8; /* number of bytes in width */ - register pel *leftP,*rightP; /* pointers to X values, left and right */ - int xmin = area->xmin; /* upper left X */ - int ymin = area->ymin; /* upper left Y */ - - for (edge = area->anchor; VALIDEDGE(edge); edge = edge->link->link) { - - p = dest + (edge->ymin - ymin) * wbytes; - leftP = edge->xvalues; - rightP = edge->link->xvalues; - - printf("leftP=%d, RightP=%d,\n", *leftP, *rightP); - - - for (y = edge->ymin; y < edge->ymax; y++) { - printf("leftP=%d, RightP=%d,y=%d\n", *leftP, *rightP, y); - - fillrun(p, *leftP++ - xmin, *rightP++ - xmin, bit); - p += wbytes; - } - } -} -#endif - - -/* T1_CopyGlyph(): Make a copy of an existent glyph-structure to save it - for later usage by the user. */ -GLYPH *T1_CopyGlyph( GLYPH *glyph) -{ - GLYPH *dest; - long size; - - - if (glyph==NULL){ - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - /* Assign padding value */ - T1_pad=pFontBase->bitmap_pad; - /* Allocate memory for struct: */ - if ((dest=(GLYPH *)malloc(sizeof(GLYPH)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - /* Copy the structure members: */ - *dest=*glyph; - /* Allocate memory for bitmap, initialize pointer to it and copy bitmap: */ - size=PAD((dest->metrics.rightSideBearing-dest->metrics.leftSideBearing)* - glyph->bpp, T1_pad) / 8; - size=size*(dest->metrics.ascent-dest->metrics.descent); - /* We must check whether there's actually a bits-pointer different from - NULL. If not omit the following step: */ - if (glyph->bits!=NULL){ - if ((dest->bits=(char *)malloc(size*sizeof(char)))==NULL){ - free(dest); - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - memcpy(dest->bits,glyph->bits,size); - } - return(dest); -} - -/* T1_DumpGlyph(): Dump a glyph-representation to stdout: */ -void T1_DumpGlyph( GLYPH *glyph) -{ - int i,j,h,w; /* i=line-index, j=column-index */ - long paddedW; - - - printf("Dataformat: T1_bit=%d, T1_byte=%d, T1_wordsize=%d, T1_pad=%d\n", - T1_bit, T1_byte, T1_pad, T1_pad); - - if (glyph==NULL){ - return; - } - - h=glyph->metrics.ascent-glyph->metrics.descent; - w=glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing; - - paddedW=PAD(w,T1_pad); - - printf("GlyphInfo: h=%d, w=%d, paddedW=%ld\n", h, w, paddedW); - - for ( i=0; ibits[i*paddedW/T1_pad+j], 1); - else if (T1_pad==16) - for (j=0; jbits)[i*paddedW/T1_pad+j], 1); - } - else - for (j=0; jbits)[i*paddedW/T1_pad+j], 1); - } - printf("\n"); - } -} - - - -/* This function will essentially return the bounding box of the - line-rule */ -void T1_ComputeLineParameters( int FontID, int mode, - int width, float size, - int *startx, int *endx, - int *starty, int *endy) -{ - float position=0.0, thickness=0.0; - int startx1, startx2, endx1, endx2; - - if (mode & T1_UNDERLINE){ - position=pFontBase->pFontArray[FontID].UndrLnPos - * DeviceSpecifics.scale_y; - thickness=pFontBase->pFontArray[FontID].UndrLnThick - * DeviceSpecifics.scale_y; - } - else if (mode & T1_OVERLINE){ - position=pFontBase->pFontArray[FontID].OvrLnPos - * DeviceSpecifics.scale_y; - thickness=pFontBase->pFontArray[FontID].OvrLnThick - * DeviceSpecifics.scale_y; - } - else if (mode & T1_OVERSTRIKE){ - position=pFontBase->pFontArray[FontID].OvrStrkPos - * DeviceSpecifics.scale_y; - thickness=pFontBase->pFontArray[FontID].OvrStrkThick - * DeviceSpecifics.scale_y; - } - - *starty=(int) floor((position+0.5*(thickness-DeviceSpecifics.y_resolution/1000.0)) - *size/1000.0 +0.5 ); - startx1=(int) floor(*starty*pFontBase->pFontArray[FontID].slant+0.5); - *endy =*starty - (int) floor(thickness/1000.0*size+0.5); - startx2=(int) floor(*endy*pFontBase->pFontArray[FontID].slant+0.5); - *startx=startx1 < startx2 ? startx1 : startx2; - endx1 = width + - (int) floor(*starty*pFontBase->pFontArray[FontID].slant+0.5); - endx2 = width + - (int) floor(*endy*pFontBase->pFontArray[FontID].slant+0.5); - *endx=endx1 < endx2 ? endx2 : endx1; - - /* We take care that at least one pixel is drawn */ - if (*starty==*endy) - *endy -=1; - - return; - -} - - - -/* The following function concatenates two glyphs. Optional offsets - x_off, y_off are respected. By the function. - If either glyph is NULL or the glyphs have distinct depth, NULL is - returned. */ -GLYPH *T1_ConcatGlyphs( GLYPH *glyph_1, GLYPH *glyph_2, - int x_off, int y_off, int modflag) -{ - - int lsb1, lsb2, rsb1, rsb2; - int advanceX1, advanceX2, advanceY1, advanceY2; - int ascent1, ascent2, descent1, descent2; - int rsb, lsb, ascent, descent, advanceX, advanceY; - int vanchor, w, h, wscanline, wscanline1, wscanline2, bpp; - int memsize, BitShift; - GLYPH *glyph1, *glyph2; - unsigned T1_AA_TYPE16 BitBuf_c; - unsigned T1_AA_TYPE32 BitBuf_s; - unsigned long BitBuf_l; /* This is only actually used if sizeof long = 8 */ - int i, j, k; - int ByteOffset; - - unsigned char *Target_c, *p_c; - unsigned T1_AA_TYPE16 *Target_s, *p_s; - unsigned T1_AA_TYPE32 *Target_l, *p_l; - - static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1}; - - - /* We handle the Right-To-Left concatenation the simple way: - 1) Change the order of the two glyphs - 2) Invert the sign of the y-part of the offset - 3) Recalculate the dimensions of the resulating glyph. - */ - /* Check for writing direction and reorganize appropriately: */ - if (modflag & T1_RIGHT_TO_LEFT){ - glyph1=glyph_2; - glyph2=glyph_1; - y_off=-y_off; - } - else { - glyph1=glyph_1; - glyph2=glyph_2; - } - - if (glyph1==NULL){ - T1_errno=T1ERR_INVALID_PARAMETER; - return( NULL); - } - if (glyph2==NULL){ - T1_errno=T1ERR_INVALID_PARAMETER; - return( NULL); - } - if (glyph1->bpp != glyph2->bpp){ - T1_errno=T1ERR_INVALID_PARAMETER; - return( NULL); - } - - /* We have two glyph different from NULL */ - /* Reset glyph, if necessary */ - if (glyph.bits!=NULL){ - free(glyph.bits); - glyph.bits=NULL; - } - glyph.metrics.leftSideBearing=0; - glyph.metrics.rightSideBearing=0; - glyph.metrics.advanceX=0; - glyph.metrics.advanceY=0; - glyph.metrics.ascent=0; - glyph.metrics.descent=0; - glyph.pFontCacheInfo=NULL; - glyph.bpp=1; - - /* Assign dimens */ - lsb1=glyph1->metrics.leftSideBearing; - rsb1=glyph1->metrics.rightSideBearing; - ascent1=glyph1->metrics.ascent; - descent1=glyph1->metrics.descent; - advanceX1=glyph1->metrics.advanceX + x_off; - advanceY1=glyph1->metrics.advanceY + y_off; - - lsb2=glyph2->metrics.leftSideBearing; - rsb2=glyph2->metrics.rightSideBearing; - ascent2=glyph2->metrics.ascent; - descent2=glyph2->metrics.descent; - advanceX2=glyph2->metrics.advanceX; - advanceY2=glyph2->metrics.advanceY; - - lsb=lsb1 < lsb2+advanceX1 ? lsb1 : lsb2+advanceX1; - rsb=rsb1 > rsb2+advanceX1 ? rsb1 : rsb2+advanceX1; - ascent=ascent1 > ascent2+advanceY1 ? ascent1 : ascent2+advanceY1; - descent=descent1 < descent2+advanceY1 ? descent1 : descent2+advanceY1; - advanceX=advanceX1+advanceX2; - advanceY=advanceY1+advanceY2; - - bpp=glyph1->bpp; - w=rsb-lsb; - h=ascent-descent; - wscanline=PAD( w*bpp, T1_pad) / 8; - wscanline1=PAD( (rsb1-lsb1)*bpp, T1_pad) / 8; - wscanline2=PAD( (rsb2-lsb2)*bpp, T1_pad) / 8; - memsize=wscanline*h; - if ((glyph.bits=(char *)calloc( memsize + 1, sizeof(unsigned char)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - - if (bpp==1){ - if (T1_pad==32 && T1_byte==0 && sizeof(long)==8){ - /* The following loop steps through the lines of the first glyph: */ - vanchor=ascent-ascent1; - BitShift=(lsb1-lsb) % 32; - ByteOffset=(lsb1-lsb)/32*4; - for ( i=0; ibits+(wscanline1*i)); - if (BitShift == 0){ - for (k=wscanline1/4; k; k--) - *Target_l++ |= *p_l++; - } - else{ - for (k=wscanline1/4; k; k--){ - BitBuf_l = ((long)*p_l++) << BitShift; - *Target_l++ |= BitBuf_l; - *Target_l |= BitBuf_l>>l_shift; - } - } - } - /* The following loop steps through the lines of the second glyph: */ - vanchor=ascent-(ascent2+advanceY1); - BitShift=(lsb2+advanceX1-lsb) % 32; - ByteOffset=(lsb2+advanceX1-lsb)/32*4; - for ( i=0; ibits+(wscanline2*i)); - if (BitShift == 0){ - for (k=wscanline2/4; k; k--) - *Target_l++ |= *p_l++; - } - else{ - for (k=wscanline2/4; k; k--){ - BitBuf_l = ((long)*p_l++) << BitShift; - *Target_l++ |= BitBuf_l; - *Target_l |= BitBuf_l>>l_shift; - } - } - } - } - else if(T1_pad==16 && T1_byte==0){ - /* The following loop steps through the lines of the first glyph: */ - vanchor=ascent-ascent1; - BitShift=(lsb1-lsb) % 16; - ByteOffset=(lsb1-lsb)/16*2; - for ( i=0; ibits+(wscanline1*i)); - if (BitShift == 0){ - for (k=wscanline1/2; k; k--) - *Target_s++ |= *p_s++; - } - else{ - for (k=wscanline1/2; k; k--){ - BitBuf_s = ((T1_AA_TYPE32)*p_s++) << BitShift; - *Target_s++ |= BitBuf_s; - *Target_s |= BitBuf_s>>s_shift; - } - } - } - /* The following loop steps through the lines of the second glyph: */ - vanchor=ascent-(ascent2+advanceY1); - BitShift=(lsb2+advanceX1-lsb) % 16; - ByteOffset=(lsb2+advanceX1-lsb)/16*2; - for ( i=0; ibits+(wscanline2*i)); - if (BitShift == 0){ - for (k=wscanline2/2; k; k--) - *Target_s++ |= *p_s++; - } - else{ - for (k=wscanline2/2; k; k--){ - BitBuf_s = ((T1_AA_TYPE32)*p_s++) << BitShift; - *Target_s++ |= BitBuf_s; - *Target_s |= BitBuf_s>>s_shift; - } - } - } - } - else{ /* T1_pad==8 or Big Endian machine */ - /* The following loop steps through the lines of the first glyph: */ - vanchor=ascent-ascent1; - BitShift=(lsb1-lsb) % 8; - ByteOffset=(lsb1-lsb) / 8; - for ( i=0; ibits+(wscanline1*i)); - if (BitShift == 0){ - for (k=wscanline1; k; k--) - *Target_c++ |= *p_c++; - } - else{ - for (k=wscanline1; k; k--){ - BitBuf_c = ((T1_AA_TYPE16)*p_c++) << BitShift; - *Target_c++ |= BitBuf_c; - *Target_c |= BitBuf_c>>c_shift; - } - } - } - /* The following loop steps through the lines of the second glyph: */ - vanchor=ascent-(ascent2+advanceY1); - BitShift=(lsb2+advanceX1-lsb) % 8; - ByteOffset=(lsb2+advanceX1-lsb) / 8; - for ( i=0; ibits+(wscanline2*i)); - if (BitShift == 0){ - for (k=wscanline2; k; k--) - *Target_c++ |= *p_c++; - } - else{ - for (k=wscanline2; k; k--){ - BitBuf_c = ((T1_AA_TYPE16)*p_c++) << BitShift; - *Target_c++ |= BitBuf_c; - *Target_c |= BitBuf_c>>c_shift; - } - } - } - } - } /* end of if (bpp==1) ... */ - else if (bpp==8){ - /* Set background */ - for ( i=0; ibits+(wscanline1*i)); - memcpy( Target_c, p_c, (rsb1-lsb1)); - } - /* The following loop steps through the lines of the second glyph. - Note that we only set the pixel if it is not background! */ - vanchor=ascent-(ascent2+advanceY1); - for ( i=0; ibits+(wscanline2*i)); - for (j=0; j<(rsb2-lsb2); j++) - if (p_c[j] != (unsigned char) T1aa_bg) - Target_c[j]=p_c[j]; - } - } /* end of if (bpp==8) ... */ - else if (bpp==16){ - /* Set background */ - for ( i=0; ibits+(wscanline1*i)); - memcpy( Target_s, p_s, (rsb1-lsb1)*2); - } - /* The following loop steps through the lines of the second glyph. - Note that we only set the pixel if it is not background! */ - vanchor=ascent-(ascent2+advanceY1); - for ( i=0; ibits+(wscanline2*i)); - for (j=0; j<(rsb2-lsb2); j++) - if (p_s[j] != (unsigned T1_AA_TYPE16) T1aa_bg) - Target_s[j]=p_s[j]; - } - } /* end of if (bpp==16) ... */ - else if (bpp==32){ - /* Set background */ - for ( i=0; ibits+(wscanline1*i)); - memcpy( Target_l, p_l, (rsb1-lsb1)*4); - } - /* The following loop steps through the lines of the second glyph. - Note that we only set the pixel if it is not background! */ - vanchor=ascent-(ascent2+advanceY1); - for ( i=0; ibits+(wscanline2*i)); - for (j=0; j<(rsb2-lsb2); j++) - if (p_l[j] != (unsigned T1_AA_TYPE32) T1aa_bg) - Target_l[j]=p_l[j]; - } - } /* end of if (bpp==32) ... */ - - - /* Check for writing direction and re-compute dimens appropriately: */ - if (modflag & T1_RIGHT_TO_LEFT){ - advanceX=-advanceX1-advanceX2; - advanceY=-advanceY1-advanceY2; - lsb=lsb1 < lsb2+advanceX1 ? advanceX+lsb1 : advanceX+lsb2+advanceX1; - rsb=rsb1 > rsb2+advanceX1 ? advanceX+rsb1 : advanceX+rsb2+advanceX1; - ascent=ascent1 > ascent2+advanceY1 ? ascent1 : ascent2+advanceY1; - descent=descent1 < descent2+advanceY1 ? descent1 : descent2+advanceY1; - ascent += advanceY; - descent += advanceY; - } - - glyph.metrics.leftSideBearing=lsb; - glyph.metrics.rightSideBearing=rsb; - glyph.metrics.advanceX=advanceX; - glyph.metrics.advanceY=advanceY; - glyph.metrics.ascent=ascent; - glyph.metrics.descent=descent; - glyph.bpp=bpp; - - /* - printf("lsb=%d, rsb=%d, adX=%d, adY=%d asc=%d, desc=%d\n", - glyph.metrics.leftSideBearing, - glyph.metrics.rightSideBearing, - glyph.metrics.advanceX, - glyph.metrics.advanceY, - glyph.metrics.ascent, - glyph.metrics.descent ); - */ - - return( &glyph); - -} - - - -/* T1_FillOutline(): Create a filled glyph from an outline description */ -GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag) -{ - struct region *area=NULL; - - static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1}; - volatile int memsize=0; - int i; - LONG h,w; - LONG paddedW; - - - /* We return to this if something goes wrong deep in the rasterizer */ - if ((i=setjmp( stck_state))!=0) { - T1_errno=T1ERR_TYPE1_ABORT; - sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", - t1_get_abort_message( i)); - T1_PrintLog( "T1_FillOutline()", err_warn_msg_buf, - T1LOG_ERROR); - return( NULL); - } - - /* Reset character glyph, if necessary */ - if (glyph.bits!=NULL){ - free(glyph.bits); - glyph.bits=NULL; - } - glyph.metrics.leftSideBearing=0; - glyph.metrics.rightSideBearing=0; - glyph.metrics.advanceX=0; - glyph.metrics.advanceY=0; - glyph.metrics.ascent=0; - glyph.metrics.descent=0; - glyph.pFontCacheInfo=NULL; - glyph.bpp=1; - - - /* Assign padding value */ - T1_pad=pFontBase->bitmap_pad; - if (pFontBase->endian) - T1_byte=1; - else - T1_byte=0; - T1_wordsize=T1_pad; - - /* Create a region from outline */ - area=(struct region *)Interior( (struct segment *)path, - WINDINGRULE+CONTINUITY); - - /* fill the glyph-structure */ - if (area == NULL){ - T1_PrintLog( "T1_FillOutline()", "area=NULL returned by Interior()", T1LOG_WARNING); - T1_errno=1000; - return(NULL); - } - h = area->ymax - area->ymin; - w = area->xmax - area->xmin; - - - paddedW = PAD(w, T1_pad); - if ( (area->xmin > area->xmax) || (area->ymin > area->ymax) ){ - /* There was a character like .notdef or space, that didn't - produce any black pixels on the bitmap! -> we return a glyph with - correct metrics and bitmap pointer set to NULL */ - sprintf( err_warn_msg_buf, - "No black pixels in outline %p", path); - T1_PrintLog( "T1_FillOutline()", err_warn_msg_buf, T1LOG_WARNING); - - glyph.metrics.leftSideBearing = 0; - glyph.metrics.advanceX = NEARESTPEL(area->ending.x - area->origin.x); - glyph.metrics.advanceY = - NEARESTPEL(area->ending.y - area->origin.y); - glyph.metrics.rightSideBearing = 0; - glyph.metrics.descent = 0; - glyph.metrics.ascent = 0; - /* make sure to get rid of 'area' before leaving! */ - KillRegion (area); - return( &glyph); - } - if (h > 0 && w > 0) { - memsize = h * paddedW / 8 + 1; - /* This is for the users copy of the character, for security-reasons - the original pointer to the cache area is not used. The entry glyph.bits - is free'ed every time this function is called: */ - glyph.bits = (char *)malloc(memsize*sizeof( char)); - if (glyph.bits == NULL){ - T1_errno=T1ERR_ALLOC_MEM; - /* make sure to get rid of area if it's there */ - if (area){ - KillRegion (area); - } - return(NULL); - } - - } - else { - h = w = 0; - area->xmin = area->xmax = 0; - area->ymin = area->ymax = 0; - } - - glyph.metrics.leftSideBearing = area->xmin; - glyph.metrics.advanceX = NEARESTPEL(area->ending.x - area->origin.x); - glyph.metrics.advanceY = - NEARESTPEL(area->ending.y - area->origin.y); - glyph.metrics.rightSideBearing = area->xmax; - glyph.metrics.descent = - area->ymax; - glyph.metrics.ascent = - area->ymin; - - - if (h > 0 && w > 0) { - (void) memset(glyph.bits, 0, memsize); - fill(glyph.bits, h, paddedW, area, T1_byte, T1_bit, T1_wordsize ); - } - - /* Check for writing direction and re-compute dimensions appropriately: */ - if (modflag & T1_RIGHT_TO_LEFT){ - glyph.metrics.advanceX *= -1; - glyph.metrics.advanceY *= -1; - glyph.metrics.leftSideBearing += glyph.metrics.advanceX; - glyph.metrics.rightSideBearing += glyph.metrics.advanceX; - glyph.metrics.descent += glyph.metrics.advanceY; - glyph.metrics.ascent += glyph.metrics.advanceY; - } - - /* make sure to get rid of area if it's there */ - if (area){ - KillRegion (area); - } - return( &glyph); - - -} diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1set.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1set.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1set.h Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1set.h Thu Jan 1 00:00:00 1970 @@ -1,87 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1set.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-05-27 - ----- Description: This file is part of the t1-library. It contains - definitions and declarations for t1set.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#ifdef T1SET_C - -GLYPH *T1_SetChar( int FontID, char charcode, - float size, T1_TMATRIX *transform); -GLYPH *T1_SetString( int FontID, char *string, volatile int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -void fill(char *dest, int h, int w, - struct region *area, int byte, int bit, - int wordsize); -void fillrun(char *p, pel x0, pel x1, int bit); -GLYPH *T1_CopyGlyph(GLYPH *glyph); -void T1_DumpGlyph( GLYPH *glyph); -void T1_ComputeLineParameters( int FontID, int width, - int mode, float size, - int *startx, int *endx, - int *starty, int *endy); -GLYPH *T1_ConcatGlyphs( GLYPH *glyph1, GLYPH *glyph2, - int x_off, int y_off, int modflag); -void T1_DumpGlyph( GLYPH *glyph); -GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag); - - -#else - -extern GLYPH *T1_SetChar( int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_SetString( int FontID, char *string, volatile int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern void fill(char *dest, int h, int w, - struct region *area, int byte, int bit, - int wordsize); -extern void fillrun(char *p, pel x0, pel x1, int bit); -extern GLYPH *T1_CopyGlyph(GLYPH *glyph); -extern void T1_DumpGlyph( GLYPH *glyph); -extern GLYPH *T1_ConcatGlyphs( GLYPH *glyph1, GLYPH *glyph2, - int x_off, int y_off, int modflag); -extern void T1_DumpGlyph( GLYPH *glyph); -extern GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag); - -#endif - - -extern struct region *fontfcnB(int FontID, int modflag, - struct XYspace *S, char **ev, - unsigned char index, int *mode, - psfont *Font_Ptr, - int do_raster); -extern struct region *fontfcnB_string( int FontID, int modflag, - struct XYspace *S, char **ev, - unsigned char *string, int no_chars, - int *mode, psfont *Font_Ptr, - int *kern_pairs, long spacewidth, - int do_raster); -extern struct region *fontfcnB_ByName( int FontID, int modflag, - struct XYspace *S, - char *charname, - int *mode, psfont *Font_Ptr, - int do_raster); diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1subset.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1subset.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1subset.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1subset.c Thu Jan 1 00:00:00 1970 @@ -1,835 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1subset.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-09-09 - ----- Description: This file is part of the t1-library. It contains - functions for subsetting type 1 fonts. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1SUBSET_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" - - -#include "t1types.h" -#include "t1extern.h" -#include "t1finfo.h" -#include "t1misc.h" -#include "t1base.h" -#include "t1subset.h" - -/* Segment header for pfb-files (reminder): - - Segment-header: - - Byte 1: always 128 (0x80) - - Byte 2: 1 = ASCII text - 2 = Binary text - 3 = End of file indicator (EOF) - - Byte 3: least significant byte \ - Byte 4: \ Length of - Byte 5: / data segment in bytes - Byte 6: most significant byte / - - */ -#define SEGMENT_ASCII 1 -#define SEGMENT_BINARY 2 -#define SEGMENT_EOF 3 - - - -static char *charstringP; -static int charstringL; - - -/* We define two lookup tables to make a fast conversion from - binary bytes to ASCII-hex bytes. */ -static unsigned char highHexByte[256]={ - 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, - 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, - 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, - 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, - 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, - 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, - 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, - 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, - 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, - 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, - 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, - 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46 -}; -static unsigned char lowHexByte[256]={ - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46 -}; - - -/* parameters for eexec encryption */ -static unsigned short int eexec_r; -static unsigned short int eexec_c1=52845; -static unsigned short int eexec_c2=22719; - -/* Eexec-encrption according to the Adobe Black Book */ -static unsigned char EexecEncrypt( unsigned char plain) -{ - - unsigned char cipher; - - cipher = (plain ^ (eexec_r>>8)); - eexec_r = (cipher + eexec_r) * eexec_c1 + eexec_c2; - return( cipher); -} - - - -static int locateCharString( int FontID, char *charname) -{ - - int namelen; - int dictlen; - int i; - psdict *CharStringsP; - - - namelen=strlen( charname); - - CharStringsP=pFontBase->pFontArray[FontID].pType1Data->CharStringsP; - - dictlen=CharStringsP[0].key.len; - for ( i=1; i<=dictlen; i++) { - if (namelen==CharStringsP[i].key.len) { - /* This could be the charstring in question */ - if (strncmp( charname, - CharStringsP[i].key.data.nameP, - namelen)==0) { - /* It is the the desired charstring */ - charstringP=CharStringsP[i].value.data.valueP; - charstringL=CharStringsP[i].value.len; - return( i); - } - } - } - /* charstring not found ??? */ - return( 0); - -} - - - -static int make_pfb_segment_header( char *ptr, int type, unsigned long size) -{ - ptr[0]=(char) 0x80; - ptr[1]=type; - if (type==3) - return( 2); - ptr[2]=(char)(size & 0xFF); - ptr[3]=(char)((size>>8) & 0xFF); - ptr[4]=(char)((size>>16) & 0xFF); - ptr[5]=(char)((size>>24) & 0xFF); - return( 6); -} - - - - -/* A function for reading a Type 1 font file. eexec-decryption - is done on the fly. */ -char *T1_SubsetFont( int FontID, - char *mask, - unsigned int flags, - int linewidth, - unsigned long maxblocksize, - unsigned long *bufsize) -{ - - FILE *ifp; - static char *filebuf=NULL; - unsigned long filesize=0; - int filesegs=0; - - char *outbuf=NULL; - unsigned long outsize=0; - char *encryptbuf=NULL; - unsigned long encryptsize=0; - int encryptsegs=0; - char *trailerbuf=NULL; - unsigned long trailersize=0; - int trailersegs=0; - char linebuf[1025]; - - char *csdone; /* stores which charstrings already have been written */ - int currstring_no=0; - char *charnameP; - unsigned char cipher; - char rdstring[3]; - char ndstring[3]; - - int retval=1; - - /* Indices. Could save a few but debugging becomes easier this way */ - int i=0; - int j=0; - int k=0; - int l=0; - int m=0; - int n=0; - int o=0; - - int notdefencoded=0; - int stdenc=0; - int reencode=0; - int colcount=0; - int tr_len=-1; - int encrypt=1; /* 1=ASCII-hex, 2=Binary, 0=None (for debugging) */ - int dindex=0; - int nocharstrings=0; - - - - /* Otherwise we would get invalid accesses later */ - if (CheckForFontID(FontID)!=1) { - T1_errno=T1ERR_INVALID_FONTID; - return(NULL); - } - - - /* Check parameters */ - if ( (mask==NULL) || (bufsize==NULL) || (linewidth < 8) || - (linewidth > 1024) || (maxblocksize < 4) ) { - T1_errno=T1ERR_INVALID_PARAMETER; - return(NULL); - } - - for ( j=0; j<256; j++) { - if (mask[j]!=0) { - nocharstrings++; - } - } - - - /* adjust encrypting type according to flags. Default is ASCII-hex - encryption because the output may be verbatim inserted into a - PostScript-file. */ - if (flags & T1_SUBSET_ENCRYPT_BINARY) - encrypt=2; - else if (flags & T1_SUBSET_ENCRYPT_NONE) - encrypt=0; - - /* Open and initialize scanning machinery */ - T1io_reset(); - if ((ifp = (FILE *)T1Open(T1_GetFontFilePath( FontID), "r"))==NULL) { - T1_errno=T1ERR_FILE_OPEN_ERR; - return(NULL); - } - - if (encrypt==0) - sprintf( err_warn_msg_buf, "Subsetting Font %d, flags=0x%X, non-encrypted debug output", - FontID, flags); - else if (encrypt==1) - sprintf( err_warn_msg_buf, "Subsetting Font %d, flags=0x%X, ASCII-hex output with linelength %d", - FontID, flags, linewidth); - else if (encrypt==2) - sprintf( err_warn_msg_buf, "Subsetting Font %d, flags=0x%X, Binary output with maximum blocksize %lu", - FontID, flags, maxblocksize); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_DEBUG); - - /* Get size of file */ - filesize=T1GetFileSize( ifp); - sprintf( err_warn_msg_buf, "Source file %s is %lu bytes long", - T1_GetFontFilePath( FontID), filesize); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_DEBUG); - if ((filebuf=(char *)calloc( filesize, sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - - while (retval>0) { - /* get a line from the file. We have to read enough characters to - ensure that "eexec" does not get split between two reads. - Otherwise, decryption would not be started. */ - retval=T1Gets(&(filebuf[i]), 1025, ifp); - i+=retval; - if ( (dindex==0) && (T1GetDecrypt()>0) ) { - dindex=i-retval; /* from this point on we have decrypted bytes */ - sprintf( err_warn_msg_buf, "Human-readable header finished (%d data bytes)", - dindex); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_DEBUG); - } - - /* Encoding handling */ - if (strstr( &(filebuf[i-retval]), "/Encoding")!=NULL) { - if (strstr( &(filebuf[i-retval]), "StandardEncoding")!=NULL) { - stdenc=1; - if ((flags & T1_SUBSET_FORCE_REENCODE)!=0) { - /* we ignore the current line ... */ - i-=retval; - /* and put the encoding header into the buffer */ - i+=sprintf( &(filebuf[i]), - "/Encoding 256 array\n0 1 255 {1 index exch /.notdef put} for\n" - ); - reencode=1; - } - else { - T1_PrintLog( "T1_SubsetFont()", "Leaving StandardEncoding untouched", - T1LOG_DEBUG); - reencode=0; - } - } - else { - /* The encoding is explicitly defined in the font file. We skip the - whole definition unless reencoding should be skipped. */ - stdenc=0; - retval=T1Gets(&(filebuf[i]), 1025, ifp); - i+=retval; - while (retval>0) { - /* get a line and check for end of encoding definition. */ - retval=T1Gets(&(filebuf[i]), 1025, ifp); - if ((flags & T1_SUBSET_SKIP_REENCODE)!=0) { /* we store the encoding - defined here */ - i+=retval; - reencode=0; - } - else { - reencode=1; - } - if ( (dindex==0) && (T1GetDecrypt()>0) ) { - dindex=i; /* from this point we have decrypted bytes */ - } - if (strstr( &(filebuf[i-retval]), "readonly def")!=NULL) { - break; - } - } - if (reencode==0) - T1_PrintLog( "T1_SubsetFont()", "Preserving FontSpecific Encoding", - T1LOG_DEBUG); - } - - /* At this point, if required, the actual encoding definition - follows */ - if ( reencode!=0) { - k=0; - for ( j=0; j<256; j++) { - if (mask[j]!=0) { - charnameP=T1_GetCharName( FontID, j); - i+=sprintf( &(filebuf[i]), "dup %d /%s put\n", j, - charnameP); - k++; - if (strcmp(charnameP, ".notdef")==0) - notdefencoded=1; - } - } - /* finish encoding definition */ - i+=sprintf( &(filebuf[i]), "readonly def\n"); - sprintf( err_warn_msg_buf, "Encoded %d characters", - k); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_DEBUG); - k=0; - } - - } /* end of if (...encoding handling...) */ - - /* Extract the names are used for the charstring definitions. - We will later need them! */ - if (strstr( &(filebuf[i-retval]), "/RD")!=NULL) { - sprintf( rdstring, "RD"); - } - if (strstr( &(filebuf[i-retval]), "/ND")!=NULL) { - sprintf( ndstring, "ND"); - } - if (strstr( &(filebuf[i-retval]), "/-|")!=NULL) { - sprintf( rdstring, "-|"); - } - if (strstr( &(filebuf[i-retval]), "/|-")!=NULL) { - sprintf( ndstring, "|-"); - } - - if (strstr( &(filebuf[i-retval]), "/CharStrings")!=NULL) { - /* replace dictionary with one of an appropriate size: */ - i -=retval; - sprintf( err_warn_msg_buf, "Private dictionary finished (%u data bytes)", - i-dindex); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_DEBUG); - /* if .notdef is not in the encoding mask, we have to reserve - room for the additional charstring .notdef. Note that still - nocharstrings is an upper bound estimation, which is reached - in cases where no characters are encoded more than one time. */ - if (notdefencoded==0) - nocharstrings++; - - i+=sprintf( &(filebuf[i]), "2 index /CharStrings %d dict dup begin\n", - nocharstrings); - break; - } - } /* the portion until Charstrings-dict is now read in */ - - - /* We now have to write the CharStrings. - Each charstring must be written once, even if the respective - character appears more than once in the encoding. So we set up - table to remember which charstrings already have been written. - - Note: The indices returned by locateCharString() range from 1 to n, so that - we have to decrement the index when filling the csdone array! - */ - if (( csdone=(char *)calloc( pFontBase->pFontArray[FontID].pType1Data->CharStringsP[0].key.len, - sizeof(char)))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - free( filebuf); - T1Close( ifp); - return( NULL); - } - - /* The .notdef character is in force! */ - if ((currstring_no=locateCharString( FontID, ".notdef"))==0) { - T1_errno=T1ERR_UNSPECIFIED; - free( csdone); - T1Close( ifp); - return( NULL); - } - i+=sprintf( &(filebuf[i]), "/.notdef %d %s ", charstringL, rdstring); - memcpy(&(filebuf[i]), charstringP, charstringL); - i+=charstringL; - i+=sprintf( &(filebuf[i]), " %s\n", ndstring); - csdone[currstring_no-1]=1; - /* Now, step through the specifier matrix and write only the - necessary charstrings. */ - for ( j=0; j<256; j++) { - if (mask[j]!=0) { - charnameP=T1_GetCharName( FontID, j); - if ((currstring_no=locateCharString( FontID, charnameP))==0) { - /* This is mysterious, but causes no harm because .notdef - will be substituted */ - sprintf( err_warn_msg_buf, "Could not locate CS ""%s"" for index %d", - charnameP, j); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_WARNING); - continue; - } - /* Process charstring only if it has not already been done */ - if (csdone[currstring_no-1]==0) { - k=i; - i+=sprintf( &(filebuf[i]), "/%s %d %s ", charnameP, charstringL, rdstring); - memcpy(&(filebuf[i]), charstringP, charstringL); - i+=charstringL; - i+=sprintf( &(filebuf[i]), " %s\n", ndstring); - csdone[currstring_no-1]=1; - sprintf( err_warn_msg_buf, - "Processing of CS ""%s"" for index %d successful (len=%d bytes, line=%d bytes)", - charnameP, j, charstringL, i-k); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_DEBUG); - } - else { - sprintf( err_warn_msg_buf, "Skipped multiple processing of CS ""%s"" (index %d)", - charnameP, j); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_DEBUG); - } - } - } - if (csdone!=NULL) - free( csdone); - /* All charstrings are written. Some PostScript code follows */ - i+=sprintf( &(filebuf[i]), - "end\nend\nreadonly put\nnoaccess put\ndup /FontName get exch definefont pop\nmark currentfile closefile\n"); - sprintf( err_warn_msg_buf, - "Charstrings and Font definition finished (%d data bytes, from which %d bytes will be encrypted)", - i, i-dindex); - T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, - T1LOG_DEBUG); - - /* we compute the size of the encrypted area. */ - if (encrypt==1) { - encryptsize=i-dindex; - encryptsize+=4; /* the four random bytes */ - encryptsize*=2; /* since we use ASCII-hex output */ - encryptsize+=(int)ceil((double)encryptsize/linewidth); /* we need a few newline characters - to adjust the output format */ - } - else if (encrypt==2) { /* binary encryption. The whole data is contiguous - and only at the end of the data a newline is - added. */ - encryptsize=i-dindex+1; - encryptsize+=4; /* the four random bytes */ - } - else { /*The case of no encryption does not produce - valid fonts, it is for debugging purposes only */ - encryptsize=i-dindex+1; - } - - - /* we add the size of the 512 zeros and the cleartomark */ - trailersize+=ZEROS; - trailersize+=(int)ceil((double)ZEROS/linewidth); - trailersize+=12; /* cleartomark */ - - /* Search for remaining PostScript code in the last 1024 bytes. This - should suffice for any font. */ - tr_len=T1GetTrailer( linebuf, 1025, ifp); - T1Close(ifp); /* we do not need the file any longer */ - - /* And we add the size of the trailer. A trailer only consisting of - a newline is ignored because the newline has already been included - in the cleartomark-string. */ - if ( !((tr_len==1) && ((linebuf[0]=='\n') || (linebuf[0]=='\r')) ) ) { - trailersize+=tr_len; - } - - - if ((encryptbuf=(char *)calloc( encryptsize, 1))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - free( filebuf); - return( NULL); - } - - /* Allocate one byte in orer to be able to use sprintf() (which appends - an ASCII-\0).*/ - if ((trailerbuf=(char *)calloc( trailersize+1, 1))==NULL) { - T1_errno=T1ERR_ALLOC_MEM; - free( filebuf); - free( encryptbuf); - return( NULL); - } - - k=0; - colcount=0; - - /* perform eexec-encryption */ - eexec_r=55665; - if (encrypt==0) { - for (j=dindex; jpFontArray[FontID].pType1Data->Private[LENIV].value.data.integer); - -} diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1subset.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1subset.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1subset.h Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1subset.h Thu Jan 1 00:00:00 1970 @@ -1,76 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1subset.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - declarations and definitions for t1subset.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independ from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#ifdef T1SUBSET_C - - -#define T1_SUBSET_DEFAULT 0x00 -#define T1_SUBSET_FORCE_REENCODE 0x01 -#define T1_SUBSET_SKIP_REENCODE 0x02 -#define T1_SUBSET_ENCRYPT_BINARY 0x04 -/* This is only for debugging, it does not produce valid font-files! */ -#define T1_SUBSET_ENCRYPT_NONE 0x08 - - -/* Functions used from the t1io-module, partially written - and added for font-subsetting. We don't care about the - special F_FILE-type defined in that module because all - accesses are done via pointers. */ -extern unsigned long T1GetFileSize( FILE *f); -extern FILE *T1Open( char *fn, char *mode); -extern int T1Gets(char *string, int size, FILE *f); -extern int T1GetDecrypt( void); -extern int T1GetTrailer(char *string, int size, FILE *f); -extern int T1Close( FILE *f); -extern void T1io_reset( void); - -char *T1_SubsetFont( int FontID, - char *mask, - unsigned int flags, - int linewidth, - unsigned long maxblocksize, - unsigned long *bufsize); -char *T1_GetCharString( int FontID, char *charname, int *len); -int T1_GetlenIV( int FontID); - - -#define ZEROS 512 - -#else - -extern char *T1_SubsetFont( int FontID, - char *mask, - unsigned int flags, - int linewidth, - unsigned long maxblocksize, - unsigned long *bufsize); -extern char *T1_GetCharString( int FontID, char *charname, int *len); -extern int T1_GetlenIV( int FontID); - - -#endif diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1trans.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1trans.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1trans.c Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1trans.c Thu Jan 1 00:00:00 1970 @@ -1,536 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1trans.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - functions for transforming fonts and setting - line-parameters. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1TRANS_C - - -#include -#include -#include -#include -#if defined(_MSC_VER) -# include -# include -# include -#else -# include -#endif -#include -#include -#include - -#include "../type1/ffilest.h" -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" - - -#include "t1types.h" -#include "t1extern.h" -#include "t1trans.h" -#include "t1base.h" - - -/* T1_ExtendFont(): Extend the font referenced by FontID by the factor - extend. This is only allowed if no size dependent data exists. - Of course, the font must already have been loaded. - Returns 0 for success and -1 otherwise. - */ -int T1_ExtendFont( int FontID, double extend) -{ - - /* First, check for font residing in memory: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - /* Second, check whether size-dependent data exists: */ - if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - pFontBase->pFontArray[FontID].extend=extend; - pFontBase->pFontArray[FontID].FontTransform[0] = extend; - return(0); -} - - - -/* T1_GetExtend(): Return the current extension factor of the - font FontID - Return: 0.0 if font not loaded - current extent otherwise -*/ -double T1_GetExtend( int FontID) -{ - /* First, check for font residing in memory: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0.0); - } - - return( pFontBase->pFontArray[FontID].extend); -} - - - - -/* T1_SlantFont(): Slant the font referenced by FontID by the factor - extend. This is only allowed if no size dependent data exists. - Of course, the font must already have been loaded. - Returns 0 for success and -1 otherwise. - */ -int T1_SlantFont( int FontID, double slant) -{ - - /* First, check for font residing in memory: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - /* Second, check whether size-dependent data exists: */ - if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - pFontBase->pFontArray[FontID].slant=slant; - pFontBase->pFontArray[FontID].FontTransform[2] = slant; - return(0); -} - - - -/* T1_GetSlant(): Return the current slanting factor of the - font FontID - Return: 0.0 if font not loaded - current slant otherwise (may also be 0.0!) -*/ -double T1_GetSlant( int FontID) -{ - /* First, check for font residing in memory: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0.0); - } - - return( pFontBase->pFontArray[FontID].slant); -} - - - -/* T1_TransformFont(): Transform the font referenced by FontID according - to the transform matrix. This is only allowed if no size dependent - data exists. Of course, the font must already have been loaded. - Returns 0 for success and -1 otherwise. - */ -int T1_TransformFont( int FontID, T1_TMATRIX *matrix) -{ - - /* First, check for font residing in memory: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - /* Second, check whether size-dependent data exists: */ - if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){ - T1_errno=T1ERR_OP_NOT_PERMITTED; - return(-1); - } - - pFontBase->pFontArray[FontID].FontTransform[0] = matrix->cxx; - pFontBase->pFontArray[FontID].FontTransform[1] = matrix->cxy; - pFontBase->pFontArray[FontID].FontTransform[2] = matrix->cyx; - pFontBase->pFontArray[FontID].FontTransform[3] = matrix->cyy; - return(0); -} - - - -/* T1_GetTransform(): Return the current transformation matrix for the - font FontID - Return: [0.0, 0.0, 0.0, 0.0] if font not loaded - current tmatrix otherwise -*/ -T1_TMATRIX T1_GetTransform( int FontID) -{ - T1_TMATRIX tmatrix={0.0, 0.0, 0.0, 0.0}; - - /* First, check for font residing in memory: */ - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(tmatrix); - } - - tmatrix.cxx=pFontBase->pFontArray[FontID].FontTransform[0]; - tmatrix.cxy=pFontBase->pFontArray[FontID].FontTransform[1]; - tmatrix.cyx=pFontBase->pFontArray[FontID].FontTransform[2]; - tmatrix.cyy=pFontBase->pFontArray[FontID].FontTransform[3]; - - return( tmatrix); -} - - - -/* Functions for setting line-parameters: - linetypeis expected to be an OR'ed combination of - T1_UNDERLINE, T1_OVERLINE and T1_OVERSTRIKE. - */ -int T1_SetLinePosition( int FontID, int linetype, float value) -{ - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - if (linetype & T1_UNDERLINE){ - pFontBase->pFontArray[FontID].UndrLnPos=value; - return( 0); - } - if (linetype & T1_OVERLINE){ - pFontBase->pFontArray[FontID].OvrLnPos=value; - return( 0); - } - if (linetype & T1_OVERSTRIKE){ - pFontBase->pFontArray[FontID].OvrStrkPos=value; - return( 0); - } - - /* The linetype was bad */ - T1_errno=T1ERR_INVALID_PARAMETER; - return( -1); - -} - - - -int T1_SetLineThickness( int FontID, int linetype, float value) -{ - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(-1); - } - - if (linetype & T1_UNDERLINE){ - pFontBase->pFontArray[FontID].UndrLnThick=value; - return( 0); - } - if (linetype & T1_OVERLINE){ - pFontBase->pFontArray[FontID].OvrLnThick=value; - return( 0); - } - if (linetype & T1_OVERSTRIKE){ - pFontBase->pFontArray[FontID].OvrStrkThick=value; - return( 0); - } - - /* The linetype was bad */ - T1_errno=T1ERR_INVALID_PARAMETER; - return( -1); - -} - - -float T1_GetLinePosition( int FontID, int linetype) -{ - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0.0); - } - - if (linetype & T1_UNDERLINE) - return( pFontBase->pFontArray[FontID].UndrLnPos); - if (linetype & T1_OVERLINE) - return( pFontBase->pFontArray[FontID].OvrLnPos); - if (linetype & T1_OVERSTRIKE) - return( pFontBase->pFontArray[FontID].OvrStrkPos); - - /* The linetype was bad */ - T1_errno=T1ERR_INVALID_PARAMETER; - return( 0.0); - -} - - - -float T1_GetLineThickness( int FontID, int linetype) -{ - - if (CheckForFontID(FontID)!=1){ - T1_errno=T1ERR_INVALID_FONTID; - return(0.0); - } - - if (linetype & T1_UNDERLINE) - return( pFontBase->pFontArray[FontID].UndrLnThick); - if (linetype & T1_OVERLINE) - return( pFontBase->pFontArray[FontID].OvrLnThick); - if (linetype & T1_OVERSTRIKE) - return( pFontBase->pFontArray[FontID].OvrStrkThick); - - /* The linetype was bad */ - T1_errno=T1ERR_INVALID_PARAMETER; - return( 0.0); - -} - - -/* Functions for intuitively transforming matrices. All function operate on their - original objects. In case NULL is specified, a unity-matrix is allocated by - the function and then tranformed appropriately. Note that in order to concatenate - transformation in the sense of t1lib the current transformation matrix must be - left-multiplied by the trnasformation to be applied! */ -/* Rotation: - ( x11' x21' ) ( cos(a) -sin(a) ) ( x11 x21 ) - ( ) = ( ) * ( ) - ( x12' x22' ) ( sin(a) cos(a) ) ( x12 x22 ) -*/ -T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, double angle) -{ - T1_TMATRIX tmat; - - if (matrix==NULL){ - if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - matrix->cxx=1.0; - matrix->cyx=0.0; - matrix->cxy=0.0; - matrix->cyy=1.0; - } - memcpy( &tmat, matrix, sizeof(T1_TMATRIX)); - /* Convert angle to radians: */ - angle=angle*PI/180.0; - /* multiply matrices */ - matrix->cxx=cos((double)angle) * tmat.cxx - sin((double)angle) * tmat.cxy; - matrix->cyx=cos((double)angle) * tmat.cyx - sin((double)angle) * tmat.cyy; - matrix->cxy=sin((double)angle) * tmat.cxx + cos((double)angle) * tmat.cxy; - matrix->cyy=sin((double)angle) * tmat.cyx + cos((double)angle) * tmat.cyy; - return( matrix); -} - - -/* Horizontal mirroring */ -/* H-Mirror: - ( x11' x21' ) ( -1 0 ) ( x11 x21 ) ( -x11 -x21 ) - ( ) = ( ) * ( ) = ( ) - ( x12' x22' ) ( 0 1 ) ( x12 x22 ) ( x12 x22 ) -*/ -T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix) -{ - - if (matrix==NULL){ - if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - matrix->cxx=1.0; - matrix->cyx=0.0; - matrix->cxy=0.0; - matrix->cyy=1.0; - } - matrix->cxx *=-1.0; - matrix->cyx *=-1.0; - return( matrix); -} - - -/* Vertical mirroring */ -/* V-Mirror: - ( x11' x21' ) ( 1 0 ) ( x11 x21 ) ( x11 x21 ) - ( ) = ( ) * ( ) = ( ) - ( x12' x22' ) ( 0 -1 ) ( x12 x22 ) ( -x12 -x22 ) -*/ -T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix) -{ - - if (matrix==NULL){ - if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - matrix->cxx=1.0; - matrix->cyx=0.0; - matrix->cxy=0.0; - matrix->cyy=1.0; - } - matrix->cxy *=-1.0; - matrix->cyy *=-1.0; - return( matrix); - -} - - -/* Horizontal shearing */ -/* H-Shearing: - ( x11' x21' ) ( 1 f ) ( x11 x21 ) ( x11+f*x12 x21+f*x22 ) - ( ) = ( ) * ( ) = ( ) - ( x12' x22' ) ( 0 1 ) ( x12 x22 ) ( x12 x22 ) -*/ -T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, double shear) -{ - - if (matrix==NULL){ - if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - matrix->cxx=1.0; - matrix->cyx=0.0; - matrix->cxy=0.0; - matrix->cyy=1.0; - } - matrix->cxx +=shear*matrix->cxy; - matrix->cyx +=shear*matrix->cyy; - return( matrix); - -} - - -/* Vertical shearing */ -/* V-Shearing: - ( x11' x21' ) ( 1 0 ) ( x11 x21 ) ( x11 x21 ) - ( ) = ( ) * ( ) = ( ) - ( x12' x22' ) ( f 1 ) ( x12 x22 ) ( x12+f*x11 x22+f*x21 ) -*/ -T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, double shear) -{ - - if (matrix==NULL){ - if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - matrix->cxx=1.0; - matrix->cyx=0.0; - matrix->cxy=0.0; - matrix->cyy=1.0; - } - matrix->cxy +=shear*matrix->cxx; - matrix->cyy +=shear*matrix->cyx; - return( matrix); - -} - - -/* Horizontal extension */ -/* Horizontal-Extension: - ( x11' x21' ) ( f 0 ) ( x11 x21 ) ( f*x11 f*x21 ) - ( ) = ( ) * ( ) = ( ) - ( x12' x22' ) ( 0 1 ) ( x12 x22 ) ( x12 x22 ) -*/ -T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, double extent) -{ - - if (matrix==NULL){ - if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - matrix->cxx=1.0; - matrix->cyx=0.0; - matrix->cxy=0.0; - matrix->cyy=1.0; - } - matrix->cxx *=extent; - matrix->cyx *=extent; - return( matrix); - -} - - -/* Vertical extension */ -/* Vertical-Extension: - ( x11' x21' ) ( 1 0 ) ( x11 x21 ) ( x11 x21 ) - ( ) = ( ) * ( ) = ( ) - ( x12' x22' ) ( 0 f ) ( x12 x22 ) ( f*x12 f*x22 ) -*/ -T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, double extent) -{ - - if (matrix==NULL){ - if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - matrix->cxx=1.0; - matrix->cyx=0.0; - matrix->cxy=0.0; - matrix->cyy=1.0; - } - matrix->cxy *=extent; - matrix->cyy *=extent; - return( matrix); - -} - - -/* General transformation */ -/* - ( x11 x21 ) ( y11 y21 ) ( x11*y11+x21*y12 x11*y21+x21*y22 ) - ( ) * ( ) = ( ) - ( x12 x22 ) ( y12 y22 ) ( x12*y11+x22*y12 x12*y21+x22*y22 ) -*/ -T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, - double cxx, double cyx, - double cxy, double cyy) -{ - T1_TMATRIX tmat; - - if (matrix==NULL){ - if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return( NULL); - } - matrix->cxx=1.0; - matrix->cyx=0.0; - matrix->cxy=0.0; - matrix->cyy=1.0; - } - memcpy( &tmat, matrix, sizeof(T1_TMATRIX)); - matrix->cxx=cxx * tmat.cxx + cyx * tmat.cxy; - matrix->cyx=cxx * tmat.cyx + cyx * tmat.cyy; - matrix->cxy=cxy * tmat.cxx + cyy * tmat.cxy; - matrix->cyy=cxy * tmat.cyx + cyy * tmat.cyy; - - return( matrix); -} - - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1trans.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1trans.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1trans.h Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1trans.h Thu Jan 1 00:00:00 1970 @@ -1,75 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1trans.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - definitions and declarations fort t1trans.c - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#ifdef T1TRANS_C - -int T1_ExtendFont( int FontID, double extend); -int T1_SlantFont( int FontID, double slant); -int T1_TransformFont( int FontID, T1_TMATRIX *matrix); -double T1_GetExtend( int FontID); -double T1_GetSlant( int FontID); -T1_TMATRIX T1_GetTransform( int FontID); -int T1_SetLinePosition( int FontID, int linetype, float value); -int T1_SetLineThickness( int FontID, int linetype, float value); -float T1_GetLinePosition( int FontID, int linetype); -float T1_GetLineThickness( int FontID, int linetype); -T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, double angle); -T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix); -T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix); -T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, double shear); -T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, double shear); -T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, double extent); -T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, double extent); -T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, - double cxx, double cyx, - double cxy, double cyy); - -#else - -extern int T1_ExtendFont( int FontID, double extend); -extern int T1_SlantFont( int FontID, double slant); -extern int T1_TransformFont( int FontID, T1_TMATRIX *matrix); -extern double T1_GetExtend( int FontID); -extern double T1_GetSlant( int FontID); -extern T1_TMATRIX T1_GetTransform( int FontID); -extern int T1_SetLinePosition( int FontID, int linetype, float value); -extern int T1_SetLineThickness( int FontID, int linetype, float value); -extern float T1_GetLinePosition( int FontID, int linetype); -extern float T1_GetLineThickness( int FontID, int linetype); -extern T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, double angle); -extern T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix); -extern T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix); -extern T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, double shear); -extern T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, double shear); -extern T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, double extent); -extern T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, double extent); -extern T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, - double cxx, double cyx, - double cxy, double cyy); - -#endif - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1types.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1types.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1types.h Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1types.h Thu Jan 1 00:00:00 1970 @@ -1,221 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1types.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-06-04 - ----- Description: This file is part of the t1-library. It contains - type definitions used by the t1-library. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#define T1TYPES_H - - -typedef struct -{ - int flags; - int chars; - int hkern; -} METRICS_ENTRY; - - -typedef struct -{ - char *pFontFileName; /* Pointer to the font's filename */ - char *pAfmFileName; /* Pointer to the afm filename, IFF set explicitly */ - FontInfo *pAFMData; /* A pointer to a struct which gives access to all - the data contained in the .afm-file. If this - pointer is NULL, no .afm-file had been found. - => There's no advanced info on the font available. - */ - psfont *pType1Data; /* A pointer to a struct giving access to all - information contained in the .pfa/.pfb-file. This - is needed! */ - int *pEncMap; /* For fast mapping from charnames to encoding - indices */ - METRICS_ENTRY *pKernMap; /* dito */ - int KernMapSize; - char **pFontEnc; /* This is the pointer to the encoding array - associated with that particular font. If - FontEnc=NULL, it means the internal - (fontspecific) encoding is to be used. */ - char *vm_base; /* The base address of the virtual memory area for this - font. It must be stored in order to be able to realloc - and free those memory areas later. */ - void *pFontSizeDeps; /* This one points to a linked list of structures - which store all font size dependent data. */ - double FontMatrix[4]; /* Two matrices which store the font matrix and special - Transformation to be applied, such as slant and - extend or probably some rotation. */ - double FontTransform[4]; - float slant; /* A slant factor for the font */ - float extend; /* A extension factor for the font */ - float UndrLnPos; /* Parameters for ~lining rules */ - float UndrLnThick; - float OvrLnPos; - float OvrLnThick; - float OvrStrkPos; - float OvrStrkThick; - unsigned short physical; /* This entry is used to decide, whether a - font is associated with an own physical - fontfile, or whether it has been created - as a "logical" font by copying another - "physical" font. */ - unsigned short refcount; /* At load time this counter is set to 1. Every - time, a T1_CopyFont() is executed on this font, - this counter is incremented by 1. This gives - the possibility to decide whether a physical - font is used by some logical font. */ - short space_position; /* The position where "space" is encoded, is saved - in this entry. The space character needs special - treatment. Saving its position here yields faster - execution during rastering of strings with a - user-supplied space-offset! */ - short info_flags; /* Here some info may be stored */ -} FONTPRIVATE; - - -/* A structure representing a matrix */ -typedef struct -{ - double cxx; - double cyx; - double cxy; - double cyy; -} T1_TMATRIX; - - -/* Following struct is used for storing all information for a particular - rendered character glyph */ -typedef struct -{ - char *bits; /* A pointer to the characters local bitmap */ - struct /* A struct containing diverse metric information */ - { - int ascent; - int descent; - int leftSideBearing; - int rightSideBearing; - int advanceX; - int advanceY; - } metrics; - void *pFontCacheInfo; - unsigned long bpp; /* The number of bits that represent 1 pixel */ -} GLYPH; - - - -/* Next comes the struct declaration for FontSizeDeps, which stores size - specific data of a font */ -typedef struct -{ - GLYPH *pFontCache; /* Pointer to the cache area of this - font at this size */ - void *pNextFontSizeDeps; /* A pointer to the next size's - FontSizeDeps-structure. */ - void *pPrevFontSizeDeps; /* A pointer to the previous size's - FontSizeDeps-structure or NULL if - the current is the first. */ - struct XYspace *pCharSpaceLocal; /* This is a scaled version of the - global version for this font. */ - float size; /* The desired size, to be specified - in bp's. */ - int antialias; /* Switch for marking the current size - antialiased */ -} FONTSIZEDEPS; - - - -/* A data that makes most important information available to user. */ -typedef struct -{ - int width; /* The glyph's width */ - BBox bbox; /* The glyph's bounding box */ - int numchars; /* The number of characters in the glyph (string) */ - int *charpos; /* A pointer to an integer array were the horizontal - positions in (afm units) of the individual - characters in the string are stored */ -} METRICSINFO; - - -/* Handling of outlines: These definitions decouple from the type 1 rasterizers - def's and make the necessary stuff available to end users */ - -#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ -/* From/to conversion of pels/fractpels */ -#define T1_TOPATHPOINT(p) (((long)p)<>FRACTBITS) - -/* A fractional point */ -typedef struct { - long x; - long y; -} T1_PATHPOINT; - - -/* A straight outline segment, stroked or not stroked */ -typedef struct pathsegment { - char type; /* type of segment (line or move) */ - unsigned char flag; /* type1 rasterizer internal stuff */ - short references; /* type1 rasterizer internal stuff */ - unsigned char size; /* size of the structure */ - unsigned char context; /* index to device context */ - struct pathsegment *link; /* pointer to next structure in linked list */ - struct pathsegment *last; /* pointer to last structure in list */ - T1_PATHPOINT dest; /* relative ending location of path segment */ -} T1_PATHSEGMENT; - -/* A third order bezier segment */ -typedef struct bezierpathsegment { - char type; /* type of segment (bezier) */ - unsigned char flag; /* type1 rasterizer internal stuff */ - short references; /* type1 rasterizer internal stuff */ - unsigned char size; /* as with any 'segment' type */ - unsigned char context; /* as with any 'segment' type */ - T1_PATHSEGMENT *link; /* as with any 'segment' type */ - T1_PATHSEGMENT *last; /* as with any 'segment' type */ - T1_PATHPOINT dest; /* ending point (D) */ - T1_PATHPOINT B; /* control point B */ - T1_PATHPOINT C; /* control point C */ -} T1_BEZIERSEGMENT; - -typedef T1_PATHSEGMENT T1_OUTLINE; - - -/* Two structures for handling composite character data */ -/* One structure for each symbol of the composite character */ -typedef struct -{ - int piece; /* the index of the current symbol */ - int deltax; /* horizontal displacement of current symbol in CS */ - int deltay; /* vertical displacement of current symbol in CS */ -} T1_COMP_PIECE; - -/* This one defines the composite character, the number of pieces and how to - access their data. */ -typedef struct -{ - int compchar; /* the base character in the current encoding */ - int numPieces; /* the number of defined pieces including the base char */ - T1_COMP_PIECE *pieces; /* a pointer to the pieces' information */ -} T1_COMP_CHAR_INFO; - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1x11.c xdvik-22.40n/libs/t1lib/lib/t1lib/t1x11.c --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1x11.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1x11.c Thu Jan 1 00:00:00 1970 @@ -1,861 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1x11.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-11-01 - ----- Description: This file is part of the t1-library. It contains - functions for generating glyphs with data in - X11-Pixmap format. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#define T1X11_C - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "../type1/types.h" -#include "parseAFM.h" -#include "../type1/objects.h" -#include "../type1/spaces.h" -#include "../type1/util.h" -#include "../type1/fontfcn.h" -#include "../type1/regions.h" - -#include "t1types.h" -#include "t1extern.h" -#include "t1set.h" -#include "t1aaset.h" -#include "t1load.h" -#include "t1finfo.h" -#include "t1misc.h" -#include "t1x11.h" -#include "t1base.h" - - - -#define T1GCMASK GCForeground | GCBackground - -/* As a fall back */ -#ifndef T1_AA_TYPE16 -#define T1_AA_TYPE16 short -#endif -#ifndef T1_AA_TYPE32 -#define T1_AA_TYPE32 int -#endif - - - -/* The three important X11 parameters t1lib has to deal with: */ -static Display *T1_display=NULL; /* Must be accessible from t1delete.c */ -static Visual *T1_visual=NULL; -static Colormap T1_colormap; -static unsigned int T1_depth=0; -static int T1_byte_order; -static int lastlevel=0; -static unsigned long oldfg_n=0, oldbg_n=0, oldfg_l=0, oldbg_l=0; -static unsigned long oldfg_h=0, oldbg_h=0, oldfg=0, oldbg=0; - - -extern int T1aa_SmartOn; /* from t1aaset.c */ -extern float T1aa_smartlimit1; -extern float T1aa_smartlimit2; - - - -static XColor aacolors[AAMAXPLANES]; -static unsigned long aapixels[AAMAXPLANES]; - - -/* The following parameter determines whether t1lib will use logical - positioning of chars and string (place the origin at specified - destination-point) or absolute positioning with respect to the - origin (upper left corner) of the generated bitmap/pixmap. */ -static int T1_lposition=1; - - - -/* T1_SetX11Params(): Set X11-parameters which t1lib has to know in order - to properly generate pixmaps from characters */ -int T1_SetX11Params( Display *display, - Visual *visual, - unsigned int depth, - Colormap colormap) -{ - - T1_display =display; - T1_visual =visual; - T1_depth =depth; - T1_colormap =colormap; - - if (T1_CheckEndian()==0) - T1_byte_order=0; - else - T1_byte_order=1; - - /* For bug hunting: */ - if (ImageByteOrder( T1_display)==0) - T1_PrintLog( "T1_SetX11Params()", - "X-Server uses Little Endian data representation", - T1LOG_DEBUG); - else - T1_PrintLog( "T1_SetX11Params()", - "X-Server uses Big Endian data representation", - T1LOG_DEBUG); - - return(0); -} - - - -/* T1_SetCharX(): Generate an object of type GLYPH, i.e, a glyph with - a pixmap ID instead of a pointer to a bitmap: */ - -GLYPH *T1_SetCharX( Drawable d, GC gc, int mode, int x_dest, int y_dest, - int FontID, char charcode, - float size, T1_TMATRIX *transform) -{ - GLYPH *pglyph; - static GLYPH xglyph={NULL,{0,0,0,0,0,0},NULL,0}; - - int height, width; - Pixmap clipmask=0; - int opaque; - - - xglyph.metrics.leftSideBearing=0; - xglyph.metrics.rightSideBearing=0; - xglyph.metrics.advanceX=0; - xglyph.metrics.advanceY=0; - xglyph.metrics.ascent=0; - xglyph.metrics.descent=0; - xglyph.pFontCacheInfo=NULL; - - - opaque=mode; - - - if ((pglyph=T1_SetChar( FontID, charcode, size, transform))==NULL){ - T1_PrintLog( "T1_SetCharX()", - "T1_SetChar() returned NULL-pointer!", - T1LOG_WARNING); - return(NULL); - } - - /* Check for empty bitmap */ - if (pglyph->bits==NULL) { - xglyph=*pglyph; - return( &xglyph); - } - - width=pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing; - height=pglyph->metrics.ascent-pglyph->metrics.descent; - - - clipmask=XCreateBitmapFromData( T1_display, - d, - (char *)pglyph->bits, - PAD(width, pFontBase->bitmap_pad), - height - ); - - /* Correct position */ - if (T1_lposition){ - x_dest += pglyph->metrics.leftSideBearing; - y_dest -= pglyph->metrics.ascent; - } - - if (opaque==0){ - XSetClipMask(T1_display, gc, clipmask); - XSetClipOrigin(T1_display, gc, x_dest, y_dest); - } - - XCopyPlane( T1_display, clipmask, d, gc, 0, 0, - width, height, x_dest, y_dest, 0x01); - - if (clipmask){ - XFreePixmap( T1_display, clipmask); - clipmask=0; - XSetClipMask(T1_display, gc, None); - XSetClipOrigin(T1_display, gc, 0, 0); - } - - pglyph->bits=NULL; /* Since XDestroyImage() free's this also! */ - xglyph.metrics.leftSideBearing=pglyph->metrics.leftSideBearing; - xglyph.metrics.rightSideBearing=pglyph->metrics.rightSideBearing; - xglyph.metrics.advanceX=pglyph->metrics.advanceX; - xglyph.metrics.advanceY=pglyph->metrics.advanceY; - xglyph.metrics.ascent=pglyph->metrics.ascent; - xglyph.metrics.descent=pglyph->metrics.descent; - xglyph.bpp=pglyph->bpp; - - return( &xglyph); - - -} - - - -/* T1_SetStringX(...): Draw a string of characters into an X11 drawable */ -GLYPH *T1_SetStringX( Drawable d, GC gc, int mode, int x_dest, int y_dest, - int FontID, char *string, int len, - long spaceoff, int modflag, float size, - T1_TMATRIX *transform) -{ - GLYPH *pglyph; - static GLYPH xglyph={NULL,{0,0,0,0,0,0},NULL,0}; - - int height, width; - Pixmap clipmask=0; - int opaque; - - - xglyph.metrics.leftSideBearing=0; - xglyph.metrics.rightSideBearing=0; - xglyph.metrics.advanceX=0; - xglyph.metrics.advanceY=0; - xglyph.metrics.ascent=0; - xglyph.metrics.descent=0; - xglyph.pFontCacheInfo=NULL; - - - opaque=mode; - - - if ((pglyph=T1_SetString( FontID, string, len, - spaceoff, modflag, size, - transform))==NULL){ - T1_PrintLog( "T1_SetStringX()", - "T1_SetString() returned NULL-pointer!", - T1LOG_WARNING); - return(NULL); - } - - /* Check for empty bitmap */ - if (pglyph->bits==NULL) { - xglyph=*pglyph; - return( &xglyph); - } - - width=pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing; - height=pglyph->metrics.ascent-pglyph->metrics.descent; - - clipmask=XCreateBitmapFromData( T1_display, - d, - (char *)pglyph->bits, - PAD(width, pFontBase->bitmap_pad), /* width */ - height - ); - - /* Correct position */ - if (T1_lposition){ - x_dest += pglyph->metrics.leftSideBearing; - y_dest -= pglyph->metrics.ascent; - } - - if (opaque==0){ - XSetClipMask(T1_display, gc, clipmask); - XSetClipOrigin(T1_display, gc, x_dest, y_dest); - } - - XCopyPlane( T1_display, clipmask, d, gc, 0, 0, - width, height, x_dest, y_dest, 0x01); - - if (clipmask){ - XFreePixmap( T1_display, clipmask); - clipmask=0; - XSetClipMask(T1_display, gc, None); - XSetClipOrigin(T1_display, gc, 0, 0); - } - - pglyph->bits=NULL; /* Since XDestroyImage() free's this also! */ - xglyph.metrics.leftSideBearing=pglyph->metrics.leftSideBearing; - xglyph.metrics.rightSideBearing=pglyph->metrics.rightSideBearing; - xglyph.metrics.advanceX=pglyph->metrics.advanceX; - xglyph.metrics.advanceY=pglyph->metrics.advanceY; - xglyph.metrics.ascent=pglyph->metrics.ascent; - xglyph.metrics.descent=pglyph->metrics.descent; - xglyph.bpp=pglyph->bpp; - - return( &xglyph); - - -} - - - -/* T1_AASetCharX(): Generate an object of type GLYPH, i.e, a glyph with - a pixmap ID instead of a pointer to a bitmap: */ -GLYPH *T1_AASetCharX( Drawable d, GC gc, int mode, int x_dest, int y_dest, - int FontID, char charcode, - float size, T1_TMATRIX *transform) -{ - int j, k; - - GLYPH *pglyph; - XImage *ximage; - - static GLYPH xglyph={NULL,{0,0,0,0,0,0},NULL,0}; - - int height, width, width_pad; - - XGCValues xgcvalues; - static unsigned long fg, bg; - - Pixmap clipmask=0; - int clipmask_h, clipmask_v, line_off; - char *clipmask_ptr; - - int opaque; - - - - xglyph.metrics.leftSideBearing=0; - xglyph.metrics.rightSideBearing=0; - xglyph.metrics.advanceX=0; - xglyph.metrics.advanceY=0; - xglyph.metrics.ascent=0; - xglyph.metrics.descent=0; - xglyph.pFontCacheInfo=NULL; - - - opaque=mode; - - xglyph.bpp=T1_depth; - - /* In order to be able to contruct the pixmap we need to know - foreground and background color as well the copy function */ - XGetGCValues( T1_display, gc, T1GCMASK, &xgcvalues); - fg=xgcvalues.foreground; - bg=xgcvalues.background; - - - /* At this point we must compute the colors that are needed to do - antialiasing between fore- and background. The following function - fills the static aacolors */ - if (T1aa_SmartOn==0) - j=T1_AAGetLevel(); - else if (size>=T1aa_smartlimit2) - j=1; - else if (size>=T1aa_smartlimit1) - j=2; - else - j=4; - if ( j!=lastlevel || fg!=oldfg || bg!=oldbg ){ - switch ( j){ - case 1: - if ( fg!=oldfg_n || bg!=oldbg_n){ - oldfg_n=fg; - oldbg_n=bg; - /* computing colors is not necessary here */ - T1_AANSetGrayValues( bg, fg); - } - break; - case 2: - if ( fg!=oldfg_l || bg!=oldbg_l){ - T1_ComputeAAColorsX( fg, bg, AAMAXPLANES); - /*~derekn*/ - /* If fg=bg, the clipmask will be messed up; in this case */ - /* we can arbitrarily change bg to get a correct clipmask. */ - if (opaque == 0 && fg == bg) - aapixels[0] = bg = (fg > 0) ? fg - 1 : fg + 1; - oldfg_l=fg; - oldbg_l=bg; - T1_AASetGrayValues(aapixels[0], /* white */ - aapixels[4], - aapixels[8], - aapixels[12], - aapixels[16] ); /* black */ - } - break; - case 4: - if ( fg!=oldfg_h || bg!=oldbg_h){ - T1_ComputeAAColorsX( fg, bg, AAMAXPLANES); - /*~derekn*/ - /* If fg=bg, the clipmask will be messed up; in this case */ - /* we can arbitrarily change bg to get a correct clipmask. */ - if (opaque == 0 && fg == bg) - aapixels[0] = bg = (fg > 0) ? fg - 1 : fg + 1; - oldfg_h=fg; - oldbg_h=bg; - T1_AAHSetGrayValues( aapixels); - } - break; - } - lastlevel=j; - oldfg=fg; - oldbg=bg; - } - - if ((pglyph=T1_AASetChar( FontID, charcode, size, - transform))==NULL){ - T1_PrintLog( "T1_AASetCharX()", - "T1_AASetChar() returned NULL-pointer!", - T1LOG_WARNING); - return(NULL); - } - - /* Check for empty bitmap */ - if (pglyph->bits==NULL) { - xglyph=*pglyph; - return( &xglyph); - } - - width=pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing; - height=pglyph->metrics.ascent-pglyph->metrics.descent; - - - /* Correct position */ - if (T1_lposition){ - x_dest += pglyph->metrics.leftSideBearing; - y_dest -= pglyph->metrics.ascent; - } - - if (opaque==0){ - clipmask_v=height; - clipmask_h=width; - width_pad=PAD(width*T1aa_bpp, pFontBase->bitmap_pad)/T1aa_bpp; - clipmask_ptr=(char *)calloc((PAD(clipmask_h, 8)>>3) * clipmask_v, sizeof( char)); - if (clipmask_ptr==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - /* Note: We pad the clipmask always to byte boundary */ - if (pglyph->bpp==8) - for ( k=0; k>3); - for (j=0; jbits))[k*width_pad+j]!=bg) - clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); - } - } - else if (pglyph->bpp==16) - for ( k=0; k>3); - for (j=0; jbits))[k*width_pad+j]!=(T1_AA_TYPE16)bg) - clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); - } - } - else - for ( k=0; k>3); - for (j=0; jbits))[k*width_pad+j]!=(T1_AA_TYPE32)bg) - clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); - } - } - - clipmask=XCreateBitmapFromData( T1_display, - d, - (char *)clipmask_ptr, - width, - height - ); - free( clipmask_ptr); - XSetClipMask(T1_display, gc, clipmask); - XSetClipOrigin(T1_display, gc, x_dest, y_dest); - - } - ximage=XCreateImage( T1_display, - T1_visual, - T1_depth, - ZPixmap, /* XYBitmap or XYPixmap */ - 0, /* No offset */ - (char *)pglyph->bits, - width, - height, - pFontBase->bitmap_pad, - 0 /*PAD(width,8)/8*/ /* number of bytes per line */ - ); - ximage->byte_order=T1_byte_order; - XPutImage(T1_display, - d, - gc, - ximage, - 0, - 0, - x_dest, - y_dest, - width, - height - ); - XDestroyImage(ximage); - if (clipmask){ - XFreePixmap( T1_display, clipmask); - clipmask=0; - XSetClipMask(T1_display, gc, None); - XSetClipOrigin(T1_display, gc, 0, 0); - } - - pglyph->bits=NULL; /* Since XDestroyImage() free's this also! */ - xglyph.metrics.leftSideBearing=pglyph->metrics.leftSideBearing; - xglyph.metrics.rightSideBearing=pglyph->metrics.rightSideBearing; - xglyph.metrics.advanceX=pglyph->metrics.advanceX; - xglyph.metrics.advanceY=pglyph->metrics.advanceY; - xglyph.metrics.ascent=pglyph->metrics.ascent; - xglyph.metrics.descent=pglyph->metrics.descent; - xglyph.bpp=pglyph->bpp; - - return( &xglyph); - - -} - - - -/* T1_AASetStringX(...): Draw a string of characters into an X11 drawable */ -GLYPH *T1_AASetStringX( Drawable d, GC gc, int mode, int x_dest, int y_dest, - int FontID, char *string, int len, - long spaceoff, int modflag, float size, - T1_TMATRIX *transform) -{ - int j, k; - - GLYPH *pglyph; - XImage *ximage; - - - static GLYPH xglyph={NULL,{0,0,0,0,0,0},NULL,0}; - - int height, width, width_pad; - - XGCValues xgcvalues; - static unsigned long fg, bg; - - - Pixmap clipmask=0; - int clipmask_h, clipmask_v, line_off; - char *clipmask_ptr; - - int opaque; - - - xglyph.metrics.leftSideBearing=0; - xglyph.metrics.rightSideBearing=0; - xglyph.metrics.advanceX=0; - xglyph.metrics.advanceY=0; - xglyph.metrics.ascent=0; - xglyph.metrics.descent=0; - xglyph.pFontCacheInfo=NULL; - - - opaque=mode; - - - /* In order to be able to contruct the pixmap we need to know - foreground and background color as well the copy function */ - XGetGCValues( T1_display, gc, T1GCMASK, &xgcvalues); - fg=xgcvalues.foreground; - bg=xgcvalues.background; - - xglyph.bpp=T1_depth; - - /* At this point we must compute the colors that are needed to do - antialiasing between fore- and background. The following function - fills the static aacolors */ - if (T1aa_SmartOn==0) - j=T1_AAGetLevel(); - else if (size>=T1aa_smartlimit2) - j=1; - else if (size>=T1aa_smartlimit1) - j=2; - else - j=4; - if ( j!=lastlevel || fg!=oldfg || bg!=oldbg ){ - switch ( j){ - case 1: - if ( fg!=oldfg_n || bg!=oldbg_n){ - oldfg_n=fg; - oldbg_n=bg; - /* computing colors is not necessary here */ - T1_AANSetGrayValues( bg, fg); - } - break; - case 2: - if ( fg!=oldfg_l || bg!=oldbg_l){ - T1_ComputeAAColorsX( fg, bg, AAMAXPLANES); - /*~derekn*/ - /* If fg=bg, the clipmask will be messed up; in this case */ - /* we can arbitrarily change bg to get a correct clipmask. */ - if (opaque == 0 && fg == bg) - aapixels[0] = bg = (fg > 0) ? fg - 1 : fg + 1; - oldfg_l=fg; - oldbg_l=bg; - T1_AASetGrayValues(aapixels[0], /* white */ - aapixels[4], - aapixels[8], - aapixels[12], - aapixels[16] ); /* black */ - } - break; - case 4: - if ( fg!=oldfg_h || bg!=oldbg_h){ - T1_ComputeAAColorsX( fg, bg, AAMAXPLANES); - /*~derekn*/ - /* If fg=bg, the clipmask will be messed up; in this case */ - /* we can arbitrarily change bg to get a correct clipmask. */ - if (opaque == 0 && fg == bg) - aapixels[0] = bg = (fg > 0) ? fg - 1 : fg + 1; - oldfg_h=fg; - oldbg_h=bg; - T1_AAHSetGrayValues( aapixels); - } - break; - } - lastlevel=j; - oldfg=fg; - oldbg=bg; - } - - - if ((pglyph=T1_AASetString( FontID, string, len, - spaceoff, modflag, size, - transform))==NULL){ - T1_PrintLog( "T1_AASetStringX()", - "T1_AASetString() returned NULL-pointer!", - T1LOG_WARNING); - return(NULL); - } - - /* Check for empty bitmap */ - if (pglyph->bits==NULL) { - xglyph=*pglyph; - return( &xglyph); - } - - width=pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing; - height=pglyph->metrics.ascent-pglyph->metrics.descent; - - - /* Correct position */ - if (T1_lposition){ - x_dest += pglyph->metrics.leftSideBearing; - y_dest -= pglyph->metrics.ascent; - } - - if (opaque==0){ - clipmask_v=height; - clipmask_h=width; - width_pad=PAD(width*T1aa_bpp, pFontBase->bitmap_pad)/T1aa_bpp; - clipmask_ptr=(char *)calloc((PAD(clipmask_h, 8)>>3) * clipmask_v, sizeof( char)); - if (clipmask_ptr==NULL){ - T1_errno=T1ERR_ALLOC_MEM; - return(NULL); - } - /* Note: We pad the clipmask always to byte boundary */ - if (pglyph->bpp==8) - for ( k=0; k>3); - for (j=0; jbits))[k*width_pad+j]!=bg) - clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); - } - } - else if (pglyph->bpp==16) - for ( k=0; k>3); - for (j=0; jbits))[k*width_pad+j]!=(T1_AA_TYPE16)bg) - clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); - } - } - else - for ( k=0; k>3); - for (j=0; jbits))[k*width_pad+j]!=(T1_AA_TYPE32)bg) - clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); - } - } - - clipmask=XCreateBitmapFromData( T1_display, - d, - (char *)clipmask_ptr, - width, - height - ); - free( clipmask_ptr); - XSetClipMask(T1_display, gc, clipmask); - XSetClipOrigin(T1_display, gc, x_dest, y_dest); - - } - ximage=XCreateImage( T1_display, - T1_visual, - T1_depth, - ZPixmap, /* XYBitmap or XYPixmap */ - 0, /* No offset */ - (char *)pglyph->bits, - width, - height, - pFontBase->bitmap_pad, /* lines padded to bytes */ - 0 /*PAD(width,8)/8*/ /* number of bytes per line */ - ); - ximage->byte_order=T1_byte_order; - XPutImage(T1_display, - d, - gc, - ximage, - 0, - 0, - x_dest, - y_dest, - width, - height - ); - XDestroyImage(ximage); - if (clipmask){ - XFreePixmap( T1_display, clipmask); - clipmask=0; - XSetClipMask(T1_display, gc, None); - XSetClipOrigin(T1_display, gc, 0, 0); - } - - pglyph->bits=NULL; /* Since XDestroyImage() free's this also! */ - xglyph.metrics.leftSideBearing=pglyph->metrics.leftSideBearing; - xglyph.metrics.rightSideBearing=pglyph->metrics.rightSideBearing; - xglyph.metrics.advanceX=pglyph->metrics.advanceX; - xglyph.metrics.advanceY=pglyph->metrics.advanceY; - xglyph.metrics.ascent=pglyph->metrics.ascent; - xglyph.metrics.descent=pglyph->metrics.descent; - xglyph.bpp=pglyph->bpp; - - return( &xglyph); - - -} - - - -/* T1_ComputeAAColorsX(): Compute the antialiasing colors in dependency - of foreground and background */ -int T1_ComputeAAColorsX( unsigned long fg, unsigned long bg, int nolevels) -{ - - static unsigned long last_fg; - static unsigned long last_bg; - long delta_red, delta_green, delta_blue; - int i; - int nocolors=0; - - - aacolors[0].pixel=bg; - aacolors[nolevels-1].pixel=fg; - - if ((fg==last_fg)&&(bg==last_bg)) - return(nocolors); - - /* Get RGB values for fore- and background */ - XQueryColor( T1_display, T1_colormap, &aacolors[0]); - XQueryColor( T1_display, T1_colormap, &aacolors[nolevels-1]); - delta_red = (aacolors[nolevels-1].red - aacolors[0].red)/(nolevels-1); - delta_green = (aacolors[nolevels-1].green - aacolors[0].green)/(nolevels-1); - delta_blue = (aacolors[nolevels-1].blue - aacolors[0].blue)/(nolevels-1); - aapixels[0]=aacolors[0].pixel; - aapixels[nolevels-1]=aacolors[nolevels-1].pixel; - - for (i=1; ibits==NULL) { - T1_errno=T1ERR_INVALID_PARAMETER; - return( NULL); - } - - if (pglyph->bpp==1) { /* we have a bitmap glyph */ - ximage=XCreateImage( T1_display, - T1_visual, - 1, - XYBitmap, /* XYBitmap or XYPixmap */ - 0, /* No offset */ - (char *)pglyph->bits, - pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing, - pglyph->metrics.ascent-pglyph->metrics.descent, - pFontBase->bitmap_pad, - 0 /* number of bytes per line */ - ); - } - else { /* we have an anztialiased glyph */ - ximage=XCreateImage( T1_display, - T1_visual, - T1_depth, - ZPixmap, /* XYBitmap or XYPixmap */ - 0, /* No offset */ - (char *)pglyph->bits, - pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing, - pglyph->metrics.ascent-pglyph->metrics.descent, - pFontBase->bitmap_pad, - 0 /* number of bytes per line */ - ); - } - - if (ximage==NULL) { - T1_errno=T1ERR_X11; - return( NULL); - } - ximage->byte_order=T1_byte_order; /* Set t1lib´s byteorder */ - - return( ximage); - -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib/t1x11.h xdvik-22.40n/libs/t1lib/lib/t1lib/t1x11.h --- xdvik-22.40l/libs/t1lib/lib/t1lib/t1x11.h Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib/t1x11.h Thu Jan 1 00:00:00 1970 @@ -1,87 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: t1x11.h - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-04-01 - ----- Description: This file is part of the t1-library. It contains - definitions and declarations for t1x11.c. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -#include - -#ifdef T1X11_C - -int T1_SetX11Params( Display *display, - Visual *visual, - unsigned int depth, - Colormap colormap); -GLYPH *T1_SetCharX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char charcode, - float size, T1_TMATRIX *transform); -GLYPH *T1_SetStringX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -GLYPH *T1_AASetCharX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char charcode, - float size, T1_TMATRIX *transform); -GLYPH *T1_AASetStringX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -int T1_ComputeAAColorsX( unsigned long fg, - unsigned long bg, - int nolevels); -int T1_GetDepthOfDrawable( Drawable drawable); -void T1_LogicalPositionX( int pos_switch); - - -#else - -extern Display *T1_display; - -extern int T1_SetX11Params( Display *display, - Visual *visual, - unsigned int depth, - Colormap colormap); -extern GLYPH *T1_SetCharX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_SetStringX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_AASetCharX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char charcode, - float size, T1_TMATRIX *transform); -extern GLYPH *T1_AASetStringX( Drawable d, GC gc, int mode, int x, int y, - int FontID, char *string, int len, - long spaceoff, int modflag, - float size, T1_TMATRIX *transform); -extern int T1_ComputeAAColorsX( unsigned long fg, - unsigned long bg, - int nolevels); -extern int T1_GetDepthOfDrawable( Drawable drawable); -extern void T1_LogicalPositionX( int pos_switch); - - -#endif - diff -Naur xdvik-22.40l/libs/t1lib/lib/t1lib.config xdvik-22.40n/libs/t1lib/lib/t1lib.config --- xdvik-22.40l/libs/t1lib/lib/t1lib.config Wed Apr 18 14:24:05 2001 +++ xdvik-22.40n/libs/t1lib/lib/t1lib.config Thu Jan 1 00:00:00 1970 @@ -1,8 +0,0 @@ -This is the global configuration file for t1lib. -Note that it is not of any use if not setup by the system administrator. - -For information on how to set up these things see the t1lib-manual. - -ENCODING=. -AFM=. -TYPE1=. diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/.dependencies xdvik-22.40n/libs/t1lib/lib/type1/.dependencies --- xdvik-22.40l/libs/t1lib/lib/type1/.dependencies Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/type1/.dependencies Thu Jan 1 00:00:00 1970 @@ -1,28 +0,0 @@ -arith.lo: arith.c types.h objects.h spaces.h arith.h -bstring.lo: bstring.c -curves.lo: curves.c types.h objects.h spaces.h paths.h regions.h \ - curves.h lines.h arith.h -fontfcn.lo: fontfcn.c t1imager.h types.h fontmisc.h util.h fontfcn.h \ - paths_rmz.h spaces_rmz.h ../t1lib/parseAFM.h ../t1lib/t1types.h \ - ../t1lib/t1extern.h ../t1lib/t1misc.h ../t1lib/t1base.h \ - ../t1lib/t1finfo.h -hints.lo: hints.c types.h objects.h spaces.h paths.h regions.h hints.h -lines.lo: lines.c types.h objects.h spaces.h regions.h lines.h -objects.lo: objects.c types.h objects.h spaces.h paths.h regions.h \ - fonts.h pictures.h strokes.h cluts.h -paths.lo: paths.c types.h objects.h spaces.h paths.h regions.h fonts.h \ - pictures.h strokes.h trig.h -regions.lo: regions.c types.h objects.h spaces.h regions.h paths.h \ - curves.h lines.h pictures.h fonts.h hints.h strokes.h -scanfont.lo: scanfont.c t1stdio.h types.h util.h token.h fontfcn.h \ - blues.h -spaces.lo: spaces.c types.h objects.h spaces.h paths.h pictures.h \ - fonts.h arith.h trig.h -t1io.lo: t1io.c t1stdio.h types.h t1hdigit.h -t1snap.lo: t1snap.c objects.h types.h spaces.h paths.h -t1stub.lo: t1stub.c objects.h types.h -token.lo: token.c types.h t1stdio.h util.h digit.h token.h tokst.h \ - hdigit.h -type1.lo: type1.c types.h objects.h spaces.h paths.h fonts.h pictures.h \ - util.h fontfcn.h blues.h -util.lo: util.c types.h util.h fontmisc.h diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/CHANGES xdvik-22.40n/libs/t1lib/lib/type1/CHANGES --- xdvik-22.40l/libs/t1lib/lib/type1/CHANGES Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/CHANGES Thu Jan 1 00:00:00 1970 @@ -1,71 +0,0 @@ -This are the sources as I have found them on the X11R5 distribution. In -order to use them for my purpose (ps2pk: conversion tool for Type1 fonts to -packed TeX fonts) a number of changes were needed (see Changelog). - ---Piet - -internet: rcpt@urc.tue.nl | Piet Tutelaers -bitnet: rcpt@heitue5.BITNET | Computer Center Room RC 1.90 -phone: +31 (0)40 474541 | Eindhoven University of Technology -fax: +31 (0)40 434438 | P.O. Box 513, 5600 MB Eindhoven, NL - -Changelog (the main-line): --------------------------- -92-02: Start of ps2pk project - - decoupling Type1 library from X11 (changes in t1intf.h + t1funcs.h; - added Xstuff.h to replace X header files) - - user definable encoding schemes (removed hardwired ISOLatin1 and - Symbol encodings from t1funcs.c and replaced by encoding paramater - in Type1OpenScalable) -92-03: First release 1.0 (pre-release) -92-04: - added expansion and slanting features as suggested by Lee - Hetherington (changes in spaces.c, t1funcs.c) - - changed t1test.c in order to test above features; added ISOLatin1 - encoding vector. - - README2 replaced by CHANGES (this file) - - MSDOS concession (thanks to Sebastian Rahtz): renamed - fontfilest.h to ffilest.h so it does not clash with fontfile.h - (affects: fontfilest.h (->ffilest.h), t1funcs.c, t1info.c and - t1test.c). - - MSDOS concession: all file extensions .c.orig and .h.orig renamed - to .crg respectivally .hrg - - patch to handle /negationslash and /mapsto from LucidaMath-Symbol - correctly in t1funcs.c (ILH: Lee Hetherington). -92-05: AMIGA/Aztec: - - added type1.ami (contains order of objects in library) - - added Makefile.ami - - added bstring.c (contains a bzero()) -92-05: - fixed a reference to a NULL pointer in t1info.c - - more verbose error messages in type1 library (NDW: Norman Walsh) - - changed memory heuristic in type1 library from static (one chunk) - into dynamic (up to a maximum of 10 chunks). This was needed for - big fonts like daysrib.pfa (reported by Norman Walsh). - (Changes in t1funcs.c and t1malloc.c) - - added Makefile.tcc for MSDOS/Turbo C, removed Makefile.dos -92-06: - added Makefile.djg for MSDOS/GCC 386 (djgpp) - - fixed bug in t1io.c so MSDOS can read its own .pfb format -92-08: - fixed alligment problem for machines with wordlength other than 32 - bits (patch in util.c). Reported by J"urgen Marenda - for DataGeneral AViiON (Motorola - M88k machine) - - The type1 library did not render Oblique fonts correctly. - Erik Schenk provided a patch for - this problem (patches in fontfcn.c and t1util.c). - - Official X11.5 patches (Stephen Gildea 920728) merged in the type1 - library version of ps2pk. These patches were available on: - export.lcs.mit.edu:/pub/R5/contrib-fixes/Type1.patch - - portability: index() in t1info.c replaced by strchr() -94-01: Version 1.4 (bug fix release) - - types.h: added basic type definitions for non 32-bit platforms - - fontfcn.c: made `virtual memory' management dynamically - (reported by Norman Walsh, needed for complicated fonts) - - Makefile.*: improved - - original X11R5 sources no longer included (see X11R5 sources if - you want to see them) - - t1malloc.c removed, not longer needed. -95-11 Version 1.5 - - Makefile.bcc, Makefile.djg and Makefile.wat removed in favour - of Makefile.unx and Makefile.emx - - bzero() dropped in favour of ANSI C's memset() - - Improved cooperation between the master makefile and - its depending makefiles (thanks ) diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/CVS/Entries xdvik-22.40n/libs/t1lib/lib/type1/CVS/Entries --- xdvik-22.40l/libs/t1lib/lib/type1/CVS/Entries Sat Aug 31 22:50:43 2002 +++ xdvik-22.40n/libs/t1lib/lib/type1/CVS/Entries Thu Jan 1 00:00:00 1970 @@ -1,58 +0,0 @@ -/.dependencies/1.1.1.1.8.1/Mon Jan 7 15:50:18 2002//Txdvik_22_40_STABLE -/CHANGES/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/Makefile.in/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/README/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/README.RMz/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/Xstuff.h/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/arith.c/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/arith.h/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/blues.h/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/bstring.c/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/cluts.h/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/curves.c/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/curves.h/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/digit.h/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/ffilest.h/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/font.h/1.1.1.1/Wed Apr 18 14:24:09 2001//Txdvik_22_40_STABLE -/fontfcn.c/1.1.1.1.8.1/Sun Oct 14 12:30:24 2001//Txdvik_22_40_STABLE -/fontfcn.h/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/fontfile.h/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/fontmisc.h/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/fonts.h/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/fontstruct.h/1.2.8.2/Mon Jan 7 15:50:18 2002//Txdvik_22_40_STABLE -/fontxlfd.h/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/fsmasks.h/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/hdigit.h/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/hints.c/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/hints.h/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/lines.c/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/lines.h/1.1.1.1/Wed Apr 18 14:24:10 2001//Txdvik_22_40_STABLE -/objects.c/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/objects.h/1.1.1.1/Wed Apr 18 14:24:11 2001//Txdvik_22_40_STABLE -/paths.c/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/paths.h/1.1.1.1/Wed Apr 18 14:24:11 2001//Txdvik_22_40_STABLE -/paths_rmz.h/1.1.1.1/Wed Apr 18 14:24:11 2001//Txdvik_22_40_STABLE -/pictures.h/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/regions.c/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/regions.h/1.1.1.1/Wed Apr 18 14:24:12 2001//Txdvik_22_40_STABLE -/scanfont.c/1.3.6.1/Sun Oct 14 12:30:24 2001//Txdvik_22_40_STABLE -/spaces.c/1.1.1.1/Wed Apr 18 14:24:12 2001//Txdvik_22_40_STABLE -/spaces.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/spaces_rmz.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/strokes.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/t1hdigit.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/t1imager.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/t1intf.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/t1io.c/1.3.6.2/Mon Jan 7 15:50:18 2002//Txdvik_22_40_STABLE -/t1snap.c/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/t1stdio.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/t1stub.c/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/token.c/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/token.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/tokst.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/trig.h/1.1.1.1/Wed Apr 18 14:24:13 2001//Txdvik_22_40_STABLE -/type1.c/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/types.h/1.1.1.1/Wed Apr 18 14:24:14 2001//Txdvik_22_40_STABLE -/util.c/1.1.1.1/Wed Apr 18 14:24:14 2001//Txdvik_22_40_STABLE -/util.h/1.1.1.1/Wed Apr 18 14:24:14 2001//Txdvik_22_40_STABLE -D diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/CVS/Repository xdvik-22.40n/libs/t1lib/lib/type1/CVS/Repository --- xdvik-22.40l/libs/t1lib/lib/type1/CVS/Repository Sat Aug 31 22:50:39 2002 +++ xdvik-22.40n/libs/t1lib/lib/type1/CVS/Repository Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -xdvik/libs/t1lib/lib/type1 diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/CVS/Root xdvik-22.40n/libs/t1lib/lib/type1/CVS/Root --- xdvik-22.40l/libs/t1lib/lib/type1/CVS/Root Sat Aug 31 22:50:39 2002 +++ xdvik-22.40n/libs/t1lib/lib/type1/CVS/Root Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/CVS/Tag xdvik-22.40n/libs/t1lib/lib/type1/CVS/Tag --- xdvik-22.40l/libs/t1lib/lib/type1/CVS/Tag Sat Aug 31 23:06:36 2002 +++ xdvik-22.40n/libs/t1lib/lib/type1/CVS/Tag Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/Makefile.in xdvik-22.40n/libs/t1lib/lib/type1/Makefile.in --- xdvik-22.40l/libs/t1lib/lib/type1/Makefile.in Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/Makefile.in Thu Jan 1 00:00:00 1970 @@ -1,106 +0,0 @@ -# Makefile.in -# -# This file is part of the t1lib-package! See documentation and Readme files -# of the t1lib-package for copyright restrictions. -# -# Targets provided: -# all (default) -# install -# clean -# -# Author: Rainer Menzner (Rainer.Menzner@web.de) -# Date: 04/06/1997 -# Last modified: 2001-04-01 -# -# Modified by H.Kakugawa to use libtool - -LIBTOOL = ../../libtool -SHELL = /bin/sh -CC = @CC@ -CPP = @CPP@ -CFLAGS = @CFLAGS@ -OPTIONS = @OPTIONS@ -X_LIBS = @X_LIBS@ -TOPSRC = @top_srcdir@ -XPM_LIB = -lXpm -XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ -LDFLAGS = @LDFLAGS@ -LDLIBS = @LDLIBS@ -AR = ar rc -RANLIB = @RANLIB@ -RM = rm -f -X_CFLAGS = @X_CFLAGS@ -YACC = @YACC@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -ALLCFLAGS = $(CFLAGS) -SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(ALLCFLAGS)' 'OPTIONS=$(OPTIONS)' -@SET_MAKE@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @top_srcdir@/ac-tools/mkinstalldirs -prefix = @prefix@ -exec_prefix = @exec_prefix@ -includedir = @includedir@ -bindir = @bindir@ -datadir = @datadir@ -libdir = @libdir@ -mandir = @mandir@/man1 -manext = .1 -no_x = @no_x@ - - -# targets to build: - -OBJS = \ - arith.lo \ - curves.lo \ - fontfcn.lo \ - hints.lo \ - lines.lo \ - objects.lo \ - paths.lo \ - regions.lo \ - scanfont.lo \ - spaces.lo \ - t1io.lo \ - t1snap.lo \ - t1stub.lo \ - token.lo \ - type1.lo \ - util.lo - - -.SUFFIXES: .c .o .lo -.c.lo: - $(LIBTOOL) --mode=compile \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< - -.c.o: - $(LIBTOOL) --mode=compile \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< - - -all: $(OBJS) - -.PHONY: clean - -dependencies: dummy - gcc -MM *.c | sed 's/\.o:/.lo:/g' > .dependencies - -clean: dummy - -$(RM) *.lo *.o .libs/* - -$(RM) *~ *.bak \#*\# - -rmdir .libs - -install: dummy - - -dummy: - - -# Dependencies of object files -include .dependencies - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/README xdvik-22.40n/libs/t1lib/lib/type1/README --- xdvik-22.40l/libs/t1lib/lib/type1/README Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/README Thu Jan 1 00:00:00 1970 @@ -1,25 +0,0 @@ -This directory contains a rasterizer for "Type 1" (PostScript) format -outline fonts. It was donated by IBM for the R5 contrib tape and has -been maintained since then by the MIT X Consortium. This version is -compatible with X11R5 public patch 13. - -To be used, this rasterizer must be bound into the X server and the font -server. It is most convenient to do this if this directory is moved -into the 'mit' directory tree (i.e., mit/font/lib/font/Type1, a peer of -the 'Speedo' directory). Of course, mit/font/lib/font/Imakefile must be -made aware of its new subdirectory and the objects in it. In any case, -you must ensure that the library mit/font/lib/font/libfont.a contains -this code. - -In addition, the rasterizer must be "registered" with X. The source in -mit/fonts/lib/font/fontfile/renderers.c, specifically the routine -FontFileRegisterFontFileFunctions(), must be modified to add the line: - - Type1RegisterFontFileFunctions(); - -after the call to "SpeedoRegisterFontFileFunctions". - -Some Type 1 fonts have been donated; see, for example, the directory -contrib/fonts/scaled/Type1. In order to use them, they must be in the -font path, either by combining them in some existing font object -directory, or adding a new font directory to the path. diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/README.RMz xdvik-22.40n/libs/t1lib/lib/type1/README.RMz --- xdvik-22.40l/libs/t1lib/lib/type1/README.RMz Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/README.RMz Thu Jan 1 00:00:00 1970 @@ -1,12 +0,0 @@ -Dear Folks, - -this directory basically contains the Type 1 rasterizer code, donated -to the X11-project by IBM and afterwards modified by Piet Tutelaers -for his ps2pk-package. But there are several files modified by -myself. Thus the state of this directory is not an official one and -subject to further changes! - -Before version 0.6 of t1lib I have cleaned the sources, removed the X11-dummy -function and made the sources more ANSI-C compliant. - - (03/09/1998, RMz) diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/Xstuff.h xdvik-22.40n/libs/t1lib/lib/type1/Xstuff.h --- xdvik-22.40l/libs/t1lib/lib/type1/Xstuff.h Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/Xstuff.h Thu Jan 1 00:00:00 1970 @@ -1,42 +0,0 @@ -#ifndef NULL -#define NULL 0 -#endif - -#ifndef XMD_H -#define XMD_H 1 - -#include "types.h" - -/* - * Bitfield suffixes for the protocol structure elements, if you - * need them. Note that bitfields are not guarranteed to be signed - * (or even unsigned) according to ANSI C. - */ -#ifdef WORD64 -#define B32 :32 -#define B16 :16 -#else -#define B32 -#define B16 -#endif - -typedef struct { - SHORT leftSideBearing B16, - rightSideBearing B16, - characterWidth B16, - ascent B16, - descent B16; - USHORT attributes; -} xCharInfo; -#endif /* XMD_H */ - -#ifndef _FS_PROTO_H_ -#define _FS_PROTO_H_ - -typedef struct { - USHORT x_resolution B16; - USHORT y_resolution B16; - USHORT point_size B16; -} fsResolution; - -#endif /* _FS_PROTO_H_ */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/arith.c xdvik-22.40n/libs/t1lib/lib/type1/arith.c --- xdvik-22.40l/libs/t1lib/lib/type1/arith.c Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/arith.c Thu Jan 1 00:00:00 1970 @@ -1,424 +0,0 @@ -/* $XConsortium: arith.c,v 1.2 91/10/10 11:14:06 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - /* ARITH CWEB V0006 ******** */ -/* -:h1.ARITH Module - Portable Module for Multiple Precision Fixed Point Arithmetic - -This module provides division and multiplication of 64-bit fixed point -numbers. (To be more precise, the module works on numbers that take -two 'longs' to store. That is almost always equivalent to saying 64-bit -numbers.) - -Note: it is frequently easy and desirable to recode these functions in -assembly language for the particular processor being used, because -assembly language, unlike C, will have 64-bit multiply products and -64-bit dividends. This module is offered as a portable version. - -&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) and Sten F. Andler - - -:h3.Include Files - -The included files are: -*/ - -#include - -#include "types.h" -#include "objects.h" -#include "spaces.h" -#include "arith.h" - -/* -:h3. -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -Reference for all algorithms: Donald E. Knuth, "The Art of Computer -Programming, Volume 2, Semi-Numerical Algorithms," Addison-Wesley Co., -Massachusetts, 1969, pp. 229-279. - -Knuth talks about a 'digit' being an arbitrary sized unit and a number -being a sequence of digits. We'll take a digit to be a 'short'. -The following assumption must be valid for these algorithms to work: -:ol. -:li.A 'long' is two 'short's. -:eol. -The following code is INDEPENDENT of: -:ol. -:li.The actual size of a short. -:li.Whether shorts and longs are stored most significant byte -first or least significant byte first. -:eol. - -SHORTSIZE is the number of bits in a short; LONGSIZE is the number of -bits in a long; MAXSHORT is the maximum unsigned short: -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -ASSEMBLE concatenates two shorts to form a long: -*/ -#define ASSEMBLE(hi,lo) ((((ULONG)hi)<>SHORTSIZE) -#define LOWDIGIT(u) ((u)&MAXSHORT) - -/* -SIGNBITON tests the high order bit of a long 'w': -*/ -#define SIGNBITON(w) (((LONG)w)<0) - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h2.Double Long Arithmetic - -:h3.DLmult() - Multiply Two Longs to Yield a Double Long - -The two multiplicands must be positive. -*/ - -void DLmult(product, u, v) - register doublelong *product; - register ULONG u; - register ULONG v; -{ - register ULONG u1, u2; /* the digits of u */ - register ULONG v1, v2; /* the digits of v */ - register unsigned int w1, w2, w3, w4; /* the digits of w */ - register ULONG t; /* temporary variable */ -/* printf("DLmult(? ?, %x, %x)\n", u, v); */ - u1 = HIGHDIGIT(u); - u2 = LOWDIGIT(u); - v1 = HIGHDIGIT(v); - v2 = LOWDIGIT(v); - - if (v2 == 0) w4 = w3 = w2 = 0; - else - { - t = u2 * v2; - w4 = LOWDIGIT(t); - t = u1 * v2 + HIGHDIGIT(t); - w3 = LOWDIGIT(t); - w2 = HIGHDIGIT(t); - } - - if (v1 == 0) w1 = 0; - else - { - t = u2 * v1 + w3; - w3 = LOWDIGIT(t); - t = u1 * v1 + w2 + HIGHDIGIT(t); - w2 = LOWDIGIT(t); - w1 = HIGHDIGIT(t); - } - - product->high = ASSEMBLE(w1, w2); - product->low = ASSEMBLE(w3, w4); -} - -/* -:h2.DLdiv() - Divide Two Longs by One Long, Yielding Two Longs - -Both the dividend and the divisor must be positive. -*/ - -void DLdiv(quotient, divisor) - doublelong *quotient; /* also where dividend is, originally */ - ULONG divisor; -{ - register ULONG u1u2 = quotient->high; - register ULONG u3u4 = quotient->low; - register LONG u3; /* single digit of dividend */ - register int v1,v2; /* divisor in registers */ - register LONG t; /* signed copy of u1u2 */ - register int qhat; /* guess at the quotient digit */ - register ULONG q3q4; /* low two digits of quotient */ - register int shift; /* holds the shift value for normalizing */ - register int j; /* loop variable */ - -/* printf("DLdiv(%x %x, %x)\n", quotient->high, quotient->low, divisor); */ - /* - * Knuth's algorithm works if the dividend is smaller than the - * divisor. We can get to that state quickly: - */ - if (u1u2 >= divisor) { - quotient->high = u1u2 / divisor; - u1u2 %= divisor; - } - else - quotient->high = 0; - - if (divisor <= MAXSHORT) { - - /* - * This is the case where the divisor is contained in one - * 'short'. It is worthwhile making this fast: - */ - u1u2 = ASSEMBLE(u1u2, HIGHDIGIT(u3u4)); - q3q4 = u1u2 / divisor; - u1u2 %= divisor; - u1u2 = ASSEMBLE(u1u2, LOWDIGIT(u3u4)); - quotient->low = ASSEMBLE(q3q4, u1u2 / divisor); - return; - } - - - /* - * At this point the divisor is a true 'long' so we must use - * Knuth's algorithm. - * - * Step D1: Normalize divisor and dividend (this makes our 'qhat' - * guesses more accurate): - */ - for (shift=0; !SIGNBITON(divisor); shift++, divisor <<= 1) { ; } - shift--; - divisor >>= 1; - - if ((u1u2 >> (LONGSIZE - shift)) != 0 && shift != 0) - abort("DLdiv: dividend too large", 1); - u1u2 = (u1u2 << shift) + ((shift == 0) ? 0 : u3u4 >> (LONGSIZE - shift)); - u3u4 <<= shift; - - /* - * Step D2: Begin Loop through digits, dividing u1,u2,u3 by v1,v2, - * then shifting U left by 1 digit: - */ - v1 = HIGHDIGIT(divisor); - v2 = LOWDIGIT(divisor); - q3q4 = 0; - u3 = HIGHDIGIT(u3u4); - - for (j=0; j < 2; j++) { - - /* - * Step D3: make a guess (qhat) at the next quotient denominator: - */ - qhat = (HIGHDIGIT(u1u2) == v1) ? MAXSHORT : u1u2 / v1; - /* - * At this point Knuth would have us further refine our - * guess, since we know qhat is too big if - * - * v2 * qhat > ASSEMBLE(u1u2 % v, u3) - * - * That would make sense if u1u2 % v was easy to find, as it - * would be in assembly language. I ignore this step, and - * repeat step D6 if qhat is too big. - */ - - /* - * Step D4: Multiply v1,v2 times qhat and subtract it from - * u1,u2,u3: - */ - u3 -= qhat * v2; - /* - * The high digit of u3 now contains the "borrow" for the - * rest of the substraction from u1,u2. - * Sometimes we can lose the sign bit with the above. - * If so, we have to force the high digit negative: - */ - t = HIGHDIGIT(u3); - if (t > 0) - t |= -1 << SHORTSIZE; - t += u1u2 - qhat * v1; -/* printf("..>divide step qhat=%x t=%x u3=%x u1u2=%x v1=%x v2=%x\n", - qhat, t, u3, u1u2, v1, v2); */ - while (t < 0) { /* Test is Step D5. */ - - /* - * D6: Oops, qhat was too big. Add back in v1,v2 and - * decrease qhat by 1: - */ - u3 = LOWDIGIT(u3) + v2; - t += HIGHDIGIT(u3) + v1; - qhat--; -/* printf("..>>qhat correction t=%x u3=%x qhat=%x\n", t, u3, qhat); */ - } - /* - * Step D7: shift U left one digit and loop: - */ - u1u2 = t; - if (HIGHDIGIT(u1u2) != 0) - abort("divide algorithm error", 2); - u1u2 = ASSEMBLE(u1u2, LOWDIGIT(u3)); - u3 = LOWDIGIT(u3u4); - q3q4 = ASSEMBLE(q3q4, qhat); - } - quotient->low = q3q4; -/* printf("DLdiv returns %x %x\n", quotient->high, quotient->low); */ - return; -} - -/* -:h3.DLadd() - Add Two Double Longs - -In this case, the doublelongs may be signed. The algorithm takes the -piecewise sum of the high and low longs, with the possibility that the -high should be incremented if there is a carry out of the low. How to -tell if there is a carry? Alex Harbury suggested that if the sum of -the lows is less than the max of the lows, there must have been a -carry. Conversely, if there was a carry, the sum of the lows must be -less than the max of the lows. So, the test is "if and only if". -*/ - -void DLadd(u, v) - doublelong *u; /* u = u + v */ - doublelong *v; -{ - register ULONG lowmax = TYPE1_MAX(u->low, v->low); - -/* printf("DLadd(%x %x, %x %x)\n", u->high, u->low, v->high, v->low); */ - u->high += v->high; - u->low += v->low; - if (lowmax > u->low) - u->high++; -} -/* -:h3.DLsub() - Subtract Two Double Longs - -Testing for a borrow is even easier. If the v.low is greater than -u.low, there must be a borrow. -*/ - -void DLsub(u, v) - doublelong *u; /* u = u - v */ - doublelong *v; -{ -/* printf("DLsub(%x %x, %x %x)\n", u->high, u->low, v->high, v->low);*/ - u->high -= v->high; - if (v->low > u->low) - u->high--; - u->low -= v->low; -} -/* -:h3.DLrightshift() - Macro to Shift Double Long Right by N -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h2.Fractional Pel Arithmetic -*/ -/* -:h3.FPmult() - Multiply Two Fractional Pel Values - -This funtion first calculates w = u * v to "doublelong" precision. -It then shifts w right by FRACTBITS bits, and checks that no -overflow will occur when the resulting value is passed back as -a fractpel. -*/ - -fractpel FPmult(u, v) - register fractpel u,v; -{ - doublelong w; - register int negative = FALSE; /* sign flag */ - int maxshort = MAXSHORT; /* To avoid that overflow warning (RMz) */ - - if ((u == 0) || (v == 0)) return (0); - - - if (u < 0) {u = -u; negative = TRUE;} - if (v < 0) {v = -v; negative = !negative;} - - if (u == TOFRACTPEL(1)) return ((negative) ? -v : v); - if (v == TOFRACTPEL(1)) return ((negative) ? -u : u); - - DLmult(&w, u, v); - DLrightshift(w, FRACTBITS); - if (w.high != 0 || SIGNBITON(w.low)) { - IfTrace2(TRUE,"FPmult: overflow, %dx%d\n", u, v); - w.low = TOFRACTPEL(maxshort); - } - - return ((negative) ? -w.low : w.low); -} - -/* -:h3.FPdiv() - Divide Two Fractional Pel Values - -These values may be signed. The function returns the quotient. -*/ - -fractpel FPdiv(dividend, divisor) - register fractpel dividend; - register fractpel divisor; -{ - doublelong w; /* result will be built here */ - int negative = FALSE; /* flag for sign bit */ - int maxshort = MAXSHORT; /* To avoid that overflow warning (RMz) */ - - if (dividend < 0) { - dividend = -dividend; - negative = TRUE; - } - if (divisor < 0) { - divisor = -divisor; - negative = !negative; - } - w.low = dividend << FRACTBITS; - w.high = dividend >> (LONGSIZE - FRACTBITS); - DLdiv(&w, divisor); - if (w.high != 0 || SIGNBITON(w.low)) { - IfTrace2(TRUE,"FPdiv: overflow, %d/%d\n", dividend, divisor); - w.low = TOFRACTPEL(maxshort); - } - return( (negative) ? -w.low : w.low); -} - -/* -:h3.FPstarslash() - Multiply then Divide - -Borrowing a chapter from the language Forth, it is useful to define -an operator that first multiplies by one constant then divides by -another, keeping the intermediate result in extended precision. -*/ - -fractpel FPstarslash(a, b, c) - register fractpel a,b,c; /* result = a * b / c */ -{ - doublelong w; /* result will be built here */ - int negative = FALSE; - int maxshort = MAXSHORT; /* To avoid that overflow warning (RMz) */ - - if (a < 0) { a = -a; negative = TRUE; } - if (b < 0) { b = -b; negative = !negative; } - if (c < 0) { c = -c; negative = !negative; } - - DLmult(&w, a, b); - DLdiv(&w, c); - if (w.high != 0 || SIGNBITON(w.low)) { - IfTrace3(TRUE,"FPstarslash: overflow, %d*%d/%d\n", a, b, c); - w.low = TOFRACTPEL(maxshort); - } - return((negative) ? -w.low : w.low); -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/arith.h xdvik-22.40n/libs/t1lib/lib/type1/arith.h --- xdvik-22.40l/libs/t1lib/lib/type1/arith.h Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/arith.h Thu Jan 1 00:00:00 1970 @@ -1,62 +0,0 @@ -/* $XConsortium: arith.h,v 1.2 91/10/10 11:17:49 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - -#include "types.h" - -void DLmult(),DLdiv(),DLadd(),DLsub(); - -fractpel FPmult(); -fractpel FPdiv(); -fractpel FPstarslash(); - -/*END SHARED*/ -/*SHARED*/ - -#define SHORTSIZE (sizeof(SHORT)*8) -#define LONGSIZE (SHORTSIZE*2) -#define MAXSHORT ((1<> N) + (((ULONG) dl.high) << (LONGSIZE - N)); \ - dl.high >>= N; \ -} - -/*END SHARED*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/blues.h xdvik-22.40n/libs/t1lib/lib/type1/blues.h --- xdvik-22.40l/libs/t1lib/lib/type1/blues.h Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/blues.h Thu Jan 1 00:00:00 1970 @@ -1,95 +0,0 @@ -/* $XConsortium: blues.h,v 1.2 91/10/10 11:17:52 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * Portions Copyright (c) 1990 Adobe Systems Incorporated. - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark or Adobe - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. - * - * IBM, LEXMARK, AND ADOBE PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY - * WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE - * ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING - * ANY DUTY TO SUPPORT OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY - * PORTION OF THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM, - * LEXMARK, OR ADOBE) ASSUMES THE ENTIRE COST OF ALL SERVICING, REPAIR AND - * CORRECTION. IN NO EVENT SHALL IBM, LEXMARK, OR ADOBE BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "types.h" - -extern psobj *GetType1CharString(); - -#define TOPLEFT 1 -#define BOTTOMRIGHT 2 - -#define NUMBLUEVALUES 14 -#define NUMOTHERBLUES 10 -#define NUMFAMILYBLUES 14 -#define NUMFAMILYOTHERBLUES 10 -#define NUMSTEMSNAPH 12 -#define NUMSTEMSNAPV 12 -#define NUMSTDHW 1 -#define NUMSTDVW 1 - -#define DEFAULTBOLDSTEMWIDTH 2.0 - -#define MAXALIGNMENTZONES ((NUMBLUEVALUES+NUMOTHERBLUES)/2) -#define DEFAULTBLUESCALE 0.039625 -#define DEFAULTBLUESHIFT 7 -#define DEFAULTBLUEFUZZ 1 -#define DEFAULTSTDHW 0 -#define DEFAULTSTDVW 0 -#define DEFAULTFORCEBOLD FALSE -#define DEFAULTLANGUAGEGROUP 0 -#define DEFAULTRNDSTEMUP FALSE -#define DEFAULTLENIV 4 -#define DEFAULTEXPANSIONFACTOR 0.06 - -/* see Type 1 Font Format book for explanations of these values */ -/* Note that we're currently doing nothing for minfeature and password. */ -struct blues_struct { - struct blues_struct *next; /* ptr to next Blues structure in list */ - int numBlueValues; /* # of BlueValues in following array */ - int BlueValues[NUMBLUEVALUES]; - int numOtherBlues; /* # of OtherBlues values in following array */ - int OtherBlues[NUMOTHERBLUES]; - int numFamilyBlues; /* # of FamilyBlues values in following array */ - int FamilyBlues[NUMFAMILYBLUES]; - int numFamilyOtherBlues; /* # of FamilyOtherBlues values in */ - int FamilyOtherBlues[NUMFAMILYOTHERBLUES]; /* this array */ - DOUBLE BlueScale; - int BlueShift; - int BlueFuzz; - DOUBLE StdHW; - DOUBLE StdVW; - int numStemSnapH; /* # of StemSnapH values in following array */ - DOUBLE StemSnapH[NUMSTEMSNAPH]; - int numStemSnapV; /* # of StemSnapV values in following array */ - DOUBLE StemSnapV[NUMSTEMSNAPV]; - int ForceBold; - int LanguageGroup; - int RndStemUp; - int lenIV; - DOUBLE ExpansionFactor; -}; - -/* the alignment zone structure -- somewhat similar to the stem structure */ -/* see Adobe Type1 Font Format book about the terms used in this structure */ -struct alignmentzone { - int topzone; /* TRUE if a topzone, FALSE if a bottom zone */ - DOUBLE bottomy, topy; /* interval of this alignment zone */ -}; diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/bstring.c xdvik-22.40n/libs/t1lib/lib/type1/bstring.c --- xdvik-22.40l/libs/t1lib/lib/type1/bstring.c Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/bstring.c Thu Jan 1 00:00:00 1970 @@ -1,9 +0,0 @@ -/* - * A simple memset() in case your ANSI C does not provide it - */ - -memset(void *s, int c, int length) -{ char *p = s; - - while (length--) *(p++) = c; -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/cluts.h xdvik-22.40n/libs/t1lib/lib/type1/cluts.h --- xdvik-22.40l/libs/t1lib/lib/type1/cluts.h Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/cluts.h Thu Jan 1 00:00:00 1970 @@ -1,35 +0,0 @@ -/* $XConsortium: cluts.h,v 1.2 91/10/10 11:17:54 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* STUB */ - -#define KillCLUT(T) -#define CopyCLUT(T) T -#define UniqueCLUT(T) - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/curves.c xdvik-22.40n/libs/t1lib/lib/type1/curves.c --- xdvik-22.40l/libs/t1lib/lib/type1/curves.c Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/curves.c Thu Jan 1 00:00:00 1970 @@ -1,220 +0,0 @@ -/* $XConsortium: curves.c,v 1.3 91/10/10 11:17:56 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 */ -/* All Rights Reserved */ - -/* License to use, copy, modify, and distribute this software */ -/* and its documentation for any purpose and without fee is */ -/* hereby granted, provided that licensee provides a license to */ -/* IBM, Corp. to use, copy, modify, and distribute derivative */ -/* works and their documentation for any purpose and without */ -/* fee, that the above copyright notice appear in all copies */ -/* and that both that copyright notice and this permission */ -/* notice appear in supporting documentation, and that the name */ -/* of IBM not be used in advertising or publicity pertaining to */ -/* distribution of the software without specific, written prior */ -/* permission. */ - -/* IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES */ -/* OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT */ -/* LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, */ -/* FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF */ -/* THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND */ -/* PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT */ -/* OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF */ -/* THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES */ -/* THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN */ -/* NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR */ -/* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING */ -/* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF */ -/* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT */ -/* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS */ -/* SOFTWARE. */ -/* -:h1.CURVES Module - Stepping Beziers - -This module is responsible for "rasterizing" -third order curves. That is, it changes the high level curve -specification into a list of pels that that curve travels -through. - -:h3.Include Files - -Include files needed: -*/ - -#include "types.h" -#include "objects.h" -#include "spaces.h" -#include "paths.h" -#include "regions.h" -#include "curves.h" -#include "lines.h" -#include "arith.h" - - -/* -:h3.Functions Provided to Other Modules - -External entry points: -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -Note that "stepping" and "flattening" are so similiar that they use the -same routine. When the "region" parameter is NULL, that is a flag that -we are flattening instead of stepping. -*/ -/* -:h2.Bezier Third Order Curves -*/ -/* -:h3.The "bezierinfo" Structure - -This structure is used to store information used when we subdivide -Bezier curves. -*/ - -struct bezierinfo { - struct region *region; /* the region being built or NULL */ - struct fractpoint last; /* not used yet; maybe could save some work */ - struct fractpoint origin; /* the origin of the bezier */ -} ; - -/* - Checking for termination of the subdivision process: - This is the stupidest test in the world, just check if the coordinatewise - distance from an end control point to the next control point is less than - one half pel. If so, we must be done. - This returns 1 if the subdivision is terminated and 0 if you still need - to subdivide. -*/ - -int BezierTerminationTest(xa,ya,xb,yb,xc,yc,xd,yd) -fractpel xa,ya,xb,yb,xc,yc,xd,yd; -{ - fractpel dmax; - dmax = TYPE1_ABS(xa - xb); - dmax = TYPE1_MAX(dmax,TYPE1_ABS(ya - yb)); - dmax = TYPE1_MAX(dmax,TYPE1_ABS(xd - xc)); - dmax = TYPE1_MAX(dmax,TYPE1_ABS(yd - yc)); - if(dmax > FPHALF) - return(0); /* not done yet */ - else - return(1); /* done */ -} - -/* -:h3.StepBezierRecurse() - The Recursive Logic in StepBezier() - -The recursion involves dividing the control polygon into two smaller -control polygons by finding the midpoints of the lines. This idea is -described in any graphics text book and its simplicity is what caused -Bezier to define his curves as he did. If the input region 'R' is NULL, -the result is a path that is the 'flattened' curve; otherwise StepBezier -returns nothing special. -*/ -static struct segment *StepBezierRecurse(I,xA,yA,xB,yB,xC,yC,xD,yD) - struct bezierinfo *I; /* Region under construction or NULL */ - fractpel xA,yA; /* A control point */ - fractpel xB,yB; /* B control point */ - fractpel xC,yC; /* C control point */ - fractpel xD,yD; /* D control point */ - -{ - if (BezierTerminationTest(xA,yA,xB,yB,xC,yC,xD,yD)) - { - if (I->region == NULL) - return(PathSegment(LINETYPE, xD - xA, yD - yA)); - else - StepLine(I->region, I->origin.x + xA, I->origin.y + yA, - I->origin.x + xD, I->origin.y + yD); - } - else - { - fractpel xAB,yAB; - fractpel xBC,yBC; - fractpel xCD,yCD; - fractpel xABC,yABC; - fractpel xBCD,yBCD; - fractpel xABCD,yABCD; - - xAB = xA + xB; yAB = yA + yB; - xBC = xB + xC; yBC = yB + yC; - xCD = xC + xD; yCD = yC + yD; - - xABC = xAB + xBC; yABC = yAB + yBC; - xBCD = xBC + xCD; yBCD = yBC + yCD; - - xABCD = xABC + xBCD; yABCD = yABC + yBCD; - - xAB >>= 1; yAB >>= 1; - xBC >>= 1; yBC >>= 1; - xCD >>= 1; yCD >>= 1; - xABC >>= 2; yABC >>= 2; - xBCD >>= 2; yBCD >>= 2; - xABCD >>= 3; yABCD >>= 3; - - if (I->region == NULL) - { - return( Join( - StepBezierRecurse(I, xA, yA, xAB, yAB, xABC, yABC, xABCD, yABCD), - StepBezierRecurse(I, xABCD, yABCD, xBCD, yBCD, xCD, yCD, xD, yD) - ) - ); - } - else - { - StepBezierRecurse(I, xA, yA, xAB, yAB, xABC, yABC, xABCD, yABCD); - StepBezierRecurse(I, xABCD, yABCD, xBCD, yBCD, xCD, yCD, xD, yD); - } - } - /*NOTREACHED*/ - /* To make ANSI-C-comnpiler happy (RMz): */ - return(0); -} - -/* -:h3.TOOBIG() - Macro to Test if a Coordinate is Too Big to Bezier SubDivide Normally - -Intermediate values in the Bezier subdivision are 8 times bigger than -the starting values. If this overflows, a 'long', we are in trouble: -*/ - -#define BITS (sizeof(LONG)*8) -#define HIGHTEST(p) (((p)>>(BITS-4)) != 0) /* includes sign bit */ -#define TOOBIG(xy) ((xy < 0) ? HIGHTEST(-xy) : HIGHTEST(xy)) - -/* -:h3.StepBezier() - Produce Run Ends for a Bezier Curve - -This is the entry point called from outside the module. -*/ - -struct segment *StepBezier(R, xA, yA, xB, yB, xC, yC, xD, yD) - struct region *R; /* Region under construction or NULL */ - fractpel xA,yA; /* A control point */ - fractpel xB,yB; /* B control point */ - fractpel xC,yC; /* C control point */ - fractpel xD,yD; /* D control point */ -{ - struct bezierinfo Info; - - Info.region = R; - Info.origin.x = xA; - Info.origin.y = yA; - - xB -= xA; - xC -= xA; - xD -= xA; - yB -= yA; - yC -= yA; - yD -= yA; - - if ( TOOBIG(xB) || TOOBIG(yB) || TOOBIG(xC) || TOOBIG(yC) - || TOOBIG(xD) || TOOBIG(yD) ) - abort("Beziers this big not yet supported", 3); - - return(StepBezierRecurse(&Info, - (fractpel) 0, (fractpel) 0, xB, yB, xC, yC, xD, yD)); -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/curves.h xdvik-22.40n/libs/t1lib/lib/type1/curves.h --- xdvik-22.40l/libs/t1lib/lib/type1/curves.h Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/curves.h Thu Jan 1 00:00:00 1970 @@ -1,40 +0,0 @@ -/* $XConsortium: curves.h,v 1.2 91/10/10 11:17:59 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - -#define StepConic(R,xA,yA,xB,yB,xC,yC,r) t1_StepConic(R,xA,yA,xB,yB,xC,yC,r) -#define StepBezier(R,xA,yA,xB,yB,xC,yC,xD,yD) t1_StepBezier(R,xA,yA,xB,yB,xC,yC,xD,yD) - -#define FlattenConic(xM,yM,xC,yC,r) t1_StepConic(NULL,(fractpel)0,(fractpel)0,xM,yM,xC,yC,r) -#define FlattenBezier(xB,yB,xC,yC,xD,yD) t1_StepBezier(NULL,(fractpel)0,(fractpel)0,xB,yB,xC,yC,xD,yD) - -struct segment *t1_StepConic(); -struct segment *t1_StepBezier(); - -/*END SHARED*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/digit.h xdvik-22.40n/libs/t1lib/lib/type1/digit.h --- xdvik-22.40l/libs/t1lib/lib/type1/digit.h Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/digit.h Thu Jan 1 00:00:00 1970 @@ -1,64 +0,0 @@ -/* $XConsortium: digit.h,v 1.2 91/10/10 11:18:01 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* -------------------------------------- */ -/* --- MACHINE GENERATED, DO NOT EDIT --- */ -/* -------------------------------------- */ - -#ifndef DIGIT -#define DIGIT 1 - -/* - * Digit Value Table -- - * - * The entries in the Digit Value Table map character - * codes in the set {0-9,a-z,A-Z} to their numeric - * values as part of numbers of radix 2-36. - * - */ -unsigned char digit_value[256] = { -0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18, - 0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18, - 0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF -}; - -#endif diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/ffilest.h xdvik-22.40n/libs/t1lib/lib/type1/ffilest.h --- xdvik-22.40l/libs/t1lib/lib/type1/ffilest.h Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/ffilest.h Thu Jan 1 00:00:00 1970 @@ -1,151 +0,0 @@ -/* - * $XConsortium: fontfilest.h,v 1.3 91/07/16 20:15:16 keith Exp $ - * - * Copyright 1991 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifndef _FONTFILEST_H_ -#define _FONTFILEST_H_ - -#ifdef XSERVER -#include -#else -#include "types.h" -#include "Xstuff.h" -#endif - -#include "fontmisc.h" -#include "fontstruct.h" -#include "fontfile.h" -#include "fontxlfd.h" - -typedef struct _FontName { - char *name; - short length; - short ndashes; -} FontNameRec; - -typedef struct _FontScaled { - FontScalableRec vals; - FontEntryPtr bitmap; - FontPtr pFont; -} FontScaledRec; - -typedef struct _FontScalableExtra { - FontScalableRec defaults; - int numScaled; - int sizeScaled; - FontScaledPtr scaled; - pointer private; -} FontScalableExtraRec; - -typedef struct _FontScalableEntry { - FontRendererPtr renderer; - char *fileName; - FontScalableExtraPtr extra; -} FontScalableEntryRec; - -/* - * This "can't" work yet - the returned alias string must be permanent, - * but this layer would need to generate the appropriate name from the - * resolved scalable + the XLFD values passed in. XXX - */ - -typedef struct _FontScaleAliasEntry { - char *resolved; -} FontScaleAliasEntryRec; - -typedef struct _FontBitmapEntry { - FontRendererPtr renderer; - char *fileName; - FontPtr pFont; -} FontBitmapEntryRec; - -typedef struct _FontAliasEntry { - char *resolved; -} FontAliasEntryRec; - -typedef struct _FontBCEntry { - FontScalableRec vals; - FontEntryPtr entry; -} FontBCEntryRec; - -typedef struct _FontEntry { - FontNameRec name; - int type; - union _FontEntryParts { - FontScalableEntryRec scalable; - FontBitmapEntryRec bitmap; - FontAliasEntryRec alias; - FontBCEntryRec bc; - } u; -} FontEntryRec; - -typedef struct _FontTable { - int used; - int size; - FontEntryPtr entries; - Bool sorted; -} FontTableRec; - -typedef struct _FontDirectory { - char *directory; - ULONG dir_mtime; - ULONG alias_mtime; - FontTableRec scalable; - FontTableRec nonScalable; -} FontDirectoryRec; - -typedef struct _FontRenderer { - char *fileSuffix; - int fileSuffixLen; - int (*OpenBitmap)(/* fpe, pFont, flags, entry, fileName, format, fmask */); - int (*OpenScalable)(/* fpe, pFont, flags, entry, fileName, vals, format, fmask */); - int (*GetInfoBitmap)(/* fpe, pFontInfo, entry, fileName */); - int (*GetInfoScalable)(/* fpe, pFontInfo, entry, fileName, vals */); - int number; -} FontRendererRec; - -typedef struct _FontRenders { - int number; - FontRendererPtr *renderers; -} FontRenderersRec, *FontRenderersPtr; - -typedef struct _BitmapInstance { - FontScalableRec vals; - FontBitmapEntryPtr bitmap; -} BitmapInstanceRec, *BitmapInstancePtr; - -typedef struct _BitmapScalablePrivate { - int numInstances; - BitmapInstancePtr instances; -} BitmapScalablePrivateRec, *BitmapScalablePrivatePtr; - -typedef struct _BitmapSources { - FontPathElementPtr *fpe; - int size; - int count; -} BitmapSourcesRec, *BitmapSourcesPtr; - -extern BitmapSourcesRec FontFileBitmapSources; - -#endif /* _FONTFILEST_H_ */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/font.h xdvik-22.40n/libs/t1lib/lib/type1/font.h --- xdvik-22.40l/libs/t1lib/lib/type1/font.h Wed Apr 18 14:24:09 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/font.h Thu Jan 1 00:00:00 1970 @@ -1,107 +0,0 @@ -/* $XConsortium: font.h,v 1.8 91/07/19 21:03:49 rws Exp $ */ -/*********************************************************** -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, -and the Massachusetts Institute of Technology, Cambridge, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Digital or MIT not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* $NCDId: @(#)font.h,v 1.7 1991/06/24 17:00:23 lemke Exp $ */ - -#ifndef FONT_H -#define FONT_H - -#ifndef BitmapFormatByteOrderMask -#include "fsmasks.h" -#endif - -/* data structures */ -typedef struct _Font *FontPtr; -typedef struct _FontInfo *FontInfoPtr; -typedef struct _FontProp *FontPropPtr; -typedef struct _ExtentInfo *ExtentInfoPtr; -typedef struct _FontPathElement *FontPathElementPtr; -typedef struct _CharInfo *CharInfoPtr; -typedef struct _FontNames *FontNamesPtr; -typedef struct _FontResolution *FontResolutionPtr; - -#define NullCharInfo ((CharInfoPtr) 0) -#define NullFont ((FontPtr) 0) -#define NullFontInfo ((FontInfoPtr) 0) - - /* draw direction */ -#define LeftToRight 0 -#define RightToLeft 1 -#define BottomToTop 2 -#define TopToBottom 3 -typedef int DrawDirection; - -#define NO_SUCH_CHAR -1 - - -#define FontAliasType 0x1000 - -#define AllocError 80 -#define StillWorking 81 -#define FontNameAlias 82 -#define BadFontName 83 -#define Suspended 84 -#define Successful 85 -#define BadFontPath 86 -#define BadCharRange 87 -#define BadFontFormat 88 -#define FPEResetFailed 89 /* for when an FPE reset won't work */ - -/* OpenFont flags */ -#define FontLoadInfo 0x0001 -#define FontLoadProps 0x0002 -#define FontLoadMetrics 0x0004 -#define FontLoadBitmaps 0x0008 -#define FontLoadAll 0x000f -#define FontOpenSync 0x0010 - -/* Query flags */ -#define LoadAll 0x1 -#define FinishRamge 0x2 -#define EightBitFont 0x4 -#define SixteenBitFont 0x8 - -typedef char *closure; - -extern int StartListFontsWithInfo( /* client, length, pattern, maxNames */ ); -extern int ListFonts( /* client, length, pattern, maxNames */ ); - -extern FontNamesPtr MakeFontNamesRecord( /* size */ ); -extern void FreeFontNames(); -extern int AddFontNamesName(); - -extern int FontToFSError(); - -extern FontResolutionPtr GetClientResolution(); - -typedef struct _FontPatternCache *FontPatternCachePtr; - -extern FontPatternCachePtr MakeFontPatternCache (); -extern void FreeFontPatternCache (); -extern void EmtpyFontPatternCache (); -extern void CacheFontPattern (); -extern FontPtr FindCachedFontPattern (); -extern void RemoveCachedFontPattern (); - -#endif /* FONT_H */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/fontfcn.c xdvik-22.40n/libs/t1lib/lib/type1/fontfcn.c --- xdvik-22.40l/libs/t1lib/lib/type1/fontfcn.c Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/fontfcn.c Thu Jan 1 00:00:00 1970 @@ -1,1105 +0,0 @@ -/* $XConsortium: fontfcn.c,v 1.8 92/03/27 18:15:45 eswu Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */ - -#include -#include -#include - -#include "t1imager.h" -#include "util.h" -#include "fontfcn.h" -#include "fontmisc.h" -#include "paths_rmz.h" - -#include "../t1lib/parseAFM.h" -#include "../t1lib/t1types.h" -#include "../t1lib/t1extern.h" -#include "../t1lib/t1misc.h" -#include "../t1lib/t1base.h" -#include "../t1lib/t1finfo.h" - -extern xobject Type1Char(psfont *env, struct XYspace *S, - psobj *charstrP, psobj *subrsP, - psobj *osubrsP, - struct blues_struct *bluesP, - int *modeP, char *name); -extern xobject Type1Line(psfont *env, struct XYspace *S, - float line_position, - float line_thickness, - float line_length); -extern boolean Init_BuiltInEncoding( void); -void objFormatName(psobj *objP, int length, char *valueP); - -extern void T1io_reset( void); - -#define BEZIERTYPE 0x10+0x02 -#define LINETYPE 0x10+0x00 -#define MOVETYPE 0x10+0x05 - - -/***================================================================***/ -/* GLOBALS */ -/***================================================================***/ -static char CurCharName[257]=""; -static char BaseCharName[257]=""; -char CurFontName[120]; -char *CurFontEnv; -char *vm_base = NULL; - -static char notdef[]=".notdef"; - - -/* the following is inserted by RMz for VM checking and reallocating: */ -char *vm_used = NULL; -extern int vm_init_count; -extern int vm_init_amount; - -static psfont *FontP = NULL; -psfont TheCurrentFont; - - -/***================================================================***/ -/* SearchDict - look for name */ -/* - compare for match on len and string */ -/* return 0 - not found. */ -/* return n - nth element in dictionary. */ -/***================================================================***/ -int SearchDictName(dictP,keyP) - psdict *dictP; - psobj *keyP; -{ - int i,n; - - - n = dictP[0].key.len; - for (i=1;i<=n;i++) { /* scan the intire dictionary */ - if ( - (dictP[i].key.len == keyP->len ) - && - (strncmp(dictP[i].key.data.valueP, - keyP->data.valueP, - keyP->len) == 0 - ) - ) return(i); - } - return(0); -} -/***================================================================***/ -/* assignment of &TheCurrentFont removed by RMz: - */ -boolean initFont() -{ - if (!(vm_init())) return(FALSE); - vm_base = vm_next_byte(); - if (!(Init_BuiltInEncoding())) return(FALSE); - strcpy(CurFontName, ""); /* iniitialize to none */ - FontP->vm_start = vm_next_byte(); - FontP->FontFileName.len = 0; - FontP->FontFileName.data.valueP = CurFontName; - return(TRUE); -} -/***================================================================***/ -int resetFont(env) -char *env; -{ - - vm_next = FontP->vm_start; - vm_free = vm_size - ( vm_next - vm_base); - FontP->Subrs.len = 0; - FontP->Subrs.data.stringP = NULL; - FontP->CharStringsP = NULL; - FontP->Private = NULL; - FontP->fontInfoP = NULL; - FontP->BluesP = NULL; - /* This will load the font into the FontP */ - strcpy(CurFontName,env); - FontP->FontFileName.len = strlen(CurFontName); - FontP->FontFileName.data.nameP = CurFontName; - T1io_reset(); - - return(0); - -} -/***================================================================***/ -/* Read font used to attempt to load the font and, upon failure, - try a second time with twice as much memory. Unfortunately, if - it's a really complex font, simply using 2*vm_size may be insufficient. - I've modified it so that the program will try progressively larger - amounts of memory until it really runs out or the font loads - successfully. (ndw) -*/ -int readFont(env) -char *env; -{ - int rcode; - /* int memscale = 2; */ /* initially, try twice just like we used to ... */ - - /* restore the virtual memory and eliminate old font */ - - resetFont(env); - /* This will load the font into the FontP */ - - rcode = scan_font(FontP); - return(rcode); -} - - -static int isCompositeChar( int FontID, - char *charname) -{ - int i; - FontInfo *pAFMData; - - if (pFontBase->pFontArray[FontID].pAFMData==NULL) { - /* No AFM data present */ - return( -1); - } - - pAFMData=pFontBase->pFontArray[FontID].pAFMData; - for ( i=0; inumOfComps; i++) { - if (strcmp( pAFMData->ccd[i].ccName, charname)==0) - return( i); - } - - return( -1); - -} - - - -/* dump a description of path elements to stdout */ -static T1_PATHPOINT getDisplacement( struct segment *path) -{ - - register struct segment *ipath; - register struct beziersegment *ibpath; - T1_PATHPOINT point={0,0}; - - /* Step through the path list */ - ipath=(struct segment *)path; - - do { - if (ipath->type==LINETYPE) { - point.x+=ipath->dest.x; - point.y+=ipath->dest.y; - } - else if (ipath->type==MOVETYPE) { - point.x+=ipath->dest.x; - point.y+=ipath->dest.y; - } - else if (ipath->type==BEZIERTYPE) { - ibpath=(struct beziersegment *)ipath; - point.x+=ibpath->dest.x; - point.y+=ibpath->dest.y; - } - ipath=ipath->link; - } while (ipath!=NULL); - return( point); - -} - - - -/***================================================================***/ -/* RMz: instead of code, which is a character pointer to the name - of the character, we use "ev" which is a pointer to a desired - encoding vector (or NULL if font-internal encoding should be - used) and "index" as an index into the desired encoding vector! - The user thus has the opportunity of supplying whatever encoding - he wants. Font_Ptr is the pointer to the local psfont-structure. - */ - -xobject fontfcnB(int FontID, int modflag, - struct XYspace *S, char **ev, - unsigned char index, int *mode, - psfont *Font_Ptr, - int do_raster) -{ - - psobj *charnameP; /* points to psobj that is name of character*/ - FontInfo *pAFMData=NULL; - int i=-1; - int j=0; - int numPieces=1; - int N; - T1_PATHPOINT currdisp; - int basechar; - - psdict *CharStringsDictP; /* dictionary with char strings */ - psobj CodeName; /* used to store the translation of the name*/ - psobj *SubrsArrayP; - psobj *theStringP; - int localmode=0; - - struct segment *charpath=NULL; /* the path for this character */ - struct segment *tmppath1=NULL; - struct segment *tmppath2=NULL; - struct segment *tmppath3=NULL; - struct segment *tmppath4=NULL; - - - /* set the global font pointer to the address of already allocated - structure and setup pointers*/ - FontP=Font_Ptr; - CharStringsDictP = FontP->CharStringsP; - SubrsArrayP = &(FontP->Subrs); - charnameP = &CodeName; - - if (ev==NULL){ /* font-internal encoding should be used */ - charnameP->len = FontP->fontInfoP[ENCODING].value.data.arrayP[index].len; - charnameP->data.stringP = (unsigned char *) FontP->fontInfoP[ENCODING].value.data.arrayP[index].data.arrayP; - } - else{ /* some user-supplied encoding is to be used */ - charnameP->len = strlen(ev[index]); - charnameP->data.stringP = (unsigned char *) ev[index]; - } - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - - - /* search the chars string for this charname as key */ - basechar = SearchDictName(CharStringsDictP,charnameP); - if (basechar<=0) { - /* Check first, whether a char in question is a composite char */ - if ((i=isCompositeChar( FontID, CurCharName))>-1) { - /* i is now the index of the composite char definitions - (starting at 0). At this point it is clear that AFM-info - must be present -> fetch first component of composite char. */ - pAFMData=pFontBase->pFontArray[FontID].pAFMData; - charnameP->len=strlen( pAFMData->ccd[i].pieces[0].pccName); - charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[0].pccName; - numPieces=pAFMData->ccd[i].numOfPieces; - - if ((basechar=SearchDictName(CharStringsDictP,charnameP))<=0) { - /* this is bad, AFM-file and font file do not match. This - will most probably lead to errors or inconsistencies later. - However, we substitute .notdef and inform the user via - logfile and T1_errno. */ - sprintf( err_warn_msg_buf, - "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", - pAFMData->ccd[i].pieces[0].pccName, - pAFMData->ccd[i].ccName, FontID); - T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); - T1_errno=T1ERR_COMPOSITE_CHAR; - } - } - } - - if (basechar<=0) { /* This means the requested char is unknown or the - base char of a composite is not found -> - we substitute .notdef */ - charnameP = &CodeName; - charnameP->len = 7; - charnameP->data.stringP = (unsigned char *) notdef; - basechar = SearchDictName(CharStringsDictP,charnameP); - localmode=FF_NOTDEF_SUBST; - /* Font must be completely damaged if it doesn't define a .notdef */ - if (basechar<=0) { - *mode=FF_PARSE_ERROR; - return(NULL); - } - } /* if (basechar<=0) */ - /* basechar is now the index of the base character in the CharStrings - dictionary */ - - /* we provide the Type1Char() procedure with the name of the character - to rasterize for debugging purposes */ - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - /* get CharString and character path */ - theStringP = &(CharStringsDictP[basechar].value); - tmppath2 = (struct segment *) Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, - FontP->BluesP,mode,CurCharName); - /* if Type1Char reported an error, then return */ - if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) - return(NULL); - - /* Defer rastering to later, we first have to handle the composite - symbols */ - for (j=1; jlen=strlen( pAFMData->ccd[i].pieces[j].pccName); - charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[j].pccName; - /* get CharString definition */ - if ((N=SearchDictName(CharStringsDictP,charnameP))<=0) { - /* handling of errors, see comments above ... */ - sprintf( err_warn_msg_buf, - "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", - pAFMData->ccd[i].pieces[j].pccName, - pAFMData->ccd[i].ccName, FontID); - T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); - charnameP = &CodeName; - charnameP->len = 7; - charnameP->data.stringP = (unsigned char *) notdef; - N = SearchDictName(CharStringsDictP,charnameP); - localmode=FF_NOTDEF_SUBST; - /* damaged Font */ - if (N<=0) { - *mode=FF_PARSE_ERROR; - if (charpath!=NULL) { - KillPath( charpath); - } - return(NULL); - } - } - theStringP = &(CharStringsDictP[N].value); - tmppath1=(struct segment *)ILoc(S, - pAFMData->ccd[i].pieces[j].deltax, - pAFMData->ccd[i].pieces[j].deltay); - - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - charpath=(struct segment *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, - FontP->BluesP,mode,CurCharName); - /* return if Type1Char reports an error */ - if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) - return(NULL); - /* get escapement of current symbol */ - currdisp=getDisplacement( charpath); - /* concat displacement and symbol path */ - charpath=(struct segment *)Join(tmppath1,charpath); - /* for composite symbols we have to step back the char escapement. - this is, in order to be able to use accents that cause a - non zero displacement of the current point! We further have to - step back the displacement from composite char data. */ - tmppath1=(struct segment *)t1_PathSegment( MOVETYPE, -currdisp.x, -currdisp.y); - tmppath3=(struct segment *)ILoc(S, - -pAFMData->ccd[i].pieces[j].deltax, - -pAFMData->ccd[i].pieces[j].deltay); - tmppath3=(struct segment *)Join(tmppath1,tmppath3); - /* create path, or, respectively, append to existing path */ - if (tmppath4==NULL) { - tmppath4=(struct segment *)Join(charpath,tmppath3); - } - else { - charpath=(struct segment *)Join(charpath,tmppath3); - tmppath4=(struct segment *)Join(tmppath4,charpath); - } - } - - /* concat composite symbols and base char */ - if (tmppath4==NULL) { /* no previous composite symbols */ - charpath=tmppath2; /* a simple char */ - } - else { - charpath=(struct segment *)Join(tmppath4,tmppath2); - } - - - if (do_raster) { - /* fill with winding rule unless path was requested */ - if (*mode != FF_PATH) { - charpath = (struct segment *)Interior(charpath,WINDINGRULE+CONTINUITY); - } - } - - if (*mode==0) - *mode=localmode; - - return((xobject) charpath); -} - - - - -/***================================================================***/ -/* fontfcnA(env, mode) */ -/* */ -/* env is a pointer to a string that contains the fontname. */ -/* */ -/* 1) initialize the font - global indicates it has been done */ -/* 2) load the font */ -/* */ -/* This function has been modified by RMz. It now takes a pointer which - already contains the address of a valid type1 font structure as the - third argument. The value of this pointer is first handed to FontP - so that most other routines may be used without changes */ - -#define MAXTRIAL 4 - -/***================================================================***/ -Bool fontfcnA(env,mode,Font_Ptr) -char *env; -int *mode; -psfont *Font_Ptr; - -{ - int i, result; - - /* set the global font pointer to the address of already allocated - structure */ - FontP=Font_Ptr; - - InitImager(); - - /* Read the font program. */ - for (i=1; ifontInfoP; - objFormatName(&nameObj,strlen(infoName),infoName); - N = SearchDictName(dictP,&nameObj); - /* if found */ - if ( N > 0 ) { - *rcodeP = 0; - switch (dictP[N].value.type) { - case OBJ_ARRAY: - valueP = dictP[N].value.data.arrayP; - if (strcmp(infoName,"FontMatrix") == 0) { - /* 6 elments, return them as floats */ - for (i=0;i<6;i++) { - if (valueP->type == OBJ_INTEGER ) - ((float *)infoValue)[i] = valueP->data.integer; - else - ((float *)infoValue)[i] = valueP->data.real; - valueP++; - } - } - if (strcmp(infoName,"FontBBox") == 0) { - /* 4 elments for Bounding Box. all integers */ - for (i=0;i<4;i++) { - ((int *)infoValue)[i] = valueP->data.integer; - valueP++; - } - break; - case OBJ_INTEGER: - case OBJ_BOOLEAN: - *((int *)infoValue) = dictP[N].value.data.integer; - break; - case OBJ_REAL: - *((float *)infoValue) = dictP[N].value.data.real; - break; - case OBJ_NAME: - case OBJ_STRING: - *((char **)infoValue) = dictP[N].value.data.valueP; - break; - default: - *rcodeP = 1; - break; - } - } - } - else *rcodeP = 1; -} - - -/***================================================================***/ -/* RMz: instead of code, which is a character pointer to the name - of the character, we use "ev" which is a pointer to a desired - encoding vector (or NULL if font-internal encoding should be - used) and "index" as an index into the desired encoding vector! - The user thus has the opportunity of supplying whatever encoding - he wants. Font_Ptr is the pointer to the local psfont-structure. - */ -xobject fontfcnB_string( int FontID, int modflag, - struct XYspace *S, char **ev, - unsigned char *string, int no_chars, - int *mode, psfont *Font_Ptr, - int *kern_pairs, long spacewidth, - int do_raster) -{ - - psobj *charnameP; /* points to psobj that is name of character*/ - FontInfo *pAFMData=NULL; - int i=-1; - int j=0; - int k=0; - long acc_width=0; - int numPieces=1; - int N; - T1_PATHPOINT currdisp; - int basechar; - - psdict *CharStringsDictP; /* dictionary with char strings */ - psobj CodeName; /* used to store the translation of the name*/ - psobj *SubrsArrayP; - psobj *theStringP; - int localmode=0; - - struct segment *charpath=NULL; /* the path for this character */ - struct segment *tmppath1=NULL; - struct segment *tmppath2=NULL; - struct segment *tmppath3=NULL; - struct segment *tmppath4=NULL; - struct segment *tmppath5=NULL; - - - /* set the global font pointer to the address of already allocated - structure and setup pointers*/ - FontP=Font_Ptr; - CharStringsDictP = FontP->CharStringsP; - SubrsArrayP = &(FontP->Subrs); - charnameP = &CodeName; - - - /* In the following for-loop, all characters are processed, one after - the other. Between them, the amount of kerning is inserted. - The number of path variables used is somewhat numerous. We use the - follwing conventions: - - charpath: the overall path of the string. - tmppath5: the overall path of one component (possibly a composite symbol) - tmppath2: the path of a simple char or base char of a composite - tmppath4: the path of all "accents" of a composite symbol - */ - for (k=0; klen = FontP->fontInfoP[ENCODING].value.data.arrayP[string[k]].len; - charnameP->data.stringP = (unsigned char *) FontP->fontInfoP[ENCODING].value.data.arrayP[string[k]].data.arrayP; - } - else { /* some user-supplied encoding is to be used */ - charnameP = &CodeName; - charnameP->len = strlen(ev[string[k]]); - charnameP->data.stringP = (unsigned char*) ev[string[k]]; - } - - /* Spacing is to be under users control: => if space is the charname, don't - raster it. Rather, generate a horizontal movement of spacewidth: */ - if (strcmp((char *)charnameP->data.stringP, "space")==0){ - tmppath5=(struct segment *)ILoc(S, spacewidth,0); - acc_width += spacewidth; - } - else { - /* here a character or composite character is to be constructed */ - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - - /* search the CharString for this charname as key */ - basechar = SearchDictName(CharStringsDictP,charnameP); - if (basechar<=0) { - /* Check first, whether a char in question is a composite char */ - if ((i=isCompositeChar( FontID, CurCharName))>-1) { - /* i is now the index of the composite char definitions - (starting at 0). At this point it is clear that AFM-info - must be present -> fetch first component of composite char. */ - pAFMData=pFontBase->pFontArray[FontID].pAFMData; - charnameP->len=strlen( pAFMData->ccd[i].pieces[0].pccName); - charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[0].pccName; - numPieces=pAFMData->ccd[i].numOfPieces; - - if ((basechar=SearchDictName(CharStringsDictP,charnameP))<=0) { - /* this is bad, AFM-file and font file do not match. This - will most probably lead to errors or inconsistencies later. - However, we substitute .notdef and inform the user via - logfile and T1_errno. */ - sprintf( err_warn_msg_buf, - "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", - pAFMData->ccd[i].pieces[0].pccName, - pAFMData->ccd[i].ccName, FontID); - T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); - T1_errno=T1ERR_COMPOSITE_CHAR; - } - } - } - - if (basechar<=0) { /* This means the requested char is unknown or the - base char of a composite is not found -> - we substitute .notdef */ - charnameP = &CodeName; - charnameP->len = 7; - charnameP->data.stringP = (unsigned char *) notdef; - basechar = SearchDictName(CharStringsDictP,charnameP); - localmode=FF_NOTDEF_SUBST; - /* Font must be completely damaged if it doesn't define a .notdef */ - if (basechar<=0) { - *mode=FF_PARSE_ERROR; - return(NULL); - } - } /* if (basechar<=0) */ - /* basechar is now the index of the base character in the CharStrings - dictionary */ - - /* we provide the Type1Char() procedure with the name of the character - to rasterize for debugging purposes */ - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - /* get CharString and character path */ - theStringP = &(CharStringsDictP[basechar].value); - tmppath2 = (struct segment *) Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, - FontP->BluesP,mode,CurCharName); - strcpy( BaseCharName, CurCharName); - /* if Type1Char reports an error, clean up and return */ - if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) { - if (charpath!=NULL) { - KillPath( charpath); - } - if (tmppath1!=NULL) { - KillPath( tmppath1); - } - if (tmppath2!=NULL) { - KillPath( tmppath2); - } - if (tmppath3!=NULL) { - KillPath( tmppath3); - } - if (tmppath4!=NULL) { - KillPath( tmppath4); - } - if (tmppath5!=NULL) { - KillPath( tmppath5); - } - return(NULL); - } - - /* Defer rastering to later, we first have to handle the composite - symbols */ - for (j=1; jlen=strlen( pAFMData->ccd[i].pieces[j].pccName); - charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[j].pccName; - /* get CharString definition */ - if ((N=SearchDictName(CharStringsDictP,charnameP))<=0) { - /* handling of errors, see comments above ... */ - sprintf( err_warn_msg_buf, - "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", - pAFMData->ccd[i].pieces[j].pccName, - pAFMData->ccd[i].ccName, FontID); - T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); - charnameP = &CodeName; - charnameP->len = 7; - charnameP->data.stringP = (unsigned char *) notdef; - N = SearchDictName(CharStringsDictP,charnameP); - localmode=FF_NOTDEF_SUBST; - /* an undefined .notdef is fatal -> clean up and return */ - if (N<=0) { - *mode=FF_PARSE_ERROR; - if (charpath!=NULL) { - KillPath( charpath); - } - if (tmppath1!=NULL) { - KillPath( tmppath1); - } - if (tmppath2!=NULL) { - KillPath( tmppath2); - } - if (tmppath3!=NULL) { - KillPath( tmppath3); - } - if (tmppath4!=NULL) { - KillPath( tmppath4); - } - if (tmppath5!=NULL) { - KillPath( tmppath5); - } - return(NULL); - } - } - theStringP = &(CharStringsDictP[N].value); - tmppath1=(struct segment *)ILoc(S, - pAFMData->ccd[i].pieces[j].deltax, - pAFMData->ccd[i].pieces[j].deltay); - - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - tmppath5=(struct segment *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, - FontP->BluesP,mode,CurCharName); - /* return if Type1Char reports an error */ - if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) - return(NULL); - /* get escapement of current symbol */ - currdisp=getDisplacement( tmppath5); - /* concat displacement and symbol path */ - tmppath5=(struct segment *)Join(tmppath1,tmppath5); - /* for composite symbols we have to step back the char escapement. - this is, in order to be able to use accents that cause a - non zero displacement of the current point! We further have to - step back the displacement from composite char data. */ - tmppath1=(struct segment *)t1_PathSegment( MOVETYPE, -currdisp.x, -currdisp.y); - tmppath3=(struct segment *)ILoc(S, - -pAFMData->ccd[i].pieces[j].deltax, - -pAFMData->ccd[i].pieces[j].deltay); - tmppath3=(struct segment *)Join(tmppath1,tmppath3); - /* create path, or, respectively, append to existing path */ - if (tmppath4==NULL) { - tmppath4=(struct segment *)Join(tmppath5,tmppath3); - } - else { - tmppath5=(struct segment *)Join(tmppath5,tmppath3); - tmppath4=(struct segment *)Join(tmppath4,tmppath5); - } - } - - /* concat composite symbols and base char. We use tmppath5 to store - the path of the resulting (possibly composite) character. */ - if (tmppath4==NULL) { /* no previous composite symbols */ - tmppath5=tmppath2; /* a simple char */ - } - else { - tmppath5=(struct segment *)Join(tmppath4,tmppath2); - } - - - /* Accumulate displacement, but be careful: In case of composite - characters, we have to take the escapement of the base char only - into account, because accents do not cause spacing. The path is - constructed in a way that this automatically matches. - */ - if (numPieces>1) { /* composite character */ - acc_width +=pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[string[k]]+1)].wx; - } - else { /* ordinary character */ - acc_width +=pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[string[k]]-1].wx; - } - - } /* else (if (char==space) */ - - /* character path is now stored in tmppath5. It may be a composite character. - Insert kerning amount, if it is not the last character of the string. */ - if (kpFontArray[FontID].UndrLnPos, - pFontBase->pFontArray[FontID].UndrLnThick, - (float) acc_width); - charpath=(struct segment *)Join(charpath,tmppath2); - } - if (modflag & T1_OVERLINE){ - tmppath2=(struct segment *)Type1Line(FontP,S, - pFontBase->pFontArray[FontID].OvrLnPos, - pFontBase->pFontArray[FontID].OvrLnThick, - (float) acc_width); - charpath=(struct segment *)Join(charpath,tmppath2); - } - if (modflag & T1_OVERSTRIKE){ - tmppath2=(struct segment *)Type1Line(FontP,S, - pFontBase->pFontArray[FontID].OvrStrkPos, - pFontBase->pFontArray[FontID].OvrStrkThick, - (float) acc_width); - charpath=(struct segment *)Join(charpath,tmppath2); - } - - /* - printf("charpath->type: %x\n",charpath->type); - printf("path1->type: %x\n",path1->type); - printf("path2->type: %x\n",path2->type); - */ - - /* if Type1Char reported an error, then return */ - - if ( *mode == FF_PARSE_ERROR) return(NULL); - if ( *mode == FF_PATH_ERROR) return(NULL); - if (do_raster) { - /* fill with winding rule unless path was requested */ - if (*mode != FF_PATH) { - charpath = (struct segment *) Interior((path) charpath,WINDINGRULE+CONTINUITY); - } - } - - if (*mode==0) - *mode=localmode; - - return((path)charpath); -} - - -/* This special variant is for generating character bitmaps from - charactername */ -xobject fontfcnB_ByName( int FontID, int modflag, - struct XYspace *S, - unsigned char *charname, - int *mode, psfont *Font_Ptr, - int do_raster) -{ - - psobj *charnameP; /* points to psobj that is name of character*/ - FontInfo *pAFMData=NULL; - int i=-1; - int j=0; - int numPieces=1; - int N; - T1_PATHPOINT currdisp; - int basechar; - - psdict *CharStringsDictP; /* dictionary with char strings */ - psobj CodeName; /* used to store the translation of the name*/ - psobj *SubrsArrayP; - psobj *theStringP; - int localmode=0; - - struct segment *charpath=NULL; /* the path for this character */ - struct segment *tmppath1=NULL; - struct segment *tmppath2=NULL; - struct segment *tmppath3=NULL; - struct segment *tmppath4=NULL; - - - /* set the global font pointer to the address of already allocated - structure and setup pointers*/ - FontP=Font_Ptr; - CharStringsDictP = FontP->CharStringsP; - SubrsArrayP = &(FontP->Subrs); - charnameP = &CodeName; - - charnameP->len = strlen((char*)charname); - charnameP->data.stringP = charname; - - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - - - /* search the chars string for this charname as key */ - basechar = SearchDictName(CharStringsDictP,charnameP); - if (basechar<=0) { - /* Check first, whether a char in question is a composite char */ - if ((i=isCompositeChar( FontID, CurCharName))>-1) { - /* i is now the index of the composite char definitions - (starting at 0). At this point it is clear that AFM-info - must be present -> fetch first component of composite char. */ - pAFMData=pFontBase->pFontArray[FontID].pAFMData; - charnameP->len=strlen( pAFMData->ccd[i].pieces[0].pccName); - charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[0].pccName; - numPieces=pAFMData->ccd[i].numOfPieces; - - if ((basechar=SearchDictName(CharStringsDictP,charnameP))<=0) { - /* this is bad, AFM-file and font file do not match. This - will most probably lead to errors or inconsistencies later. - However, we substitute .notdef and inform the user via - logfile and T1_errno. */ - sprintf( err_warn_msg_buf, - "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", - pAFMData->ccd[i].pieces[0].pccName, - pAFMData->ccd[i].ccName, FontID); - T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); - T1_errno=T1ERR_COMPOSITE_CHAR; - } - } - } - - if (basechar<=0) { /* This means the requested char is unknown or the - base char of a composite is not found -> - we substitute .notdef */ - charnameP = &CodeName; - charnameP->len = 7; - charnameP->data.stringP = (unsigned char *) notdef; - basechar = SearchDictName(CharStringsDictP,charnameP); - localmode=FF_NOTDEF_SUBST; - /* Font must be completely damaged if it doesn't define a .notdef */ - if (basechar<=0) { - *mode=FF_PARSE_ERROR; - return(NULL); - } - } /* if (basechar<=0) */ - /* basechar is now the index of the base character in the CharStrings - dictionary */ - - /* we provide the Type1Char() procedure with the name of the character - to rasterize for debugging purposes */ - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - /* get CharString and character path */ - theStringP = &(CharStringsDictP[basechar].value); - tmppath2 = (struct segment *) Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, - FontP->BluesP,mode,CurCharName); - /* if Type1Char reported an error, then return */ - if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) - return(NULL); - - /* Defer rastering to later, we first have to handle the composite - symbols */ - for (j=1; jlen=strlen( pAFMData->ccd[i].pieces[j].pccName); - charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[j].pccName; - /* get CharString definition */ - if ((N=SearchDictName(CharStringsDictP,charnameP))<=0) { - /* handling of errors, see comments above ... */ - sprintf( err_warn_msg_buf, - "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", - pAFMData->ccd[i].pieces[j].pccName, - pAFMData->ccd[i].ccName, FontID); - T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); - charnameP = &CodeName; - charnameP->len = 7; - charnameP->data.stringP = (unsigned char *) notdef; - N = SearchDictName(CharStringsDictP,charnameP); - localmode=FF_NOTDEF_SUBST; - /* damaged Font */ - if (N<=0) { - *mode=FF_PARSE_ERROR; - if (charpath!=NULL) { - KillPath( charpath); - } - return(NULL); - } - } - theStringP = &(CharStringsDictP[N].value); - tmppath1=(struct segment *)ILoc(S, - pAFMData->ccd[i].pieces[j].deltax, - pAFMData->ccd[i].pieces[j].deltay); - - strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); - CurCharName[charnameP->len]='\0'; - charpath=(struct segment *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, - FontP->BluesP,mode,CurCharName); - /* return if Type1Char reports an error */ - if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) - return(NULL); - /* get escapement of current symbol */ - currdisp=getDisplacement( charpath); - /* concat displacement and symbol path */ - charpath=(struct segment *)Join(tmppath1,charpath); - /* for composite symbols we have to step back the char escapement. - this is, in order to be able to use accents that cause a - non zero displacement of the current point! We further have to - step back the displacement from composite char data. */ - tmppath1=(struct segment *)t1_PathSegment( MOVETYPE, -currdisp.x, -currdisp.y); - tmppath3=(struct segment *)ILoc(S, - -pAFMData->ccd[i].pieces[j].deltax, - -pAFMData->ccd[i].pieces[j].deltay); - tmppath3=(struct segment *)Join(tmppath1,tmppath3); - /* create path, or, respectively, append to existing path */ - if (tmppath4==NULL) { - tmppath4=(struct segment *)Join(charpath,tmppath3); - } - else { - charpath=(struct segment *)Join(charpath,tmppath3); - tmppath4=(struct segment *)Join(tmppath4,charpath); - } - } - - /* concat composite symbols and base char */ - if (tmppath4==NULL) { /* no previous composite symbols */ - charpath=tmppath2; /* a simple char */ - } - else { - charpath=(struct segment *)Join(tmppath4,tmppath2); - } - - - if (do_raster) { - /* fill with winding rule unless path was requested */ - if (*mode != FF_PATH) { - charpath = (struct segment *)Interior(charpath,WINDINGRULE+CONTINUITY); - } - } - - if (*mode==0) - *mode=localmode; - - return((xobject) charpath); - -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/fontfcn.h xdvik-22.40n/libs/t1lib/lib/type1/fontfcn.h --- xdvik-22.40l/libs/t1lib/lib/type1/fontfcn.h Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/fontfcn.h Thu Jan 1 00:00:00 1970 @@ -1,99 +0,0 @@ -/* $XConsortium: fontfcn.h,v 1.3 92/03/26 16:42:23 eswu Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* Definition of a PostScript FONT */ -typedef struct ps_font { - char *vm_start; - psobj FontFileName; - psobj Subrs; - psdict *CharStringsP; - psdict *Private; - psdict *fontInfoP; -struct blues_struct *BluesP; -} psfont; -/***================================================================***/ -/* Routines in scan_font */ -/***================================================================***/ - -extern boolean Init_StdEnc(); -extern int scan_font(); -extern int GetFontInfo(); -/***================================================================***/ -/* Return codes from scan_font */ -/***================================================================***/ -#define SCAN_OK 0 -#define SCAN_FILE_EOF -1 -#define SCAN_ERROR -2 -#define SCAN_OUT_OF_MEMORY -3 -#define SCAN_FILE_OPEN_ERROR -4 -#define SCAN_MMFONT -5 /* font is a Multiple Master Font */ -#define SCAN_TRUE -6 -#define SCAN_FALSE -7 -#define SCAN_END -8 - -/***================================================================***/ -/* Name of FontInfo fields */ -/***================================================================***/ - -#define FONTNAME 1 -#define PAINTTYPE 2 -#define FONTTYPENUM 3 -#define FONTMATRIX 4 -#define FONTBBOX 5 -#define UNIQUEID 6 -#define STROKEWIDTH 7 -#define VERSION 8 -#define NOTICE 9 -#define FULLNAME 10 -#define FAMILYNAME 11 -#define WEIGHT 12 -#define ITALICANGLE 13 -#define ISFIXEDPITCH 14 -#define UNDERLINEPOSITION 15 -#define UNDERLINETHICKNESS 16 -#define ENCODING 17 -/***================================================================***/ -/* Name of Private values */ -/***================================================================***/ -#define BLUEVALUES 1 -#define OTHERBLUES 2 -#define FAMILYBLUES 3 -#define FAMILYOTHERBLUES 4 -#define BLUESCALE 5 -#define BLUESHIFT 6 -#define BLUEFUZZ 7 -#define STDHW 8 -#define STDVW 9 -#define STEMSNAPH 10 -#define STEMSNAPV 11 -#define FORCEBOLD 12 -#define LANGUAGEGROUP 13 -#define LENIV 14 -#define RNDSTEMUP 15 -#define EXPANSIONFACTOR 16 diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/fontfile.h xdvik-22.40n/libs/t1lib/lib/type1/fontfile.h --- xdvik-22.40l/libs/t1lib/lib/type1/fontfile.h Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/fontfile.h Thu Jan 1 00:00:00 1970 @@ -1,72 +0,0 @@ -/* - * $XConsortium: fontfile.h,v 1.1 91/05/11 09:11:58 rws Exp $ - * - * Copyright 1991 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifndef _FONTFILE_H_ -#define _FONTFILE_H_ -typedef struct _FontEntry *FontEntryPtr; -typedef struct _FontTable *FontTablePtr; -typedef struct _FontName *FontNamePtr; -typedef struct _FontScaled *FontScaledPtr; -typedef struct _FontScalableExtra *FontScalableExtraPtr; -typedef struct _FontScalableEntry *FontScalableEntryPtr; -typedef struct _FontScaleAliasEntry *FontScaleAliasEntryPtr; -typedef struct _FontBitmapEntry *FontBitmapEntryPtr; -typedef struct _FontAliasEntry *FontAliasEntryPtr; -typedef struct _FontBCEntry *FontBCEntryPtr; -typedef struct _FontDirectory *FontDirectoryPtr; -typedef struct _FontRenderer *FontRendererPtr; - -#define NullFontEntry ((FontEntryPtr) 0) -#define NullFontTable ((FontTablePtr) 0) -#define NullFontName ((FontNamePtr) 0) -#define NullFontScaled ((FontScaled) 0) -#define NullFontScalableExtra ((FontScalableExtra) 0) -#define NullFontscalableEntry ((FontScalableEntry) 0) -#define NullFontScaleAliasEntry ((FontScaleAliasEntry) 0) -#define NullFontBitmapEntry ((FontBitmapEntry) 0) -#define NullFontAliasEntry ((FontAliasEntry) 0) -#define NullFontBCEntry ((FontBCEntry) 0) -#define NullFontDirectory ((FontDirectoryPtr) 0) -#define NullFontRenderer ((FontRendererPtr) 0) - -#define FONT_ENTRY_SCALABLE 0 -#define FONT_ENTRY_SCALE_ALIAS 1 -#define FONT_ENTRY_BITMAP 2 -#define FONT_ENTRY_ALIAS 3 -#define FONT_ENTRY_BC 4 - -#define MAXFONTNAMELEN 1024 -#define MAXFONTFILENAMELEN 1024 - -#define FontDirFile "fonts.dir" -#define FontAliasFile "fonts.alias" -#define FontScalableFile "fonts.scale" - -extern FontEntryPtr FontFileFindNameInDir (); -extern FontDirectoryPtr FontFileMakeDir (); -extern FontRendererPtr FontFileMatchRenderer (); -extern char *SaveString (); -extern FontScaledPtr FontFileFindScaledInstance (); -#endif /* _FONTFILE_H_ */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/fontmisc.h xdvik-22.40n/libs/t1lib/lib/type1/fontmisc.h --- xdvik-22.40l/libs/t1lib/lib/type1/fontmisc.h Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/fontmisc.h Thu Jan 1 00:00:00 1970 @@ -1,63 +0,0 @@ -/* - * $XConsortium: fontmisc.h,v 1.5 91/05/12 16:15:48 rws Exp $ - * - * Copyright 1991 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifndef _FONTMISC_H_ -#define _FONTMISC_H_ - -#ifdef XSERVER -#include "Xfuncs.h" -#endif - -typedef unsigned char *pointer; -/* To suppress gcc-warning (11/25/97, RMz) */ -#ifndef T1DELETE_C -typedef int Bool; -#endif - -#ifndef X_PROTOCOL -typedef unsigned long Atom; -typedef unsigned long XID; -#endif -#ifndef LSBFirst -#define LSBFirst 0 -#define MSBFirst 1 -#endif - -#ifndef None -#define None 0l -#endif - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - -extern char *NameForAtom (); - -#define lowbit(x) ((x) & (~(x) + 1)) - -#define assert(x) - -#endif /* _FONTMISC_H_ */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/fonts.h xdvik-22.40n/libs/t1lib/lib/type1/fonts.h --- xdvik-22.40l/libs/t1lib/lib/type1/fonts.h Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/fonts.h Thu Jan 1 00:00:00 1970 @@ -1,49 +0,0 @@ -/* $XConsortium: fonts.h,v 1.2 91/10/10 11:18:09 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* STUB */ - -#define CopyFont(f) f -#define UniqueFont(f) f -#define KillFont(f) -#define KillText(t) -#define CopyText(t) t -#define I_DumpText(t) -#define CoerceText(t) t -#define TextDelta(t,pt) -#define XformText(p,s) -#define GimeSpace() FALSE - -#define LibInit() -#define InitFonts() -#define InitFiles() -#define TraceClose() - -#define FF_PARSE_ERROR -1 diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/fontstruct.h xdvik-22.40n/libs/t1lib/lib/type1/fontstruct.h --- xdvik-22.40l/libs/t1lib/lib/type1/fontstruct.h Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/lib/type1/fontstruct.h Thu Jan 1 00:00:00 1970 @@ -1,224 +0,0 @@ -/* $Header: /cvsroot/xdvi/xdvik/libs/t1lib/lib/type1/Attic/fontstruct.h,v 1.2.8.2 2002/01/07 15:50:18 stefanulrich Exp $ */ -/*********************************************************** -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, -and the Massachusetts Institute of Technology, Cambridge, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Digital or MIT not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - - @(#)fontstruct.h 3.2 91/04/15 - -******************************************************************/ - -#ifndef FONTSTR_H -#define FONTSTR_H - -#ifdef XSERVER -#include -#else -#include "Xstuff.h" -#endif - -#include "font.h" - -/* - * This version of the server font data strucutre is only for describing - * the in memory data structure. The file structure is not necessarily a - * copy of this. That is up to the compiler and the OS layer font loading - * machinery. - */ - -#define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */ - -typedef enum { - Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit -} FontEncoding; - -typedef struct _FontProp { - long name; - long value; /* assumes ATOM is not larger than INT32 */ -} FontPropRec; - -typedef struct _FontResolution { - unsigned short x_resolution; - unsigned short y_resolution; - unsigned short point_size; -} FontResolutionRec; - -typedef struct _ExtentInfo { - DrawDirection drawDirection; - int fontAscent; - int fontDescent; - int overallAscent; - int overallDescent; - int overallWidth; - int overallLeft; - int overallRight; -} ExtentInfoRec; - -typedef struct _CharInfo { - xCharInfo metrics; /* info preformatted for Queries */ - char *bits; /* pointer to glyph image */ -} CharInfoRec; - -/* - * Font is created at font load time. It is specific to a single encoding. - * e.g. not all of the glyphs in a font may be part of a single encoding. - */ - -typedef struct _FontInfo { - unsigned short firstCol; - unsigned short lastCol; - unsigned short firstRow; - unsigned short lastRow; - unsigned short defaultCh; - unsigned int noOverlap:1; - unsigned int terminalFont:1; - unsigned int constantMetrics:1; - unsigned int constantWidth:1; - unsigned int inkInside:1; - unsigned int inkMetrics:1; - unsigned int allExist:1; - unsigned int drawDirection:2; - unsigned int cachable:1; - unsigned int anamorphic:1; - short maxOverlap; - short pad; - xCharInfo maxbounds; - xCharInfo minbounds; - xCharInfo ink_maxbounds; - xCharInfo ink_minbounds; - short fontAscent; - short fontDescent; - int nprops; - FontPropPtr props; - char *isStringProp; -} FontInfoRec; - -typedef struct _Font { - int refcnt; - FontInfoRec info; - char bit; - char byte; - char glyph; - char scan; - fsBitmapFormat format; - int (*get_glyphs) ( /* font, count, chars, encoding, count, glyphs */ ); - int (*get_metrics) ( /* font, count, chars, encoding, count, glyphs */ ); - int (*get_bitmaps) (/* client, font, flags, ranges, nranges, - nextents, extents */ ); - int (*get_extents) (/* client, font, format, flags, ranges, - nranges, nglyphs, offsets, glyphs */ ); - void (*unload_font) ( /* font */ ); - FontPathElementPtr fpe; - pointer svrPrivate; - pointer fontPrivate; - pointer fpePrivate; - int maxPrivate; - pointer *devPrivates; -} FontRec; - -extern Bool _FontSetNewPrivate (/* pFont, n, ptr */); -extern int AllocateFontPrivateIndex (); - -#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (pointer) 0 : \ - (pFont)->devPrivates[n]) - -#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \ - _FontSetNewPrivate (pFont, n, ptr) : \ - ((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE)) - -typedef struct _FontNames { - int nnames; - int size; - int *length; - char **names; -} FontNamesRec; - -/* External view of font paths */ -typedef struct _FontPathElement { - int name_length; - char *name; - int type; - int refcount; - pointer private; -} FontPathElementRec; - -typedef struct _FPEFunctions { - int (*name_check) ( /* name */ ); - int (*init_fpe) ( /* fpe */ ); - int (*reset_fpe) ( /* fpe */ ); - int (*free_fpe) ( /* fpe */ ); - int (*open_font) ( /* client, fpe, flags, name, namelen, format, - fid, ppfont, alias */ ); - int (*close_font) ( /* pfont */ ); - int (*list_fonts) ( /* client, fpe, pattern, patlen, maxnames, - paths */ ); - int (*start_list_fonts_with_info) ( /* client, fpe, name, namelen, - maxnames, data */ ); - int (*list_next_font_with_info) ( /* client, fpe, name, namelen, - info, num, data */ ); - int (*wakeup_fpe) ( /* fpe, mask */ ); - int (*client_died) ( /* client, fpe */ ); -} FPEFunctionsRec, FPEFunctions; - -extern int InitFPETypes(); - -/* - * Various macros for computing values based on contents of - * the above structures - */ - -#define GLYPHWIDTHPIXELS(pci) \ - ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing) - -#define GLYPHHEIGHTPIXELS(pci) \ - ((pci)->metrics.ascent + (pci)->metrics.descent) - -#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3) - -#define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7) - -#define BYTES_PER_ROW(bits, nbytes) \ - ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \ - :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \ - :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \ - :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \ - : 0) - -#define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \ - BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad)) -/* - * Macros for computing different bounding boxes for fonts; from - * the font protocol - */ - -#define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \ - (pi)->fontAscent : (pi)->ink_maxbounds.ascent) -#define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \ - (pi)->fontDescent : (pi)->ink_maxbounds.descent) -#define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi)) -#define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \ - (pi)->ink_minbounds.leftSideBearing : 0) -#define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \ - (pi)->ink_maxbounds.characterWidth ? \ - (pi)->ink_maxbounds.rightSideBearing : \ - (pi)->ink_maxbounds.characterWidth) -#define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi)) - -#endif /* FONTSTR_H */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/fontxlfd.h xdvik-22.40n/libs/t1lib/lib/type1/fontxlfd.h --- xdvik-22.40l/libs/t1lib/lib/type1/fontxlfd.h Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/fontxlfd.h Thu Jan 1 00:00:00 1970 @@ -1,45 +0,0 @@ -/* - * $XConsortium: fontxlfd.h,v 1.1 91/05/11 09:12:07 rws Exp $ - * - * Copyright 1990 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifndef _FONTXLFD_H_ -#define _FONTXLFD_H_ - - -typedef struct _FontScalable { - int pixel, - point, - x, - y, - width; -} FontScalableRec, *FontScalablePtr; - -extern Bool FontParseXLFDName(); - -#define FONT_XLFD_REPLACE_NONE 0 -#define FONT_XLFD_REPLACE_STAR 1 -#define FONT_XLFD_REPLACE_ZERO 2 -#define FONT_XLFD_REPLACE_VALUE 3 - -#endif /* _FONTXLFD_H_ */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/fsmasks.h xdvik-22.40n/libs/t1lib/lib/type1/fsmasks.h --- xdvik-22.40l/libs/t1lib/lib/type1/fsmasks.h Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/fsmasks.h Thu Jan 1 00:00:00 1970 @@ -1,72 +0,0 @@ -/* $XConsortium: fsmasks.h,v 1.2 91/05/13 16:46:16 gildea Exp $ */ -/* - * Copyright 1990, 1991 Network Computing Devices; - * Portions Copyright 1987 by Digital Equipment Corporation and the - * Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this protoype software - * and its documentation to Members and Affiliates of the MIT X Consortium - * any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Network Computing Devices, Digital or - * MIT not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. - * - * NETWORK COMPUTING DEVICES, DIGITAL AND MIT DISCLAIM ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * @(#)fsmasks.h 4.1 91/05/02 - * - */ - -/* - * masks & values used by the font lib and the font server - */ - -#ifndef _FSMASKS_H_ -#define _FSMASKS_H_ - -#include "types.h" - -/* font format macros */ -#define BitmapFormatByteOrderMask (1L << 0) -#define BitmapFormatBitOrderMask (1L << 1) -#define BitmapFormatImageRectMask (3L << 2) -#define BitmapFormatScanlinePadMask (3L << 8) -#define BitmapFormatScanlineUnitMask (3L << 12) - -#define BitmapFormatByteOrderLSB (0) -#define BitmapFormatByteOrderMSB (1L << 0) -#define BitmapFormatBitOrderLSB (0) -#define BitmapFormatBitOrderMSB (1L << 1) - -#define BitmapFormatImageRectMin (0L << 2) -#define BitmapFormatImageRectMaxWidth (1L << 2) -#define BitmapFormatImageRectMax (2L << 2) - -#define BitmapFormatScanlinePad8 (0L << 8) -#define BitmapFormatScanlinePad16 (1L << 8) -#define BitmapFormatScanlinePad32 (2L << 8) -#define BitmapFormatScanlinePad64 (3L << 8) - -#define BitmapFormatScanlineUnit8 (0L << 12) -#define BitmapFormatScanlineUnit16 (1L << 12) -#define BitmapFormatScanlineUnit32 (2L << 12) -#define BitmapFormatScanlineUnit64 (3L << 12) - -#define BitmapFormatMaskByte (1L << 0) -#define BitmapFormatMaskBit (1L << 1) -#define BitmapFormatMaskImageRectangle (1L << 2) -#define BitmapFormatMaskScanLinePad (1L << 3) -#define BitmapFormatMaskScanLineUnit (1L << 4) - -typedef ULONG fsBitmapFormat; -typedef ULONG fsBitmapFormatMask; - -#endif /* _FSMASKS_H_ */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/hdigit.h xdvik-22.40n/libs/t1lib/lib/type1/hdigit.h --- xdvik-22.40l/libs/t1lib/lib/type1/hdigit.h Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/hdigit.h Thu Jan 1 00:00:00 1970 @@ -1,104 +0,0 @@ -/* $XConsortium: hdigit.h,v 1.2 91/10/10 11:18:11 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* -------------------------------------- */ -/* --- MACHINE GENERATED, DO NOT EDIT --- */ -/* -------------------------------------- */ - -/* ... and yet, I did it. - The code would fail on ASCII-encrypted files if the lines - were separated by instead of (which is typical - DOSian, but appearently such files exist). Setting the 13th - element in the two LUTs to HWHITE_SPACE cures the problem. - - (RMz (Author of t1lib), 2000-05-18) -*/ - - -#ifndef HDIGIT -#define HDIGIT 1 - -/* - * Hex Digit Value Table -- - * - * The entries in the Digit Value Table map character codes in the set - * {0-9,a-f,A-F} to their numeric values for readhexstring - * (00 10...F0 for the high hex digit and 00 01...0F for the low). - * The white-space and hex string termination characters are. - * mapped to codes > 0xf0 to enable usage by several modules. - * 2 tables are build HighHex and LowHex. - * - */ - -/* Indicators for special characters in these tables */ -#define HERROR (0xfe) -#define HWHITE_SPACE (0xfd) -#define HRIGHT_ANGLE (0xfc) -#define LAST_HDIGIT (0xf0) - -#define HighHexP (HighHex+1) -unsigned char HighHex[257] = { 0xFF, - 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFE,0xFE,0xFD,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80,0x90,0xFE,0xFE,0xFE,0xFE,0xFC,0xFE, - 0xFE,0xA0,0xB0,0xC0,0xD0,0xE0,0xF0,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xA0,0xB0,0xC0,0xD0,0xE0,0xF0,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE -}; -#define LowHexP (LowHex+1) -unsigned char LowHex[257] = { 0xFF, - 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFE,0xFE,0xFD,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0xFE,0xFE,0xFE,0xFE,0xFC,0xFE, - 0xFE,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, - 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE -}; - -#endif diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/hints.c xdvik-22.40n/libs/t1lib/lib/type1/hints.c --- xdvik-22.40l/libs/t1lib/lib/type1/hints.c Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/hints.c Thu Jan 1 00:00:00 1970 @@ -1,928 +0,0 @@ -/* $XConsortium: hints.c,v 1.4 91/10/10 11:18:13 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - /* HINTS CWEB V0006 ******** */ -/* -:h1.HINTS Module - Processing Rasterization Hints - -&author. Sten F. Andler; continuity by Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) and Duaine -W. Pryor, Jr. - - -:h3.Include Files - -The included files are: -*/ - -#include - -#include "types.h" -#include "objects.h" -#include "spaces.h" -#include "paths.h" -#include "regions.h" -#include "hints.h" - -/* -:h3.Functions Provided to the TYPE1IMAGER User - -None. -*/ - -/* -:h3.Functions Provided to Other Modules - -This module provides the following entry point to other modules: -*/ - - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h3.Macros Provided to Other Modules - -None. -*/ - -/* -:h2.InitHints() - Initialize hint data structure -*/ - -#define MAXLABEL 20 -static struct { - int inuse; - int computed; - struct fractpoint hint; -} oldHint[MAXLABEL]; - -#define ODD(x) (((int)(x)) & 01) -#define FPFLOOR(fp) TOFRACTPEL((fp) >> FRACTBITS) -#define FPROUND(fp) FPFLOOR((fp) + FPHALF) - -void InitHints() -{ - int i; - - for (i = 0; i < MAXLABEL; i++) - { - oldHint[i].inuse = FALSE; - oldHint[i].computed = FALSE; - } -} - -/* -:h3.CloseHints(hintP) - Reverse hints that are still open -*/ - -void CloseHints(hintP) - struct fractpoint *hintP; -{ - int i; - - for (i = 0; i < MAXLABEL; i++) - { - if (oldHint[i].inuse) - { - hintP->x -= oldHint[i].hint.x; - hintP->y -= oldHint[i].hint.y; - - oldHint[i].inuse = FALSE; - - IfTrace3((HintDebug > 1)," Hint %d was open, hint=(%d,%d)\n", - i, hintP->x, hintP->y); - } - } -} - -/* -:h3.ComputeHint(hP, currX, currY, hintP) - Compute the value of a hint -*/ - -static void ComputeHint(hP, currX, currY, hintP) - struct hintsegment *hP; - fractpel currX, currY; - struct fractpoint *hintP; -{ - fractpel currRef=0, currWidth=0; - int idealWidth; - fractpel hintValue=0; - char orientation; - -/* -By construction, width is never zero. Therefore we can use the -width value to determine if the hint has been rotated by a -multiple of 90 degrees. -*/ - - if (hP->width.y == 0) - { - orientation = 'v'; /* vertical */ - IfTrace0((HintDebug > 0)," vertical hint\n"); - } - else if (hP->width.x == 0) - { - orientation = 'h'; /* horizontal */ - IfTrace0((HintDebug > 0)," horizontal hint\n"); - } - else - { - IfTrace0((HintDebug > 0)," hint not vertical or horizontal\n"); - hintP->x = hintP->y = 0; - return; - } - - /* Compute currRef and currWidth with a unit of 1 pel */ - if (orientation == 'v') /* vertical */ - { - currRef = hP->ref.x + currX; - currWidth = TYPE1_ABS(hP->width.x); - } - else if (orientation == 'h') /* horizontal */ - { - currRef = hP->ref.y + currY; - currWidth = TYPE1_ABS(hP->width.y); - } - else /* error */ - { - abort("ComputeHint: invalid orientation", 4); - } - - IfTrace4((HintDebug > 1), - " currX=%d, currY=%d, currRef=%d, currWidth=%d\n", - currX, currY, - currRef, currWidth); - - if ((hP->hinttype == 'b') /* Bar or stem */ - || (hP->hinttype == 's')) /* Serif */ - { - idealWidth = NEARESTPEL(currWidth); - if (idealWidth == 0) idealWidth = 1; - if (ODD(idealWidth)) /* Is ideal width odd? */ - { - /* center "ref" over pel */ - hintValue = FPFLOOR(currRef) + FPHALF - currRef; - } - else - { - /* align "ref" on pel boundary */ - hintValue = FPROUND(currRef) - currRef; - } - if (HintDebug > 2) { - IfTrace1(TRUE," idealWidth=%d, ", idealWidth); - } - } - else if (hP->hinttype == 'c') /* Curve extrema */ - { - /* align "ref" on pel boundary */ - hintValue = FPROUND(currRef) - currRef; - } - else /* error */ - { - abort("ComputeHint: invalid hinttype", 5); - } - - IfTrace1((HintDebug > 1)," hintValue=%d", hintValue); - - if (orientation == 'v') /* vertical */ - { - hintP->x = hintValue; - hintP->y = 0; - } - else if (orientation == 'h') /* horizontal */ - { - hintP->x = 0; - hintP->y = hintValue; - } - else /* error */ - { - abort("ComputeHint: invalid orientation", 6); - } -} - -/* -:h3.ProcessHint(hP, currX, currY, hintP) - Process a rasterization hint -*/ - -void ProcessHint(hP, currX, currY, hintP) - struct hintsegment *hP; - fractpel currX, currY; - struct fractpoint *hintP; -{ - struct fractpoint thisHint; - - IfTrace4((HintDebug > 1)," ref=(%d,%d), width=(%d,%d)", - hP->ref.x, hP->ref.y, - hP->width.x, hP->width.y); - IfTrace4((HintDebug > 1),", %c %c %c %c", - hP->orientation, hP->hinttype, - hP->adjusttype, hP->direction); - IfTrace1((HintDebug > 1),", label=%d\n", hP->label); - - if ((hP->adjusttype == 'm') /* Move */ - || (hP->adjusttype == 'a')) /* Adjust */ - { - /* Look up hint in oldHint table */ - if ((hP->label >= 0) && (hP->label < MAXLABEL)) - { - if (oldHint[hP->label].computed) - /* Use old hint value if already computed */ - { - thisHint.x = oldHint[hP->label].hint.x; - thisHint.y = oldHint[hP->label].hint.y; - oldHint[hP->label].inuse = TRUE; - } - else - /* Compute new value for hint and store it for future use */ - { - ComputeHint(hP, currX, currY, &thisHint); - - oldHint[hP->label].hint.x = thisHint.x; - oldHint[hP->label].hint.y = thisHint.y; - oldHint[hP->label].inuse = TRUE; - oldHint[hP->label].computed = TRUE; - } - } - else /* error */ - { - abort("ProcessHint: invalid label", 7); - } - } - else if (hP->adjusttype == 'r') /* Reverse */ - { - /* Use the inverse of the existing hint value to reverse hint */ - if ((hP->label >= 0) && (hP->label < MAXLABEL)) - { - if (oldHint[hP->label].inuse) - { - thisHint.x = -oldHint[hP->label].hint.x; - thisHint.y = -oldHint[hP->label].hint.y; - oldHint[hP->label].inuse = FALSE; - } - else /* error */ - { - abort("ProcessHint: label is not in use", 8); - } - } - else /* error */ - { - abort("ProcessHint: invalid label", 9); - } - - } - else /* error */ - { - abort("ProcessHint: invalid adjusttype", 10); - } - IfTrace3((HintDebug > 1)," label=%d, thisHint=(%d,%d)\n", - hP->label, thisHint.x, thisHint.y); - - hintP->x += thisHint.x; - hintP->y += thisHint.y; - - IfTrace2((HintDebug > 1)," hint=(%d,%d)\n", - hintP->x, hintP->y); -} - -/* -:h2 id=subpath.Navigation Through Edge Lists - -For continuity checking purposes, we need to navigate through edge -lists by the "subpath" chains and answer questions about edges. The -subpath chain links together edges that were part of the same subpath -(no intervening move segments) when the interior of the path was -calculated. Here we use the term "edge" to mean every edge list -that was created in between changes of direction. - -The subpath chains are singly-linked circular chains. For the convenience -of building them, they direction of the list (from edge to edge) is the -reverse of the order in which they were built. Within any single edge, -the subpath chain goes from top-to-bottom. (There might be a violation -of this because of the way the user started the first chain; see -:hdref refid=fixsubp..). - -:h3.ISTOP() and ISBOTTOM() - Flag Bits for Edge Lists at the Top and -Bottom of Their SubPaths -*/ - -#define ISTOP(flag) ((flag)&0x20) -#define ISBOTTOM(flag) ((flag)&0x10) -/* -:h3.ISLEFT() - Flag Bit for Left Edges -*/ - -#define ISLEFT(flag) ((flag)&0x08) - -/* -:h3.XofY() - Macro to Find X Value at Given Y - -This macro can only be used if it is known that the Y is within the -given edgelist's ymin and ymax. -*/ - -#define XofY(edge, y) edge->xvalues[y - edge->ymin] - -/* -:h3.findXofY() - Like XofY(), Except not Restricted - -If the Y is out of bounds of the given edgelist, this macro will -call SearchXofY to search the edge's subpath chain for the correct -Y range. If the Y value is off the edge, MINPEL is returned. -*/ -#define findXofY(edge, y) ((y < edge->ymin || y >= edge->ymax) ? SearchXofY(edge, y) : XofY(edge, y)) - -/* -:h4.SearchXofY() - Routine Called by FindXofY() for Difficult Cases - -The concept of this routine is to follow the subpath chain to find the -edge just below (i.e., next in chain) or just above (i.e., immediately -before in chain. It is assumed that the Y value is no more than one -off of the edge's range; XofY() could be replace by FindXofY() to -call ourselves recursively if this were not true. -*/ - -static pel SearchXofY(edge, y) - register struct edgelist *edge; /* represents edge */ - register pel y; /* 'y' value to find edge for */ -{ - register struct edgelist *e; /* loop variable */ - - if (y < edge->ymin) { - if (ISTOP(edge->flag)) - return(MINPEL); - for (e = edge->subpath; e->subpath != edge; e = e->subpath) { ; } - if (e->ymax == edge->ymin) - return(XofY(e, y)); - } - else if (y >= edge->ymax) { - if (ISBOTTOM(edge->flag)) - return(MINPEL); - e = edge->subpath; - if (e->ymin == edge->ymax) - return(XofY(e, y)); - } - else - return(XofY(edge, y)); - - abort("bad subpath chain", 11); - /*NOTREACHED*/ - /* To make ANSI-C-compiler happy: */ - return(y); - -} -/* -:h3.ISBREAK() Macro - Tests if an Edge List is at a "Break" - -The subpath chains are organized top to bottom. When the bottom of -a given edge is reached, the subpath chain points to the top of the -next edge. We call this a "break" in the chain. The following macro -is the simple test for the break condition: -*/ - -#define ISBREAK(top,bot) (top->ymax != bot->ymin) - - -/* -:h3.ImpliedHorizontalLine() - Tests for Horizontal Connectivity - -This function returns true if two edges are connected horizontally. -They are connected horizontally if they are consecutive in the subpath, -and either we are at the bottom and the first edge is going down or we -are at the top and the first edge is going up. -*/ - -#define BLACKABOVE -1 -#define BLACKBELOW +1 -#define NONE 0 - -static int ImpliedHorizontalLine(e1, e2, y) - register struct edgelist *e1,*e2; /* two edges to check */ - register int y; /* y where they might be connected */ -{ - register struct edgelist *e3,*e4; - - if (ISDOWN(e1->flag) == ISDOWN(e2->flag)) - return(NONE); /* can't be consecutive unless different directions */ -/* -Now we check for consecutiveness: Can we get from 'e1' to 'e2' with -only one intervening break? Can we get from 'e2' to 'e1' with only one -intervening break? 'e3' will be as far as we can get after 'e1'; 'e4' -will be has far as we can get after 'e2': -*/ - for (e3 = e1; !ISBREAK(e3, e3->subpath); e3 = e3->subpath) { ; } - for (e3 = e3->subpath; e3 != e2; e3 = e3->subpath) - if (ISBREAK(e3, e3->subpath)) - break; - - for (e4 = e2; !ISBREAK(e4, e4->subpath); e4 = e4->subpath) { ; } - for (e4 = e4->subpath; e4 != e1; e4 = e4->subpath) - if (ISBREAK(e4, e4->subpath)) - break; -/* -If the edges are mutually consecutive, we must have horizontal lines -both top and bottom: -*/ - if (e3 == e2 && e4 == e1) - return(TRUE); -/* -If the edges are not consecutive either way, no horizontal lines are -possible: -*/ - if (e3 != e2 && e4 != e1) - return(NONE); -/* -Now let's swap 'e1' and 'e2' if necessary to enforce the rule that 'e2' -follows 'e1'. Remember that subpath chains go in the opposite direction -from the way the subpaths were built; this led to the simplest way -do build them. -*/ - if (e4 != e1) { - e2 = e1; - e1 = e3; /* remember e3 == e2, this just swaps 'e1' and 'e2' */ - } -/* -Now we have everything to return the answer: -*/ - if (ISTOP(e1->flag) && y == e1->ymin) - return(ISDOWN(e2->flag)); - else if (ISBOTTOM(e1->flag) && y == e1->ymax) - return(!ISDOWN(e2->flag)); - else - abort("ImpliedHorizontalLine: why ask?", 12); - /*NOTREACHED*/ - /* To make ANSI-C-compiler happy */ - return(0); - -} - -/* -:h3 id=fixsubp.FixSubPaths() - Must be Called to Organize Subpath Chains - -The region-building code in Interior(), in particular splitedge(), -maintains the rule that sub-paths are linked top-to-bottom except -at breaks. However, it is possible that there may be a "false break" -because the user started the subpath in the middle of an edge (and -went in the "wrong" direction from there, up instead of down). This -routine finds and fixes false breaks. - -Also, this routine sets the ISTOP and ISBOTTOM flags in the edge lists. -*/ - -static void FixSubPaths(R) - register struct region *R; /* anchor of region */ -{ - register struct edgelist *e; /* fast loop variable */ - register struct edgelist *edge; /* current edge in region */ - register struct edgelist *next; /* next in subpath after 'edge' */ - register struct edgelist *break1; /* first break after 'next' */ - register struct edgelist *break2=NULL; /* last break before 'edge' */ - register struct edgelist *prev; /* previous edge for fixing links */ - int left = TRUE; - - for (edge = R->anchor; edge != NULL; edge = edge->link) { - - if (left) - edge->flag |= ISLEFT(ON); - left = !left; - - next = edge->subpath; - - if (!ISBREAK(edge, next)) - continue; - if (edge->ymax < next->ymin) - abort("disjoint subpath?", 13); -/* -'edge' now contains an edgelist at the bottom of an edge, and 'next' -contains the next subsequent edgelist in the subpath, which must be at -the top. We refer to this a "break" in the subpath. -*/ - next->flag |= ISTOP(ON); - edge->flag |= ISBOTTOM(ON); - - if (ISDOWN(edge->flag) != ISDOWN(next->flag)) - continue; -/* -We are now in the unusual case; both edges are going in the same -direction so this must be a "false break" due to the way that the user -created the path. We'll have to fix it. -*/ - for (break1 = next; !ISBREAK(break1, break1->subpath); break1 = break1->subpath) { ; } - - for (e = break1->subpath; e != edge; e = e->subpath) - if (ISBREAK(e, e->subpath)) - break2 = e; -/* -Now we've set up 'break1' and 'break2'. I've found the following -diagram invaluable. 'break1' is the first break after 'next'. 'break2' -is the LAST break before 'edge'. -&drawing. - next - +------+ +---->+------+ - +--->| >-----+ | | >-----+ - | | | | | | | | - | +-------------+ | +-------------+ - | | |break1| | | | | - | +->| >-------+ +->| >-----+ - | | | | | | - | | | +-------------+ - | +------+ | | | - | +----------------+ | | | - | | +------+ | +->| >-----+ - | +->| >-----+ | | | | - | | | | | +-------------+ - | +-------------+ | | | | - | | |edge | | | |break2| - | +->| >-----+ | +->| >-----+ - | | | | | | | | - | | | | | | | | - | | | | | | | | - | +------+ | | +------+ | - | | | | - +---------------+ +---------------+ - -&edrawing. -We want to fix this situation by having 'edge' point to where 'break1' -now points, and having 'break1' point to where 'break2' now points. -Finally, 'break2' should point to 'next'. Also, we observe that -'break1' can't be a bottom, and is also not a top unless it is the same -as 'next': -*/ - edge->subpath = break1->subpath; - - break1->subpath = break2->subpath; - if (ISBREAK(break1, break1->subpath)) - abort("unable to fix subpath break?", 14); - - break2->subpath = next; - - break1->flag &= ~ISBOTTOM(ON); - if (break1 != next) - break1->flag &= ~ISTOP(ON); - } -/* -This region might contain "ambiguous" edges; edges exactly equal to -edge->link. Due to the random dynamics of where they get sorted into -the list, they can yield false crossings, where the edges appear -to cross. This confuses our continuity logic no end. Since we can -swap them without changing the region, we do. -*/ - for (edge = R->anchor, prev = NULL; VALIDEDGE(edge); prev = edge, edge = prev->link) { - - if (! ISAMBIGUOUS(edge->flag)) - continue; - - next = edge->subpath; - - while (ISAMBIGUOUS(next->flag) && next != edge) - next = next->subpath; -/* -We've finally found a non-ambiguous edge; we make sure it is left/right -compatible with 'edge': -*/ - if ( (ISLEFT(edge->flag) == ISLEFT(next->flag) && ISDOWN(edge->flag) == ISDOWN(next->flag) ) - || (ISLEFT(edge->flag) != ISLEFT(next->flag) && ISDOWN(edge->flag) != ISDOWN(next->flag) ) ) - continue; - -/* -Incompatible, we will swap 'edge' and the following edge in the list. -You may think that there must be a next edge in this swath. So did I. -No! If there is a totally ambiguous inner loop, for example, we could -get all the way to the outside without resolving ambiguity. -*/ - next = edge->link; /* note new meaning of 'next' */ - if (next == NULL || edge->ymin != next->ymin) - continue; - if (prev == NULL) - R->anchor = next; - else - prev->link = next; - edge->link = next->link; - next->link = edge; - edge->flag ^= ISLEFT(ON); - edge->flag &= ~ISAMBIGUOUS(ON); - next->flag ^= ISLEFT(ON); - next->flag &= ~ISAMBIGUOUS(ON); - edge = next; - } -} -/* -:h3.DumpSubPaths() - -A debug tool. -*/ - -static struct edgelist *before(); /* subroutine of DumpSubPaths */ - -static void DumpSubPaths(anchor) - struct edgelist *anchor; -{ - - register struct edgelist *edge,*e,*e2; - pel y; - - for (edge = anchor; VALIDEDGE(edge); edge = edge->link) { - if (ISPERMANENT(edge->flag)) - continue; - IfTrace0(TRUE, "BEGIN Subpath\n"); - for (e2 = edge; !ISPERMANENT(e2->flag);) { - if (ISDOWN(e2->flag)) { - IfTrace1(TRUE, ". Downgoing edge's top at %p\n", e2); - for (e = e2;; e = e->subpath) { - IfTrace4(TRUE, ". . [%5d] %5d @ %p[%x]\n", - e->ymin, *e->xvalues, e, e->flag); - for (y=e->ymin+1; y < e->ymax; y++) - IfTrace2(TRUE, ". . [%5d] %5d \"\n", y, e->xvalues[y-e->ymin]); - e->flag |= ISPERMANENT(ON); - if (ISBREAK(e, e->subpath)) - break; - } - } - else { - IfTrace1(TRUE, ". Upgoing edge's top at %p\n", e2); - for (e = e2; !ISBREAK(e, e->subpath); e = e->subpath) { ; } - for (;; e=before(e)) { - IfTrace4(TRUE, ". . [%5d] %5d @ %p[%x]\n", - e->ymax-1, e->xvalues[e->ymax-1-e->ymin], e, e->flag); - for (y=e->ymax-2; y >= e->ymin; y--) - IfTrace2(TRUE, ". . [%5d] %5d \"\n", y, e->xvalues[y-e->ymin]); - e->flag |= ISPERMANENT(ON); - if (e == e2) - break; - } - } - do { - e2 = before(e2); - } while (!ISBREAK(before(e2), e2)); - } - } -} - -static struct edgelist *before(e) - struct edgelist *e; -{ - struct edgelist *r; - for (r = e->subpath; r->subpath != e; r = r->subpath) { ; } - return(r); -} - -/* -:h2.Fixing Region Continuity Problems - -Small regions may become disconnected when their connecting segments are -less than a pel wide. This may be correct in some applications, but in -many (especially small font characters), it is more pleasing to keep -connectivity. ApplyContinuity() (invoked by +CONTINUITY on the -Interior() fill rule) fixes connection breaks. The resulting region -is geometrically less accurate, but may be more pleasing to the eye. -*/ -/* -Here are some macros which we will need: -*/ - -#define IsValidPel(j) (j!=MINPEL) - -/* -:h3.writeXofY() - Stuffs an X Value Into an "edgelist" - -writeXofY writes an x value into an edge at position 'y'. It must -update the edge's xmin and xmax. If there is a possibility that this -new x might exceed the region's bounds, updating those are the -responsibility of the caller. -*/ - -static void writeXofY(e, y, x) - struct edgelist *e; /* relevant edgelist */ - int y; /* y value */ - int x; /* new x value */ -{ - if (e->xmin > x) e->xmin = x; - if (e->xmax < x) e->xmax = x; - e->xvalues[y - e->ymin] = x; -} - -/*-------------------------------------------------------------------------*/ -/* the following three macros tell us whether we are at a birth point, a */ -/* death point, or simply in the middle of the character */ -/*-------------------------------------------------------------------------*/ -#define WeAreAtTop(e,i) (ISTOP(e->flag) && e->ymin == i) -#define WeAreAtBottom(e,i) (ISBOTTOM(e->flag) && e->ymax-1 == i) -#define WeAreInMiddle(e,i) \ - ((!ISTOP(e->flag) && !ISBOTTOM(e->flag))||(i < e->ymax-1 && i > e->ymin)) -/* -The following macro tests if two "edgelist" structures are in the same -swath: -*/ -#define SAMESWATH(e1,e2) (e1->ymin == e2->ymin) - -/* -:h3.CollapseWhiteRun() - Subroutine of ApplyContinuity() - -When we have a white run with an implied horizontal line above or -below it, we better have black on the other side of this line. This -function both tests to see if black is there, and adjusts the end -points (collapses) the white run as necessary if it is not. The -goal is to collapse the white run as little as possible. -*/ - -static void CollapseWhiteRun(anchor, yblack, left, right, ywhite) - struct edgelist *anchor; /* anchor of edge list */ - pel yblack; /* y of (hopefully) black run above or below */ - struct edgelist *left; /* edgelist at left of WHITE run */ - struct edgelist *right; /* edgelist at right of WHITE run */ - pel ywhite; /* y location of white run */ -{ - struct edgelist *edge; - struct edgelist *swathstart = anchor; - register pel x; - - if (XofY(left, ywhite) >= XofY(right, ywhite)) - return; -/* -Find the swath with 'yblack'. If we don't find it, completely collapse -the white run and return: -*/ - while (VALIDEDGE(swathstart)) { - if (yblack < swathstart->ymin) { - writeXofY(left, ywhite, XofY(right, ywhite)); - return; - } - if (yblack < swathstart->ymax) break; - swathstart = swathstart->link->link; - } - if(!VALIDEDGE(swathstart)) { - writeXofY(left, ywhite, XofY(right, ywhite)); - return; - } -/* -Now we are in the swath that contains 'y', the reference line above -or below that we are trying to maintain continuity with. If black -in this line begins in the middle of our white run, we must collapse -the white run from the left to that point. If black ends in the -middle of our white run, we must collapse the white run from the right -to that point. -*/ - for (edge = swathstart; VALIDEDGE(edge); edge = edge->link) { - - if (!SAMESWATH(swathstart,edge)) - break; - if( XofY(edge, yblack) > XofY(left, ywhite)) { - if (ISLEFT(edge->flag)) { - x = XofY(edge, yblack); - if (XofY(right, ywhite) < x) - x = XofY(right, ywhite); - writeXofY(left, ywhite, x); - } - else { - x = XofY(edge, yblack); - while (edge->link != NULL && SAMESWATH(edge, edge->link) - && x >= XofY(edge->link, yblack) ) { - edge = edge->link->link; - x = XofY(edge, yblack); - } - if (x < XofY(right, ywhite)) - writeXofY(right, ywhite, x); - return; - } - } - } - writeXofY(left, ywhite, XofY(right, ywhite)); -} - -/* -:h3.ApplyContinuity() - Fix False Breaks in a Region - -This is the externally visible routine called from the REGIONS module -when the +CONTINUITY flag is on the Interior() fill rule. -*/ - -void ApplyContinuity(R) -struct region *R; -{ - struct edgelist *left; - struct edgelist *right; - struct edgelist *edge,*e2; - pel rightXabove,rightXbelow,leftXabove,leftXbelow; - pel leftX,rightX; - int i; - LONG newcenter,abovecenter,belowcenter; - - FixSubPaths(R); - if (RegionDebug >= 3) - DumpSubPaths(R->anchor); - left = R->anchor; -/* loop through and do all of the easy checking. ( no tops or bottoms) */ - while(VALIDEDGE(left)) - { - right = left->link; - for(i=left->ymin;iymax;++i) - { - leftX = findXofY(left,i); - rightX = findXofY(right,i); - leftXbelow = findXofY(left,i+1); - rightXbelow = findXofY(right,i+1); - if(rightX <= leftX) - { -/* then, we have a break in a near vertical line */ - leftXabove = findXofY(left,i-1); - rightXabove = findXofY(right,i-1); - if( IsValidPel(leftXabove) && IsValidPel(rightXabove) ) - { - abovecenter = leftXabove + rightXabove; - } - else - { - abovecenter = leftX + rightX; - } - if( IsValidPel(leftXbelow) && IsValidPel(rightXbelow) ) - { - belowcenter = leftXbelow + rightXbelow; - } - else - { - belowcenter = leftX + rightX; - } - newcenter = abovecenter + belowcenter; - if( newcenter > 4*leftX ) - { - rightX = rightX + 1; - } - else if( newcenter < 4*leftX) - { - leftX = leftX - 1; - } - else - { - rightX = rightX + 1; - } - writeXofY(right,i,rightX); - writeXofY(left,i,leftX); - if(rightX > R->xmax) {R->xmax = rightX;} - if(leftX < R->xmin) {R->xmin = leftX;} - } - if( !WeAreAtBottom(left,i) && (leftXbelow>=rightX)) - { -/* then we have a break in a near horizontal line in the middle */ - writeXofY(right,i,leftXbelow); - } - if( !WeAreAtBottom(right,i) && (leftX >=rightXbelow)) - { -/* then we have a break in a near horizontal line in the middle */ - writeXofY(left,i,rightXbelow); - } - } - left = right->link; - } -/* -There may be "implied horizontal lines" between edges that have -implications for continuity. This loop looks for white runs that -have implied horizontal lines on the top or bottom, and calls -CollapseWhiteRuns to check and fix any continuity problems from -them. -*/ - for (edge = R->anchor; VALIDEDGE(edge); edge = edge->link) { - if ((!ISTOP(edge->flag) && !ISBOTTOM(edge->flag)) || ISLEFT(edge->flag)) - continue; /* at some future date we may want left edge logic here too */ - for (e2 = edge->link; VALIDEDGE(e2) && SAMESWATH(edge,e2); e2 = e2->link) { - if (ISTOP(e2->flag) && ISTOP(edge->flag) - && NONE != ImpliedHorizontalLine(edge,e2,edge->ymin)) { - if (ISLEFT(e2->flag)) - CollapseWhiteRun(R->anchor, edge->ymin-1, - edge, e2, edge->ymin); - } - if (ISBOTTOM(e2->flag) && ISBOTTOM(edge->flag) - && NONE != ImpliedHorizontalLine(edge,e2, edge->ymax)) { - if (ISLEFT(e2->flag)) - CollapseWhiteRun(R->anchor, edge->ymax, - edge, e2, edge->ymax-1); - } - } - } -} - - - - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/hints.h xdvik-22.40n/libs/t1lib/lib/type1/hints.h --- xdvik-22.40l/libs/t1lib/lib/type1/hints.h Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/hints.h Thu Jan 1 00:00:00 1970 @@ -1,42 +0,0 @@ -/* $XConsortium: hints.h,v 1.2 91/10/10 11:18:19 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - -#define InitHints() t1_InitHints() -void t1_InitHints(); /* Initialize hint data structure */ - -#define CloseHints(hintP) t1_CloseHints(hintP) -void t1_CloseHints(); /* Reverse hints that are still open */ - -#define ProcessHint(hP, currX, currY, hintP) t1_ProcessHint(hP, currX, currY, hintP) -void t1_ProcessHint(); /* Process a rasterization hint */ - -#define ApplyContinuity(R) t1_ApplyContinuity(R) -void t1_ApplyContinuity(); /* fix false connection breaks in a region */ -/*END SHARED*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/lines.c xdvik-22.40n/libs/t1lib/lib/type1/lines.c --- xdvik-22.40l/libs/t1lib/lib/type1/lines.c Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/lines.c Thu Jan 1 00:00:00 1970 @@ -1,189 +0,0 @@ -/* $XConsortium: lines.c,v 1.2 91/10/10 11:18:21 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - /* LINES CWEB V0003 ******** */ -/* -:h1.LINES Module - Rasterizing Lines - -&author. Duaine W. Pryor, Jr. and Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) - - -:h3.Include Files - -The included files are: -*/ - -#include - -#include "types.h" -#include "objects.h" -#include "spaces.h" -#include "regions.h" -#include "lines.h" - -/* -:h3.Functions Provided to the TYPE1IMAGER User - -None. -*/ - -/* -:h3.Functions Provided to Other Modules - -This module provides the following entry point to other modules: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h3.Macros Provided to Other Modules - -None. -*/ - -/* -:h2.StepLine() - Produces Run Ends for a Line After Checks - -The main work is done by Bresenham(); here we just perform checks and -get the line so that its Y direction is always increasing: -*/ - -void StepLine(R, x1, y1, x2, y2) - register struct region *R; /* region being built */ - register fractpel x1,y1; /* starting point */ - register fractpel x2,y2; /* ending point */ -{ - register fractpel dy; - - IfTrace4((LineDebug > 0), ".....StepLine: (%d,%d) to (%d,%d)\n", - x1, y1, x2, y2); - - dy = y2 - y1; - -/* -We execute the "GOING_TO" macro to call back the REGIONS module, if -necessary (like if the Y direction of the edge has changed): -*/ - GOING_TO(R, x1, y1, x2, y2, dy); - - if (dy == 0) - return; - - if (dy < 0) - Bresenham(R->edge, x2, y2, x1, y1); - else - Bresenham(R->edge, x1, y1, x2, y2); - return; -} -/* -:h3.Bresenham() - Actually Produces Run Ends - -This routine runs a Bresenham line-stepping -algorithm. See, for example, Newman and Sproul, :hp1/Principles -of Interactive Computer Graphics/, pp. 25-27. -When we enter this, we -are guaranteed that dy is positive. -We'd like to work in 8 bit precision, so we'll define some macros and -constants to let us do that: -*/ - -#define PREC 8 /* we'll keep fraction pels in 8 bit precision */ -/* -RoundFP() rounds down by 'b' bits: -*/ -#define RoundFP(xy,b) (((xy)+(1<<((b)-1)))>>(b)) - -/* -TruncFP() truncates down by 'b' bits: -*/ -#define TruncFP(xy,b) ((xy)>>(b)) - - -void Bresenham(edgeP,x1,y1,x2,y2) - register pel *edgeP; /* pointer to top of list (y == 0) */ - register fractpel x1,y1; /* starting point on line */ - register fractpel x2,y2; /* ending point on the line (down) */ -{ - register LONG dx,dy; /* change in x and y, in my own precision */ - register LONG x,y; /* integer pel starting point */ - register int count; /* integer pel delta y */ - register LONG d; /* the Bresenham algorithm error term */ - - x1 = TruncFP(x1, FRACTBITS-PREC); - y1 = TruncFP(y1, FRACTBITS-PREC); - x2 = TruncFP(x2, FRACTBITS-PREC); - y2 = TruncFP(y2, FRACTBITS-PREC); - - dx = x2 - x1; - dy = y2 - y1; -/* -Find the starting x and y integer pel coordinates: -*/ - - x = RoundFP(x1,PREC); - y = RoundFP(y1,PREC); - edgeP += y; - count = RoundFP(y2,PREC) - y; -/*------------------------------------------------------------------*/ -/* Force dx to be positive so that dfy will be negative */ -/* this means that vertical moves will decrease d */ -/*------------------------------------------------------------------*/ - if (dx<0) - { - dx = -dx; -#define P PREC - d=(dy*(x1-(x<>P; -#undef P - while(--count >= 0 ) - { - while(d<0) - { - --x; - d += dy; - } - *(edgeP++) = x; - d -= dx; - } - } - else /* positive dx */ - { -#define P PREC - d = (dy*((x<>P; -#undef P - while(--count >= 0 ) - { - while(d<0) - { - ++x; - d += dy; - } - *(edgeP++) = x; - d -= dx; - } - } -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/lines.h xdvik-22.40n/libs/t1lib/lib/type1/lines.h --- xdvik-22.40l/libs/t1lib/lib/type1/lines.h Wed Apr 18 14:24:10 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/lines.h Thu Jan 1 00:00:00 1970 @@ -1,37 +0,0 @@ -/* $XConsortium: lines.h,v 1.2 91/10/10 11:18:23 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - -#define StepLine(R,x1,y1,x2,y2) t1_StepLine(R,x1,y1,x2,y2) -#define Bresenham(e,x1,y1,x2,y2) t1_Bresenham(e,x1,y1,x2,y2) - -void t1_StepLine(); /* check for special conditions, call Bresenham */ -void t1_Bresenham(); /* produce run ends for lines */ - -/*END SHARED*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/objects.c xdvik-22.40n/libs/t1lib/lib/type1/objects.c --- xdvik-22.40l/libs/t1lib/lib/type1/objects.c Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/objects.c Thu Jan 1 00:00:00 1970 @@ -1,1208 +0,0 @@ -/* $XConsortium: objects.c,v 1.5 92/03/20 15:56:06 eswu Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - /* OBJECTS CWEB V0025 ******** */ -/* -:h1.OBJECTS Module - TYPE1IMAGER Objects Common Routines - -This module defines and implements the C structures that represent -objects in the TYPE1IMAGER. All common routines for manipulating these -objects are defined in this module. Specific routines for -specific objects are defined in the modules that deal with that -object type. - - -&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) - - -:h3.Include Files - -The included files are: -*/ -#define GLOBALS 1 /* see :hdref refid=debugvar. */ -/* -The following two includes are C standards; we include them because we -use 'toupper' and the 'str'-type functions in this module. Potentially -these may be defined as macros; if these ".h" files do not exist on your -system it is a pretty safe bet that these are external entry points and -you do do not need to include these header files. -*/ - - -#include "types.h" -#include -#include -#include -#include -#include - -/* -override incorrect system functions; for example you might define -a macro for "strcpy" that diverts it to "my_strcpy". -*/ - - /* moved these includes from above the */ - /* was included first (it contains com- */ - /* piler defines). dsr 081291 */ -#include "objects.h" -#include "spaces.h" -#include "paths.h" -#include "regions.h" -#include "fonts.h" -#include "pictures.h" -#include "strokes.h" -#include "cluts.h" -static char *TypeFmt(); -static int ObjectPostMortem(); - -/* -:h3.The "pointer" Macro - Define a Generic Pointer - -Sadly, many compilers will give a warning message when a pointer to -one structure is assigned to a pointer to another. We've even seen -some that give severe errors (when the wrong pointer type is used as -an initializer or returned from a function). TYPE1IMAGER has routines -like Dup and Allocate that are perfectly willing to duplicate or -allocate any of a number of different types of structures. How to -declare them in a truely portable way? - -Well, there is no single good answer that I've found. You can always -beg the question and "cast" everything. I find this distracting and the -resulting code ugly. On the other hand, we have found at least one -compiler that will accept "void *" as a generic pointer that can -assigned to any other pointer type without error or warning (apparently -this is also the ANSI standard). So, we define "void *" to be a generic -pointer. (You might have to change this for your compiler; the "ifndef" -allows the change to be made on the command line if you want.) -:i1/portability assumptions/ -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Functions Provided to the TYPE1IMAGER User - -This module provides the following TYPE1IMAGER entry points: -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -Note that entry points that are intended for use external to TYPE1IMAGER -begin with the characters :q/xi/. Macros are used to make the names -more mnemonic. -*/ - -/* -:h3.Functions Provided to Other Modules - -This module provides the following functions for other modules: -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -Note that entry points that intended for use within TYPE1IMAGER, but -which must be global because they are used across module boundaries, -begin with the characters :q/I_/. Macros are used to make the names -more mnemonic. - -Entry points totally within a module use mnemonic names and are -declared :hp2/static/. One of the compilers I used had a bug when -static functions were passed as addresses. Thus, some functions -which are logically "static" are not so declared. - -Note also the trick of declaring routines, like Consume(), with a -variable number of arguments. To avoid the restrictions on variable -numbers of arguments in the macro processor, we just replace the -text 'Consume' with 'I_Consume'. -*/ -/* -:h3.Macros Provided to Other Modules - -This is the module where we define all the useful constants like -TRUE, FALSE, and NULL, and simple expressions like TYPE1_MIN(), -TYPE1_MAX(), and TYPE1_ABS(). -We might as well get to it right here: -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -Notice that upper case is used for constant values and macro -definitions. I generally follow that convention. - -Many more global macros are defined later in this module. -*/ -/* -:h2.Basic TYPE1IMAGER Object Structure - -All TYPE1IMAGER objects which are available to the user have a common -header. This header is defined below: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -The following define is an attempt to centralize the definition of the -common xobject data shared by structures that are derived from the -generic xobject structure. For example, the structure font, defined in -fonts.shr : -&code. - struct font { - char type; - char flag; - int references; - ... other data types & structs ... - } -&ecode. -would now be defined as: -&code. - struct font { - XOBJ_COMMON - ... other data types & structs ... - } -&ecode. -Thus we have a better-structured inheritance mechanism. 3-26-91 PNM -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Object Type Definitions - -These constants define the values which go in the 'type' field of -an TYPE1IMAGER object structure: -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Flag Byte Definitions - -Many programmers define flag bits as a mask (for example, 0x04), and -test, set, and reset them as follows: - -&code. - if ((flag & PERMANENT) != 0) - - flag |= PERMANENT; - flag &= &inv.PERMANENT; -:exmp. - -I favor a style where the 'if' statement can ask a question: - -&code. - if (ISPERMANENT(flag)) - - flag |= ISPERMANENT(ON); - flag &= &inv.ISPERMANENT(ON); - -:exmp. -This said, we now define two bit settings of the flag byte of the -object. "ISPERMANENT" will be set by the user, when he calls -Permanent(). "ISIMMORTAL" will be used for compiled-in objects -that we don't want the user to ever destroy. -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -Flag bit definitions that apply to all objects are assigned -starting with the least significant (0x01) bit. Flag bit definitions -specific to a certain object type are assigned starting with the -most significant (0x80) bit. We hope they never meet. -*/ -/* -:h3 id=preserve.PRESERVE() Macro - -Occasionally an TYPE1IMAGER operator is implemented by calling other -TYPE1IMAGER operators. For example, Arc2() calls Conic(). When we -call more than one operator as a subroutine, we have to be careful -of temporary objects. A temporary object will be consumed by the -subroutine operator and then is no longer available for the caller. -This can be prevented simply by bumping a temporary object's reference -count. -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h3.RefRoll() Macro to Detect References Count Rollover - -The following macro is designed to check for reference count rollover. -A return value of TRUE means rollover has not occurred; a return value -of FALSE means we cannot increment the reference count. Note also that -those functions that use this macro must decrement the reference count -afterwards. 3-26-91 PNM -*/ - -#define RefRoll(obj) (++(obj)->references > 0) - -/* -:h2.TYPE1IMAGER Object Functions - -:h3.LONGCOPY() - Macro to Copy "long" Aligned Data - -Copying arbitrary bytes in C is a bit of a problem. "strcpy" can't be -used, because 0 bytes are special-cased. Most environments have a -routine "memcopy" or "bcopy" or "bytecopy" that copies memory containing -zero bytes. Sadly, there is no standard on the name of such a routine, -which makes it impossible to write truely portable code to use it. - -It turns out that TYPE1IMAGER, when it wants to copy data, frequently -knows that both the source and destination are aligned on "long" -boundaries. This allows us to copy by using "long *" pointers. This -is usually very efficient on almost all processors. Frequently, it -is more efficient than using general-purpose assembly language routines. -So, we define a macro to do this in a portable way. "dest" and "source" -must be long-aligned, and "bytes" must be a multiple of "sizeof(long)": -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Allocate() - Allocating a Memory Block - -Allocate returns a pointer to memory object that is a copy of -the template passed (if any). In addition, extra bytes may be -allocated contiguously with the object. (This may be useful for -variable size objects such as edge lists. See :hdref refid=regions..) - -Allocate() always returns a non-immortal object, even if the template is -immortal. Therefore a non-NULL template must have a "flag" byte. - -If the template is NULL, then 'size' bytes are cleared to all NULLs. - -If the template is non-NULL, a new object is allocated in memory. -It therefore seems logical that its reference count field should be -set to 1. So, a nun-NULL template must also have a "references" field. -PNM 3-26-91 -*/ - - -/* to pacify gcc we put the externals here ... */ -extern struct XYspace *USER; -extern jmp_buf stck_state; - - -struct xobject *t1_Allocate(size, template, extra) /* non-ANSI; type checking was too strict */ - register int size; /* number of bytes to allocate & initialize */ - register struct xobject *template; /* example structure to allocate */ - register int extra; /* any extra uninitialized bytes needed contiguously */ -{ - - register struct xobject *r; - - /* - * round up 'size' and 'extra' to be an integer number of 'long's: - */ - size = (size + sizeof(LONG) - 1) & -sizeof(LONG); - extra = (extra + sizeof(LONG) - 1) & -sizeof(LONG); - if (size + extra <= 0) - abort("Non-positive allocate?", 15); - r = (struct xobject *) malloc(size + extra); - - while (r == NULL) { - if (!GimeSpace()) { - IfTrace1(TRUE, "malloc attempted %d bytes.\n", - size + extra); - abort("We have REALLY run out of memory", 16); - } - r = (struct xobject *) malloc(size + extra); - } - - /* - * copy the template into the new memory: - */ - if (template != NULL) { - /* Added references count decrement if template is not permanent. - This is for the case where Allocate is called by a Dupxxxx - function, which was in turn called by Unique(). (PNM) */ - if (!ISPERMANENT(template->flag)) - --template->references; - LONGCOPY(r, template, size); - r->flag &= ~(ISPERMANENT(ON) | ISIMMORTAL(ON)); - /* added reference field 3-2-6-91 PNM */ - r->references = 1; - } - else { - register char **p1; - - for (p1=(char **)r; size > 0; size -= sizeof(char *)) - *p1++ = NULL; - } - - if (MemoryDebug > 1) { - register int *L; - L = (int *) r; - IfTrace4(TRUE, "Allocating at %p: %x %x %x\n", - L, L[-1], L[0], L[1]); - } - return(r); -} - -/* -:h3.Free() - Frees an Allocated Object - -This routine makes a sanity check to make sure the "type" field of the -standard object structure has not been cleared. If the object is -not a standard structure, then the macro "NonObjectFree" is available -that does not perform this check. - -In either case, the object must not be the NULL pointer. This preserves -portability, as the C system Xfree() will not always accept NULL. -*/ - -void Free(obj) /* non-ANSI to avoid overly strict type checking */ - register struct xobject *obj; /* structure to free */ -{ - if (obj->type == INVALIDTYPE) - abort("Free of already freed object?", 17); - obj->type = INVALIDTYPE; - - if (MemoryDebug > 1) { - register int *L; - L = (int *) obj; - IfTrace4(TRUE,"Freeing at %p: %x %x %x\n", L, L[-1], L[0], L[1]); - } - - free(obj); -} - -/* -:h3.Permanent() - Makes an Object Permanent - -Real simple--just set a flag. Every routine that consumes its objects -(which is almost every user entry) must check this flag, and not consume -the object if it is set. - -If a temporary object is made permanent, and there is more than one -reference to it, we must first Copy() it, then set the ISPERMANENT -flag. Note also that the reference count must be incremented when an -object is changed from temporary to permanent (see the ISUNIQUE macro). - -Note that the purpose of this function is to convert an object into a -permanent object: - If it was permanent to begin with, we do nothing; - If it was temporary and unique, we set the PERMANENT flag and increment -the reference count; - If it was temporary and nonunique, we must make a unique Copy(), set -the PERMANENT flag, and set the reference count to 2. We must also -decrement the original object's reference count, because what we have -done is to change one of the old temporary handles to a permanent one. -3-26-91 PNM -*/ - -struct xobject *t1_Permanent(obj) /* non-ANSI to avoid overly strict type checking */ - register struct xobject *obj; /* object to be made permanent */ -{ - IfTrace1((MustTraceCalls),"Permanent(%p)\n", obj); - - if ( (obj != NULL) && ( !(ISPERMANENT(obj->flag)) ) ) - { - /* there is a non-NULL, temporary object to be made permanent. - If there are multiple references to this object, first get - a new COPY(). - Note also that we have to decrement the reference count if - we do a Copy() here, because we are consuming the temporary - argument passed, and returning a unique, permanent one. - */ - if ( obj->references > 1) - { - obj = Copy(obj); - } - /* now set the permanent flag, and increment the reference - count, since a temporary object has now become permanent. */ - obj->references++; - obj->flag |= ISPERMANENT(ON); - } - return(obj); -} - -/* -:h3.Temporary() - Undoes the Effect of "Permanent()" - -This simply resets the "ISPERMANENT" flag. - -If a permanent object is made temporary, and there is more than one reference -to it, we must first Copy() it, then reset the ISPERMANENT flag. However, -if the permanent object has obly one reference, we need only decrement the -reference count ( and reset the flag). - -Note that this function, in the case of a PERMANENT argument, basically -converts the PERMANENT handle to a TEMPORARY one. Thus, in the case of -a nonunique, permanent argument passed, we not only make a Copy(), -we also decrement the reference count, to reflect the fact that we have -lost a permanent handle and gained a temporary one. -PNM 3-2-6-91 -*/ - -struct xobject *xiTemporary(obj) /* non-ANSI to avoid overly strict type checking */ - register struct xobject *obj; /* object to be made permanent */ -{ - IfTrace1((MustTraceCalls),"Temporary(%p)\n", obj); - - if (obj != NULL) { - /* if it's already temporary, there's nothing to do. */ - if ISPERMANENT(obj->flag) - { - /* if there are multiple references to this object, get a - Copy we can safely alter. Recall that the reference count - is incremented for permanent objects. - Recall further that Copy returns an object with the - same flag state and a reference count of 2 (for PERMANENT - objects). - Thus, regardless of whether or not we need to copy a - permanent object, we still decrement its reference - count and reset the flag. - */ - if (obj->references != 2 || ISIMMORTAL(obj->flag)) - { - /* not unique; consume handle, get a temporary Copy! */ - obj = Copy(obj); - } - /* else decrement the reference count (since it's going from - permanent to temporary) and clear the flag. */ - else { - obj->references--; - obj->flag &= ~ISPERMANENT(ON); - } - } - } - return(obj); -} - -/* -:h3.Dup() - Duplicate an Object - -Dup will increment the reference count of an object, only making a -Copy() if needed. -Note that Dup() retains the state of the permanent flag. -3-26-91 PNM -*/ - - -struct xobject *t1_Dup(obj) /* non-ANSI avoids overly strict type checking */ - register struct xobject *obj; /* object to be duplicated */ -{ - register char oldflag; /* copy of original object's flag byte */ - - IfTrace1((MustTraceCalls),"Dup(%p)\n", obj); - - if (obj == NULL) - return(NULL); - /* An immortal object must be Copy'ed, so that we get a mortal - copy of it, since we try not to destroy immortal objects. */ - if (ISIMMORTAL(obj->flag)) - return(Copy(obj)); - - /* if incrementing the reference count doesn't cause the count - to wrap, simply return the object with the count bumped. Note - that the RefRoll macro increments the count to perform the - rollover check, so we must decrement the count. */ - if (RefRoll(obj)) - return(obj); - - /* that didn't work out, so put the count back and call Copy(). */ - --obj->references; - oldflag = obj->flag; - obj = Copy(obj); - if (ISPERMANENT(oldflag)) - obj = Permanent(obj); - return(obj); -} - -/* -:h3.Copy() - Make a New Copy of an Object - -This is the generic Copy() where the object type is unknown. There -are specific Copyxxx functions for known object types. - -Copy will create a NEW temporary object, and WILL NOT simply bump the -reference count. - -Sometimes duplicating an object is just as simple as Allocating with it -as a template. But other objects are complicated linked lists. So, we -let each module provide us a routine (or macro) that duplicates the -objects it knows about. -*/ - -struct xobject *t1_Copy(obj) - register struct xobject *obj; /* object to be Copy'ed */ -{ - if (obj == NULL) - return(NULL); - - if (ISPATHTYPE(obj->type)) - obj = (struct xobject *) CopyPath(obj); - else - switch (obj->type) { - case SPACETYPE: - obj = (struct xobject *) CopySpace(obj); break; - case FONTTYPE: - obj = (struct xobject *) CopyFont(obj); break; - case REGIONTYPE: - obj = (struct xobject *) CopyRegion(obj); break; - case PICTURETYPE: - obj = (struct xobject *) CopyPicture(obj); break; - case LINESTYLETYPE: - obj = (struct xobject *) CopyLineStyle(obj); break; - case STROKEPATHTYPE: - obj = (struct xobject *) CopyStrokePath(obj); break; - case CLUTTYPE: - obj = (struct xobject *) CopyCLUT(obj); break; - default: - return(ArgErr("Copy: invalid object", obj, NULL)); - } - - return(obj); -} - -/* -:h3.Destroy() - Destroys an Object - -This can get complicated. Just like with Copy(), we let the experts -handle it. -*/ -struct xobject *Destroy(obj) /* non-ANSI avoids overly strict type checking */ - register struct xobject *obj; /* object to be destroyed */ -{ - IfTrace1((MustTraceCalls),"Destroy(%p)\n", obj); - - if (obj == NULL) - return(NULL); - if (ISIMMORTAL(obj->flag)) { - IfTrace1(TRUE,"Destroy of immortal object %p ignored\n", obj); - return(NULL); - } - if (ISPATHTYPE(obj->type)) - KillPath(obj); - else { - switch (obj->type) { - case REGIONTYPE: - KillRegion(obj); - break; - case SPACETYPE: - KillSpace(obj); - break; - case LINESTYLETYPE: - KillLineStyle(obj); - break; - case FONTTYPE: - KillFont(obj); - break; - case PICTURETYPE: - /* KillPicture macro removed from sources (RMz, 2001-04-01) - KillPicture(obj); - */ - break; - case STROKEPATHTYPE: - KillStrokePath(obj); - break; - case CLUTTYPE: - KillCLUT(obj); - break; - default: - return(ArgErr("Destroy: invalid object", obj, NULL)); - } - } - return(NULL); -} -/* -:h2.Generally Useful Macros - -:h3.FOLLOWING() - Macro to Point to the Data Following a Structure - -There are several places in TYPE1IMAGER where we will allocate variable -data that belongs to a structure immediately after that structure. -This is a performance technique, because it reduces the number of -trips we have to take through Xalloc() and Xfree(). It turns out C has -a very convenient way to point past a structure--if 'p' is a pointer -to a structure, 'p+1' is a pointer to the data after it. This -behavior of C is somewhat startling and somewhat hard to follow, if -you are not used to it, so we define a macro to point to the data -following a structure: -*/ -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.TYPECHECK() - Verify the Type of an Argument - -This macro tests the type of an argument. If the test fails, it consumes -any other arguments as necessary and causes the imbedding routine to -return the value 'whenBAD'. - -Note that the consumeables list should be an argument list itself, for -example (0) or (2,A,B). See :hdref refid=consume. below. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.ARGCHECK() - Perform an Arbitrary Check on an Argument - -This macro is a generalization of TYPECHECK to take an arbitrary -predicate. If the error occurs (i.e., the predicate is true), the -arbitrary message 'msg' is returned. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.TYPENULLCHECK() - Extension of TYPECHECK() for NULL arguments - -Many routines allow NULLs to be passed as arguments. 'whenBAD' will -be returned in this case, too. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.MAKECONSUME() - Create a "Consume"-type Macro - -Consuming an object means destroying it if it is not permanent. This -logic is so common to all the routines, that it is immortalized in this -macro. For example, ConsumePath(p) can be simply defined as -MAKECONSUME(p,KillPath(p)). In effect, this macro operates on a -meta-level. -:i1/consuming objects/ -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h3.MAKEUNIQUE() - Create a "Unique"-type Macro - -Many routines are written to modify their arguments in place. Thus, -they want to insure that they duplicate an object if it is permanent. -This is called making an object "unique". For example, UniquePath(p) -can be simply defined as MAKEUNIQUE(p,DupPath(p)). -:i1/unique objects/ -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -An object is unique (and directly alterable) if there is only one -reference to it, and it is not permanent (in which case we increment -the reference count, so we don't have to check the permanent bit). -3-26-91 PNM - -Note the rules for making a unique object: -&drawing. - IF (obj->references = 1) return(obj); - ELSE (references > 1) - IF (ISPERMANENT(obj->flag)) return(Dupxxx(obj)); - ELSE (nonunique, temporary object!) - obj->references--; return(Dupxxx(obj)); -&edrawing. -If we must make a Copy of a nonunique, temporary object, we decrement -reference count of the original object! -*/ - -/* -:h3.Unique() - Make a Unique Object - -Here is a generic 'Unique' function if the object type is not known. -Why didn't we build it with the MAKEUNIQUE macro, you ask? Well, we -used to, but there is at least one damn compiler in the world that -raises errors if the types of an "(a) ? b : c" expression do not match. -Also, when we changed Dup() to retain the permanent/temporary flag, we -wanted to make sure "Unique" always returned a temporary object. - -Note that we cannot use Dup() to create a copy of the object in question, -because Dup() may simply bump the reference count, and not return a -unique copy to us. That is why we use t1_Copy(). - -The purpose of this function is to make sure we have a copy of an object -that we can safely alter: -:ol. -:li.If we have a unique, temporary object, we simply return the argument. -:li.If we have a nonunique, temporary object, we have to make a new copy -of it, and decrement the reference count of the original object, to reflect -the fact that we traded temporary handles. -:li.If we have a permanent object, we make a temporary copy of it, but -we do not decrement the reference count of the original permanent object, -because permanent objects, by definition, are persistent. 3-2-6-91 PNM -:eol. -*/ - -struct xobject *t1_Unique(obj) - struct xobject *obj; -{ - /* if the original object is not already unique, make a unique - copy...Note also that if the object was not permanent, we must - consume the old handle! 3-26-91 PNM - NOTE : consumption of the old handle moved to Allocate. 4-18-91 */ - if (!obj || obj->references == 1) - return(obj); - - obj = Copy(obj); - /* and make sure we return a temporary object ! */ - if (ISPERMANENT(obj->flag)) - { - obj->flag &= ~ISPERMANENT(ON); - obj->references--; - } - return(obj); -} - - -/* -:h2.Initialization, Error, and Debug Routines - -:h3 id=debugvar.Declarations for Debug Purposes - -We declare all the debug flags here. Some link editors make the not -unreasonable restriction that only one module may declare and -initialize global variables; all the rest must declare the variable -'extern'. This is logical, but is somewhat awkward to implement with -C include files. We solve the problem by temporarily making the name -'extern' a null name if GLOBALS is defined. (GLOBALS is only defined -in this OBJECTS module.) Since 'externs' can't be initialized, we -have to handle that with #defines too. -:i1/GLOBALS (&#define.)/ -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -static char *ErrorMessage = NULL; - -/* -:h3.Pragmatics() - Set/Reset Debug Flags - -We provide a controlled way for the TYPE1IMAGER user to set and reset -our debugging and tracing: -*/ -void Pragmatics(username, value) - char *username; /* name of the flag */ - int value; /* value to set it to */ -{ - register char *p; /* temporary loop variable */ -#define NAMESIZE 40 - char name[NAMESIZE]; /* buffer to store my copy of 'username' */ - - if (strlen(username) >= NAMESIZE) - abort("Pragmatics name too large", 18); - strcpy(name, username); - for (p = name; *p != '\0'; p++) - *p = toupper(*p); - - if (!strcmp(name, "ALL")) - MustTraceCalls = InternalTrace = /* MustCrash = */ - LineIOTrace = value; - - else if (!strcmp(name, "LINEIOTRACE")) - LineIOTrace = value; - - else if (!strcmp(name, "TRACECALLS")) - MustTraceCalls = value; - - else if (!strcmp(name, "CHECKARGS")) - MustCheckArgs = value; - - else if (!strcmp(name, "PROCESSHINTS")) - ProcessHints = value; - - else if (!strcmp(name, "SAVEFONTPATHS")) - SaveFontPaths = value; - - else if (!strcmp(name, "CRASTERCOMPRESSIONTYPE")) - CRASTERCompressionType = value; - - else if (!strcmp(name, "CRASHONUSERERROR")) - MustCrash = value; - - else if (!strcmp(name, "DEBUG")) - StrokeDebug = SpaceDebug = PathDebug = ConicDebug = LineDebug = - RegionDebug = MemoryDebug = FontDebug = - HintDebug = ImageDebug = OffPageDebug = value; - - else if (!strcmp(name, "CONICDEBUG")) - ConicDebug = value; - - else if (!strcmp(name, "LINEDEBUG")) - LineDebug = value; - - else if (!strcmp(name, "REGIONDEBUG")) - RegionDebug = value; - - else if (!strcmp(name, "PATHDEBUG")) - PathDebug = value; - - else if (!strcmp(name, "SPACEDEBUG")) - SpaceDebug = value; - - else if (!strcmp(name, "STROKEDEBUG")) - StrokeDebug = value; - - else if (!strcmp(name, "MEMORYDEBUG")) - MemoryDebug = value; - - else if (!strcmp(name, "FONTDEBUG")) - FontDebug = value; - - else if (!strcmp(name, "HINTDEBUG")) - HintDebug = value; - - else if (!strcmp(name, "IMAGEDEBUG")) - ImageDebug = value; - - else if (!strcmp(name, "OFFPAGEDEBUG")) - OffPageDebug = value; - -#ifdef MC68000 -/* -The following pragmatics flag turns on or off instruction histograming -for performance analysis. It is only defined in the Delta card -environment. -*/ - else if (!strcmp(name, "PROFILE")) { - if (value) - StartProfile(); - else - StopProfile(); - } -#endif - /* GimeSpace() is define as false ... */ - /* - else if (!strcmp(name, "FLUSHCACHE")) { - while (GimeSpace()) { ; } - } - */ - else if (!strcmp(name, "CACHEDCHARS")) - CachedChars = (value <= 0) ? 1 : value; - - else if (!strcmp(name, "CACHEDFONTS")) - CachedFonts = (value <= 0) ? 1 : value; - - else if (!strcmp(name, "CACHEBLIMIT")) - CacheBLimit = value; - - else if (!strcmp(name, "CONTINUITY")) - Continuity = value; - - - else { - printf("Pragmatics flag = '%s'\n", name); - ArgErr("Pragmatics: flag not known", NULL, NULL); - } - return; -} - -/* -:h3.Consume() - Consume a List of Arguments - -This general purpose routine is provided in the case where the object -type(s) to be consumed are unknown or not yet verified, and/or it is -not known whether the object is permanent. - -If the type of the argument is known, it is faster to directly consume -that type, for example, ConsumeRegion() or ConsumePath(). Furthermore, -if it is already known that the object is temporary, it is faster to -just kill it rather than consume it, for example, KillSpace(). -*/ - -void Consume(n, obj1, obj2, obj3) /* non-ANSI avoids overly strict type checking */ - int n; - struct xobject *obj1,*obj2,*obj3; -{ - switch(n) { - - case 0: - return; - - case 1: - if (obj1 != NULL && !ISPERMANENT(obj1->flag)) - Destroy(obj1); - return; - - case 2: - if (obj1 != NULL && !ISPERMANENT(obj1->flag)) - Destroy(obj1); - if (obj2 != NULL && !ISPERMANENT(obj2->flag)) - Destroy(obj2); - return; - - case 3: - if (obj1 != NULL && !ISPERMANENT(obj1->flag)) - Destroy(obj1); - if (obj2 != NULL && !ISPERMANENT(obj2->flag)) - Destroy(obj2); - if (obj3 != NULL && !ISPERMANENT(obj3->flag)) - Destroy(obj3); - return; - - default: - abort("Consume: too many objects", 19); - } -} -/* -:h3.TypeErr() - Handles "Invalid Object Type" Errors -*/ - -struct xobject *TypeErr(name, obj, expect, ret) /* non-ANSI avoids overly strict type checking */ - char *name; /* Name of routine (for error message) */ - struct xobject *obj; /* Object in error */ - int expect; /* type expected */ - struct xobject *ret; /* object to return to caller */ -{ - static char typemsg[80]; - - if (MustCrash) - LineIOTrace = TRUE; - - sprintf(typemsg, "Wrong object type in %s; expected %s, found %s.\n", - name, TypeFmt(expect), TypeFmt(obj->type)); - IfTrace0(TRUE,typemsg); - - ObjectPostMortem(obj); - - if (MustCrash) - abort("Terminating because of CrashOnUserError...", 20); - else - ErrorMessage = typemsg; - -/* changed ISPERMANENT to ret->references > 1 3-26-91 PNM */ - if (ret != NULL && (ret->references > 1)) - ret = Dup(ret); - return(ret); -} - -/* -:h4.TypeFmt() - Returns Pointer to English Name of Object Type - -This is a subroutine of TypeErr(). -*/ - -static char *TypeFmt(type) - int type; /* type field */ -{ - char *r; - - if (ISPATHTYPE(type)) - if (type == TEXTTYPE) - r = "path or region (from TextPath)"; - else - r = "path"; - else { - switch (type) { - case INVALIDTYPE: - r = "INVALID (previously consumed?)"; - break; - case REGIONTYPE: - r = "region"; - break; - case SPACETYPE: - r = "XYspace"; - break; - case LINESTYLETYPE: - r = "linestyle"; - break; - case FONTTYPE: - r = "font"; - break; - case PICTURETYPE: - r = "picture"; - break; - case STROKEPATHTYPE: - r = "path (from StrokePath)"; - break; - default: - r = "UNKNOWN"; - break; - } - } - return(r); -} -/* -:h4.ObjectPostMortem() - Prints as Much as We Can About a Bad Object - -This is a subroutine of TypeErr() and ArgErr(). -*/ - -/*ARGSUSED*/ -static int ObjectPostMortem(obj) /* non-ANSI avoids overly strict type checking */ - register struct xobject *obj; -{ - - Pragmatics("Debug", 10); - IfTrace2(TRUE,"Bad object is of %s type %p\n", TypeFmt(obj->type), obj); - - IfTrace0((obj == (struct xobject *) USER), - "Suspect that InitImager() was omitted.\n"); - Pragmatics("Debug", 0); - /* We return a value to make ANSI-compiler happy */ - return(0); - -} - -/* -:h3.ArgErr() - Invalid Argument Passed to a Routine - -A common routine to report argument errors. It is usually called -is returned to the caller in case MustCrash is FALSE and ArgErr -returns to its caller. -*/ - -struct xobject *ArgErr(string, obj, ret) /* non-ANSI avoids overly strict type checking */ - char *string; /* description of error */ - struct xobject *obj; /* object, if any, that was in error */ - struct xobject *ret; /* object returned to caller or NULL */ -{ - if (MustCrash) - LineIOTrace = TRUE; - IfTrace1(TRUE,"ARGUMENT ERROR-- %s.\n", string); - if (obj != NULL) - ObjectPostMortem(obj); - if (MustCrash) - abort("Terminating because of CrashOnUserError...", 21); - else - ErrorMessage = string; - return(ret); -} - -/* -:h3.abort() - Crash Due to Error - -We divide by zero, and if that doesn't work, call exit(), the results of -which is system dependent (and thus is part of the Hourglass required -environment). -*/ -/* RMz: We now do a longjmp in order to be able to recover from the error */ -/*ARGSUSED*/ -void abort(string, no) - char *string; - int no; -{ - - LineIOTrace = TRUE; - TraceClose(); - longjmp( stck_state, no); - -} - -/* By RMz: Return the abort string to t1lib! */ -char *t1_get_abort_message( int number) -{ - static char *err_msgs[]={ - "DLdiv: dividend too large", /* 1 */ - "divide algorithm error", /* 2 */ - "Beziers this big not yet supported", /* 3 */ - "ComputeHint: invalid orientation", /* 4 */ - "ComputeHint: invalid hinttype", /* 5 */ - "ComputeHint: invalid orientation", /* 6 */ - "ProcessHint: invalid label", /* 7 */ - "ProcessHint: label is not in use", /* 8 */ - "ProcessHint: invalid label", /* 9 */ - "ProcessHint: invalid adjusttype", /* 10 */ - "bad subpath chain", /* 11 */ - "ImpliedHorizontalLine: why ask?", /* 12 */ - "disjoint subpath?", /* 13 */ - "unable to fix subpath break?", /* 14 */ - "Non-positive allocate?", /* 15 */ - "We have REALLY run out of memory", /* 16 */ - "Free of already freed object?", /* 17 */ - "Pragmatics name too large", /* 18 */ - "Consume: too many objects", /* 19 */ - "Terminating because of CrashOnUserError...", /* 20 */ - "Terminating because of CrashOnUserError...", /* 21 */ - "Fundamental TYPE1IMAGER assumptions invalid in this port", /* 22 */ - "Reverse: bad path segment", /* 23 */ - "UnClose: no LASTCLOSED", /* 24 */ - "PathTransform: invalid segment", /* 25 */ - "QueryPath: unknown segment", /* 26 */ - "QueryBounds: unknown type", /* 27 */ - "KillRegion: negative reference count", /* 28 */ - "newedge: height not positive", /* 29 */ - "Interior: path type error", /* 30 */ - "Unwind: uneven edges", /* 31 */ - "negative sized edge?", /* 32 */ - "splitedge: above top of list", /* 33 */ - "splitedge: would be null", /* 34 */ - "null splitedge", /* 35 */ - "vertjoin not disjoint", /* 36 */ - "SwathUnion: 0 height swath?", /* 37 */ - "discard(): ran off end", /* 38 */ - "UnJumble: unpaired edge?", /* 39 */ - "Tighten: existing edge bound was bad", /* 40 */ - "Tighten: existing region bound was bad", /* 41 */ - "EDGE ERROR: non EDGETYPE in list", /* 42 */ - "EDGE ERROR: overlapping swaths", /* 43 */ - "Context: QueryDeviceState didn't work", /* 44 */ - "QueryDeviceState returned invalid orientation", /* 45 */ - "Context: out of them", /* 46 */ - "MatrixInvert: can't", /* 47 */ - "xiStub called", /* 48 */ - "Illegal access type1 abort() message" /* 49 */ - }; - - /* no is valid from 1 to 48 */ - if ( (number<1)||(number>48)) - number=49; - return( err_msgs[number-1]); - -} - - -/* -:h3.REAL Miscellaneous Stuff - -:h4.ErrorMsg() - Return the User an Error Message -*/ - -char *ErrorMsg() -{ - register char *r; - - r = ErrorMessage; - ErrorMessage = NULL; - return(r); -} - -/* -:h4.InitImager() - Initialize TYPE1IMAGER - -We check that a short is 16 bits and a long 32 bits; we have made -those assumptions elsewhere in the code. (This is almost a C standard, -anyway.) Note that TYPE1IMAGER makes no assumptions about the size of an -'int'! -:i1/portability assumptions/ -*/ -void InitImager() -{ - -/* Check to see if we have been using our own malloc. If so,*/ -/* Undef malloc so that we can get to the system call. */ -/* All other calls to malloc are defined to Xalloc. */ - - if (sizeof(SHORT) != 2 || sizeof(LONG) != 4) - abort("Fundamental TYPE1IMAGER assumptions invalid in this port", 22); - InitSpaces(); - InitFonts(); - InitFiles(); -/* -In some environments, constants and/or exception handling need to be -*/ - LibInit(); -} -/* -:h4.TermImager() - Terminate TYPE1IMAGER - -This only makes sense in a server environment; true TYPE1IMAGER needs do -nothing. -*/ -void TermImager() -{ - return; -} -/* -:h4.reportusage() - A Stub to Get a Clean Link with Portable PMP -*/ -void reportusage( void) -{ - return; -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/objects.h xdvik-22.40n/libs/t1lib/lib/type1/objects.h --- xdvik-22.40l/libs/t1lib/lib/type1/objects.h Wed Apr 18 14:24:11 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/objects.h Thu Jan 1 00:00:00 1970 @@ -1,296 +0,0 @@ -/* $XConsortium: objects.h,v 1.6 92/03/20 14:35:56 keith Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - -/*END SHARED*/ -/*SHARED*/ - -#include "types.h" - -#define Permanent(obj) t1_Permanent(obj) -#define Temporary(obj) t1_Temporary(obj) -#define Destroy(obj) t1_Destroy(obj) -#define Dup(obj) t1_Dup(obj) -#define InitImager() t1_InitImager() -#define TermImager() t1_TermImager() -#define Pragmatics(f,v) t1_Pragmatics(f,v) -#define ErrorMsg() t1_ErrorMsg() - -struct xobject *t1_Permanent(); /* make an object permanent */ -struct xobject *t1_Temporary(); /* make an object temporary */ -struct xobject *t1_Destroy(); /* destroy an object */ -struct xobject *t1_Dup(); /* duplicate an object */ -void t1_InitImager(); /* initialize TYPE1IMAGER */ -void t1_TermImager(); /* terminate TYPE1IMAGER */ -void t1_Pragmatics(); /* set debug flags, etc. */ -char *t1_ErrorMsg(); /* return last TYPE1IMAGER error message */ - -/*END SHARED*/ -/*SHARED*/ - -#define abort(line,no) t1_abort(line,no) -#define Allocate(n,t,s) t1_Allocate(n,t,s) -#define Free(obj) t1_Free(obj) -#define NonObjectFree(a) free(a) -#define Consume t1_Consume -#define ArgErr(s,o,r) t1_ArgErr(s,o,r) -#define TypeErr(n,o,e,r) t1_TypeErr(n,o,e,r) -#define Copy(obj) t1_Copy(obj) -#define Unique(obj) t1_Unique(obj) - -void t1_abort(); /* crash; software logic error */ -struct xobject *t1_Allocate(); /* allocate memory */ -void t1_Free(); /* free memory */ -struct xobject *t1_Unique(); /* make a unique temporary copy of an object */ -struct xobject *t1_ArgErr(); /* handle argument errors */ -struct xobject *t1_TypeErr(); /* handle 'bad type' argument errors */ -void t1_Consume(); /* consume a variable number of arguments */ -struct xobject *t1_Copy(); /* make a new copy, not reference bump PNM */ - -/*END SHARED*/ -/*SHARED*/ - -#define ON (~0) /* all bits on */ -#ifndef FALSE -#define FALSE 0 /* handy zero value */ -#endif -#ifndef TRUE -#define TRUE 1 /* handy non-zero value */ -#endif - -#ifndef NULL -#define NULL 0 -/* -The NULL pointer is system specific. (Most systems, however, use 0.) -TYPE1IMAGER could have its own NULL, independent of the rest of the system, -were it not for malloc(). The system call malloc() returns NULL when -out of memory. -:i1/portibility assumptions/ -*/ -#endif - -#define TYPE1_MIN(a,b) (((a)<(b)) ? a : b) -#define TYPE1_MAX(a,b) (((a)>(b)) ? a : b) -#define TYPE1_ABS(a) (((a)>=0)?(a):-(a)) - -/*END SHARED*/ -/*SHARED*/ - -struct xobject { - char type; /* encoded type of object */ - unsigned char flag; /* flag byte for temporary object characteristics */ - short references; /* count of pointers to this object - (plus 1 for permanent objects) PNM */ -} ; - -/*END SHARED*/ -/*SHARED*/ - -#define XOBJ_COMMON char type; unsigned char flag; short references; - -/*END SHARED*/ -/*SHARED*/ - - -#define INVALIDTYPE 0 -#define FONTTYPE 1 -#define REGIONTYPE 3 -#define PICTURETYPE 4 -#define SPACETYPE 5 -#define LINESTYLETYPE 6 -#define EDGETYPE 7 -#define STROKEPATHTYPE 8 -#define CLUTTYPE 9 - -#define ISPATHTYPE(type) ((type)&0x10) /* all path segments have this bit on */ -#define LINETYPE (0+ISPATHTYPE(ON)) -#define CONICTYPE (1+ISPATHTYPE(ON)) -#define BEZIERTYPE (2+ISPATHTYPE(ON)) -#define HINTTYPE (3+ISPATHTYPE(ON)) - -#define MOVETYPE (5+ISPATHTYPE(ON)) -#define TEXTTYPE (6+ISPATHTYPE(ON)) - -/*END SHARED*/ -/*SHARED*/ - -#define ISPERMANENT(flag) ((flag)&0x01) -#define ISIMMORTAL(flag) ((flag)&0x02) - -/*END SHARED*/ -/*SHARED*/ - -#define PRESERVE(obj) if (!ISPERMANENT((obj)->flag)) \ - (obj)->references++; - -/*END SHARED*/ -/*SHARED*/ - -#define LONGCOPY(dest,source,bytes) { \ - register LONG *p1 = (LONG *)dest; register LONG *p2 = (LONG *)source; \ - register int count = (bytes) / sizeof(LONG); \ - while (--count >= 0) *p1++ = *p2++; } - - -/*END SHARED*/ -/*SHARED*/ - -#define FOLLOWING(p) ((p)+1) - -/*END SHARED*/ -/*SHARED*/ - -#define TYPECHECK(name, obj, expect, whenBAD, consumables, rettype) { \ - if (obj->type != expect) { \ - (Consume)consumables; \ - return((rettype)TypeErr(name, obj, expect, whenBAD)); \ - } \ -} - -/*END SHARED*/ -/*SHARED*/ - -#define ARGCHECK(test,msg,obj,whenBAD,consumables,rettype) { \ - if (test) { \ - (Consume)consumables; \ - return((rettype)ArgErr(msg, obj, whenBAD)); \ - } \ -} - -/*END SHARED*/ -/*SHARED*/ - -/* Changed use of Dup() below to Temporary(Copy()) because Dup() does not - necessarily return a Unique Copy anymore! 3-26-91 */ -#define TYPENULLCHECK(name, obj, expect, whenBAD, consumables,rettype) \ - if (obj == NULL) { \ - (Consume)consumables; \ - if (whenBAD != NULL && ISPERMANENT(whenBAD->flag)) \ - return((rettype)Temporary(Copy(whenBAD))); \ - else return((rettype)whenBAD); \ - } else { \ - if (obj->type != expect) { \ - (Consume)consumables; \ - return((rettype)TypeErr(name, obj, expect, whenBAD)); \ - } \ - } -/*END SHARED*/ -/*SHARED*/ - -#define MAKECONSUME(obj,stmt) { if (!ISPERMANENT(obj->flag)) stmt; } - -/*END SHARED*/ -/*SHARED*/ - -#define MAKEUNIQUE(obj,stmt) ( ( (obj)->references > 1 ) ? stmt : obj ) - -/*END SHARED*/ -/*SHARED*/ -/* NDW: personally, I want to see status and error messages! */ -#define IfTrace0(condition,model) \ - {if (condition) printf(model);} -#define IfTrace1(condition,model,arg0) \ - {if (condition) printf(model,arg0);} -#define IfTrace2(condition,model,arg0,arg1) \ - {if (condition) printf(model,arg0,arg1);} -#define IfTrace3(condition,model,arg0,arg1,arg2) \ - {if (condition) printf(model,arg0,arg1,arg2);} -#define IfTrace4(condition,model,arg0,arg1,arg2,arg3) \ - {if (condition) printf(model,arg0,arg1,arg2,arg3);} -#define IfTrace5(condition,model,arg0,arg1,arg2,arg3,arg4) \ - {if (condition) printf(model,arg0,arg1,arg2,arg3,arg4);} -#define IfTrace6(condition,model,arg0,arg1,arg2,arg3,arg4,arg5) \ - {if (condition) printf(model,arg0,arg1,arg2,arg3,arg4,arg5);} -/* NDW: patch ends */ - -void Trace0(); -char *Trace1(),*Trace2(),*Trace3(),*Trace4(),*Trace5(),*Trace6(); - -#ifdef GLOBALS - -#define extern -#define INITIALIZED(value) = value - -#else - -#define INITIALIZED(value) - -#endif - -extern char MustCheckArgs INITIALIZED(TRUE); -extern char MustTraceCalls INITIALIZED(FALSE); -extern char MustCrash INITIALIZED(TRUE); -extern char InternalTrace INITIALIZED(TRUE); -extern char LineIOTrace INITIALIZED(TRUE); - -extern char ProcessHints INITIALIZED(TRUE); - -extern char SaveFontPaths INITIALIZED(TRUE); - -extern short CRASTERCompressionType INITIALIZED(1); - -extern char ConicDebug INITIALIZED(0); -extern char LineDebug INITIALIZED(0); -extern char RegionDebug INITIALIZED(0); -extern char PathDebug INITIALIZED(0); -extern char FontDebug INITIALIZED(0); -extern char SpaceDebug INITIALIZED(0); -extern char StrokeDebug INITIALIZED(0); -extern char MemoryDebug INITIALIZED(0); -extern char HintDebug INITIALIZED(0); -extern char ImageDebug INITIALIZED(0); -extern char OffPageDebug INITIALIZED(0); - -extern short CachedChars INITIALIZED(0x7FFF); -extern short CachedFonts INITIALIZED(0x7FFF); -extern int CacheBLimit INITIALIZED(12500); -extern char Continuity INITIALIZED(2); - -#ifdef extern -#undef extern -#endif - -/* -We define other routines formatting parameters -*/ -#define DumpArea(area) t1_DumpArea(area) -#define DumpText(text) t1_DumpText(text) -/* #define DumpPath(path) t1_DumpPath(path) */ /* commented by RMz, 1999-06-10 */ -#define DumpSpace(space) t1_DumpSpace(space) -#define DumpEdges(e) t1_DumpEdges(e) -#define FormatFP(s,p) t1_FormatFP(s,p) - -void t1_DumpArea(); /* dump a region structure */ -void t1_DumpText(); /* dump a textpath structure */ -void t1_DumpPath(); /* dump a path list */ -void t1_DumpSpace(); /* dump a coordinate space structure */ -void t1_DumpEdges(); /* dump a region's edge list */ -void t1_FormatFP(); /* dump a format a "fractpel" coordinate */ - -/*END SHARED*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/paths.c xdvik-22.40n/libs/t1lib/lib/type1/paths.c --- xdvik-22.40l/libs/t1lib/lib/type1/paths.c Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/paths.c Thu Jan 1 00:00:00 1970 @@ -1,1514 +0,0 @@ -/* $XConsortium: paths.c,v 1.4 91/10/10 11:18:40 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - /* PATHS CWEB V0021 ******** */ -/* -:h1 id=paths.PATHS Module - Path Operator Handler - -This is the module that is responsible for building and transforming -path lists. - -&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) - - -:h3.Include Files - -The included files are: -*/ - -#include -#include - /* after the system includes (dsr) */ -#include "types.h" -#include "objects.h" -#include "spaces.h" -#include "paths.h" -#include "regions.h" /* understands about Union */ -#include "fonts.h" /* understands about TEXTTYPEs */ -#include "pictures.h" /* understands about handles */ -#include "strokes.h" /* understands how to coerce stroke paths */ -#include "trig.h" -static int UnClose(); - -/* -:h3.Routines Available to the TYPE1IMAGER User - -The PATHS routines that are made available to the outside user are: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Functions Provided to Other Modules - -The path routines that are made available to other TYPE1IMAGER modules -are defined here: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -NOTE: because of the casts put in the macros for Loc, ArcCA, Conic, -RoundConic, PathSegment, and JoinSegment, we cannot use the macro names -when the functions are actually defined. We have to use the unique -names with their unique first two characters. Thus, if anyone in the -future ever decided to change the first two characters, it would not be -enough just to change the macro (as it would for most other functions). -He would have to also change the function definition. -*/ -/* -:h3.Macros Provided to Other Modules - -The CONCAT macro is defined here and used in the STROKES module. See -:hdref refid=pathmac.. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h2.Path Segment Structures - -A path is represented as a linked list of the following structure: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -When 'link' is NULL, we are at the last segment in the path (surprise!). - -'last' is only non-NULL on the first segment of a path, -for all the other segments 'last' == NULL. We test for a non-NULL -'last' (ISPATHANCHOR predicate) when we are given an alleged path -to make sure the user is not trying to pull a fast one on us. - -A path may be a collection of disjoint paths. Every break in the -disjoint path is represented by a MOVETYPE segment. - -Closed paths are discussed in :hdref refid=close.. - -:h3.CopyPath() - Physically Duplicating a Path - -This simple function illustrates moving through the path linked list. -Duplicating a segment just involves making a copy of it, except for -text, which has some auxilliary things involved. We don't feel -competent to duplicate text in this module, so we call someone who -knows how (in the FONTS module). -*/ -struct segment *CopyPath(p0) - register struct segment *p0; /* path to duplicate */ -{ - register struct segment *p,*n=NULL,*last=NULL,*anchor; - - for (p = p0, anchor = NULL; p != NULL; p = p->link) { - - ARGCHECK((!ISPATHTYPE(p->type) || (p != p0 && p->last != NULL)), - "CopyPath: invalid segment", p, NULL, (0), struct segment *); - - if (p->type == TEXTTYPE) - n = (struct segment *) CopyText(p); - else - n = (struct segment *)Allocate(p->size, p, 0); - n->last = NULL; - if (anchor == NULL) - anchor = n; - else - last->link = n; - last = n; - } -/* -At this point we have a chain of newly allocated segments hanging off -'anchor'. We need to make sure the first segment points to the last: -*/ - if (anchor != NULL) { - n->link = NULL; - anchor->last = n; - } - - return(anchor); -} -/* -:h3.KillPath() - Destroying a Path - -Destroying a path is simply a matter of freeing each segment in the -linked list. Again, we let the experts handle text. -*/ -void KillPath(p) - register struct segment *p; /* path to destroy */ -{ - register struct segment *linkp; /* temp register holding next segment*/ - - /* return conditional based on reference count 3-26-91 PNM */ - if ( (--(p->references) > 1) || - ( (p->references == 1) && !ISPERMANENT(p->flag) ) ) - return; - - while (p != NULL) { - if (!ISPATHTYPE(p->type)) { - ArgErr("KillPath: bad segment", p, NULL); - return; - } - linkp = p->link; - if (p->type == TEXTTYPE) - KillText(p); - else - Free(p); - p = linkp; - } -} - -/* -:h2 id=location."location" Objects - -The TYPE1IMAGER user creates and destroys objects of type "location". These -objects locate points for the primitive path operators. We play a trick -here and store these objects in the same "segment" structure used for -paths, with a type field == MOVETYPE. - -This allows the Line() operator, for example, to be very trivial: -It merely stamps its input structure as a LINETYPE and returns it to the -caller--assuming, of course, the input structure was not permanent (as -it usually isn't). - -:h3.The "movesegment" Template Structure - -This template is used as a generic segment structure for Allocate: -*/ - -/* added reference field 1 to temporary template below 3-26-91 PNM */ -static struct segment movetemplate = { MOVETYPE, 0, 1, sizeof(struct segment), 0, - NULL, NULL, {0, 0} }; -/* -:h3.Loc() - Create an "Invisible Line" Between (0,0) and a Point - -*/ - -struct segment *t1_Loc(S, x, y) - register struct XYspace *S; /* coordinate space to interpret X,Y */ - DOUBLE x,y; /* destination point */ -{ - register struct segment *r; - - - IfTrace3((MustTraceCalls),"..Loc(S=%p, x=%f, y=%f)\n", S, x, y); - - r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0); - TYPECHECK("Loc", S, SPACETYPE, r, (0), struct segment *); - - r->last = r; - r->context = S->context; - (*S->convert)(&r->dest, S, x, y); - ConsumeSpace(S); - return(r); -} -/* -:h3.ILoc() - Loc() With Integer Arguments - -*/ -struct segment *ILoc(S, x, y) - register struct XYspace *S; /* coordinate space to interpret X,Y */ - register int x,y; /* destination point */ -{ - register struct segment *r; - - IfTrace3((MustTraceCalls),"..ILoc(S=%p, x=%d, y=%d)\n", - S, (LONG) x, (LONG) y); - r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0); - TYPECHECK("Loc", S, SPACETYPE, r, (0), struct segment *); - - r->last = r; - r->context = S->context; - (*S->iconvert)(&r->dest, S, (LONG) x, (LONG) y); - ConsumeSpace(S); - return(r); -} - -/* -:h3.SubLoc() - Vector Subtraction of Two Locition Objects - -This user operator subtracts two location objects, yielding a new -location object that is the result. - -The symmetrical function AddLoc() is totally redundent with Join(), -so it is not provided. -*/ - -struct segment *SubLoc(p1, p2) - register struct segment *p1; - register struct segment *p2; -{ - IfTrace2((MustTraceCalls),"SubLoc(%p, %p)\n", p1, p2); - - ARGCHECK(!ISLOCATION(p1), "SubLoc: bad first arg", p1, NULL, (0), struct segment *); - ARGCHECK(!ISLOCATION(p2), "SubLoc: bad second arg", p2, NULL, (0), struct segment *); - p1 = UniquePath(p1); - p1->dest.x -= p2->dest.x; - p1->dest.y -= p2->dest.y; - ConsumePath(p2); - return(p1); -} - -/* -:h2.Straight Line Segments - -:h3.PathSegment() - Create a Generic Path Segment - -Many routines need a LINETYPE or MOVETYPE path segment, but do not -want to go through the external user's interface, because, for example, -they already know the "fractpel" destination of the segment and the -conversion is unnecessary. PathSegment() is an internal routine -provided to the rest of TYPE1IMAGER for handling these cases. -*/ - -struct segment *t1_PathSegment(type, x, y) - int type; /* LINETYPE or MOVETYPE */ - fractpel x,y; /* where to go to, if known */ -{ - register struct segment *r; /* newly created segment */ - - r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0); - r->type = type; - r->last = r; /* last points to itself for singleton */ - r->dest.x = x; - r->dest.y = y; - return(r); -} -/* -:h3.Line() - Create a Line Segment Between (0,0) and a Point P - -This involves just creating and filling out a segment structure: -*/ -struct segment *Line(P) - register struct segment *P; /* relevant coordinate space */ -{ - - IfTrace1((MustTraceCalls),"..Line(%p)\n", P); - ARGCHECK(!ISLOCATION(P), "Line: arg not a location", P, NULL, (0), struct segment *); - - P = UniquePath(P); - P->type = LINETYPE; - return(P); -} -/* -:h2.Curved Path Segments - -We need more points to describe curves. So, the structures for curved -path segments are slightly different. The first part is identical; -the curved structures are larger with the extra points on the end. - -:h3.Bezier Segment Structure - -We support third order Bezier curves. They are specified with four -control points A, B, C, and D. The curve starts at A with slope AB -and ends at D with slope CD. The curvature at the point A is inversely -related to the length |AB|, and the curvature at the point D is -inversely related to the length |CD|. Point A is always point (0,0). - -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Bezier() - Generate a Bezier Segment - -This is just a simple matter of filling out a 'beziersegment' structure: -*/ - -struct beziersegment *Bezier(B, C, D) - register struct segment *B; /* second control point */ - register struct segment *C; /* third control point */ - register struct segment *D; /* fourth control point (ending point) */ -{ -/* added reference field of 1 to temporary template below 3-26-91 PNM */ - static struct beziersegment template = - { BEZIERTYPE, 0, 1, sizeof(struct beziersegment), 0, - NULL, NULL, { 0, 0 }, { 0, 0 }, { 0, 0 } }; - - register struct beziersegment *r; /* output segment */ - - IfTrace3((MustTraceCalls),"..Bezier(%p, %p, %p)\n", B, C, D); - ARGCHECK(!ISLOCATION(B), "Bezier: bad B", B, NULL, (2,C,D), struct beziersegment *); - ARGCHECK(!ISLOCATION(C), "Bezier: bad C", C, NULL, (2,B,D), struct beziersegment *); - ARGCHECK(!ISLOCATION(D), "Bezier: bad D", D, NULL, (2,B,C), struct beziersegment *); - - r = (struct beziersegment *)Allocate(sizeof(struct beziersegment), &template, 0); - r->last = (struct segment *) r; - r->dest.x = D->dest.x; - r->dest.y = D->dest.y; - r->B.x = B->dest.x; - r->B.y = B->dest.y; - r->C.x = C->dest.x; - r->C.y = C->dest.y; - - ConsumePath(B); - ConsumePath(C); - ConsumePath(D); - return(r); -} - -/* -:h2.Font "Hint" Segments - -:h3.Hint() - A Font 'Hint' Segment - -This is temporary code while we experiment with hints. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -struct hintsegment *Hint(S, ref, width, orientation, hinttype, adjusttype, direction, label) - struct XYspace *S; - float ref; - float width; - char orientation; - char hinttype; - char adjusttype; - char direction; - int label; -{ -/* added reference field of 1 to hintsegment template below 3-26-91 PNM */ - static struct hintsegment template = { HINTTYPE, 0, 1, sizeof(struct hintsegment), 0, - NULL, NULL, { 0, 0 }, { 0, 0 }, { 0, 0 }, - ' ', ' ', ' ', ' ', 0}; - - register struct hintsegment *r; - - r = (struct hintsegment *)Allocate(sizeof(struct hintsegment), &template, 0); - - r->orientation = orientation; - if (width == 0.0) width = 1.0; - - if (orientation == 'h') { - (*S->convert)(&r->ref, S, 0.0, ref); - (*S->convert)(&r->width, S, 0.0, width); - } - else if (orientation == 'v') { - (*S->convert)(&r->ref, S, ref, 0.0); - (*S->convert)(&r->width, S, width, 0.0); - } - else - return((struct hintsegment *)ArgErr("Hint: orient not 'h' or 'v'", NULL, NULL)); - if (r->width.x < 0) r->width.x = - r->width.x; - if (r->width.y < 0) r->width.y = - r->width.y; - r->hinttype = hinttype; - r->adjusttype = adjusttype; - r->direction = direction; - r->label = label; - r->last = (struct segment *) r; - ConsumeSpace(S); - return(r); -} - -/* -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -POP removes the first segment in a path 'p' and Frees it. 'p' is left -pointing to the end of the path: -*/ -#define POP(p) \ - { register struct segment *linkp; \ - linkp = p->link; \ - if (linkp != NULL) \ - linkp->last = p->last; \ - Free(p); \ - p = linkp; } -/* -INSERT inserts a single segment in the middle of a chain. 'b' is -the segment before, 'p' the segment to be inserted, and 'a' the -segment after. -*/ -#define INSERT(b,p,a) b->link=p; p->link=a; p->last=NULL - -/* -:h3.Join() - Join Two Objects Together - -If these are paths, this operator simply invokes the CONCAT macro. -Why so much code then, you ask? Well we have to check for object -types other than paths, and also check for certain path consistency -rules. -*/ - -struct segment *Join(p1, p2) - register struct segment *p1,*p2; -{ - IfTrace2((MustTraceCalls && PathDebug > 1),"..Join(%p, %p)\n", p1, p2); - IfTrace2((MustTraceCalls && PathDebug <=1),"..Join(%p, %p)\n", p1, p2); -/* -We start with a whole bunch of very straightforward argument tests: -*/ - if (p2 != NULL) { - if (!ISPATHTYPE(p2->type)) { - - if (p1 == NULL) - return((struct segment *)Unique(p2)); - - switch (p1->type) { - - case REGIONTYPE: - - case STROKEPATHTYPE: - p1 = CoercePath(p1); - break; - - default: - return((struct segment *)BegHandle(p1, p2)); - } - } - - ARGCHECK((p2->last == NULL), "Join: right arg not anchor", p2, NULL, (1,p1), struct segment *); - p2 = UniquePath(p2); - -/* -In certain circumstances, we don't have to duplicate a permanent -location. (We would just end up destroying it anyway). These cases -are when 'p2' begins with a move-type segment: -*/ - if (p2->type == TEXTTYPE || p2->type == MOVETYPE) { - if (p1 == NULL) - return(p2); - if (ISLOCATION(p1)) { - p2->dest.x += p1->dest.x; - p2->dest.y += p1->dest.y; - ConsumePath(p1); - return(p2); - } - } - } - else - return((struct segment *)Unique(p1)); - - if (p1 != NULL) { - if (!ISPATHTYPE(p1->type)) - - switch (p2->type) { - - case REGIONTYPE: - - case STROKEPATHTYPE: - p2 = CoercePath(p2); - break; - - default: - return((struct segment *)EndHandle(p1, p2)); - } - - ARGCHECK((p1->last == NULL), "Join: left arg not anchor", p1, NULL, (1,p2), struct segment *); - p1 = UniquePath(p1); - } - else - return(p2); - -/* -At this point all the checking is done. We have two temporary non-null -path types in 'p1' and 'p2'. If p1 ends with a MOVE, and p2 begins with -a MOVE, we collapse the two MOVEs into one. We enforce the rule that -there may not be two MOVEs in a row: -*/ - - if (p1->last->type == MOVETYPE && p2->type == MOVETYPE) { - p1->last->flag |= p2->flag; - p1->last->dest.x += p2->dest.x; - p1->last->dest.y += p2->dest.y; - POP(p2); - if (p2 == NULL) - return(p1); - } -/* -Now we check for another silly rule. If a path has any TEXTTYPEs, -then it must have only TEXTTYPEs and MOVETYPEs, and furthermore, -it must begin with a TEXTTYPE. This rule makes it easy to check -for the special case of text. If necessary, we will coerce -TEXTTYPEs into paths so we don't mix TEXTTYPEs with normal paths. -*/ - if (p1->type == TEXTTYPE) { - if (p2->type != TEXTTYPE && !ISLOCATION(p2)) - p1 = CoerceText(p1); - } - else { - if (p2->type == TEXTTYPE) { - if (ISLOCATION(p1)) { - p2->dest.x += p1->dest.x; - p2->dest.y += p1->dest.y; - Free(p1); - return(p2); - } - else - p2 = CoerceText(p2); - } - } -/* -Thank God! Finally! It's hard to believe, but we are now able to -actually do the join. This is just invoking the CONCAT macro: -*/ - CONCAT(p1, p2); - - return(p1); -} - -/* -:h3.JoinSegment() - Create a Path Segment and Join It to a Known Path - -This internal function is quicker than a full-fledged join because -it can do much less checking. -*/ - -struct segment *t1_JoinSegment(before, type, x, y, after) - register struct segment *before; /* path to join before new segment */ - int type; /* type of new segment (MOVETYPE or LINETYPE) */ - fractpel x,y; /* x,y of new segment */ - register struct segment *after; /* path to join after new segment */ -{ - register struct segment *r; /* returned path built here */ - - r = PathSegment(type, x, y); - if (before != NULL) { - CONCAT(before, r); - r = before; - } - else - r->context = after->context; - if (after != NULL) - CONCAT(r, after); - return(r); -} - -/* -:h2.Other Path Functions - -*/ - - -struct segment *t1_ClosePath(p0,lastonly) - register struct segment *p0; /* path to close */ - register int lastonly; /* flag deciding to close all subpaths or... */ -{ - register struct segment *p,*last=NULL,*start; /* used in looping through path */ - register fractpel x,y; /* current position in path */ - register fractpel firstx=0,firsty=0; /* start position of sub path */ - register struct segment *lastnonhint=NULL; /* last non-hint segment in path */ - - IfTrace1((MustTraceCalls),"ClosePath(%p)\n", p0); - if (p0 != NULL && p0->type == TEXTTYPE) - return(UniquePath(p0)); - if (p0->type == STROKEPATHTYPE) - return((struct segment *)Unique(p0)); - /* - * NOTE: a null closed path is different from a null open path - * and is denoted by a closed (0,0) move segment. We make - * sure this path begins and ends with a MOVETYPE: - */ - if (p0 == NULL || p0->type != MOVETYPE) - p0 = JoinSegment(NULL, MOVETYPE, 0, 0, p0); - TYPECHECK("ClosePath", p0, MOVETYPE, NULL, (0), struct segment *); - if (p0->last->type != MOVETYPE) - p0 = JoinSegment(p0, MOVETYPE, 0, 0, NULL); - - p0 = UniquePath(p0); - -/* -We now begin a loop through the path, -incrementing current 'x' and 'y'. We are searching -for MOVETYPE segments (breaks in the path) that are not already closed. -At each break, we insert a close segment. -*/ - for (p = p0, x = y = 0, start = NULL; - p != NULL; - x += p->dest.x, y += p->dest.y, last = p, p = p->link) - { - - if (p->type == MOVETYPE) { - if (start != NULL && (lastonly?p->link==NULL:TRUE) && - !(ISCLOSED(start->flag) && LASTCLOSED(last->flag))) { - register struct segment *r; /* newly created */ - - start->flag |= ISCLOSED(ON); - r = PathSegment(LINETYPE, firstx - x, - firsty - y); - INSERT(last, r, p); - r->flag |= LASTCLOSED(ON); - /*< adjust 'last' if possible for a 0,0 close >*/ -{ - -#define CLOSEFUDGE 3 /* if we are this close, let's change last segment */ - - if (r->dest.x != 0 || r->dest.y != 0) { - if (r->dest.x <= CLOSEFUDGE && r->dest.x >= -CLOSEFUDGE - && r->dest.y <= CLOSEFUDGE && r->dest.y >= -CLOSEFUDGE) { - IfTrace2((PathDebug), - "ClosePath forced closed by (%d,%d)\n", - r->dest.x, r->dest.y); - lastnonhint->dest.x += r->dest.x; - lastnonhint->dest.y += r->dest.y; - r->dest.x = r->dest.y = 0; - } - } -} - if (p->link != NULL) { - p->dest.x += x - firstx; - p->dest.y += y - firsty; - x = firstx; - y = firsty; - } - } - start = p; - firstx = x + p->dest.x; - firsty = y + p->dest.y; - } - else if (p->type != HINTTYPE) - lastnonhint = p; - } - return(p0); -} -/* -*/ -/* -:h2.Reversing the Direction of a Path - -This turned out to be more difficult than I thought at first. The -trickiness was due to the fact that closed paths must remain closed, -etc. - -We need three subroutines: -*/ - -static struct segment *SplitPath(); /* break a path at any point */ -static struct segment *DropSubPath(); /* breaks a path after first sub-path */ -static struct segment *ReverseSubPath(); /* reverses a single sub-path */ - -/* -:h3.Reverse() - User Operator to Reverse a Path - -This operator reverses the entire path. -*/ - -struct segment *Reverse(p) - register struct segment *p; /* full path to reverse */ -{ - register struct segment *r; /* output path built here */ - register struct segment *nextp; /* contains next sub-path */ - - IfTrace1((MustTraceCalls),"Reverse(%p)\n", p); - - if (p == NULL) - return(NULL); - - ARGCHECK(!ISPATHANCHOR(p), "Reverse: invalid path", p, NULL, (0), struct segment *); - - if (p->type == TEXTTYPE) - p = CoerceText(p); - p = UniquePath(p); - - r = NULL; - - do { - nextp = DropSubPath(p); - p = ReverseSubPath(p); - r = Join(p, r); - p = nextp; - - } while (p != NULL); - - return(r); -} - -/* -:h4.ReverseSubPath() - Subroutine to Reverse a Single Sub-Path -*/ - -static struct segment *ReverseSubPath(p) - register struct segment *p; /* input path */ -{ - register struct segment *r; /* reversed path will be created here */ - register struct segment *nextp; /* temporary variable used in loop */ - register int wasclosed; /* flag, path was closed */ - - if (p == NULL) - return(NULL); - - wasclosed = ISCLOSED(p->flag); - r = NULL; - - do { -/* -First we reverse the direction of this segment and clean up its flags: -*/ - p->dest.x = - p->dest.x; p->dest.y = - p->dest.y; - p->flag &= ~(ISCLOSED(ON) | LASTCLOSED(ON)); - - switch (p->type) { - - case LINETYPE: - case MOVETYPE: - break; - - case CONICTYPE: - { -/* -The logic of this is that the new M point (stored relative to the new -beginning) is (M - C). However, C ("dest") has already been reversed -So, we add "dest" instead of subtracting it: -*/ - register struct conicsegment *cp = (struct conicsegment *) p; - - cp->M.x += p->dest.x; cp->M.y += p->dest.y; - } - break; - - case BEZIERTYPE: - { - register struct beziersegment *bp = (struct beziersegment *) p; - - bp->B.x += p->dest.x; bp->B.y += p->dest.y; - bp->C.x += p->dest.x; bp->C.y += p->dest.y; - } - break; - - case HINTTYPE: - { - register struct hintsegment *hp = (struct hintsegment *) p; - - hp->ref.x = -hp->ref.x; hp->ref.y = -hp->ref.y; - } - break; - - default: - abort("Reverse: bad path segment", 23); - } -/* -We need to reverse the order of segments too, so we break this segment -off of the input path, and tack it on the front of the growing path -in 'r': -*/ - nextp = p->link; - p->link = NULL; - p->last = p; - if (r != NULL) - CONCAT(p,r); /* leaves result in 'p'... not what we want */ - r = p; - p = nextp; /* advance to next segment in input path */ - - } while (p != NULL); - - if (wasclosed) - r = ClosePath(r); - - return(r); -} - -/* -:h4.DropSubPath() - Drops the First Sub-Path Off a Path - -This subroutine returns the remaining sub-path(s). While doing so, it -breaks the input path after the first sub-path so that a pointer to -the original path now contains the first sub-path only. -*/ - -static struct segment *DropSubPath(p0) - register struct segment *p0; /* original path */ -{ - register struct segment *p; /* returned remainder here */ - - for (p = p0; p->link != NULL; p = p->link) { - if (p->link->type == MOVETYPE) - break; - } - - return(SplitPath(p0, p)); -} - -static struct segment *SplitPath(anchor, before) - register struct segment *anchor; - register struct segment *before; -{ - register struct segment *r; - - if (before == anchor->last) - return(NULL); - - r = before->link; - r->last = anchor->last; - anchor->last = before; - before->link = NULL; - - return(r); -} - - -/* -:h3.ReverseSubPaths() - Reverse the Direction of Sub-paths Within a Path - -This user operator reverses the sub-paths in a path, but leaves the -'move' segments unchanged. It builds on top of the subroutines -already established. -*/ - -struct segment *ReverseSubPaths(p) - register struct segment *p; /* input path */ -{ - register struct segment *r; /* reversed path will be created here */ - register struct segment *nextp; /* temporary variable used in loop */ - int wasclosed; /* flag; subpath was closed */ - register struct segment *nomove; /* the part of sub-path without move segment */ - struct fractpoint delta; - - IfTrace1((MustTraceCalls),"ReverseSubPaths(%p)\n", p); - - if (p == NULL) - return(NULL); - - ARGCHECK(!ISPATHANCHOR(p), "ReverseSubPaths: invalid path", p, NULL, (0), struct segment *); - - if (p->type == TEXTTYPE) - p = CoerceText(p); - if (p->type != MOVETYPE) - p = JoinSegment(NULL, MOVETYPE, 0, 0, p); - - p = UniquePath(p); - - r = NULL; - - for (; p != NULL;) { - nextp = DropSubPath(p); - wasclosed = ISCLOSED(p->flag); - if (wasclosed) - UnClose(p); - - nomove = SplitPath(p, p); - r = Join(r, p); - - PathDelta(nomove, &delta); - - nomove = ReverseSubPath(nomove); - p->dest.x += delta.x; - p->dest.y += delta.y; - if (nextp != NULL) { - nextp->dest.x += delta.x; - nextp->dest.y += delta.y; - } - if (wasclosed) { - nomove = ClosePath(nomove); - nextp->dest.x -= delta.x; - nextp->dest.y -= delta.y; - } - r = Join(r, nomove); - p = nextp; - - } - - return(r); -} - -static int UnClose(p0) - register struct segment *p0; -{ - register struct segment *p; - - for (p=p0; p->link->link != NULL; p=p->link) { ; } - - if (!LASTCLOSED(p->link->flag)) - abort("UnClose: no LASTCLOSED", 24); - - Free(SplitPath(p0, p)); - p0->flag &= ~ISCLOSED(ON); - return(0); - -} - -/* -:h2.Transforming and Putting Handles on Paths - -:h3.PathTransform() - Transform a Path - -Transforming a path involves transforming all the points. In order -that closed paths do not become "unclosed" when their relative -positions are slightly changed due to loss of arithmetic precision, -all point transformations are in absolute coordinates. - -(It might be better to reset the "absolute" coordinates every time a -move segment is encountered. This would mean that we could accumulate -error from subpath to subpath, but we would be less likely to make -the "big error" where our fixed point arithmetic "wraps". However, I -think I'll keep it this way until something happens to convince me -otherwise.) - -The transform is described as a "space", that way we can use our -old friend the "iconvert" function, which should be very efficient. -*/ - -struct segment *PathTransform(p0, S) - register struct segment *p0; /* path to transform */ - register struct XYspace *S; /* pseudo space to transform in */ -{ - register struct segment *p; /* to loop through path with */ - register fractpel newx,newy; /* current transformed position in path */ - register fractpel oldx,oldy; /* current untransformed position in path */ - register fractpel savex,savey; /* save path delta x,y */ - - p0 = UniquePath(p0); - - newx = newy = oldx = oldy = 0; - - for (p=p0; p != NULL; p=p->link) { - - savex = p->dest.x; savey = p->dest.y; - - (*S->iconvert)(&p->dest, S, p->dest.x + oldx, p->dest.y + oldy); - p->dest.x -= newx; - p->dest.y -= newy; - - switch (p->type) { - - case LINETYPE: - case MOVETYPE: - break; - - case CONICTYPE: - { - register struct conicsegment *cp = (struct conicsegment *) p; - - (*S->iconvert)(&cp->M, S, cp->M.x + oldx, cp->M.y + oldy); - cp->M.x -= newx; - cp->M.y -= newy; - /* - * Note roundness doesn't change... linear transform - */ - break; - } - - - case BEZIERTYPE: - { - register struct beziersegment *bp = (struct beziersegment *) p; - - (*S->iconvert)(&bp->B, S, bp->B.x + oldx, bp->B.y + oldy); - bp->B.x -= newx; - bp->B.y -= newy; - (*S->iconvert)(&bp->C, S, bp->C.x + oldx, bp->C.y + oldy); - bp->C.x -= newx; - bp->C.y -= newy; - break; - } - - case HINTTYPE: - { - register struct hintsegment *hp = (struct hintsegment *) p; - - (*S->iconvert)(&hp->ref, S, hp->ref.x + oldx, hp->ref.y + oldy); - hp->ref.x -= newx; - hp->ref.y -= newy; - (*S->iconvert)(&hp->width, S, hp->width.x, hp->width.y); - /* Note: width is not relative to origin */ - break; - } - - case TEXTTYPE: - { - XformText(p,S); - break; - } - - default: - IfTrace1(TRUE,"path = %p\n", p); - abort("PathTransform: invalid segment", 25); - } - oldx += savex; - oldy += savey; - newx += p->dest.x; - newy += p->dest.y; - } - return(p0); -} - -/* -:h3.PathDelta() - Return a Path's Ending Point -*/ - -void PathDelta(p, pt) - register struct segment *p; /* input path */ - register struct fractpoint *pt; /* pointer to x,y to set */ -{ - struct fractpoint mypoint; /* I pass this to TextDelta */ - register fractpel x,y; /* working variables for path current point */ - - for (x=y=0; p != NULL; p=p->link) { - x += p->dest.x; - y += p->dest.y; - if (p->type == TEXTTYPE) { - TextDelta(p, &mypoint); - x += mypoint.x; - y += mypoint.y; - } - } - - pt->x = x; - pt->y = y; -} - -/* -:h3.BoundingBox() - Produce a Bounding Box Path - -This function is called by image code, when we know the size of the -image in pels, and need to get a bounding box path that surrounds it. -The starting/ending handle is in the lower right hand corner. -*/ -struct segment *BoundingBox(h, w) - register pel h,w; /* size of box */ -{ - register struct segment *path; - - path = PathSegment(LINETYPE, -TOFRACTPEL(w), 0); - path = JoinSegment(NULL, LINETYPE, 0, -TOFRACTPEL(h), path); - path = JoinSegment(NULL, LINETYPE, TOFRACTPEL(w), 0, path); - path = ClosePath(path); - - return(path); -} - -/* -:h2.Querying Locations and Paths - -:h3.QueryLoc() - Return the X,Y of a Locition -*/ - -void QueryLoc(P, S, xP, yP) - register struct segment *P; /* location to query, not consumed */ - register struct XYspace *S; /* XY space to return coordinates in */ - register DOUBLE *xP,*yP; /* coordinates returned here */ -{ - IfTrace4((MustTraceCalls),"QueryLoc(P=%p, S=%p, (%f, %f))\n", - P, S, *xP, *yP); - if (!ISLOCATION(P)) { - ArgErr("QueryLoc: first arg not a location", P, NULL); - return; - } - if (S->type != SPACETYPE) { - ArgErr("QueryLoc: second arg not a space", S, NULL); - return; - } - UnConvert(S, &P->dest, xP, yP); -} -/* -:h3.QueryPath() - Find Out the Type of Segment at the Head of a Path - -This is a very simple routine that looks at the first segment of a -path and tells the caller what it is, as well as returning the control -point(s) of the path segment. Different path segments have different -number of control points. If the caller knows that the segment is -a move segment, for example, he only needs to pass pointers to return -one control point. -*/ - -void QueryPath(path, typeP, Bp, Cp, Dp, fP) - register struct segment *path; /* path to check */ - register int *typeP; /* return the type of path here */ - register struct segment **Bp; /* return location of first point */ - register struct segment **Cp; /* return location of second point */ - register struct segment **Dp; /* return location of third point */ - register DOUBLE *fP; /* return Conic sharpness */ -{ - register int coerced = FALSE; /* did I coerce a text path? */ - - IfTrace3((MustTraceCalls), "QueryPath(%p, %p, %p, ...)\n", - path, typeP, Bp); - if (path == NULL) { - *typeP = -1; - return; - } - if (!ISPATHANCHOR(path)) { - ArgErr("QueryPath: arg not a valid path", path, NULL); - } - if (path->type == TEXTTYPE) { - path = CoerceText(path); - coerced = TRUE; - } - - switch (path->type) { - - case MOVETYPE: - *typeP = 0; - *Bp = PathSegment(MOVETYPE, path->dest.x, path->dest.y); - break; - - case LINETYPE: - *typeP = (LASTCLOSED(path->flag)) ? 4 : 1; - *Bp = PathSegment(MOVETYPE, path->dest.x, path->dest.y); - break; - - case CONICTYPE: - { - register struct conicsegment *cp = (struct conicsegment *) path; - - *typeP = 2; - *Bp = PathSegment(MOVETYPE, cp->M.x, cp->M.y); - *Cp = PathSegment(MOVETYPE, cp->dest.x, cp->dest.y); - *fP = cp->roundness; - } - break; - - case BEZIERTYPE: - { - register struct beziersegment *bp = (struct beziersegment *) path; - - *typeP = 3; - *Bp = PathSegment(MOVETYPE, bp->B.x, bp->B.y); - *Cp = PathSegment(MOVETYPE, bp->C.x, bp->C.y); - *Dp = PathSegment(MOVETYPE, bp->dest.x, bp->dest.y); - } - break; - - case HINTTYPE: - *typeP = 5; - break; - - default: - abort("QueryPath: unknown segment", 26); - } - if (coerced) - KillPath(path); -} -/* -:h3.QueryBounds() - Return the Bounding Box of a Path - -Returns the bounding box by setting the user's variables. -*/ - -void QueryBounds(p0, S, xminP, yminP, xmaxP, ymaxP) - register struct segment *p0; /* object to check for bound */ - struct XYspace *S; /* coordinate space of returned values */ - DOUBLE *xminP,*yminP; /* lower left hand corner (set by routine) */ - DOUBLE *xmaxP,*ymaxP; /* upper right hand corner (set by routine) */ -{ - register struct segment *path; /* loop variable for path segments */ - register fractpel lastx,lasty; /* loop variables: previous endingpoint */ - register fractpel x,y; /* loop variables: current ending point */ - struct fractpoint min; /* registers to keep lower left hand corner */ - struct fractpoint max; /* registers to keep upper right hand corner */ - int coerced = FALSE; /* we have coerced the path from another object */ - DOUBLE x1,y1,x2,y2,x3,y3,x4,y4; /* corners of rectangle in space X */ - - IfTrace2((MustTraceCalls), "QueryBounds(%p, %p,", p0, S); - IfTrace4((MustTraceCalls), " %p, %p, %p, %p)\n", - xminP, yminP, xmaxP, ymaxP); - if (S->type != SPACETYPE) { - ArgErr("QueryBounds: bad XYspace", S, NULL); - return; - } - - min.x = min.y = max.x = max.y = 0; - if (p0 != NULL) { - if (!ISPATHANCHOR(p0)) { - switch(p0->type) { - case STROKEPATHTYPE: - /* replaced DupStrokePath() with Dup() 3-26-91 PNM */ - p0 = (struct segment *) DoStroke(Dup(p0)); - /* no break here, we have a region in p0 */ - case REGIONTYPE: - p0 = RegionBounds(p0); - break; - - case PICTURETYPE: - p0 = PictureBounds(p0); - break; - - default: - ArgErr("QueryBounds: bad object", p0, NULL); - return; - } - coerced = TRUE; - } - if (p0->type == TEXTTYPE) { - /* replaced CopyPath() with Dup() 3-26-91 PNM */ - p0 = (struct segment *)CoerceText(Dup(p0)); /* there are faster ways */ - coerced = TRUE; - } - if (p0->type == MOVETYPE) { - min.x = max.x = p0->dest.x; - min.y = max.y = p0->dest.y; - } - } - lastx = lasty = 0; - - for (path = p0; path != NULL; path = path->link) { - - x = lastx + path->dest.x; - y = lasty + path->dest.y; - - switch (path->type) { - - case LINETYPE: - break; - - case CONICTYPE: - { - register struct conicsegment *cp = (struct conicsegment *) path; - register fractpel Mx = lastx + cp->M.x; - register fractpel My = lasty + cp->M.y; - register fractpel deltax = 0.5 * cp->roundness * cp->dest.x; - register fractpel deltay = 0.5 * cp->roundness * cp->dest.y; - register fractpel Px = Mx - deltax; - register fractpel Py = My - deltay; - register fractpel Qx = Mx + deltax; - register fractpel Qy = My + deltay; - - - if (Mx < min.x) min.x = Mx; - else if (Mx > max.x) max.x = Mx; - if (My < min.y) min.y = My; - else if (My > max.y) max.y = My; - - if (Px < min.x) min.x = Px; - else if (Px > max.x) max.x = Px; - if (Py < min.y) min.y = Py; - else if (Py > max.y) max.y = Py; - - if (Qx < min.x) min.x = Qx; - else if (Qx > max.x) max.x = Qx; - if (Qy < min.y) min.y = Qy; - else if (Qy > max.y) max.y = Qy; - } - break; - - - case MOVETYPE: - /* - * We can't risk adding trailing Moves to the - * bounding box: - */ - if (path->link == NULL) - goto done; /* God forgive me */ - break; - - case BEZIERTYPE: - { - register struct beziersegment *bp = (struct beziersegment *) path; - register fractpel Bx = lastx + bp->B.x; - register fractpel By = lasty + bp->B.y; - register fractpel Cx = lastx + bp->C.x; - register fractpel Cy = lasty + bp->C.y; - - if (Bx < min.x) min.x = Bx; - else if (Bx > max.x) max.x = Bx; - if (By < min.y) min.y = By; - else if (By > max.y) max.y = By; - - if (Cx < min.x) min.x = Cx; - else if (Cx > max.x) max.x = Cx; - if (Cy < min.y) min.y = Cy; - else if (Cy > max.y) max.y = Cy; - } - break; - - case HINTTYPE: - break; - default: - abort("QueryBounds: unknown type", 27); - } - - if (x < min.x) min.x = x; - else if (x > max.x) max.x = x; - if (y < min.y) min.y = y; - else if (y > max.y) max.y = y; - - lastx = x; lasty = y; - } -done: - UnConvert(S, &min, &x1, &y1); - UnConvert(S, &max, &x4, &y4); - x = min.x; min.x = max.x; max.x = x; - UnConvert(S, &min, &x2, &y2); - UnConvert(S, &max, &x3, &y3); - - *xminP = *xmaxP = x1; - if (x2 < *xminP) *xminP = x2; - else if (x2 > *xmaxP) *xmaxP = x2; - if (x3 < *xminP) *xminP = x3; - else if (x3 > *xmaxP) *xmaxP = x3; - if (x4 < *xminP) *xminP = x4; - else if (x4 > *xmaxP) *xmaxP = x4; - - *yminP = *ymaxP = y1; - if (y2 < *yminP) *yminP = y2; - else if (y2 > *ymaxP) *ymaxP = y2; - if (y3 < *yminP) *yminP = y3; - else if (y3 > *ymaxP) *ymaxP = y3; - if (y4 < *yminP) *yminP = y4; - else if (y4 > *ymaxP) *ymaxP = y4; - - if (coerced) - Destroy(p0); -} -/* -:h3.BoxPath() -*/ -struct segment *BoxPath(S, h, w) - struct XYspace *S; - int h,w; -{ - struct segment *path; - - path = Join( Line(ILoc(S, w, 0)), Line(ILoc(S, 0, h)) ); - path = JoinSegment(path, LINETYPE, -path->dest.x, -path->dest.y, NULL); - return(ClosePath(path)); -} - -/* -:h3.DropSegment() - Drop the First Segment in a Path - -This routine takes the path and returns a new path that is one segment -shorter. It can be used in conjunction with QueryPath(), for example, -to ask about an entire path. -*/ - -struct segment *DropSegment(path) - register struct segment *path; -{ - IfTrace1((MustTraceCalls),"DropSegment(%p)\n", path); - if (path != NULL && path->type == STROKEPATHTYPE) - path = CoercePath(path); - ARGCHECK((path == NULL || !ISPATHANCHOR(path)), - "DropSegment: arg not a non-null path", path, path, (0), struct segment *); - if (path->type == TEXTTYPE) - path = CoerceText(path); - path = UniquePath(path); - - POP(path); - return(path); -} -/* -:h3.HeadSegment() - Return the First Segment in a Path - -This routine takes the path and returns a new path consists of the -first segment only. -*/ - -struct segment *HeadSegment(path) - register struct segment *path; /* input path */ -{ - IfTrace1((MustTraceCalls),"HeadSegment(%p)\n", path); - if (path == NULL) - return(NULL); - if (path->type == STROKEPATHTYPE) - path = CoercePath(path); - ARGCHECK(!ISPATHANCHOR(path), "HeadSegment: arg not a path", path, path, (0), struct segment *); - if (path->type == TEXTTYPE) - path = CoerceText(path); - path = UniquePath(path); - - if (path->link != NULL) - KillPath(path->link); - path->link = NULL; - path->last = path; - return(path); -} - -/* -:h2.Path Debug Routines - -:h3.DumpPath() - Display a Path on the Trace File - removed by RMz, 1999-06-07 -*/ - -/* -void DumpPath(p) - register struct segment *p; -{ - register fractpel x,y; - register fractpel lastx,lasty; - DOUBLE roundness; - - IfTrace1(TRUE,"Dumping path, anchor=%p:\n", p); - lastx = lasty = 0; - - for (;p != NULL; p=p->link) { - - IfTrace0(TRUE,". "); - x = p->dest.x; - y = p->dest.y; - switch (p->type) { - - case LINETYPE: - IfTrace1(TRUE,". line<%x> to", (LONG) p->flag); - IfTrace4(TRUE," (%d,%d), delta=(%d,%d)", - x + lastx, y + lasty, x, y); - break; - - case MOVETYPE: - IfTrace1(TRUE,"MOVE<%x> to", (LONG) p->flag); - IfTrace4(TRUE,"(%d,%d), delta=(%d,%d)", - x + lastx, y + lasty, x, y); - break; - - case CONICTYPE: - { - register struct conicsegment *cp = (struct conicsegment *) p; - - roundness = cp->roundness; - IfTrace2(TRUE, ". conic to (%d,%d),", - x + lastx, y + lasty); - IfTrace3(TRUE," M=(%d,%d), r=%p", cp->M.x + lastx, - cp->M.y + lasty, &roundness); - } - break; - - case BEZIERTYPE: - { - register struct beziersegment *bp = (struct beziersegment *) p; - - IfTrace4(TRUE,". bezier to (%d,%d), B=(%d,%d)", - x + lastx, y + lasty, - bp->B.x + lastx, bp->B.y + lasty); - IfTrace2(TRUE, ", C=(%d,%d)", - bp->C.x + lastx, bp->C.y + lasty); - } - break; - - case HINTTYPE: - { - register struct hintsegment *hp = (struct hintsegment *) p; - - IfTrace4(TRUE,". hint ref=(%d,%d), width=(%d,%d)", - hp->ref.x + lastx, hp->ref.y + lasty, - hp->width.x, hp->width.y); - IfTrace4(TRUE, ", %c %c %c %c", - hp->orientation, hp->hinttype, - hp->adjusttype, hp->direction); - IfTrace1(TRUE, ", %d", (LONG) hp->label); - } - break; - - case TEXTTYPE: - DumpText(p); - break; - - default: - IfTrace0(TRUE, "bad path segment?"); - } - IfTrace1(TRUE," at %p\n", p); - lastx += x; - lasty += y; - } -} - -*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/paths.h xdvik-22.40n/libs/t1lib/lib/type1/paths.h --- xdvik-22.40l/libs/t1lib/lib/type1/paths.h Wed Apr 18 14:24:11 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/paths.h Thu Jan 1 00:00:00 1970 @@ -1,199 +0,0 @@ -/* $XConsortium: paths.h,v 1.2 91/10/10 11:18:50 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - -#include "types.h" - -#define Loc(S,x,y) t1_Loc(S,(DOUBLE)x,(DOUBLE)y) -#define ILoc(S,x,y) t1_ILoc(S,x,y) -#define Line(P) t1_Line(P) -#define Join(p1,p2) t1_Join(p1,p2) -#define ClosePath(p) t1_ClosePath(p,0) -#define CloseLastSubPath(p) t1_ClosePath(p,1) -#define Conic(B,C,s) t1_Conic(B,C,(DOUBLE)s) -#define RoundConic(M,C,r) t1_RoundConic(M,C,(DOUBLE)r) -#define ArcP3(S,P2,P3) t1_ArcP3(S,P2,P3) -#define ArcCA(S,C,d) t1_ArcCA(S,C,(DOUBLE)d) -#define Bezier(B,C,D) t1_Bezier(B,C,D) -#define Hint(S,r,w,o,h,a,d,l) t1_Hint(S,r,w,o,h,a,d,l) -#define Reverse(p) t1_Reverse(p) -#define ReverseSubPaths(p) t1_ReverseSubPaths(p) -#define AddLoc(p1,p2) t1_Join(p1,p2) -#define SubLoc(p1,p2) t1_SubLoc(p1,p2) -#define DropSegment(p) t1_DropSegment(p) -#define HeadSegment(p) t1_HeadSegment(p) -#define QueryLoc(P,S,x,y) t1_QueryLoc(P,S,x,y) -#define QueryPath(p,t,B,C,D,r) t1_QueryPath(p,t,B,C,D,r) -#define QueryBounds(p,S,x1,y1,x2,y2) t1_QueryBounds(p,S,x1,y1,x2,y2) - - -struct segment *t1_Loc(); /* create a location object (or "move" segment) */ -struct segment *t1_ILoc(); /* integer argument version of same */ -struct segment *t1_Line(); /* straight line path segment */ -struct segment *t1_Join(); /* join two paths or regions together */ -struct segment *t1_ClosePath(); /* close a path or path set */ -struct conicsegment *t1_Conic(); /* conic curve path segment */ -struct conicsegment *t1_RoundConic(); /* ditto, specified another way */ -struct conicsegment *t1_ArcP3(); /* circular path segment with three points */ -struct conicsegment *t1_ArcCA(); /* ditto, with center point and angle */ -struct beziersegment *t1_Bezier(); /* Bezier third order curve path segment */ -struct hintsegment *t1_Hint(); /* produce a font 'hint' path segment */ -struct segment *t1_Reverse(); /* reverse the complete order of paths */ -struct segment *t1_ReverseSubPaths(); /* reverse only sub-paths; moves unchanged */ -struct segment *t1_SubLoc(); /* subtract two location objects */ -struct segment *t1_DropSegment(); /* Drop the first segment in a path */ -struct segment *t1_HeadSegment(); /* return the first segment in a path */ -void t1_QueryLoc(); /* Query location; return its (x,y) */ -void t1_QueryPath(); /* Query segment at head of a path */ -void t1_QueryBounds(); /* Query the bounding box of a path */ - -/*END SHARED*/ -/*SHARED*/ - -#define CopyPath(p) t1_CopyPath(p) -#define KillPath(p) t1_KillPath(p) -#define PathTransform(p,m) t1_PathXform(p,m) -#define PathDelta(p,pt) t1_PathDelta(p,pt) -#define BoundingBox(h,w) t1_BoundingBox(h,w) -#define PathSegment(t,x,y) t1_PathSegment(t,(fractpel)x,(fractpel)y) -#define JoinSegment(b,t,x,y,a) t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a) -#define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy) -#define BoxPath(S,h,w) t1_BoxPath(S,h,w) - -struct segment *t1_CopyPath(); /* duplicate a path */ -void t1_KillPath(); /* destroy a path */ -struct segment *t1_PathXform(); /* transform a path arbitrarily */ -void t1_PathDelta(); /* calculate the ending point of a path */ -struct segment *t1_PathSegment(); /* produce a MOVE or LINE segment */ -struct segment *t1_JoinSegment(); /* join a MOVE or LINE segment to a path */ -DOUBLE t1_Hypoteneuse(); /* returns the length of a line */ -struct segment *t1_BoxPath(); /* returns a rectangular path */ - -/*END SHARED*/ -/*SHARED*/ - -#define ConsumePath(p) MAKECONSUME(p,KillPath(p)) -#define UniquePath(p) MAKEUNIQUE(p,CopyPath(p)) - -/*END SHARED*/ -/*SHARED*/ - -struct segment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - unsigned char size; /* size of the structure */ - unsigned char context; /* index to device context */ - struct segment *link; /* pointer to next structure in linked list */ - struct segment *last; /* pointer to last structure in list */ - struct fractpoint dest; /* relative ending location of path segment */ -} ; - -#define ISCLOSED(flag) ((flag)&0x80) /* subpath is closed */ -#define LASTCLOSED(flag) ((flag)&0x40) /* last segment in closed subpath */ - -/* -NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the -subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE) -in the subpath - -We define the ISPATHANCHOR predicate to test that a path handle -passed by the user is valid: -*/ - -#define ISPATHANCHOR(p) (ISPATHTYPE(p->type)&&p->last!=NULL) - -/* -For performance reasons, a user's "location" object is identical to -a path whose only segment is a move segment. We define a predicate -to test for this case. See also :hdref refid=location.. -*/ - -#define ISLOCATION(p) ((p)->type == MOVETYPE && (p)->link == NULL) - -/*END SHARED*/ -/*SHARED*/ - -struct conicsegment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = CONICTYPE */ - unsigned char size; /* as with any 'segment' type */ - unsigned char context; /* as with any 'segment' type */ - struct segment *link; /* as with any 'segment' type */ - struct segment *last; /* as with any 'segment' type */ - struct fractpoint dest; /* Ending point (C point) */ - struct fractpoint M; /* "midpoint" of conic explained above */ - float roundness; /* explained above */ -} ; -/*END SHARED*/ -/*SHARED*/ - -struct beziersegment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = BEZIERTYPE */ - unsigned char size; /* as with any 'segment' type */ - unsigned char context; /* as with any 'segment' type */ - struct segment *link; /* as with any 'segment' type */ - struct segment *last; /* as with any 'segment' type */ - struct fractpoint dest; /* ending point (D) */ - struct fractpoint B; /* control point B */ - struct fractpoint C; /* control point C */ -} ; - -/*END SHARED*/ -/*SHARED*/ - -struct hintsegment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = HINTTYPE */ - unsigned char size; /* size of the structure */ - unsigned char context; /* device context */ - struct segment *link; /* pointer to next structure in linked list */ - struct segment *last; /* pointer to last structure in list */ - struct fractpoint dest; /* ALWAYS 0,0 */ - struct fractpoint ref; - struct fractpoint width; - char orientation; - char hinttype; - char adjusttype; - char direction; - int label; -} ; - -/*END SHARED*/ -/*SHARED*/ - -/* -CONCAT links the 'p2' path chain on the end of the 'p1' chain. (This macro -is also used by the STROKES module.) -*/ -#define CONCAT(p1, p2) { \ - p1->last->link = p2; /* link p2 on end of p1 */ \ - p1->last = p2->last; /* last of new is last of p2 */ \ - p2->last = NULL; } /* only first segment has non-NULL "last" */ - -/*END SHARED*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/paths_rmz.h xdvik-22.40n/libs/t1lib/lib/type1/paths_rmz.h --- xdvik-22.40l/libs/t1lib/lib/type1/paths_rmz.h Wed Apr 18 14:24:11 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/paths_rmz.h Thu Jan 1 00:00:00 1970 @@ -1,210 +0,0 @@ -/* $XConsortium: paths.h,v 1.2 91/10/10 11:18:50 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - -#include "types.h" - - -#define XOBJ_COMMON char type; unsigned char flag; short references; -#include "spaces_rmz.h" - - - -/* - -#define Loc(S,x,y) t1_Loc(S,(DOUBLE)x,(DOUBLE)y) -#define ILoc(S,x,y) t1_ILoc(S,x,y) -#define Line(P) t1_Line(P) -#define Join(p1,p2) t1_Join(p1,p2) -#define ClosePath(p) t1_ClosePath(p,0) -#define CloseLastSubPath(p) t1_ClosePath(p,1) -#define Conic(B,C,s) t1_Conic(B,C,(DOUBLE)s) -#define RoundConic(M,C,r) t1_RoundConic(M,C,(DOUBLE)r) -#define ArcP3(S,P2,P3) t1_ArcP3(S,P2,P3) -#define ArcCA(S,C,d) t1_ArcCA(S,C,(DOUBLE)d) -#define Bezier(B,C,D) t1_Bezier(B,C,D) -#define Hint(S,r,w,o,h,a,d,l) t1_Hint(S,r,w,o,h,a,d,l) -#define Reverse(p) t1_Reverse(p) -#define ReverseSubPaths(p) t1_ReverseSubPaths(p) -#define AddLoc(p1,p2) t1_Join(p1,p2) -#define SubLoc(p1,p2) t1_SubLoc(p1,p2) -#define DropSegment(p) t1_DropSegment(p) -#define HeadSegment(p) t1_HeadSegment(p) -#define QueryLoc(P,S,x,y) t1_QueryLoc(P,S,x,y) -#define QueryPath(p,t,B,C,D,r) t1_QueryPath(p,t,B,C,D,r) -#define QueryBounds(p,S,x1,y1,x2,y2) t1_QueryBounds(p,S,x1,y1,x2,y2) - -*/ - -/* -struct segment *t1_Loc(); -struct segment *t1_ILoc(); -struct segment *t1_Line(); -struct segment *t1_Join(); -struct segment *t1_ClosePath(); -struct conicsegment *t1_Conic(); -struct conicsegment *t1_RoundConic(); -struct conicsegment *t1_ArcP3(); -struct conicsegment *t1_ArcCA(); -struct beziersegment *t1_Bezier(); -struct hintsegment *t1_Hint(); -struct segment *t1_Reverse(); -struct segment *t1_ReverseSubPaths(); -struct segment *t1_SubLoc(); -struct segment *t1_DropSegment(); -struct segment *t1_HeadSegment(); -void t1_QueryLoc(); -void t1_QueryPath(); -void t1_QueryBounds(); - -*/ -/*END SHARED*/ -/*SHARED*/ - -#define CopyPath(p) t1_CopyPath(p) -#define KillPath(p) t1_KillPath(p) -#define PathTransform(p,m) t1_PathXform(p,m) -#define PathDelta(p,pt) t1_PathDelta(p,pt) -#define BoundingBox(h,w) t1_BoundingBox(h,w) -#define PathSegment(t,x,y) t1_PathSegment(t,(fractpel)x,(fractpel)y) -#define JoinSegment(b,t,x,y,a) t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a) -#define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy) -#define BoxPath(S,h,w) t1_BoxPath(S,h,w) - -struct segment *t1_CopyPath(); /* duplicate a path */ -void t1_KillPath(); /* destroy a path */ -struct segment *t1_PathXform(); /* transform a path arbitrarily */ -void t1_PathDelta(); /* calculate the ending point of a path */ -struct segment *t1_PathSegment(); /* produce a MOVE or LINE segment */ -struct segment *t1_JoinSegment(); /* join a MOVE or LINE segment to a path */ -DOUBLE t1_Hypoteneuse(); /* returns the length of a line */ -struct segment *t1_BoxPath(); /* returns a rectangular path */ - -/*END SHARED*/ -/*SHARED*/ - -#define ConsumePath(p) MAKECONSUME(p,KillPath(p)) -#define UniquePath(p) MAKEUNIQUE(p,CopyPath(p)) - -/*END SHARED*/ -/*SHARED*/ - -struct segment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - unsigned char size; /* size of the structure */ - unsigned char context; /* index to device context */ - struct segment *link; /* pointer to next structure in linked list */ - struct segment *last; /* pointer to last structure in list */ - struct fractpoint dest; /* relative ending location of path segment */ -} ; - -#define ISCLOSED(flag) ((flag)&0x80) /* subpath is closed */ -#define LASTCLOSED(flag) ((flag)&0x40) /* last segment in closed subpath */ - -/* -NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the -subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE) -in the subpath - -We define the ISPATHANCHOR predicate to test that a path handle -passed by the user is valid: -*/ - -#define ISPATHANCHOR(p) (ISPATHTYPE(p->type)&&p->last!=NULL) - -/* -For performance reasons, a user's "location" object is identical to -a path whose only segment is a move segment. We define a predicate -to test for this case. See also :hdref refid=location.. -*/ - -#define ISLOCATION(p) ((p)->type == MOVETYPE && (p)->link == NULL) - -/*END SHARED*/ -/*SHARED*/ - -struct conicsegment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = CONICTYPE */ - unsigned char size; /* as with any 'segment' type */ - unsigned char context; /* as with any 'segment' type */ - struct segment *link; /* as with any 'segment' type */ - struct segment *last; /* as with any 'segment' type */ - struct fractpoint dest; /* Ending point (C point) */ - struct fractpoint M; /* "midpoint" of conic explained above */ - float roundness; /* explained above */ -} ; -/*END SHARED*/ -/*SHARED*/ - -struct beziersegment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = BEZIERTYPE */ - unsigned char size; /* as with any 'segment' type */ - unsigned char context; /* as with any 'segment' type */ - struct segment *link; /* as with any 'segment' type */ - struct segment *last; /* as with any 'segment' type */ - struct fractpoint dest; /* ending point (D) */ - struct fractpoint B; /* control point B */ - struct fractpoint C; /* control point C */ -} ; - -/*END SHARED*/ -/*SHARED*/ - -struct hintsegment { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = HINTTYPE */ - unsigned char size; /* size of the structure */ - unsigned char context; /* device context */ - struct segment *link; /* pointer to next structure in linked list */ - struct segment *last; /* pointer to last structure in list */ - struct fractpoint dest; /* ALWAYS 0,0 */ - struct fractpoint ref; - struct fractpoint width; - char orientation; - char hinttype; - char adjusttype; - char direction; - int label; -} ; - -/*END SHARED*/ -/*SHARED*/ - -/* -CONCAT links the 'p2' path chain on the end of the 'p1' chain. (This macro -is also used by the STROKES module.) -*/ -#define CONCAT(p1, p2) { \ - (struct segment *)(p1)->last->link = (struct segment *)p2; \ - (struct segment *)(p1)->last = p2->last; \ - (struct segment *)(p2)->last = NULL; } - -/*END SHARED*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/pictures.h xdvik-22.40n/libs/t1lib/lib/type1/pictures.h --- xdvik-22.40l/libs/t1lib/lib/type1/pictures.h Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/pictures.h Thu Jan 1 00:00:00 1970 @@ -1,48 +0,0 @@ -/* $XConsortium: pictures.h,v 1.2 91/10/10 11:18:53 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* STUB */ - -#define CopyPicture(p) p -#define UniquePicture(p) p -/* #define KillPicture(p) */ -#define BegHandle(o,m) o -#define EndHandle(o,m) o -#define PictureBounds(P) P - -struct picture { - struct fractpoint origin; - struct fractpoint ending; -}; - -#define Phantom(o) t1_Phantom(o) -#define Snap(o) t1_Snap(o) - -struct segment *t1_Phantom(); -struct segment *t1_Snap(); diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/regions.c xdvik-22.40n/libs/t1lib/lib/type1/regions.c --- xdvik-22.40l/libs/t1lib/lib/type1/regions.c Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/regions.c Thu Jan 1 00:00:00 1970 @@ -1,1780 +0,0 @@ -/* $XConsortium: regions.c,v 1.4 91/10/10 11:18:57 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - /* REGIONS CWEB V0023 LOTS */ -/* -:h1 id=regions.REGIONS Module - Regions Operator Handler - -This module is responsible for creating and manipulating regions. - -&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) - - -:h3.Include Files - -The included files are: -*/ - -#include -#include - -#include "types.h" -#include "objects.h" -#include "spaces.h" -#include "regions.h" -#include "paths.h" -#include "curves.h" -#include "lines.h" -#include "pictures.h" -#include "fonts.h" -#include "hints.h" -#include "strokes.h" /* to pick up 'DoStroke' */ -static int Unwind(); -static int newfilledge(); -static struct edgelist *splitedge(); -static int vertjoin(); -static int touches(); -static int crosses(); -static int edgemin(); -static int edgemax(); -static int discard(); -static int edgecheck(); -static struct edgelist *NewEdge(); -struct edgelist *swathxsort(); /* 'SortSwath' function */ -extern struct XYspace *IDENTITY; - -/* -:h3.Functions Provided to the TYPE1IMAGER User - -This module provides the following TYPE1IMAGER entry points: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Functions Provided to Other Modules - -This module provides the following entry points to other modules: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Macros Provided to Other Modules - -:h4.GOING_TO() - Macro Predicate Needed for Changing Direction, Etc. - -The actual generation of run end lists (edge boundaries) is left -to the low level rasterizing modules, LINES and CURVES. There -are some global region-type -questions that occur when doing a low-level -rasterization: -:ol. -:li.Did we just change direction in Y and therefore need to start -a new edge? -:li.Did we run out of allocated edge space? -:li.Do the minimum or maximum X values for the current edge need -updating? -:eol. -In general the REGIONS is not smart enough to answer those questions -itself. (For example, determining if and when a curve changes direction -may need detailed curve knowledge.) Yet, this must be done efficiently. -We provide a macro "GOING_TO" where the invoker tells us where it is -heading for (x2,y2), plus where it is now (x1,y1), plus the current -region under construction, and the macro answers the questions above. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h2.Data Structures Used to Represent Regions - -:h3.The "region" Structure - -The region structure is an anchor for a linked list of "edgelist" -structures (see :hdref refid=edgelist..). It also summarizes the -information in the edgelist structures (for example, the bounding -box of the region). And, it contains scratch areas used during -the creation of a region. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -The ISOPTIMIZED flag tells us if we've put a permanent region in -'optimal' form. -*/ -#define ISOPTIMIZED(flag) ((flag)&0x10) - -/* -The ISRECTANGULAR flag tells us if a region is a rectangle. We don't -always notice rectangles--if this flag is set, the region definitely -is a rectangle, but some rectangular regions will not have the flag -set. The flag is used to optimize some paths. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h4."INFINITY" - A Constant Region Structure of Infinite Extent - -Infinity is the complement of a null area: -Note - removed the refcount = 1 init, replaced with references = 2 3-26-91 PNM -*/ -static struct region infinity = { REGIONTYPE, - ISCOMPLEMENT(ON)+ISINFINITE(ON)+ISPERMANENT(ON)+ISIMMORTAL(ON), 2, - {0, 0}, {0, 0}, - 0, 0, 0, 0, - NULL, NULL, - 0, 0, 0, 0, 0, NULL, NULL, - NULL, 0, NULL, NULL }; -/* we rename INFINITY to T1_INFINITY. Anyhow it is currently not used */ -struct region *T1_INFINITY = &infinity; - -/* -:h4."EmptyRegion" - A Region Structure with Zero Area - -This structure is used to initialize the region to be built in -Interior(): -Note - replaced refcount = 1 init with references = 2 3-26-91 PNM -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -struct region EmptyRegion = { REGIONTYPE, - ISPERMANENT(ON)+ISIMMORTAL(ON), 2, - {0, 0}, {0, 0}, - MAXPEL, MAXPEL, MINPEL, MINPEL, - NULL, NULL, - 0, 0, 0, 0, 0, NULL, NULL, - NULL, 0, NULL, NULL }; - -/* -:h3 id=edgelist.The "edgelist" Structure - -Regions are represented by a linked list of 'edgelist' structures. -When a region is complete, the structures are paired, one for the -left and one for the right edge. While a region is being built, -this rule may be violated temporarily. - -An 'edgelist' structure contains the X values for a given span -of Y values. The (X,Y) pairs define an edge. We use the crack -and edge coordinate system, so that integer values of X and Y -go between pels. The edge is defined between the minimum Y and -maximum Y. - -The linked list is kept sorted from top to bottom, that is, in -increasing y. Also, if 'e1' is an edgelist structure and 'e2' is the -next one in the list, they must have exactly the same ymin,ymax values -or be totally disjoint. These two requirements mean that if e2's ymin -is less than e1's ymax, it must be exactly equal to e1's ymin. A -sublist of structures with identical ymin and ymax values is called a -'swath'. - -In addition, edgelist structures are separately linked together based -on what subpath originally created them; each subpath is kept as a -separate circular linked list. This information is ignored unless -continuity checking is invoked. See :hdref refid=subpath. for a -complete description of this. -*/ - - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -The "edgelist" structure follows the convention of TYPE1IMAGER user -objects, having a type field and a flag field as the first two -elements. However, the user never sees "edgelist" structures -directly; he is given handles to "region" structures only. - -By having a type field, we can use the "copy" feature of Allocate() -to duplicate edge lists quickly. - -We also define two flag bits for this structure. The ISDOWN bit is set -if the edge is going in the direction of increasing Y. The ISAMBIGUOUS -bit is set if the edge is identical to its neighbor (edge->link); such -edges may be "left" when they should be "right", or vice versa, -unnecessarily confusing the continuity checking logic. The FixSubPaths() -routine in HINTS will swap ambiguous edges if that avoids crossing edges; -see :hdref refid=fixsubp.. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h3.KillRegion() - Destroys a Region - -KillRegion nominally just decrements the reference count to that region. -If the reference count becomes 0, all memory associated with it is -freed. We just follow the linked list, freeing as we go, then kill any -associated (thresholded) picture. -Note - added conditional return based on references 3-26-91 PNM -*/ - -void KillRegion(area) - register struct region *area; /* area to free */ -{ - register struct edgelist *p; /* loop variable */ - register struct edgelist *next; /* loop variable */ - - if (area->references < 0) - abort("KillRegion: negative reference count", 28); - if ( (--(area->references) > 1) || - ( (area->references == 1) && !ISPERMANENT(area->flag) ) ) - return; - - for (p=area->anchor; p != NULL; p=next) { - next = p->link; - Free(p); - } - /* KillPicture-macro removed from sources (RMz, 2001-04-01) - if (area->thresholded != NULL) - KillPicture(area->thresholded); - */ - Free(area); -} -/* -:h3.CopyRegion() - Makes a Copy of a Region -*/ -struct region *CopyRegion(area) - register struct region *area; /* region to duplicate */ -{ - register struct region *r; /* output region built here */ - register struct edgelist *last=NULL; /* loop variable */ - register struct edgelist *p,*newp; /* loop variables */ - - r = (struct region *)Allocate(sizeof(struct region), area, 0); - r->anchor = NULL; - - for (p=area->anchor; VALIDEDGE(p); p=p->link) { - - newp = NewEdge(p->xmin, p->xmax, p->ymin, p->ymax, p->xvalues, ISDOWN(p->flag)); - if (r->anchor == NULL) - r->anchor = last = newp; - else - last->link = newp; - - last = newp; - } - if (area->thresholded != NULL) - /* replaced DupPicture with Dup() 3-26-91 PNM */ - r->thresholded = (struct picture *)Dup(area->thresholded); - return(r); -} -/* -:h4.NewEdge() - Allocates and Returns a New "edgelist" Structure - -We allocate space for the X values contiguously with the 'edgelist' -structure that locates them. That way, we only have to free the -edgelist structure to free all memory associated with it. Damn -clever, huh? -*/ - -static struct edgelist *NewEdge(xmin, xmax, ymin, ymax, xvalues, isdown) - pel xmin,xmax; /* X extent of edge */ - pel ymin,ymax; /* Y extent of edge */ - pel *xvalues; /* list of X values for entire edge */ - int isdown; /* flag: TRUE means edge progresses downward */ -{ - static struct edgelist template = { - EDGETYPE, 0, 1, NULL, NULL, - 0, 0, 0, 0, NULL }; - - register struct edgelist *r; /* returned structure */ - register int iy; /* ymin adjusted for 'long' alignment purposes */ - - IfTrace2((RegionDebug),"....new edge: ymin=%d, ymax=%d ", - (LONG)ymin, (LONG) ymax); - if (ymin >= ymax) - abort("newedge: height not positive", 29); -/* -We are going to copy the xvalues into a newly allocated area. It -helps performance if the values are all "long" aligned. We can test -if the xvalues are long aligned by ANDing the address with the -(sizeof(long) - 1)--if non zero, the xvalues are not aligned well. We -set 'iy' to the ymin value that would give us good alignment: -*/ - iy = ymin - (((unsigned long) xvalues) & (sizeof(LONG) - 1)) / sizeof(pel); - - r = (struct edgelist *)Allocate(sizeof(struct edgelist), &template, - (ymax - iy) * sizeof(pel)); - - if (isdown) r->flag = ISDOWN(ON); - r->xmin = xmin; - r->xmax = xmax; - r->ymin = ymin; - r->ymax = ymax; - - r->xvalues = (pel *) FOLLOWING(r); - if (ymin != iy) { - r->xvalues += ymin - iy; - xvalues -= ymin - iy; - } - -/* -We must round up (ymax - iy) so we get the ceiling of the number of -longs. The destination must be able to hold these extra bytes because -Allocate() makes everything it allocates be in multiples of longs. -*/ - LONGCOPY(&r[1], xvalues, (ymax - iy) * sizeof(pel) + sizeof(LONG) - 1); - - IfTrace1((RegionDebug),"result=%p\n", r); - return(r); -} - -/* -:h2.Building Regions - -:h3.Interior() - Iterate Through a Path, Building a Region - -This routine is the workhorse driver routine that iterates through a -path, calling the appropriate stepping routines to actually produce the -run end "edgelist" structures. - -:ol. -:li."Interior" calls StepLine or StepConic or StepBezier as appropriate -to produce run ends. -:li.Occasionally these routines will notice a change in Y direction -and will call ChangeDirection (through the GOING_TO macro); this is -a call back to the REGIONS module. -:li.ChangeDirection will call whatever function is in the region -structure; for Interior, this function is 'newfilledge'. -:li.Newfilledge will call NewEdge to create a new edgelist structure, -then, call SortSwath to sort it onto the linked list being built at -the region "anchor". -:eol. - -By making the function called by ChangeDirection be a parameter of the -region, we allow the same ChangeDirection logic to be used by stroking. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -struct region *Interior(p, fillrule) - register struct segment *p; /* take interior of this path */ - register int fillrule; /* rule to follow if path crosses itself */ -{ - register fractpel x,y; /* keeps ending point of path segment */ - fractpel lastx,lasty; /* previous x,y from path segment before */ - register struct region *R; /* region I will build */ - register struct segment *nextP; /* next segment of path */ - struct fractpoint hint; /* accumulated hint value */ - char tempflag; /* flag; is path temporary? */ - char Cflag; /* flag; should we apply continuity? */ - - IfTrace2((MustTraceCalls),". INTERIOR(%p, %d)\n", p, (LONG) fillrule); - - if (p == NULL) - return(NULL); -/* -Establish the 'Cflag' continuity flag based on user's fill rule and -our own 'Continuity' pragmatic (0: never do continuity, 1: do what -user asked, >1: do it regardless). -*/ - if (fillrule > 0) { - Cflag = Continuity > 0; - fillrule -= CONTINUITY; - } - else - Cflag = Continuity > 1; - - ARGCHECK((fillrule != WINDINGRULE && fillrule != EVENODDRULE), - "Interior: bad fill rule", NULL, NULL, (1,p), struct region *); - - if (p->type == TEXTTYPE) -/* if (fillrule != EVENODDRULE) - else */ - return((struct region *)UniquePath(p)); - if (p->type == STROKEPATHTYPE){ - if (fillrule == WINDINGRULE) - return((struct region *)DoStroke(p)); - else - p = CoercePath(p); - } - - - R = (struct region *)Allocate(sizeof(struct region), &EmptyRegion, 0); - - ARGCHECK(!ISPATHANCHOR(p), "Interior: bad path", p, R, (0), struct region *); - ARGCHECK((p->type != MOVETYPE), "Interior: path not closed", p, R, (0), struct region *); - - -/* changed definition from !ISPERMANENT to references <= 1 3-26-91 PNM */ - tempflag = (p->references <= 1); /* only first segment in path is so marked */ - if (!ISPERMANENT(p->flag)) p->references -= 1; - - R->newedgefcn = newfilledge; -/* -Believe it or not, "R" is now completely initialized. We are counting -on the copy of template to get other fields the way we want them, -namely -:ol. -:li.anchor = NULL -:li.xmin, ymin, xmax, ymax, to minimum and maximum values respectively. -:eol. -Anchor = NULL is very -important to ChangeDirection. -See :hdref refid=CD.. - -To minimize problems of "wrapping" in our pel arithmetic, we keep an -origin of the region which is the first move. Hopefully, that keeps -numbers within plus or minus 32K pels. -*/ - R->origin.x = 0/*TOFRACTPEL(NEARESTPEL(p->dest.x))*/; - R->origin.y = 0/*TOFRACTPEL(NEARESTPEL(p->dest.y))*/; - lastx = - R->origin.x; - lasty = - R->origin.y; -/* -ChangeDirection initializes other important fields in R, such as -lastdy, edge, edgeYstop, edgexmin, and edgexmax. The first segment -is a MOVETYPE, so it will be called first. -*/ -/* -The hints data structure must be initialized once for each path. -*/ - - if (ProcessHints) - InitHints(); /* initialize hint data structure */ - - while (p != NULL) { - - x = lastx + p->dest.x; - y = lasty + p->dest.y; - - IfTrace2((HintDebug > 0),"Ending point = (%d,%d)\n", - x, - y); - - nextP = p->link; - -/* -Here we start the hints processing by initializing the hint value to -zero. If ProcessHints is FALSE, the value will remain zero. -Otherwise, hint accumulates the computed hint values. -*/ - - hint.x = hint.y = 0; - -/* -If we are processing hints, and this is a MOVE segment (other than -the first on the path), we need to close (reverse) any open hints. -*/ - - if (ProcessHints) - if ((p->type == MOVETYPE) && (p->last == NULL)) { - CloseHints(&hint); - IfTrace2((HintDebug>0),"Closed point= (%d,%d)\n", - x+hint.x, - y+hint.y); - } - -/* -Next we run through all the hint segments (if any) attached to this -segment. If ProcessHints is TRUE, we will accumulate computed hint -values. In either case, nextP will be advanced to the first non-HINT -segment (or NULL), and each hint segment will be freed if necessary. -*/ - - while ((nextP != NULL) && (nextP->type == HINTTYPE)) { - if (ProcessHints) - ProcessHint(nextP, x + hint.x, y + hint.y, &hint); - - { - register struct segment *saveP = nextP; - - nextP = nextP->link; - if (tempflag) - Free(saveP); - } - } - -/* -We now apply the full hint value to the ending point of the path segment. -*/ - /* printf("Applying hints (x=%d,y=%d)\n", hint.x, hint.y);*/ - - x += hint.x; - y += hint.y; - - IfTrace2((HintDebug>0),"Hinted ending point = (%d,%d)\n", - x, y); - - switch(p->type) { - - case LINETYPE: - StepLine(R, lastx, lasty, x, y); - break; - - case CONICTYPE: - { - -/* -For a conic curve, we apply half the hint value to the conic midpoint. -*/ - - } - break; - - case BEZIERTYPE: - { - register struct beziersegment *bp = (struct beziersegment *) p; - -/* -For a Bezier curve, we apply the full hint value to the Bezier C point. -*/ - - StepBezier(R, lastx, lasty, - lastx + bp->B.x, lasty + bp->B.y, - lastx + bp->C.x + hint.x, - lasty + bp->C.y + hint.y, - x, y); - } - break; - - case MOVETYPE: -/* -At this point we have encountered a MOVE segment. This breaks the -path, making it disjoint. -*/ - if (p->last == NULL) /* i.e., not first in path */ - ChangeDirection(CD_LAST, R, lastx, lasty, (fractpel) 0); - - ChangeDirection(CD_FIRST, R, x, y, (fractpel) 0); -/* -We'll just double check for closure here. We forgive an appended -MOVETYPE at the end of the path, if it isn't closed: -*/ - if (!ISCLOSED(p->flag) && p->link != NULL) - return((struct region *)ArgErr("Fill: sub-path not closed", p, NULL)); - break; - - default: - abort("Interior: path type error", 30); - } -/* -We're done with this segment. Advance to the next path segment in -the list, freeing this one if necessary: -*/ - lastx = x; lasty = y; - - if (tempflag) - Free(p); - p = nextP; - } - ChangeDirection(CD_LAST, R, lastx, lasty, (fractpel) 0); - R->ending.x = lastx; - R->ending.y = lasty; -/* -Finally, clean up the region's based on the user's 'fillrule' request: -*/ - if (Cflag) - ApplyContinuity(R); - if (fillrule == WINDINGRULE) - Unwind(R->anchor); - return(R); -} -/* -:h4.Unwind() - Discards Edges That Fail the Winding Rule Test - -The winding rule says that upward going edges should be paired with -downward going edges only, and vice versa. So, if two upward edges -or two downward edges are nominally left/right pairs, Unwind() should -discard the second one. Everything should balance; we should discard -an even number of edges; of course, we abort if we don't. -*/ -static int Unwind(area) - register struct edgelist *area; /* input area modified in place */ -{ - register struct edgelist *last=NULL,*next; /* struct before and after current one */ - register int y; /* ymin of current swath */ - register int count,newcount; /* winding count registers */ - - IfTrace1((RegionDebug>0),"...Unwind(%p)\n", area); - - while (VALIDEDGE(area)) { - - count = 0; - y = area->ymin; - - do { - next = area->link; - - if (ISDOWN(area->flag)) - newcount = count + 1; - else - newcount = count - 1; - - if (count == 0 || newcount == 0) - last = area; - else - discard(last, next); - - count = newcount; - area = next; - - } while (area != NULL && area->ymin == y); - - if (count != 0) - abort("Unwind: uneven edges", 31); - } - /* We retunr a value for ANSI-C-compiler */ - return(0); - -} -/* -:h3."workedge" Array - -This is a statically allocated array where edges are built -before being copied into more permanent storage by NewEdge(). -*/ - -#ifndef MAXEDGE -#define MAXEDGE 1000 -#endif - -static pel workedge[MAXEDGE]; -static pel *currentworkarea = workedge; -static pel currentsize = MAXEDGE; - -/* -:h3 id=cd.ChangeDirection() - Called When Y Direction Changes - -The rasterizing routines call this entry point when they detect -a change in Y. We then build the current edge and sort it into -emerging edgelist at 'anchor' by calling whatever "newedgefcn" -is appropriate. -*/ - -void ChangeDirection(type, R, x, y, dy) - int type; /* CD_FIRST, CD_CONTINUE, or CD_LAST */ - register struct region *R; /* region in which we are changing direction */ - fractpel x,y; /* current beginning x,y */ - fractpel dy; /* direction and magnitude of change in y */ -{ - register fractpel ymin,ymax; /* minimum and maximum Y since last call */ - register fractpel x_at_ymin,x_at_ymax; /* their respective X's */ - register pel iy; /* nearest integer pel to 'y' */ - register pel idy; /* nearest integer pel to 'dy' */ - register int ydiff; /* allowed Y difference in 'currentworkarea' */ - - IfTrace4((RegionDebug>0),"Change Y direction (%d) from (%d,%d), dy=%d\n", - (LONG) type, x, y, dy); - - if (type != CD_FIRST) { - - if (R->lastdy > 0) { - ymin = R->firsty; - x_at_ymin = R->firstx; - ymax = y; - x_at_ymax = x; - } - else { - ymin = y; - x_at_ymin = x; - ymax = R->firsty; - x_at_ymax = R->firstx; - } - - if (ymax < ymin) - abort("negative sized edge?", 32); - - - (*R->newedgefcn)(R, R->edgexmin, R->edgexmax, ymin, ymax, - R->lastdy > 0, x_at_ymin, x_at_ymax); - - } - - R->firsty = y; - R->firstx = x; - R->lastdy = dy; - - iy = NEARESTPEL(y); - idy = NEARESTPEL(dy); - if (currentworkarea != workedge && idy < MAXEDGE && idy > -MAXEDGE) { - NonObjectFree(currentworkarea); - currentworkarea = workedge; - currentsize = MAXEDGE; - } - ydiff = currentsize - 1; - if (dy > 0) { - R->edge = ¤tworkarea[-iy]; - R->edgeYstop = TOFRACTPEL(ydiff + iy) + FPHALF; - } - else { - R->edge = ¤tworkarea[ydiff - iy]; - R->edgeYstop = TOFRACTPEL(iy - ydiff) - FPHALF; - } - R->edgexmax = R->edgexmin = x; -/* -If this is the end of a subpath, we complete the subpath circular -chain: -*/ - if (type == CD_LAST && R->lastedge != NULL) { - register struct edgelist *e = R->firstedge; - - while (e->subpath != NULL) - e = e->subpath; - e->subpath = R->lastedge; - R->lastedge = R->firstedge = NULL; - } -} -/* -:h3 id=newfill.newfilledge() - Called When We Have a New Edge While Filling - -This is the prototypical "newedge" function passed to "Rasterize" and -stored in "newedgefcn" in the region being built. - -If the edge is non-null, we sort it onto the list of edges we are -building at "anchor". - -This function also has to keep the bounding box of the region -up to date. -*/ - -static int newfilledge(R, xmin, xmax, ymin, ymax, isdown) - register struct region *R; /* region being built */ - fractpel xmin,xmax; /* X range of this edge */ - fractpel ymin,ymax; /* Y range of this edge */ - int isdown; /* flag: TRUE means edge goes down, else up */ -{ - - register pel pelxmin,pelymin,pelxmax,pelymax; /* pel versions of bounds */ - register struct edgelist *edge; /* newly created edge */ - - pelymin = NEARESTPEL(ymin); - pelymax = NEARESTPEL(ymax); - if (pelymin == pelymax) - return(0); - - pelxmin = NEARESTPEL(xmin); - pelxmax = NEARESTPEL(xmax); - - if (pelxmin < R->xmin) R->xmin = pelxmin; - if (pelxmax > R->xmax) R->xmax = pelxmax; - if (pelymin < R->ymin) R->ymin = pelymin; - if (pelymax > R->ymax) R->ymax = pelymax; - - edge = NewEdge(pelxmin, pelxmax, pelymin, pelymax, &R->edge[pelymin], isdown); - edge->subpath = R->lastedge; - R->lastedge = edge; - if (R->firstedge == NULL) - R->firstedge = edge; - - R->anchor = SortSwath(R->anchor, edge, swathxsort); - return(0); -} - -/* -:h2.Sorting Edges - -:h3.SortSwath() - Vertically Sort an Edge into a Region - -This routine sorts an edge or a pair of edges into a growing region, -so that the region maintains its top-to-bottom, left-to-right form. -The rules for sorting horizontally may vary depending on what you -are doing, but the rules for vertical sorting are always the same. -This routine is passed an argument that is a function that will -perform the horizontal sort on demand (for example, swathxsort() or -SwathUnion()). - -This is a recursive routine. A new edge (or edge pair) may overlap -the list I am building in strange and wonderful ways. Edges may -cross. When this happens, my strategy is to split the incoming edge -(or the growing list) in two at that point, execute the actual sort on -the top part of the split, and recursively call myself to figure out -exactly where the bottom part belongs. -*/ - -#define TOP(e) ((e)->ymin) /* the top of an edge (for readability */ -#define BOTTOM(e) ((e)->ymax) /* the bottom of an edge (for readability */ - -struct edgelist *SortSwath(anchor, edge, swathfcn) - struct edgelist *anchor; /* list being built */ - register struct edgelist *edge; /* incoming edge or pair of edges */ - struct edgelist *(*swathfcn)(); /* horizontal sorter */ -{ - register struct edgelist *before,*after; - struct edgelist base; - - if (RegionDebug > 0) { - if (RegionDebug > 2) { - IfTrace3(TRUE,"SortSwath(anchor=%p, edge=%p, fcn=%p)\n", - anchor, edge, swathfcn); - } - else { - IfTrace3(TRUE,"SortSwath(anchor=%p, edge=%p, fcn=%p)\n", - anchor, edge, swathfcn); - } - } - if (anchor == NULL) - return(edge); - - before = &base; - before->ymin = before->ymax = MINPEL; - before->link = after = anchor; - -/* -If the incoming edge is above the current list, we connect the current -list to the bottom of the incoming edge. One slight complication is -if the incoming edge overlaps into the current list. Then, we -first split the incoming edge in two at the point of overlap and recursively -call ourselves to sort the bottom of the split into the current list: -*/ - if (TOP(edge) < TOP(after)) { - if (BOTTOM(edge) > TOP(after)) { - - after = SortSwath(after, splitedge(edge, TOP(after)), swathfcn); - } - vertjoin(edge, after); - return(edge); - } -/* -At this point the top of edge is not higher than the top of the list, -which we keep in 'after'. We move the 'after' point down the list, -until the top of the edge occurs in the swath beginning with 'after'. - -If the bottom of 'after' is below the bottom of the edge, we have to -split the 'after' swath into two parts, at the bottom of the edge. -If the bottom of 'after' is above the bottom of the swath, -*/ - - while (VALIDEDGE(after)) { - - if (TOP(after) == TOP(edge)) { - if (BOTTOM(after) > BOTTOM(edge)) - vertjoin(after, splitedge(after, BOTTOM(edge))); - else if (BOTTOM(after) < BOTTOM(edge)) { - after = SortSwath(after, - splitedge(edge, BOTTOM(after)), swathfcn); - } - break; - } - else if (TOP(after) > TOP(edge)) { - IfTrace0((BOTTOM(edge) < TOP(after) && RegionDebug > 0), - "SortSwath: disjoint edges\n"); - if (BOTTOM(edge) > TOP(after)) { - after = SortSwath(after, - splitedge(edge, TOP(after)), swathfcn); - } - break; - } - else if (BOTTOM(after) > TOP(edge)) - vertjoin(after, splitedge(after, TOP(edge))); - - before = after; - after = after->link; - } - -/* -At this point 'edge' exactly corresponds in height to the current -swath pointed to by 'after'. -*/ - if (after != NULL && TOP(after) == TOP(edge)) { - before = (*swathfcn)(before, edge); - after = before->link; - } -/* -At this point 'after' contains all the edges after 'edge', and 'before' -contains all the edges before. Whew! A simple matter now of adding -'edge' to the linked list in its rightful place: -*/ - before->link = edge; - if (RegionDebug > 1) { - IfTrace3(TRUE,"SortSwath: in between %p and %p are %p", - before, after, edge); - while (edge->link != NULL) { - edge = edge->link; - IfTrace1(TRUE," and %p", edge); - } - IfTrace0(TRUE,"\n"); - } - else - for (; edge->link != NULL; edge = edge->link) { ; } - - edge->link = after; - return(base.link); -} - -/* -:h3.splitedge() - Split an Edge or Swath in Two at a Given Y Value - -This function returns the edge or swath beginning at the Y value, and -is guaranteed not to change the address of the old swath while splitting -it. -*/ - -static struct edgelist *splitedge(list, y) - struct edgelist *list; /* area to split */ - register pel y; /* Y value to split list at */ -{ - register struct edgelist *new; /* anchor for newly built list */ - register struct edgelist *last=NULL; /* end of newly built list */ - register struct edgelist *r; /* temp pointer to new structure */ - register struct edgelist *lastlist; /* temp pointer to last 'list' value */ - - IfTrace2((RegionDebug > 1),"splitedge of %p at %d ", list, (LONG) y); - - lastlist = new = NULL; - - while (list != NULL) { - if (y < list->ymin) - break; - if (y >= list->ymax) - abort("splitedge: above top of list", 33); - if (y == list->ymin) - abort("splitedge: would be null", 34); - - r = (struct edgelist *)Allocate(sizeof(struct edgelist), list, 0); -/* -At this point 'r' points to a copy of the single structure at 'list'. -We will make 'r' be the new split 'edgelist'--the lower half. -We don't bother to correct 'xmin' and 'xmax', we'll take the -the pessimistic answer that results from using the old values. -*/ - r->ymin = y; - r->xvalues = list->xvalues + (y - list->ymin); -/* -Note that we do not need to allocate new memory for the X values, -they can remain with the old "edgelist" structure. We do have to -update that old structure so it is not as high: -*/ - list->ymax = y; -/* -Insert 'r' in the subpath chain: -*/ - r->subpath = list->subpath; - list->subpath = r; -/* -Now attach 'r' to the list we are building at 'new', and advance -'list' to point to the next element in the old list: -*/ - if (new == NULL) - new = r; - else - last->link = r; - last = r; - lastlist = list; - list = list->link; - } -/* -At this point we have a new list built at 'new'. We break the old -list at 'lastlist', and add the broken off part to the end of 'new'. -Then, we return the caller a pointer to 'new': -*/ - if (new == NULL) - abort("null splitedge", 35); - lastlist->link = NULL; - last->link = list; - IfTrace1((RegionDebug > 1),"yields %p\n", new); - return(new); -} - -/* -:h3.vertjoin() - Join Two Disjoint Edge Lists Vertically - -The two edges must be disjoint vertically. -*/ -static int vertjoin(top, bottom) - register struct edgelist *top; /* uppermost region */ - register struct edgelist *bottom; /* bottommost region */ -{ - if (BOTTOM(top) > TOP(bottom)) - abort("vertjoin not disjoint", 36); - - for (; top->link != NULL; top=top->link) { ; } - - top->link = bottom; - return(0); -} - -/* -:h3.swathxsort() - Sorting by X Values - -We need to sort 'edge' into its rightful -place in the swath by X value, taking care that we do not accidentally -advance to the next swath while searching for the correct X value. Like -all swath functions, this function returns a pointer to the edge -BEFORE the given edge in the sort. -*/ - -struct edgelist *swathxsort(before0, edge) - register struct edgelist *before0; /* edge before this swath */ - register struct edgelist *edge; /* input edge */ -{ - register struct edgelist *before; - register struct edgelist *after; - register pel y=0; - - before = before0; - after = before->link; - - while (after != NULL && TOP(after) == TOP(edge)) { - - register pel *x1,*x2; - - y = TOP(edge); - x1 = after->xvalues; - x2 = edge->xvalues; - - while (y < BOTTOM(edge) && *x1 == *x2) { - x1++; x2++; y++; - } - if (y >= BOTTOM(edge)) { - edge->flag |= ISAMBIGUOUS(ON); - after->flag |= ISAMBIGUOUS(ON); - break; - } - - if (*x1 >= *x2) - break; - - before = after; - after = after->link; - } - -/* -At this point, 'edge' is between 'before' and 'after'. If 'edge' didn't -cross either of those other edges, we would be done. We check for -crossing. If it does cross, we split the problem up by calling SortSwath -recursively with the part of the edge that is below the crossing point: -*/ -{ - register int h0,h; /* height of edge--number of scans */ - - h0 = h = BOTTOM(edge) - y; - y -= TOP(edge); - - if (h0 <= 0) { - IfTrace0((RegionDebug>0),"swathxsort: exactly equal edges\n"); - return(before); - } - - if (TOP(before) == TOP(edge)) - h -= crosses(h, &before->xvalues[y], &edge->xvalues[y]); - if (after != NULL && TOP(after) == TOP(edge)) - h -= crosses(h, &edge->xvalues[y], &after->xvalues[y]); - - if (h < h0) { - SortSwath(before0->link, - splitedge(edge, TOP(edge) + y + h), - swathxsort); - - } -} - - return(before); -} -/* -:h3.SwathUnion() - Union Two Edges by X Value - -We have a left and right edge that must be unioned into a growing -swath. If they are totally disjoint, they are just added in. The -fun comes in they overlap the existing edges. Then some edges -will disappear. -*/ - -struct edgelist *SwathUnion(before0, edge) - register struct edgelist *before0; /* edge before the swath */ - register struct edgelist *edge; /* list of two edges to be unioned */ -{ - register int h; /* saves height of edge */ - register struct edgelist *rightedge; /* saves right edge of 'edge' */ - register struct edgelist *before,*after; /* edge before and after */ - int h0; /* saves initial height */ - - IfTrace2((RegionDebug > 1),"SwathUnion entered, before=%p, edge=%p\n", - before0, edge); - - h0 = h = edge->ymax - edge->ymin; - if (h <= 0) - abort("SwathUnion: 0 height swath?", 37); - - before = before0; - after = before->link; - - while (after != NULL && TOP(after) == TOP(edge)) { - register struct edgelist *right; - - right = after->link; - if (right->xvalues[0] >= edge->xvalues[0]) - break; - before = right; - after = before->link; - } -/* -This is the picture at this point. 'L' indicates a left hand edge, -'R' indicates the right hand edge. -'<--->' indicates the degree of uncertainty as to its placement -relative to other edges: -:xmp atomic. - before after - R <---L----> R L R L R - <---L---> <------R--------------------------> - edge -:exmp. -In case the left of 'edge' touches 'before', we need to reduce -the height by that amount. -*/ - if (TOP(before) == TOP(edge)) - h -= touches(h, before->xvalues, edge->xvalues); - - rightedge = edge->link; - - if (after == NULL || TOP(after) != TOP(edge) || - after->xvalues[0] > rightedge->xvalues[0]) { - IfTrace2((RegionDebug > 1), - "SwathUnion starts disjoint: before=%p after=%p\n", - before, after); -/* -On this side of the the above 'if', the new edge is disjoint from the -existing edges in the swath. This is the picture: -:xmp atomic. - before after - R L R L R L R - L R - edge -:exmp. -We will verify it remains disjoint for the entire height. If the -situation changes somewhere down the edge, we split the edge at that -point and recursively call ourselves (through 'SortSwath') to figure -out the new situation: -*/ - if (after != NULL && TOP(after) == TOP(edge)) - h -= touches(h, rightedge->xvalues, after->xvalues); - if (h < h0) - SortSwath(before0->link, splitedge(edge, edge->ymin + h), t1_SwathUnion); - /* go to "return" this edge pair; it is totally disjoint */ - } - else { -/* -At this point, at the 'else', we know that the -new edge overlaps one or more pairs in the existing swath. Here is -a picture of our knowledge and uncertainties: -:xmp atomic. - before after - R L R L R L R - <---L---> <---R-------------------> - edge -:exmp. -We need to move 'after' along until it is to the right of the -right of 'edge'. ('After' should always point to a left edge of a pair:) -*/ - register struct edgelist *left; /* variable to keep left edge in */ - - do { - left = after; - after = (after->link)->link; - - } while (after != NULL && TOP(after) == TOP(edge) - && after->xvalues[0] <= rightedge->xvalues[0]); -/* -At this point this is the picture: -:xmp atomic. - before left after - R L R L R L R - <---L---> <---R---> - edge -:exmp. -We need to verify that the situation stays like this all the way -down the edge. Again, if the -situation changes somewhere down the edge, we split the edge at that -point and recursively call ourselves (through 'SortSwath') to figure -out the new situation: -*/ - - h -= crosses(h, left->xvalues, rightedge->xvalues); - h -= crosses(h, edge->xvalues, ((before->link)->link)->xvalues); - - if (after != NULL && TOP(after) == TOP(edge)) - - h -= touches(h, rightedge->xvalues, after->xvalues); - - IfTrace3((RegionDebug > 1), - "SwathUnion is overlapped until %d: before=%p after=%p\n", - (LONG) TOP(edge) + h, before, after); -/* -OK, if we touched either of our neighbors we need to split at that point -and recursively sort the split edge onto the list. One tricky part -is that when we recursively sort, 'after' will change if it was not -in our current swath: -*/ - if (h < h0) { - SortSwath(before0->link, - splitedge(edge, edge->ymin + h), - t1_SwathUnion); - - if (after == NULL || TOP(after) != TOP(edge)) - for (after = before0->link; - TOP(after) == TOP(edge); - after = after->link) { ; } - } -/* -Now we need to augment 'edge' by the left and right of the overlapped -swath, and to discard all edges between before and after, because they -were overlapped and have been combined with the new incoming 'edge': -*/ - edge->xmin = TYPE1_MIN(edge->xmin, (before->link)->xmin); - edge->xmax = TYPE1_MIN(edge->xmax, (before->link)->xmax); - edgemin(h, edge->xvalues, (before->link)->xvalues); - rightedge->xmin = TYPE1_MAX(rightedge->xmin, (left->link)->xmin); - rightedge->xmax = TYPE1_MAX(rightedge->xmax, (left->link)->xmax); - edgemax(h, rightedge->xvalues, (left->link)->xvalues); - discard(before, after); - } - return(before); -} -/* -:h3.swathrightmost() - Simply Sorts New Edge to Rightmost of Swath - -Like all swath functions, this function returns a pointer to the edge -BEFORE the given edge in the sort. -*/ - -struct edgelist *swathrightmost(before, edge) - register struct edgelist *before; /* edge before this swath */ - register struct edgelist *edge; /* input edge */ -{ - register struct edgelist *after; - - after = before->link; - - while (after != NULL && TOP(after) == TOP(edge)) { - before = after; - after = after->link; - } - - return(before); - -} -/* -:h3.touches() - Returns the Remaining Height When Two Edges Touch - -So, it will return 0 if they never touch. Allows incredibly(?) mnemonic -if (touches(...)) construct. -*/ - -static int touches(h, left, right) - register int h; - register pel *left,*right; -{ - for (; h > 0; h--) - if (*left++ >= *right++) - break; - return(h); -} -/* -:h3.crosses() - Returns the Remaining Height When Two Edges Cross - -So, it will return 0 if they never cross. -*/ - -static int crosses(h, left, right) - register int h; - register pel *left,*right; -{ - for (; h > 0; h--) - if (*left++ > *right++) - break; - return(h); -} -/* -:h3.cedgemin() - Stores the Mininum of an Edge and an X Value -*/ - -static int cedgemin(h, e1, x) - register int h; - register pel *e1; - register pel x; -{ - for (; --h >= 0; e1++) - if (*e1 > x) - *e1 = x; - return(0); - -} -/* -:h3.cedgemax() - Stores the Maximum of an Edge and an X Value -*/ - -static int cedgemax(h, e1, x) - register int h; - register pel *e1; - register pel x; -{ - for (; --h >= 0; e1++) - if (*e1 < x) - *e1 = x; - return(0); - -} -/* -:h3.edgemin() - Stores the Mininum of Two Edges in First Edge -*/ - -static int edgemin(h, e1, e2) - register int h; - register pel *e1,*e2; -{ - for (; --h >= 0; e1++,e2++) - if (*e1 > *e2) - *e1 = *e2; - return(0); - -} -/* -:h3.edgemax() - Stores the Maximum of Two Edges in First Edge -*/ - -static int edgemax(h, e1, e2) - register int h; - register pel *e1,*e2; -{ - for (; --h >= 0; e1++,e2++) - if (*e1 < *e2) - *e1 = *e2; - return(0); - -} -/* -:h3 id=discard.discard() - Discard All Edges Between Two Edges - -At first glance it would seem that we could discard an edgelist -structure merely by unlinking it from the list and freeing it. You are -wrong, region-breath! For performance, the X values associated with an -edge are allocated contiguously with it. So, we free the X values when -we free a structure. However, once an edge has been split, we are no -longer sure which control block actually is part of the memory block -that contains the edges. Rather than trying to decide, we play it safe -and never free part of a region. - -So, to mark a 'edgelist' structure as discarded, we move it to the end -of the list and set ymin=ymax. -*/ - -static int discard(left, right) - register struct edgelist *left,*right; /* all edges between here exclusive */ - /* should be discarded */ -{ - register struct edgelist *beg,*end,*p; - - IfTrace2((RegionDebug > 0),"discard: l=%p, r=%p\n", left, right); - - beg = left->link; - if (beg == right) - return(0); - - for (p = beg; p != right; p = p->link) { - if (p->link == NULL && right != NULL) - abort("discard(): ran off end", 38); - IfTrace1((RegionDebug > 0),"discarding %p\n", p); - p->ymin = p->ymax = 32767; - end = p; - } - /* - * now put the chain beg/end at the end of right, if it is not - * already there: - */ - if (right != NULL) { - left->link = right; - while (right->link != NULL) - right = right->link; - right->link = beg; - } - end->link = NULL; - return(0); - -} - -/* -:h2.Changing the Representation of Regions - -For convenience and/or performance, we sometimes like to change the way -regions are represented. This does not change the object itself, just -the representation, so these transformations can be made on a permanent -region. - -*/ - -void MoveEdges(R, dx, dy) - register struct region *R; /* region to modify */ - register fractpel dx,dy; /* delta X and Y to move edge list by */ -{ - register struct edgelist *edge; /* for looping through edges */ - - R->origin.x += dx; - R->origin.y += dy; - R->ending.x += dx; - R->ending.y += dy; - if (R->thresholded != NULL) { - R->thresholded->origin.x -= dx; - R->thresholded->origin.y -= dy; - } -/* -From now on we will deal with dx and dy as integer pel values: -*/ - dx = NEARESTPEL(dx); - dy = NEARESTPEL(dy); - if (dx == 0 && dy == 0) - return; - - R->xmin += dx; - R->xmax += dx; - R->ymin += dy; - R->ymax += dy; - - for (edge = R->anchor; VALIDEDGE(edge); edge = edge->link) { - edge->ymin += dy; - edge->ymax += dy; - if (dx != 0) { - register int h; /* loop index; height of edge */ - register pel *Xp; /* loop pointer to X values */ - - edge->xmin += dx; - edge->xmax += dx; - for (Xp = edge->xvalues, h = edge->ymax - edge->ymin; - --h >= 0; ) - *Xp++ += dx; - } - } -} - -/* -:h3.UnJumble() - Sort a Region Top to Bottom - -It is an open question whether it pays in general to do this. -*/ - -void UnJumble(region) - struct region *region; /* region to sort */ -{ - register struct edgelist *anchor; /* new lists built here */ - register struct edgelist *edge; /* edge pointer for loop */ - register struct edgelist *next; /* ditto */ - - anchor = NULL; - - for (edge=region->anchor; VALIDEDGE(edge); edge=next) { - if (edge->link == NULL) - abort("UnJumble: unpaired edge?", 39); - next = edge->link->link; - edge->link->link = NULL; - anchor = SortSwath(anchor, edge, t1_SwathUnion); - } - - if (edge != NULL) - vertjoin(anchor, edge); - - region->anchor = anchor; - region->flag &= ~ISJUMBLED(ON); -} - -/* -*/ - -#undef NEED_OPTIMZEREGION -#ifdef NEED_OPTIMZEREGION -static int OptimizeRegion(R) - struct region *R; /* region to optimize */ -{ - register pel *xP; /* pel pointer for inner loop */ - register int x; /* holds X value */ - register int xmin,xmax; /* holds X range */ - register int h; /* loop counter */ - register struct edgelist *e; /* edgelist pointer for loop */ - - R->flag |= ISRECTANGULAR(ON); - - for (e = R->anchor; VALIDEDGE(e); e=e->link) { - xmin = MAXPEL; - xmax = MINPEL; - for (h = e->ymax - e->ymin, xP = e->xvalues; --h >= 0;) { - x = *xP++; - if (x < xmin) xmin = x; - if (x > xmax) xmax = x; - } - if (xmin != xmax || (xmin != R->xmin && xmax != R->xmax)) - R->flag &= ~ISRECTANGULAR(ON); - if (xmin < e->xmin || xmax > e->xmax) - abort("Tighten: existing edge bound was bad", 40); - if (xmin < R->xmin || xmax > R->xmax) - abort("Tighten: existing region bound was bad", 41); - e->xmin = xmin; - e->xmax = xmax; - } - R->flag |= ISOPTIMIZED(ON); - return(0); - -} - -#endif /* This function is not used */ - -/* -:h2.Miscelaneous Routines - -:h3.MoreWorkArea() - Allocate New Space for "edge" - -Our strategy is to temporarily allocate an array to hold this -unexpectedly large edge. ChangeDirection frees this array any time -it gets a shorter 'dy'. -*/ - -/*ARGSUSED*/ -void MoreWorkArea(R, x1, y1, x2, y2) - struct region *R; /* region we are generating */ - fractpel x1,y1; /* starting point of line */ - fractpel x2,y2; /* ending point of line */ -{ - register int idy; /* integer dy of line */ - - idy = NEARESTPEL(y1) - NEARESTPEL(y2); - if (idy < 0) idy = - idy; - - /* - * we must add one to the delta for the number of run ends we - * need to store: - */ - if (++idy > currentsize) { - IfTrace1((RegionDebug > 0),"Allocating edge of %d pels\n", idy); - if (currentworkarea != workedge) - NonObjectFree(currentworkarea); - currentworkarea = (pel *)Allocate(0, NULL, idy * sizeof(pel)); - currentsize = idy; - } - ChangeDirection(CD_CONTINUE, R, x1, y1, y2 - y1); -} - -/* -:h3.BoxClip() - Clip a Region to a Rectangle - -BoxClip also duplicates the region if it is permanent. Note the -clipping box is specified in REGION coordinates, that is, in -coordinates relative to the region (0,0) point -*/ - -struct region *BoxClip(R, xmin, ymin, xmax, ymax) - register struct region *R; /* region to clip */ - register pel xmin,ymin; /* upper left hand corner of rectangle */ - register pel xmax,ymax; /* lower right hand corner */ -{ - struct edgelist anchor; /* pretend edgelist to facilitate discards */ - register struct edgelist *e,*laste; - - IfTrace1((OffPageDebug),"BoxClip of %p:\n", R); - - R = UniqueRegion(R); - - if (xmin > R->xmin) { - IfTrace2((OffPageDebug),"BoxClip: left clip old %d new %d\n", - (LONG) R->xmin, (LONG) xmin); - R->xmin = xmin; - } - if (xmax < R->xmax) { - IfTrace2((OffPageDebug),"BoxClip: right clip old %d new %d\n", - (LONG) R->xmax, (LONG) xmax); - R->xmax = xmax; - } - - if (ymin > R->ymin) { - IfTrace2((OffPageDebug),"BoxClip: top clip old %d new %d\n", - (LONG) R->ymin, (LONG) ymin); - R->ymin = ymin; - } - if (ymax < R->ymax) { - IfTrace2((OffPageDebug),"BoxClip: bottom clip old %d new %d\n", - (LONG) R->ymax, (LONG) ymax); - R->ymax = ymax; - } - - - laste = &anchor; - anchor.link = R->anchor; - - for (e = R->anchor; VALIDEDGE(e); e = e->link) { - if (TOP(e) < ymin) { - e->xvalues += ymin - e->ymin; - e->ymin = ymin; - } - if (BOTTOM(e) > ymax) - e->ymax = ymax; - if (TOP(e) >= BOTTOM(e)) { - discard(laste, e->link->link); - e = laste; - continue; - } - if (e->xmin < xmin) { - cedgemax(BOTTOM(e) - TOP(e), e->xvalues, xmin); - e->xmin = xmin; - e->xmax = TYPE1_MAX(e->xmax, xmin); - } - if (e->xmax > xmax) { - cedgemin(BOTTOM(e) - TOP(e), e->xvalues, xmax); - e->xmin = TYPE1_MIN(e->xmin, xmax); - e->xmax = xmax; - } - laste = e; - } - - R->anchor = anchor.link; - - return(R); -} - -#ifdef notdef -/* -:h3.CoerceRegion() - Force a TextPath Structure to Become a Region - -We also save the newly created region in the textpath structure, if the -structure was permanent. Then we don't have to do this again. Why not -save it all the time? Well, we certainly could, but I suspect it -wouldn't pay. We would have to make this region permanent (because we -couldn't have it be consumed) and this would probably require -unnecessary CopyRegions in most cases. -*/ - -struct region *CoerceRegion(tp) - register struct textpath *tp; /* input TEXTTYPE */ -{ - struct segment *path; /* temporary character path */ - struct region *R; /* returned region */ - - - R = Interior(path, EVENODDRULE); - return(R); -} -#endif - -/* -:h3.RegionBounds() - Returns Bounding Box of a Region -*/ - -struct segment *RegionBounds(R) - register struct region *R; -{ - - register struct segment *path; /* returned path */ - - path = BoxPath(IDENTITY, R->ymax - R->ymin, R->xmax - R->xmin); - path = Join(PathSegment(MOVETYPE, R->origin.x + TOFRACTPEL(R->xmin), - R->origin.y + TOFRACTPEL(R->ymin) ), - path); - return(path); -} - -/* -:h2.Formatting/Dump Routines for Debug - -:h3.DumpArea() - Display a Region -*/ -void DumpArea(area) - register struct region *area; -{ - IfTrace1(TRUE,"Dumping area %p,", area); - IfTrace4(TRUE," X %d:%d Y %d:%d;", (LONG) area->xmin, - (LONG) area->xmax, (LONG) area->ymin,(LONG) area->ymax); - IfTrace4(TRUE," origin=(%d,%d), ending=(%d,%d)\n", - area->origin.x, area->origin.y, area->ending.x, area->ending.y); - DumpEdges(area->anchor); -} - -#define INSWATH(p, y0, y1) (p != NULL && p->ymin == y0 && p->ymax == y1) -/* -:h3.DumpEdges() - Display Run End Lists (Edge Lists) -*/ - -static pel RegionDebugYMin = MINPEL; -static pel RegionDebugYMax = MAXPEL; - -void DumpEdges(edges) - register struct edgelist *edges; -{ - register struct edgelist *p,*p2; - register pel ymin = MINPEL; - register pel ymax = MINPEL; - register int y; - - if (edges == NULL) { - IfTrace0(TRUE," NULL area.\n"); - return; - } - if (RegionDebug <= 1) { - for (p=edges; p != NULL; p = p->link) { - edgecheck(p, ymin, ymax); - ymin = p->ymin; ymax = p->ymax; - IfTrace3(TRUE,". at %p type=%d flag=%x", - p, (LONG) p->type,(LONG) p->flag); - IfTrace4(TRUE," bounding box HxW is %dx%d at (%d,%d)\n", - (LONG) ymax - ymin, (LONG) p->xmax - p->xmin, - (LONG) p->xmin, (LONG) ymin); - } - } - else { - - for (p2=edges; p2 != NULL; ) { - - edgecheck(p2, ymin, ymax); - ymin = p2->ymin; - ymax = p2->ymax; - - if (RegionDebug > 3 || (ymax > RegionDebugYMin - && ymin < RegionDebugYMax)) { - IfTrace2 (TRUE,". Swath from %d to %d:\n", - ymin, ymax); - for (p=p2; INSWATH(p,ymin,ymax); p = p->link) { - IfTrace4(TRUE,". . at %p[%x] range %d:%d, ", - p, (LONG) p->flag, - (LONG) p->xmin, (LONG)p->xmax); - IfTrace1(TRUE, "subpath=%p,\n", p->subpath); - } - } - for (y=TYPE1_MAX(ymin,RegionDebugYMin); y < TYPE1_MIN(ymax, RegionDebugYMax); y++) { - IfTrace1(TRUE,". . . Y[%5d] ", (LONG) y); - for (p=p2; INSWATH(p,ymin,ymax); p = p->link) - IfTrace1(TRUE,"%5d ", - (LONG) p->xvalues[y - ymin]); - IfTrace0(TRUE,"\n"); - } - while (INSWATH(p2, ymin, ymax)) - p2 = p2->link; - } - } -} - -/* -:h3.edgecheck() - For Debug, Verify that an Edge Obeys the Rules -*/ - -/*ARGSUSED*/ -static int edgecheck(edge, oldmin, oldmax) - struct edgelist *edge; - int oldmin,oldmax; -{ - if (edge->type != EDGETYPE) - abort("EDGE ERROR: non EDGETYPE in list", 42); -/* -The following check is not valid if the region is jumbled so I took it -out: -*/ -/* if (edge->ymin < oldmax && edge->ymin != oldmin) - abort("EDGE ERROR: overlapping swaths", 43); */ - return(0); - -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/regions.h xdvik-22.40n/libs/t1lib/lib/type1/regions.h --- xdvik-22.40l/libs/t1lib/lib/type1/regions.h Wed Apr 18 14:24:12 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/regions.h Thu Jan 1 00:00:00 1970 @@ -1,203 +0,0 @@ -/* $XConsortium: regions.h,v 1.2 91/10/10 11:19:06 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - - -#define Interior(p,rule) t1_Interior(p,rule) -#define Union(a1,a2) t1_Union(a1,a2) -#define Intersect(a1,a2) t1_Intersect(a1,a2) -#define Complement(area) t1_Complement(area) -#define Overlap(a1,a2) t1_OverLap(a1,a2) - -struct region *t1_Interior(); /* returns the interior of a closed path */ -struct region *t1_Union(); /* set union of paths or regions */ -struct region *t1_Intersect(); /* set intersection of regions */ -struct region *t1_Complement(); /* complement of a region */ -int t1_Overlap(); /* returns a Boolean; TRUE if regions overlap */ - - -/*END SHARED*/ -/*SHARED*/ - -#define ChangeDirection(type,R,x,y,dy) t1_ChangeDirection(type,R,x,y,dy) - -void t1_ChangeDirection(); /* called when we change direction in Y */ -#define CD_FIRST -1 /* enumeration of ChangeDirection type */ -#define CD_CONTINUE 0 /* enumeration of ChangeDirection type */ -#define CD_LAST 1 /* enumeration of ChangeDirection type */ - -#define MoreWorkArea(R,x1,y1,x2,y2) t1_MoreWorkArea(R,x1,y1,x2,y2) -#define KillRegion(area) t1_KillRegion(area) -#define CopyRegion(area) t1_CopyRegion(area) -#define BoxClip(R,xmin,ymin,xmax,ymax) t1_BoxClip(R,xmin,ymin,xmax,ymax) -#define SortSwath(a,p,f) t1_SortSwath(a,p,f) -#define SwathUnion(b,e) t1_SwathUnion(b,e) -#define RegionBounds(r) t1_RegionBounds(r) -#define CoerceRegion(p) t1_CoerceRegion(p) -#define MoveEdges(R,dx,dy) t1_MoveEdges(R,dx,dy) -#define UnJumble(R) t1_UnJumble(R) - -void t1_MoreWorkArea(); /* get longer edge list for stepping */ -struct region *t1_CopyRegion(); /* duplicate a region */ -void t1_KillRegion(); /* destroy a region */ -struct region *t1_BoxClip(); /* clip a region to a rectangle */ -struct edgelist *t1_SortSwath(); /* sort edges onto growing edge list */ -struct edgelist *t1_SwathUnion(); /* 'union' two edges into a swath */ -struct segment *t1_RegionBounds(); /* returns bounding box of a region */ -struct region *t1_CoerceRegion(); /* force text to become a true region */ -void t1_MoveEdges(); /* moves the edge values in a region */ -void t1_UnJumble(); /* sort the edges and reset the jumbled flag */ - -/*END SHARED*/ -/*SHARED*/ - -#define GOING_TO(R, x1, y1, x2, y2, dy) { \ - if (dy < 0) { \ - if (R->lastdy >= 0) \ - ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ - if (y2 < R->edgeYstop) \ - MoreWorkArea(R, x1, y1, x2, y2); \ - } \ - else if (dy > 0) { \ - if (R->lastdy <= 0) \ - ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ - if (y2 > R->edgeYstop) \ - MoreWorkArea(R, x1, y1, x2, y2); \ - } \ - else /* dy == 0 */ ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ - if (x2 < R->edgexmin) R->edgexmin = x2; \ - else if (x2 > R->edgexmax) R->edgexmax = x2; \ -} - - -#define MINPEL (-1<<(8*sizeof(pel)-1)) /* smallest value fitting in a pel */ -#define MAXPEL ((1<<(8*sizeof(pel)-1))-1)/* largest value fitting in a pel */ - -/* -The "Unique"-type macro is different (unique?) for regions, because some -regions structures are shared among several objects, and might have -to be made unique for that reason (i.e., references > 1). -*/ - -#define ConsumeRegion(R) MAKECONSUME(R,KillRegion(R)) -#define UniqueRegion(R) MAKEUNIQUE(R,CopyRegion(R)) - - -/*END SHARED*/ -/*SHARED*/ - -struct region { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = REGIONTYPE */ - struct fractpoint origin; /* beginning handle: X,Y origin of region */ - struct fractpoint ending; /* ending handle: X,Y change after painting region */ - pel xmin,ymin; /* minimum X,Y of region */ - pel xmax,ymax; /* mat1_mum X,Y of region */ - struct edgelist *anchor; /* list of edges that bound the region */ - struct picture *thresholded; /* region defined by thresholded picture*/ -/* -Note that the ending handle and the bounding box values are stored -relative to 'origin'. - -The above elements describe a region. The following elements are -scratchpad areas used while the region is being built: -*/ - fractpel lastdy; /* direction of last segment */ - fractpel firstx,firsty; /* starting point of current edge */ - fractpel edgexmin,edgexmax; /* x extent of current edge */ - struct edgelist *lastedge,*firstedge; /* last and first edges in subpath */ - pel *edge; /* pointer to array of X values for edge */ - fractpel edgeYstop; /* Y value where 'edges' array ends */ - int (*newedgefcn)(); /* function to use when building a new edge */ - struct strokeinfo *strokeinfo; /* scratchpad info during stroking only */ -} ; -/* -The ISCOMPLEMENT flag indicates the region is reversed--it is the -"outside" of the nominal region. -*/ -#define ISCOMPLEMENT(flag) ((flag)&0x80) -/* -The ISJUMBLED flag indicates the region is not sorted top-to-bottom. -*/ -#define ISJUMBLED(flag) ((flag)&0x40) -/* -The ISINFINITE flag allows a quick check for an INFINITE region, which -is frequently intersected. -*/ -#define ISINFINITE(flag) ((flag)&0x20) - -/*END SHARED*/ -/*SHARED*/ - -#define ISRECTANGULAR(flag) ((flag)&0x08) - -/*END SHARED*/ -/*SHARED*/ - -#define EmptyRegion t1_EmptyRegion - -/*END SHARED*/ -/*SHARED*/ - -struct edgelist { - XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ - /* type = EDGETYPE */ - struct edgelist *link; /* pointer to next in linked list */ - struct edgelist *subpath; /* informational link for "same subpath" */ - pel xmin,xmax; /* range of edge in X */ - pel ymin,ymax; /* range of edge in Y */ - pel *xvalues; /* pointer to ymax-ymin X values */ -} ; -/* -The end of the list is marked by either "link" being NULL, or by -ymin == ymax. See :hdref refid=discard.. We define the VALIDEDGE -predicate to test for the opposite of these conditions: -*/ - -#define VALIDEDGE(p) ((p)!=NULL&&(p)->ymin<(p)->ymax) - -/*END SHARED*/ -/*SHARED*/ - -#define ISDOWN(f) ((f)&0x80) - -#define ISAMBIGUOUS(f) ((f)&0x40) - -/*END SHARED*/ -/*SHARED*/ - -/* -Interior() rule enumerations: -*/ -#define WINDINGRULE -2 -#define EVENODDRULE -3 - -#define CONTINUITY 0x80 /* can be added to above rules; e.g. WINDINGRULE+CONTINUITY */ - -/*END SHARED*/ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/scanfont.c xdvik-22.40n/libs/t1lib/lib/type1/scanfont.c --- xdvik-22.40l/libs/t1lib/lib/type1/scanfont.c Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/scanfont.c Thu Jan 1 00:00:00 1970 @@ -1,1365 +0,0 @@ -/* $XConsortium: scanfont.c,v 1.9 92/07/07 17:14:56 gildea Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */ - -#include -#include "t1stdio.h" -#include "util.h" -#include "token.h" -#include "fontfcn.h" -#include "blues.h" - - -/* #define DEBUG_SCANFONT */ - - -static int rc; -static boolean InPrivateDict; -static boolean WantFontInfo; -static boolean TwoSubrs; -static psobj inputFile; -static psobj filterFile; -static psobj *inputP; - - -extern int T1Getc(F_FILE * ); -extern int T1Ungetc( int,F_FILE *); -extern int SearchDictName( psdict *dictP, psobj *keyP); -extern void T1io_setblocklen( long len); - - -/* functions from util.c */ -extern void objFormatInteger(psobj *objP, int value); -extern void objFormatReal(psobj *objP, float value); -extern void objFormatBoolean(psobj *objP, boolean value); -extern void objFormatEncoding( psobj *objP, int length, psobj *valueP); -extern void objFormatArray( psobj *objP, int length, psobj *valueP); -extern void objFormatString( psobj *objP, int length, char *valueP); -extern void objFormatName( psobj *objP, int length, char *valueP); -extern void objFormatFile( psobj *objP, FILE *valueP); - - -/**********************************************************************/ -/* Init_BuiltInEncoding() */ -/* */ -/* Initializes the StandardEncoding. */ -/* */ -/**********************************************************************/ -typedef struct /* Builtin Standard Encoding */ -{ - int index; - char *name; -} EncodingTable; - - -char not_def[]=".notdef"; - - -static EncodingTable StdEnc[] = { - {040 , "space"}, - {041 , "exclam"}, - {042 , "quotedbl"}, - {043 , "numbersign"}, - {044 , "dollar"}, - {045 , "percent"}, - {046 , "ampersand"}, - {047 , "quoteright"}, - {050 , "parenleft"}, - {051 , "parenright"}, - {052 , "asterisk"}, - {053 , "plus"}, - {054 , "comma"}, - {055 , "hyphen"}, - {056 , "period"}, - {057 , "slash"}, - {060 , "zero"}, - {061 , "one"}, - {062 , "two"}, - {063 , "three"}, - {064 , "four"}, - {065 , "five"}, - {066 , "six"}, - {067 , "seven"}, - {070 , "eight"}, - {071 , "nine"}, - {072 , "colon"}, - {073 , "semicolon"}, - {074 , "less"}, - {075 , "equal"}, - {076 , "greater"}, - {077 , "question"}, - {0100 , "at"}, - {0101 , "A"}, - {0102 , "B"}, - {0103 , "C"}, - {0104 , "D"}, - {0105 , "E"}, - {0106 , "F"}, - {0107 , "G"}, - {0110 , "H"}, - {0111 , "I"}, - {0112 , "J"}, - {0113 , "K"}, - {0114 , "L"}, - {0115 , "M"}, - {0116 , "N"}, - {0117 , "O"}, - {0120 , "P"}, - {0121 , "Q"}, - {0122 , "R"}, - {0123 , "S"}, - {0124 , "T"}, - {0125 , "U"}, - {0126 , "V"}, - {0127 , "W"}, - {0130 , "X"}, - {0131 , "Y"}, - {0132 , "Z"}, - {0133 , "bracketleft"}, - {0134 , "backslash"}, - {0135 , "bracketright"}, - {0136 , "asciicircum"}, - {0137 , "underscore"}, - {0140 , "quoteleft"}, - {0141 , "a"}, - {0142 , "b"}, - {0143 , "c"}, - {0144 , "d"}, - {0145 , "e"}, - {0146 , "f"}, - {0147 , "g"}, - {0150 , "h"}, - {0151 , "i"}, - {0152 , "j"}, - {0153 , "k"}, - {0154 , "l"}, - {0155 , "m"}, - {0156 , "n"}, - {0157 , "o"}, - {0160 , "p"}, - {0161 , "q"}, - {0162 , "r"}, - {0163 , "s"}, - {0164 , "t"}, - {0165 , "u"}, - {0166 , "v"}, - {0167 , "w"}, - {0170 , "x"}, - {0171 , "y"}, - {0172 , "z"}, - {0173 , "braceleft"}, - {0174 , "bar"}, - {0175 , "braceright"}, - {0176 , "asciitilde"}, - {0241 , "exclamdown"}, - {0242 , "cent"}, - {0243 , "sterling"}, - {0244 , "fraction"}, - {0245 , "yen"}, - {0246 , "florin"}, - {0247 , "section"}, - {0250 , "currency"}, - {0251 , "quotesingle"}, - {0252 , "quotedblleft"}, - {0253 , "guillemotleft"}, - {0254 , "guilsinglleft"}, - {0255 , "guilsinglright"}, - {0256 , "fi"}, - {0257 , "fl"}, - {0261 , "endash"}, - {0262 , "dagger"}, - {0263 , "daggerdbl"}, - {0264 , "periodcentered"}, - {0266 , "paragraph"}, - {0267 , "bullet"}, - {0270 , "quotesinglbase"}, - {0271 , "quotedblbase"}, - {0272 , "quotedblright"}, - {0273 , "guillemotright"}, - {0274 , "ellipsis"}, - {0275 , "perthousand"}, - {0277 , "questiondown"}, - {0301 , "grave"}, - {0302 , "acute"}, - {0303 , "circumflex"}, - {0304 , "tilde"}, - {0305 , "macron"}, - {0306 , "breve"}, - {0307 , "dotaccent"}, - {0310 , "dieresis"}, - {0312 , "ring"}, - {0313 , "cedilla"}, - {0315 , "hungarumlaut"}, - {0316 , "ogonek"}, - {0317 , "caron"}, - {0320 , "emdash"}, - {0341 , "AE"}, - {0343 , "ordfeminine"}, - {0350 , "Lslash"}, - {0351 , "Oslash"}, - {0352 , "OE"}, - {0353 , "ordmasculine"}, - {0361 , "ae"}, - {0365 , "dotlessi"}, - {0370 , "lslash"}, - {0371 , "oslash"}, - {0372 , "oe"}, - {0373 , "germandbls"}, - { 0, 0 } -}; - - -/* Encodings changed from static to global since they must be accessible - by T1_LoadFont() when reallocating memory. */ -psobj *StdEncArrayP = NULL; - - -static psobj *MakeEncodingArrayP(encodingTable) - EncodingTable *encodingTable; -{ - int i; - psobj *encodingArrayP; - - encodingArrayP = (psobj *)vm_alloc(256*(sizeof(psobj))); - if (!encodingArrayP) - return NULL; - - /* initialize everything to .notdef */ - for (i=0; i<256;i++) - objFormatName(&(encodingArrayP[i]),7, not_def); - - for (i=0; encodingTable[i].name; i++) - { - objFormatName(&(encodingArrayP[encodingTable[i].index]), - strlen(encodingTable[i].name), - encodingTable[i].name); - } - - return(encodingArrayP); -} - -boolean Init_BuiltInEncoding() -{ - StdEncArrayP = MakeEncodingArrayP(StdEnc); - if (StdEncArrayP==NULL) - return( FALSE); - else - return( TRUE); -} - -/********************************************************************/ -/***================================================================***/ -static int getNextValue(valueType) - int valueType; -{ - scan_token(inputP); - if (tokenType != valueType) { - return(SCAN_ERROR); - } - return(SCAN_OK); - -} -/***================================================================***/ -/* This routine will set the global rc if there is an error */ -/***================================================================***/ -static int getInt() -{ - scan_token(inputP); - if (tokenType != TOKEN_INTEGER) { - rc = SCAN_ERROR; - return(0); - } - else { - return( tokenValue.integer); - } - -} -/***================================================================***/ -/* - * See Sec 10.3 of ``Adobe Type 1 Font Format'' v1.1, - * for parsing Encoding. - */ -static int getEncoding(arrayP) - psobj *arrayP; -{ - - scan_token(inputP); - if ((tokenType == TOKEN_NAME) && - ((tokenLength==16) && (!strncmp(tokenStartP,"StandardEncoding",16))) - ) - { - /* Adobe Standard Encoding */ - - if (tokenLength == 16) - arrayP->data.valueP = (char *) StdEncArrayP; - else - return(SCAN_ERROR); - - - arrayP->len = 256; - return(SCAN_OK); - } - else if ( (tokenType == TOKEN_LEFT_BRACE) || - (tokenType == TOKEN_LEFT_BRACKET) ) - { - /* Array of literal names */ - - psobj *objP; - int i; - - objP = (psobj *)vm_alloc(256*(sizeof(psobj))); - if (!(objP)) return(SCAN_OUT_OF_MEMORY); - - arrayP->data.valueP = (char *) objP; - arrayP->len = 256; - - for (i=0; i<256; i++, objP++) - { - scan_token(inputP); - - if (tokenType != TOKEN_LITERAL_NAME) - return(SCAN_ERROR); - - if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY); - objFormatName(objP,tokenLength,tokenStartP); - } - - scan_token(inputP); - if ( (tokenType == TOKEN_RIGHT_BRACE) || - (tokenType == TOKEN_RIGHT_BRACKET) ) - return(SCAN_OK); - } - else - { - /* Must be sequences of ``dup put" */ - - psobj *objP; - int i; - - objP = (psobj *)vm_alloc(256*(sizeof(psobj))); - if (!(objP)) return(SCAN_OUT_OF_MEMORY); - - arrayP->data.valueP = (char *) objP; - arrayP->len = 256; - - for (i=0; i<256; i++) - objFormatName(objP + i, 7, not_def); - - while (TRUE) - { - scan_token(inputP); - - switch (tokenType) - { - case TOKEN_NAME: - if (tokenLength == 3) - { - if (strncmp(tokenStartP,"dup",3) == 0) - { - /* get */ - scan_token(inputP); - if (tokenType != TOKEN_INTEGER || - tokenValue.integer < 0 || - tokenValue.integer > 255) - return (SCAN_ERROR); - i = tokenValue.integer; - - /* get */ - scan_token(inputP); - if (tokenType != TOKEN_LITERAL_NAME) - return(SCAN_ERROR); - - if (!(vm_alloc(tokenLength)) ) - return(SCAN_OUT_OF_MEMORY); - objFormatName(objP + i,tokenLength,tokenStartP); - - /* get "put" */ - scan_token(inputP); - if (tokenType != TOKEN_NAME) - return(SCAN_ERROR); - } - else if (strncmp(tokenStartP,"def",3) == 0) - return (SCAN_OK); - } - break; - case TOKEN_EOF: - case TOKEN_NONE: - case TOKEN_INVALID: - return (SCAN_ERROR); - } - } - } - - return (SCAN_ERROR); -} -/***================================================================***/ -static int getArray(arrayP) - psobj *arrayP; -{ - int N; /* count the items in the array */ - psobj *objP; - - - scan_token(inputP); - if ( (tokenType != TOKEN_LEFT_BRACE) && - (tokenType != TOKEN_LEFT_BRACKET) ) { - return(SCAN_ERROR); - } - /* format the array in memory, save pointer to the beginning */ - arrayP->data.valueP = tokenStartP; - /* loop, picking up next object, until right BRACE or BRACKET */ - N = 0; - do { - scan_token(inputP); - if ( (tokenType == TOKEN_RIGHT_BRACE) || - (tokenType == TOKEN_RIGHT_BRACKET) ) { - /* save then number of items in the array */ - arrayP->len = N; - return(SCAN_OK); - } - /* allocate the space for the object */ - objP = (psobj *)vm_alloc(sizeof(psobj)); - if (!(objP)) return(SCAN_OUT_OF_MEMORY); - - /* array is an array of numbers, (real or integer) */ - if (tokenType == TOKEN_REAL) { - objFormatReal(objP, tokenValue.real); - } - else - if (tokenType == TOKEN_INTEGER) { - objFormatInteger(objP, tokenValue.integer); - } - else return(SCAN_ERROR); - N++; - } while ( 1>0 ); - /* NOTREACHED*/ -} -/***================================================================***/ -/* is not needed */ -/* - static int getName(nameP) - char *nameP; - { - do { - scan_token(inputP); - if (tokenType <= TOKEN_NONE) { - if (tokenTooLong) return(SCAN_OUT_OF_MEMORY); - return(SCAN_ERROR); - } - } while ((tokenType != TOKEN_NAME) || - (0 != strncmp(tokenStartP,nameP,strlen(nameP))) ); - - return(SCAN_OK); - } -*/ - -/***================================================================***/ -static int getNbytes(N) - int N; -{ - int I; - - if (N > vm_free_bytes()) { - if (!vm_init()) return(SCAN_OUT_OF_MEMORY); - } - tokenStartP = vm_next_byte(); - I = fread(tokenStartP,1,N,inputP->data.fileP); - if ( I != N ) return(SCAN_FILE_EOF); - return(SCAN_OK); -} - -/***================================================================***/ -/* getLiteralName(nameObjP) */ -/* scan for next literal. */ -/* if we encounter the name 'end' then terminate and say ok. */ -/* It means that the CharStrings does not have as many characters */ -/* as the dictionary said it would and that is ok. */ -/***================================================================***/ -static int getLiteralName(nameObjP) - psobj *nameObjP; -{ - do { - scan_token(inputP); - if (tokenType <= TOKEN_NONE) { - if (tokenTooLong) return(SCAN_OUT_OF_MEMORY); - return(SCAN_ERROR); - } - if (tokenType == TOKEN_NAME) { - if (0 == strncmp(tokenStartP,"end",3) ) { - return(SCAN_END); - } - } - } while (tokenType != TOKEN_LITERAL_NAME) ; - nameObjP->len = tokenLength; - /* allocate all the names in the CharStrings Structure */ - if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY); - nameObjP->data.valueP = tokenStartP; - /* found */ - return(SCAN_OK); -} - -/***================================================================***/ -/* - * BuildSubrs routine - */ -/***================================================================***/ - -static int BuildSubrs(FontP) - psfont *FontP; -{ - int N; /* number of values in Subrs */ - int I; /* index into Subrs */ - int i; /* loop thru Subrs */ - int J; /* length of Subrs entry */ - psobj *arrayP; - - /* next token should be a positive int */ - /* note: rc is set by getInt. */ - N = getInt(); - if (rc) return(rc); - if (N < 0 ) return(SCAN_ERROR); - /* if we already have a Subrs, then skip the second one */ - /* The second one is for hiresolution devices. */ - if (FontP->Subrs.data.arrayP != NULL) { - TwoSubrs = TRUE; - /* process all the Subrs, but do not update anything */ - /* can not just skip them because of the binary data */ - for (i=0;iSubrs.len = N; - FontP->Subrs.data.arrayP = arrayP; - /* get N values for Subrs */ - for (i=0;iCharStringsP = dictP; - dictP[0].key.len = N; - /* get N values for CharStrings */ - for (i=1;i<=N;i++) { - /* look for next literal name */ - rc = getLiteralName(&(dictP[i].key)); - /* If rc=SCAN_END, the end of file has been reached. This means - there were less than N charstrings. This is perfectly valid. */ - if (rc) return(rc); - /* get 1 integer */ - J = getInt(); - if (rc) return(rc); /* if next token was not an Int */ - if (J<0) return (SCAN_ERROR); - dictP[i].value.len = J; - /* get the next token, it should be RD or -|, either is ok */ - rc = getNextValue(TOKEN_NAME); - if ( rc != SCAN_OK ) return(rc); - rc = getNbytes(J); - if (rc == SCAN_OK) { - dictP[i].value.data.valueP = tokenStartP; - if ( !(vm_alloc(J)) ) return(SCAN_OUT_OF_MEMORY); - } - else { - return(rc); - } - - } - return(SCAN_OK); - -} -/***================================================================***/ -/***================================================================***/ -/* - * BuildFontInfo Dictionary - */ -/***================================================================***/ -static int BuildFontInfo(fontP) - psfont *fontP; -{ - psdict *dictP; - - /* allocate the private dictionary */ - dictP = (psdict *)vm_alloc(20*sizeof(psdict)); - if (!(dictP)) return(SCAN_OUT_OF_MEMORY); - - fontP->fontInfoP = dictP; - fontP->fontInfoP[0].key.len = 17; /* number of actual entries */ - objFormatName(&(dictP[FONTNAME].key),8,"FontName"); - objFormatName(&(dictP[FONTNAME].value),0,NULL); - objFormatName(&(dictP[PAINTTYPE].key),9,"PaintType"); - objFormatInteger(&(dictP[PAINTTYPE].value),0); - objFormatName(&(dictP[FONTTYPENUM].key),8,"FontType"); - objFormatInteger(&(dictP[FONTTYPENUM].value),0); - objFormatName(&(dictP[FONTMATRIX].key),10,"FontMatrix"); - objFormatArray(&(dictP[FONTMATRIX].value),0,NULL); - objFormatName(&(dictP[FONTBBOX].key),8,"FontBBox"); - objFormatArray(&(dictP[FONTBBOX].value),0,NULL); - objFormatName(&(dictP[ENCODING].key),8,"Encoding"); - objFormatEncoding(&(dictP[ENCODING].value),0,NULL); - objFormatName(&(dictP[UNIQUEID].key),8,"UniqueID"); - objFormatInteger(&(dictP[UNIQUEID].value),0); - objFormatName(&(dictP[STROKEWIDTH].key),11,"StrokeWidth"); - objFormatReal(&(dictP[STROKEWIDTH].value),0.0); - objFormatName(&(dictP[VERSION].key),7,"version"); - objFormatString(&(dictP[VERSION].value),0,NULL); - objFormatName(&(dictP[NOTICE].key),6,"Notice"); - objFormatString(&(dictP[NOTICE].value),0,NULL); - objFormatName(&(dictP[FULLNAME].key),8,"FullName"); - objFormatString(&(dictP[FULLNAME].value),0,NULL); - objFormatName(&(dictP[FAMILYNAME].key),10,"FamilyName"); - objFormatString(&(dictP[FAMILYNAME].value),0,NULL); - objFormatName(&(dictP[WEIGHT].key),6,"Weight"); - objFormatString(&(dictP[WEIGHT].value),0,NULL); - objFormatName(&(dictP[ITALICANGLE].key),11,"ItalicAngle"); - objFormatReal(&(dictP[ITALICANGLE].value),0.0); - objFormatName(&(dictP[ISFIXEDPITCH].key),12,"isFixedPitch"); - objFormatBoolean(&(dictP[ISFIXEDPITCH].value),FALSE); - objFormatName(&(dictP[UNDERLINEPOSITION].key),17,"UnderlinePosition"); - objFormatReal(&(dictP[UNDERLINEPOSITION].value),0.0); - objFormatName(&(dictP[UNDERLINETHICKNESS].key),18,"UnderlineThickness"); - objFormatReal(&(dictP[UNDERLINETHICKNESS].value),0.0); - return(SCAN_OK); -} -/***================================================================***/ -/* - * BuildPrivate Dictionary - */ -/* "LenIV" corrected to be "lenIV", otherwise fonts with some specific - lenIV value could not be decrypted. (RMz, Author of t1lib, 06/03/1998)*/ -/***================================================================***/ -static int BuildPrivate(fontP) - psfont *fontP; -{ - psdict *Private; - - /* allocate the private dictionary */ - Private = (psdict *)vm_alloc(20*sizeof(psdict)); - - if (!(Private)) return(SCAN_OUT_OF_MEMORY); - - fontP->Private = Private; - fontP->Private[0].key.len = 16; /* number of actual entries */ - - objFormatName(&(Private[BLUEVALUES].key),10,"BlueValues"); - objFormatArray(&(Private[BLUEVALUES].value),0,NULL); - objFormatName(&(Private[OTHERBLUES].key),10,"OtherBlues"); - objFormatArray(&(Private[OTHERBLUES].value),0,NULL); - objFormatName(&(Private[FAMILYBLUES].key),11,"FamilyBlues"); - objFormatArray(&(Private[FAMILYBLUES].value),0,NULL); - objFormatName(&(Private[FAMILYOTHERBLUES].key),16,"FamilyOtherBlues"); - objFormatArray(&(Private[FAMILYOTHERBLUES].value),0,NULL); - objFormatName(&(Private[BLUESCALE].key),9,"BlueScale"); - objFormatReal(&(Private[BLUESCALE].value),DEFAULTBLUESCALE); - objFormatName(&(Private[BLUESHIFT].key),9,"BlueShift"); - objFormatInteger(&(Private[BLUESHIFT].value),DEFAULTBLUESHIFT); - objFormatName(&(Private[BLUEFUZZ].key),8,"BlueFuzz"); - objFormatInteger(&(Private[BLUEFUZZ].value),DEFAULTBLUEFUZZ); - objFormatName(&(Private[STDHW].key),5,"StdHW"); - objFormatArray(&(Private[STDHW].value),0,NULL); - objFormatName(&(Private[STDVW].key),5,"StdVW"); - objFormatArray(&(Private[STDVW].value),0,NULL); - objFormatName(&(Private[STEMSNAPH].key),9,"StemSnapH"); - objFormatArray(&(Private[STEMSNAPH].value),0,NULL); - objFormatName(&(Private[STEMSNAPV].key),9,"StemSnapV"); - objFormatArray(&(Private[STEMSNAPV].value),0,NULL); - objFormatName(&(Private[FORCEBOLD].key),9,"ForceBold"); - objFormatBoolean(&(Private[FORCEBOLD].value),DEFAULTFORCEBOLD); - objFormatName(&(Private[LANGUAGEGROUP].key),13,"LanguageGroup"); - objFormatInteger(&(Private[LANGUAGEGROUP].value),DEFAULTLANGUAGEGROUP); - objFormatName(&(Private[LENIV].key),5,"lenIV"); - objFormatInteger(&(Private[LENIV].value),DEFAULTLENIV); - objFormatName(&(Private[RNDSTEMUP].key),9,"RndStemUp"); - objFormatBoolean(&(Private[RNDSTEMUP].value),DEFAULTRNDSTEMUP); - objFormatName(&(Private[EXPANSIONFACTOR].key),9,"ExpansionFactor"); - objFormatReal(&(Private[EXPANSIONFACTOR].value), - DEFAULTEXPANSIONFACTOR); - return(SCAN_OK); -} -/***================================================================***/ -/**********************************************************************/ -/* GetType1Blues(fontP) */ -/* */ -/* Routine to support font-level hints. */ -/* */ -/* Gets all the Blues information from the Private dictionary */ -/* for the font. */ -/* */ -/* */ -/**********************************************************************/ -static int GetType1Blues(fontP) - psfont *fontP; -{ - psdict *PrivateDictP; /* the Private dict relating to hints */ - struct blues_struct *blues; /* ptr for the blues struct we will allocate */ - int i; - psobj *HintEntryP; - - - - /* get the Private dictionary pointer */ - PrivateDictP = fontP->Private; - - /* allocate the memory for the blues structure */ - blues = (struct blues_struct *) vm_alloc(sizeof(struct blues_struct)); - - if (!blues) return(SCAN_OUT_OF_MEMORY); - - /* Make fontP's blues ptr point to this newly allocated structure. */ - fontP->BluesP = blues; - - /* fill in the BlueValues array */ - HintEntryP = &(PrivateDictP[BLUEVALUES].value); - /* check to see if the entry exists and if it's an array */ - if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) - blues->numBlueValues = 0; - else { - /* get the number of values in the array */ - if (HintEntryP->len > NUMBLUEVALUES) { - blues->numBlueValues = NUMBLUEVALUES; - } else - blues->numBlueValues = HintEntryP->len; - for (i = 0; i<= blues->numBlueValues-1; ++i) { - if (objPIsInteger(&HintEntryP->data.arrayP[i])) - blues->BlueValues[i] = - HintEntryP->data.arrayP[i].data.integer; - else if (objPIsReal(&HintEntryP->data.arrayP[i])) - blues->BlueValues[i] = - HintEntryP->data.arrayP[i].data.real; - else - blues->BlueValues[i] = 0; - } - } - - /* fill in the OtherBlues array */ - HintEntryP = &(PrivateDictP[OTHERBLUES].value); - /* check to see if the entry exists and if it's an array */ - if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) - blues->numOtherBlues = 0; - else { - /* get the number of values in the array */ - if (HintEntryP->len > NUMOTHERBLUES) { - blues->numOtherBlues = NUMOTHERBLUES; - } else - blues->numOtherBlues = HintEntryP->len; - for (i = 0; i<= blues->numOtherBlues-1; ++i) { - if (objPIsInteger(&HintEntryP->data.arrayP[i])) - blues->OtherBlues[i] = - HintEntryP->data.arrayP[i].data.integer; - else if (objPIsReal(&HintEntryP->data.arrayP[i])) - blues->OtherBlues[i] = - HintEntryP->data.arrayP[i].data.real; - else - blues->OtherBlues[i] = 0; - } - } - - /* fill in the FamilyBlues array */ - HintEntryP = &(PrivateDictP[FAMILYBLUES].value); - /* check to see if the entry exists and if it's an array */ - if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) - blues->numFamilyBlues = 0; - else { - /* get the number of values in the array */ - if (HintEntryP->len > NUMFAMILYBLUES) { - blues->numFamilyBlues = NUMFAMILYBLUES; - } else - blues->numFamilyBlues = HintEntryP->len; - for (i = 0; i<= blues->numFamilyBlues-1; ++i) { - if (objPIsInteger(&HintEntryP->data.arrayP[i])) - blues->FamilyBlues[i] = - HintEntryP->data.arrayP[i].data.integer; - else if (objPIsReal(&HintEntryP->data.arrayP[i])) - blues->FamilyBlues[i] = - HintEntryP->data.arrayP[i].data.real; - else - blues->FamilyBlues[i] = 0; - } - } - - /* fill in the FamilyOtherBlues array */ - HintEntryP = &(PrivateDictP[FAMILYOTHERBLUES].value); - /* check to see if the entry exists and if it's an array */ - if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) - blues->numFamilyOtherBlues = 0; - else { - /* get the number of values in the array */ - if (HintEntryP->len > NUMFAMILYOTHERBLUES) { - blues->numFamilyOtherBlues = NUMFAMILYOTHERBLUES; - } else - blues->numFamilyOtherBlues = HintEntryP->len; - for (i = 0; i<= blues->numFamilyOtherBlues-1; ++i) { - if (objPIsInteger(&HintEntryP->data.arrayP[i])) - blues->FamilyOtherBlues[i] = - HintEntryP->data.arrayP[i].data.integer; - else if (objPIsReal(&HintEntryP->data.arrayP[i])) - blues->FamilyOtherBlues[i] = - HintEntryP->data.arrayP[i].data.real; - else - blues->FamilyOtherBlues[i] = 0; - } - } - - /* fill in the StemSnapH array */ - HintEntryP = &(PrivateDictP[STEMSNAPH].value); - /* check to see if the entry exists and if it's an array */ - if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) - blues->numStemSnapH = 0; - else { - /* get the number of values in the array */ - if (HintEntryP->len > NUMSTEMSNAPH) { - blues->numStemSnapH = NUMSTEMSNAPH; - } else - blues->numStemSnapH = HintEntryP->len; - for (i = 0; i<= blues->numStemSnapH-1; ++i) { - if (objPIsInteger(&HintEntryP->data.arrayP[i])) - blues->StemSnapH[i] = - HintEntryP->data.arrayP[i].data.integer; - else if (objPIsReal(&HintEntryP->data.arrayP[i])) - blues->StemSnapH[i] = - HintEntryP->data.arrayP[i].data.real; - else - blues->StemSnapH[i] = 0; - } - } - - /* fill in the StemSnapV array */ - HintEntryP = &(PrivateDictP[STEMSNAPV].value); - /* check to see if the entry exists and if it's an array */ - if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) - blues->numStemSnapV = 0; - else { - /* get the number of values in the array */ - if (HintEntryP->len > NUMSTEMSNAPV) { - blues->numStemSnapV = NUMSTEMSNAPV; - } else - blues->numStemSnapV = HintEntryP->len; - for (i = 0; i<= blues->numStemSnapV-1; ++i) { - if (objPIsInteger(&HintEntryP->data.arrayP[i])) - blues->StemSnapV[i] = - HintEntryP->data.arrayP[i].data.integer; - else if (objPIsReal(&HintEntryP->data.arrayP[i])) - blues->StemSnapV[i] = - HintEntryP->data.arrayP[i].data.real; - else - blues->StemSnapV[i] = 0; - } - } - - /* fill in the StdVW array */ - HintEntryP = &(PrivateDictP[STDVW].value); - /* check to see if the entry exists and if it's an array */ - if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) - /* a value of zero signifies no entry */ - blues->StdVW = 0.0; - else { - if (HintEntryP->len > NUMSTDVW) { - } - if (objPIsInteger(&HintEntryP->data.arrayP[0])) - blues->StdVW = HintEntryP->data.arrayP[0].data.integer; - else if (objPIsReal(&HintEntryP->data.arrayP[0])) - blues->StdVW = HintEntryP->data.arrayP[0].data.real; - else - blues->StdVW = 0.0; - } - - /* fill in the StdHW array */ - HintEntryP = &(PrivateDictP[STDHW].value); - /* check to see if the entry exists and if it's an array */ - if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) - /* a value of zero signifies no entry */ - blues->StdHW = 0; - else { - if (HintEntryP->len > NUMSTDHW) { - } - if (objPIsInteger(&HintEntryP->data.arrayP[0])) - blues->StdHW = HintEntryP->data.arrayP[0].data.integer; - else if (objPIsReal(&HintEntryP->data.arrayP[0])) - blues->StdHW = HintEntryP->data.arrayP[0].data.real; - else - blues->StdHW = 0; - } - - - /* get the ptr to the BlueScale entry */ - HintEntryP = &(PrivateDictP[BLUESCALE].value); - /* put the BlueScale in the blues structure */ - if (objPIsInteger(HintEntryP)) /* Must be integer! */ - blues->BlueScale = HintEntryP->data.integer; - else if (objPIsReal(HintEntryP)) /* Error? */ - blues->BlueScale = HintEntryP->data.real; - else - blues->BlueScale = DEFAULTBLUESCALE; - - /* get the ptr to the BlueShift entry */ - HintEntryP = &(PrivateDictP[BLUESHIFT].value); - if (objPIsInteger(HintEntryP)) /* Must be integer! */ - blues->BlueShift = HintEntryP->data.integer; - else if (objPIsReal(HintEntryP)) /* Error? */ - blues->BlueShift = HintEntryP->data.real; - else - blues->BlueShift = DEFAULTBLUESHIFT; - - /* get the ptr to the BlueFuzz entry */ - HintEntryP = &(PrivateDictP[BLUEFUZZ].value); - if (objPIsInteger(HintEntryP)) /* Must be integer! */ - blues->BlueFuzz = HintEntryP->data.integer; - else if (objPIsReal(HintEntryP)) /* Error? */ - blues->BlueFuzz = HintEntryP->data.real; - else - blues->BlueFuzz = DEFAULTBLUEFUZZ; - - /* get the ptr to the ForceBold entry */ - HintEntryP = &(PrivateDictP[FORCEBOLD].value); - if (objPIsBoolean(HintEntryP)) /* Must be integer! */ - blues->ForceBold = HintEntryP->data.boolean; - else - blues->ForceBold = DEFAULTFORCEBOLD; - - /* get the ptr to the LanguageGroup entry */ - HintEntryP = &(PrivateDictP[LANGUAGEGROUP].value); - if (objPIsInteger(HintEntryP)) /* Must be integer! */ - blues->LanguageGroup = HintEntryP->data.integer; - else - blues->LanguageGroup = DEFAULTLANGUAGEGROUP; - - /* get the ptr to the RndStemUp entry */ - HintEntryP = &(PrivateDictP[RNDSTEMUP].value); - if (objPIsBoolean(HintEntryP)) /* Must be integer! */ - blues->RndStemUp = HintEntryP->data.boolean; - else - blues->RndStemUp = DEFAULTRNDSTEMUP; - - /* get the ptr to the lenIV entry */ - HintEntryP = &(PrivateDictP[LENIV].value); - if (objPIsInteger(HintEntryP)) {/* Must be integer! */ - blues->lenIV = HintEntryP->data.integer; - } - else{ - blues->lenIV = DEFAULTLENIV; - } - - - /* get the ptr to the ExpansionFactor entry */ - HintEntryP = &(PrivateDictP[EXPANSIONFACTOR].value); - if (objPIsInteger(HintEntryP)) - blues->ExpansionFactor = HintEntryP->data.integer; - else if (objPIsReal(HintEntryP)) - blues->ExpansionFactor = HintEntryP->data.real; - else - blues->ExpansionFactor = DEFAULTEXPANSIONFACTOR; - return(SCAN_OK); -} -/**********************************************************************/ -/* GetType1CharString(fontP,code) */ -/* */ -/* Look up code in the standard encoding vector and return */ -/* the charstring associated with the character name. */ -/* */ -/* fontP is the psfont structure. */ -/* */ -/* Returns a psobj (string) */ -/**********************************************************************/ -psobj *GetType1CharString(fontP, code) -psfont *fontP; -unsigned char code; -{ - int N; /* the 'Nth' entry in the CharStrings */ - psobj *charnameP; /* points to psobj that is name of character*/ - - psdict *CharStringsDictP; /* dictionary with char strings */ - psobj *theStringP; /* the definition for the code */ - - - if (StdEncArrayP == NULL) { - return(NULL); - } - /* use the code to index into the standard encoding vector */ - charnameP = &(StdEncArrayP[code]); - - /* test if the encoding array points to a name */ - if (!(objPIsName(charnameP)) ) { - return(NULL); - } - - /* Now that we have the character name out of the standardencoding */ - /* get the character definition out of the current font */ - CharStringsDictP = fontP->CharStringsP; - - /* search the chars string for this charname as key */ - N = SearchDictName(CharStringsDictP,charnameP); - if (N<=0) { - return(NULL); - } - - /* OK, the nth item is the psobj that is the string for this char */ - theStringP = &(CharStringsDictP[N].value); - - return(theStringP); -} - -/***================================================================***/ -/* - * FindDictValue - */ -/***================================================================***/ - -static int FindDictValue(dictP) - psdict *dictP; -{ - psobj LitName; - int N; - int V; - - /* we have just scanned a token and it is a literal name */ - /* need to check if that name is in Private dictionary */ - objFormatName(&LitName,tokenLength,tokenStartP); - /* is it in the dictP */ - N = SearchDictName(dictP,&LitName); - /* if found */ - if ( N > 0 ) { - /* what type */ - switch (dictP[N].value.type) { - case OBJ_ENCODING: - V = getEncoding(&(dictP[N].value)); - if ( V != SCAN_OK ) return(V); - break; - case OBJ_ARRAY: - V = getArray(&(dictP[N].value)); - if ( V != SCAN_OK ) return(V); - break; - case OBJ_INTEGER: - /* next value in integer */ - dictP[N].value.data.integer = getInt(); - if (rc) return(rc); /* if next token was not an Int */ - break; - case OBJ_REAL: - /* next value must be real or int, store as a real */ - scan_token(inputP); - if (tokenType == TOKEN_REAL) { - dictP[N].value.data.real = tokenValue.real; - } - else - if (tokenType == TOKEN_INTEGER) { - dictP[N].value.data.real = tokenValue.integer; - } - else return(SCAN_ERROR); - break; - case OBJ_NAME: - V = getNextValue(TOKEN_LITERAL_NAME); - if ( V != SCAN_OK ) return(V); - if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY); - objFormatName(&(dictP[N].value),tokenLength,tokenStartP); - break; - case OBJ_STRING: - V = getNextValue(TOKEN_STRING); - if ( V != SCAN_OK ) return(V); - if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY); - objFormatString(&(dictP[N].value),tokenLength,tokenStartP); - break; - case OBJ_BOOLEAN: - scan_token(inputP); - if (tokenType != TOKEN_NAME) { - return(SCAN_ERROR); - } - if (0 == strncmp(tokenStartP,"true",4) ) { - dictP[N].value.data.boolean =TRUE; - } - else - if (0 == strncmp(tokenStartP,"false",5) ) { - dictP[N].value.data.boolean =FALSE; - } - else return(SCAN_ERROR); - break; - - default: - return(SCAN_ERROR); - break; - } - } - /* Name is not in dictionary. That is ok. */ - return(SCAN_OK); - -} -/***================================================================***/ - -/* - * ------------------------------------------------------------------- - * Scan the next token and convert it into an object - * Result is placed on the Operand Stack as next object - * ------------------------------------------------------------------- - */ -int scan_font(FontP) - psfont *FontP; -{ - - - char filename[128]; - char filetype[3]; - FILE *fileP; - char *nameP; - int namelen; - - filetype[0] = 'r'; - filetype[1] = 'b'; - filetype[2] = '\0'; - /* copy the filename and remove leading or trailing blanks */ - /* point to name and search for leading blanks */ - nameP= FontP->FontFileName.data.nameP; - namelen = FontP->FontFileName.len; - while (nameP[0] == ' ') { - nameP++; - namelen--; - } - /* now remove any trailing blanks */ - while ((namelen>0) && ( nameP[namelen-1] == ' ')) { - namelen--; - } - strncpy(filename,nameP,namelen); - filename[namelen] = '\0'; - /* file name is now constructed */ - inputFile.data.fileP = NULL; - filterFile.data.fileP = NULL; - - inputP = &inputFile; - if ((fileP = fopen(filename,filetype))!=NULL) { - objFormatFile(inputP,fileP); - } - else { - return(SCAN_FILE_OPEN_ERROR); - }; - - WantFontInfo = TRUE; - InPrivateDict = FALSE; - TwoSubrs = FALSE; - rc = BuildFontInfo(FontP); -#ifdef DEBUG_SCANFONT - printf("BuildFontInfo(): retval=%d\n", rc); -#endif - if (rc != 0) return(rc); - - /* Assume everything will be OK */ - rc = 0; - - /* Loop until complete font is read */ - do { - /* Scan the next token */ - scan_token(inputP); - - /* ==> tokenLength, tokenTooLong, tokenType, and tokenValue are */ - /* now set */ - - switch (tokenType) { - case TOKEN_EOF: - case TOKEN_NONE: - case TOKEN_INVALID: - /* in this case we are done */ - if (tokenTooLong) return(SCAN_OUT_OF_MEMORY); - rc = SCAN_ERROR; - break; - case TOKEN_LITERAL_NAME: - /* Look up the name */ - tokenStartP[tokenLength] = '\0'; - /* At this point we check for the font not being a - Multiple Master Font. If it is, we return an error. - (RMz, 01/29/1999) */ - if (strncmp(tokenStartP, "BlendAxisTypes", 14)==0){ - rc=SCAN_MMFONT; - break; - } - if (InPrivateDict ) { - if (0== strncmp(tokenStartP,"Subrs",5) ) { - rc = BuildSubrs(FontP); -#ifdef DEBUG_SCANFONT - printf("BuildSubrs(): retval=%d\n", rc); -#endif - break; - } - if (0== strncmp(tokenStartP,"CharStrings",11) ) { - rc = BuildCharStrings(FontP); -#ifdef DEBUG_SCANFONT - printf("BuildCharstrings(): retval=%d\n", rc); -#endif - if ( (rc == SCAN_OK) ||(rc == SCAN_END) ) { - fclose(inputP->data.fileP); - /* Build the Blues Structure */ - rc = GetType1Blues(FontP); -#ifdef DEBUG_SCANFONT - printf("GetType1Blues(): retval=%d\n", rc); -#endif - /* whatever the return code, return it */ - /* all the work is done. This is the normal exit.*/ - return(rc); - } - break; - } - rc = FindDictValue(FontP->Private); - /* we are not going to report errors */ - /* Sometimes the font file may test a value such as */ - /* testing to see if the font is alreadly loaded with */ - /* same UniqueID. We would faile on /UniqueID get */ - /* because we are expecting a int to follow UniqueID*/ - /* If the correct object type does not follow a Name*/ - /* then we will skip over it without reporting error*/ - rc = SCAN_OK; - break; - } /* end of reading Private dictionary */ - else - if (0== strncmp(tokenStartP,"Private",7) ) { - InPrivateDict = TRUE; - rc = BuildPrivate(FontP); - break; - } - else - if (WantFontInfo) { - rc = FindDictValue(FontP->fontInfoP); - /* we are not going to report errors */ - rc = SCAN_OK; - break; - } - break; - case TOKEN_NAME: - if (0 == strncmp(tokenStartP,"eexec",5) ) { - /* We check for the pfb-headers in I/O-module */ - filterFile.data.fileP = T1eexec(inputP->data.fileP); - if (filterFile.data.fileP == NULL) { - fclose(inputFile.data.fileP); - return(SCAN_FILE_OPEN_ERROR); - } - inputP = &filterFile; - - WantFontInfo = FALSE; - } - break; - } - - } - while (rc ==0); - fclose(inputP->data.fileP); - if (tokenTooLong) return(SCAN_OUT_OF_MEMORY); - return(rc); -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/spaces.c xdvik-22.40n/libs/t1lib/lib/type1/spaces.c --- xdvik-22.40l/libs/t1lib/lib/type1/spaces.c Wed Apr 18 14:24:12 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/spaces.c Thu Jan 1 00:00:00 1970 @@ -1,1016 +0,0 @@ -/* $XConsortium: spaces.c,v 1.4 91/10/10 11:19:16 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - /* SPACES CWEB V0021 ******** */ -/* -:h1 id=spaces.SPACES Module - Handles Coordinate Spaces - -This module is responsible for handling the TYPE1IMAGER "XYspace" object. - -&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) - - -:h3.Include Files -*/ - -#include -#include -#include - -#include "types.h" -#include "objects.h" -#include "spaces.h" -#include "paths.h" -#include "pictures.h" -#include "fonts.h" -#include "arith.h" -#include "trig.h" - -static int FindFfcn(); -static int FindIfcn(); -/* -:h3.Entry Points Provided to the TYPE1IMAGER User -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h3.Entry Points Provided to Other Modules -*/ - -/* -In addition, other modules call the SPACES module through function -vectors in the "XYspace" structure. The entry points accessed that -way are "FConvert()", "IConvert()", and "ForceFloat()". -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h3.Macros and Typedefs Provided to Other Modules - -:h4.Duplicating and Killing Spaces - -Destroying XYspaces is so simple we can do it with a -macro: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -On the other hand, duplicating XYspaces is slightly more difficult -because of the need to keep a unique ID in the space, see -:hdref refid=dupspace.. - -:h4.Fixed Point Pel Representation - -We represent pel positions with fixed point numbers. This does NOT -mean integer, but truly means fixed point, with a certain number -of binary digits (FRACTBITS) representing the fractional part of the -pel. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -/* -:h2.Data Structures for Coordinate Spaces and Points -*/ -/* -:h3 id=matrix.Matrices - -TYPE1IMAGER uses 2x2 transformation matrices. We'll use C notation for -such a matrix (M[2][2]), the first index being rows, the second columns. -*/ - -/* -:h3.The "doublematrix" Structure - -We frequently find it desirable to store both a matrix and its -inverse. We store these in a "doublematrix" structure. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h3.The "XYspace" Structure - -The XYspace structure represents the XYspace object. -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ -#define RESERVED 10 /* 'n' IDs are reserved for invalid & immortal spaces */ -/* -*/ -#define NEXTID ((SpaceID < RESERVED) ? (SpaceID = RESERVED) : ++SpaceID) - -static unsigned int SpaceID = 1; - -struct XYspace *CopySpace(S) - register struct XYspace *S; -{ - S = (struct XYspace *)Allocate(sizeof(struct XYspace), S, 0); - S->ID = NEXTID; - return(S); -} -/* -:h3.The "fractpoint" Structure - -A fractional point is just a "fractpel" x and y: -*/ - -/*SHARED LINE(S) ORIGINATED HERE*/ - -/* -:h3.Lazy Evaluation of Matrix Inverses - -Calculating the inverse of a matrix is somewhat involved, and we usually -do not need them. So, we flag whether or not the space has the inverse -already calculated: -*/ - -#define HASINVERSE(flag) ((flag)&0x80) - -/* -The following macro forces a space to have an inverse: -*/ - -#define CoerceInverse(S) if (!HASINVERSE((S)->flag)) { \ - MatrixInvert((S)->tofract.normal, (S)->tofract.inverse); (S)->flag |= HASINVERSE(ON); } -/* -:h3.IDENTITY Space - -IDENTITY space is (logically) the space corresponding to the identity -transformation matrix. However, since all our transformation matrices -have a common FRACTFLOAT scale factor to convert to 'fractpel's, that -is actually what we store in 'tofract' matrix of IDENTITY: -*/ - -static struct XYspace identity = { SPACETYPE, ISPERMANENT(ON) + ISIMMORTAL(ON) - + HASINVERSE(ON), 2, /* added 3-26-91 PNM */ - NULL, NULL, - NULL, NULL, NULL, NULL, - INVALIDID + 1, 0, - {{{FRACTFLOAT, 0.0}, {0.0, FRACTFLOAT}}, - {{1.0/FRACTFLOAT, 0.0}, {0.0, 1.0/FRACTFLOAT}}}, - {{0, 0}, {0, 0}} }; -struct XYspace *IDENTITY = &identity; - -/* -*/ -#define MAXCONTEXTS 16 - -static struct doublematrix contexts[MAXCONTEXTS]; - -#ifdef notdef - -static int nextcontext = 1; - -/*SHARED LINE(S) ORIGINATED HERE*/ - -#if __STDC__ -#define pointer void * -#else -#define pointer char * -#endif - -/* -:h3.FindDeviceContext() - Find the Context Given a Device - -This routine, given a device, returns the index of the device's -transformation matrix in the context array. If it cannot find it, -it will allocate a new array entry and fill it out. -*/ - -static int FindDeviceContext(device) - pointer device; /* device token */ -{ - DOUBLE M[2][2]; /* temporary matrix */ - float Xres,Yres; /* device resolution */ - int orient = -1; /* device orientation */ - int rc = -1; /* return code for QueryDeviceState */ - - if (rc != 0) /* we only bother with this check once */ - abort("Context: QueryDeviceState didn't work", 44); - - M[0][0] = M[1][0] = M[0][1] = M[1][1] = 0.0; - - switch (orient) { - case 0: - M[0][0] = Xres; M[1][1] = -Yres; - break; - case 1: - M[1][0] = Yres; M[0][1] = Xres; - break; - case 2: - M[0][0] = -Xres; M[1][1] = Yres; - break; - case 3: - M[1][0] = -Yres; M[0][1] = -Xres; - break; - default: - abort("QueryDeviceState returned invalid orientation", 45); - } - return(FindContext(M)); -} - -/* -:h3.FindContext() - Find the Context Given a Matrix - -This routine, given a matrix, returns the index of that matrix matrix in -the context array. If it cannot find it, it will allocate a new array -entry and fill it out. -*/ - -int FindContext(M) - DOUBLE M[2][2]; /* array to search for */ -{ - register int i; /* loop variable for search */ - for (i=0; i < nextcontext; i++) - if (M[0][0] == contexts[i].normal[0][0] && M[1][0] == contexts[i].normal[1][0] - && M[0][1] == contexts[i].normal[0][1] && M[1][1] == contexts[i].normal[1][1]) - break; - - if (i >= nextcontext) { - if (i >= MAXCONTEXTS) - abort("Context: out of them", 46); - LONGCOPY(contexts[i].normal, M, sizeof(contexts[i].normal)); - MatrixInvert(M, contexts[i].inverse); - nextcontext++; - } - - return(i); -} - -/* -:h3.Context() - Create a Coordinate Space for a Device - -This user operator is implemented by first finding the device context -array index, then transforming IDENTITY space to create an appropriate -cooridnate space. -*/ - -struct XYspace *Context(device, units) - pointer device; /* device token */ - DOUBLE units; /* multiples of one inch */ -{ - DOUBLE M[2][2]; /* device transformation matrix */ - register int n; /* will hold device context number */ - register struct XYspace *S; /* XYspace constructed */ - - IfTrace2((MustTraceCalls),"Context(%x, %f)\n", device, &units); - - ARGCHECK((device == NULL), "Context of NULLDEVICE not allowed", - NULL, IDENTITY, (0), struct XYspace *); - ARGCHECK((units == 0.0), "Context: bad units", NULL, IDENTITY, (0), struct XYspace *); - - n = FindDeviceContext(device); - - LONGCOPY(M, contexts[n].normal, sizeof(M)); - - M[0][0] *= units; - M[0][1] *= units; - M[1][0] *= units; - M[1][1] *= units; - - S = (struct XYspace *)Xform(IDENTITY, M); - - S->context = n; - return(S); -} -#endif - -/* -:h3.ConsiderContext() - Adjust a Matrix to Take Out Device Transform - -Remember, we have :f/x times U times D/ and :f/M/ and and we want :f/x -times U times M times D/. An easy way to do this is to calculate -:f/D sup <-1> times M times D/, because: -:formula. -x times U times D times D sup <-1> times M times D = x times U times M times D -:formula. -So this subroutine, given an :f/M/and an object, finds the :f/D/ for that -object and modifies :f/M/ so it is :f/D sup <-1> times M times D/. -*/ - -static void ConsiderContext(obj, M) - register struct xobject *obj; /* object to be transformed */ - register DOUBLE M[2][2]; /* matrix (may be changed) */ -{ - register int context=0; /* index in contexts array */ - - if (obj == NULL) return; - - if (ISPATHTYPE(obj->type)) { - struct segment *path = (struct segment *) obj; - - context = path->context; - } - else if (obj->type == SPACETYPE) { - struct XYspace *S = (struct XYspace *) obj; - - context = S->context; - } - else if (obj->type == PICTURETYPE) { - - } - else - context = NULLCONTEXT; - - if (context != NULLCONTEXT) { - MatrixMultiply(contexts[context].inverse, M, M); - MatrixMultiply(M, contexts[context].normal, M); - } -} - -/* -:h2.Conversion from User's X,Y to "fractpel" X,Y - -When the user is building paths (lines, moves, curves, etc.) he passes -the control points (x,y) for the paths together with an XYspace. We -must convert from the user's (x,y) to our internal representation -which is in pels (fractpels, actually). This involves transforming -the user's (x,y) under the coordinate space transformation. It is -important that we do this quickly. So, we store pointers to different -conversion functions right in the XYspace structure. This allows us -to have simpler special case functions for the more commonly -encountered types of transformations. - -:h3.Convert(), IConvert(), and ForceFloat() - Called Through "XYspace" Structure - -These are functions that fit in the "convert" and "iconvert" function -pointers in the XYspace structure. They call the "xconvert", "yconvert", -"ixconvert", and "iyconvert" as appropriate to actually do the work. -These secondary routines come in many flavors to handle different -special cases as quickly as possible. -*/ - -int FXYConvert(pt, S, x, y) - register struct fractpoint *pt; /* point to set */ - register struct XYspace *S; /* relevant coordinate space */ - register DOUBLE x,y; /* user's coordinates of point */ -{ - pt->x = (*S->xconvert)(S->tofract.normal[0][0], S->tofract.normal[1][0], x, y); - pt->y = (*S->yconvert)(S->tofract.normal[0][1], S->tofract.normal[1][1], x, y); - return(0); - -} - -int IXYConvert(pt, S, x, y) - register struct fractpoint *pt; /* point to set */ - register struct XYspace *S; /* relevant coordinate space */ - register LONG x,y; /* user's coordinates of point */ -{ - pt->x = (*S->ixconvert)(S->itofract[0][0], S->itofract[1][0], x, y); - pt->y = (*S->iyconvert)(S->itofract[0][1], S->itofract[1][1], x, y); - return(0); - -} - -/* -ForceFloat is a substitute for IConvert(), when we just do not have -enough significant digits in the coefficients to get high enough -precision in the answer with fixed point arithmetic. So, we force the -integers to floats, and do the arithmetic all with floats: -*/ - -int ForceFloat(pt, S, x, y) - register struct fractpoint *pt; /* point to set */ - register struct XYspace *S; /* relevant coordinate space */ - register LONG x,y; /* user's coordinates of point */ -{ - (*S->convert)(pt, S, (DOUBLE) x, (DOUBLE) y); - return(0); - -} - -/* -:h3.FXYboth(), FXonly(), FYonly() - Floating Point Conversion - -These are the routines we use when the user has given us floating -point numbers for x and y. FXYboth() is the general purpose routine; -FXonly() and FYonly() are special cases when one of the coefficients -is 0.0. -*/ - -fractpel FXYboth(cx, cy, x, y) - register DOUBLE cx,cy; /* x and y coefficients */ - register DOUBLE x,y; /* user x,y */ -{ - register DOUBLE r; /* temporary float */ - - r = x * cx + y * cy; - return((fractpel) r); -} - -/*ARGSUSED*/ -fractpel FXonly(cx, cy, x, y) - register DOUBLE cx,cy; /* x and y coefficients */ - register DOUBLE x,y; /* user x,y */ -{ - register DOUBLE r; /* temporary float */ - - r = x * cx; - return((fractpel) r); -} - -/*ARGSUSED*/ -fractpel FYonly(cx, cy, x, y) - register DOUBLE cx,cy; /* x and y coefficients */ - register DOUBLE x,y; /* user x,y */ -{ - register DOUBLE r; /* temporary float */ - - r = y * cy; - return((fractpel) r); -} - -/* -:h3.IXYboth(), IXonly(), IYonly() - Simple Integer Conversion - -These are the routines we use when the user has given us integers for -x and y, and the coefficients have enough significant digits to -provide precise answers with only "long" (32 bit?) multiplication. -IXYboth() is the general purpose routine; IXonly() and IYonly() are -special cases when one of the coefficients is 0. -*/ - -fractpel IXYboth(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ -{ - return(x * cx + y * cy); -} - -/*ARGSUSED*/ -fractpel IXonly(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ -{ - return(x * cx); -} - -/*ARGSUSED*/ -fractpel IYonly(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ -{ - return(y * cy); -} - - -/* -:h3.FPXYboth(), FPXonly(), FPYonly() - More Involved Integer Conversion - -These are the routines we use when the user has given us integers for -x and y, but the coefficients do not have enough significant digits to -provide precise answers with only "long" (32 bit?) multiplication. -We have increased the number of significant bits in the coefficients -by FRACTBITS; therefore we must use "double long" (64 bit?) -multiplication by calling FPmult(). FPXYboth() is the general purpose -routine; FPXonly() and FPYonly() are special cases when one of the -coefficients is 0. - -Note that it is perfectly possible for us to calculate X with the -"FP" method and Y with the "I" method, or vice versa. It all depends -on how the functions in the XYspace structure are filled out. -*/ - -fractpel FPXYboth(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ -{ - return( FPmult(x, cx) + FPmult(y, cy) ); -} - -/*ARGSUSED*/ -fractpel FPXonly(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ -{ - return( FPmult(x, cx) ); -} - -/*ARGSUSED*/ -fractpel FPYonly(cx, cy, x, y) - register fractpel cx,cy; /* x and y coefficients */ - register LONG x,y; /* user x,y */ -{ - return( FPmult(y, cy) ); -} - - - -/* -:h3.FillOutFcns() - Determine the Appropriate Functions to Use for Conversion - -This function fills out the "convert" and "iconvert" function pointers -in an XYspace structure, and also fills the "helper" -functions that actually do the work. -*/ - -static void FillOutFcns(S) - register struct XYspace *S; /* functions will be set in this structure */ -{ - S->convert = FXYConvert; - S->iconvert = IXYConvert; - - FindFfcn(S->tofract.normal[0][0], S->tofract.normal[1][0], &S->xconvert); - FindFfcn(S->tofract.normal[0][1], S->tofract.normal[1][1], &S->yconvert); - FindIfcn(S->tofract.normal[0][0], S->tofract.normal[1][0], - &S->itofract[0][0], &S->itofract[1][0], &S->ixconvert); - FindIfcn(S->tofract.normal[0][1], S->tofract.normal[1][1], - &S->itofract[0][1], &S->itofract[1][1], &S->iyconvert); - - if (S->ixconvert == NULL || S->iyconvert == NULL) - S->iconvert = ForceFloat; -} - -/* -:h4.FindFfcn() - Subroutine of FillOutFcns() to Fill Out Floating Functions - -This function tests for the special case of one of the coefficients -being zero: -*/ - -static int FindFfcn(cx, cy, fcnP) - register DOUBLE cx,cy; /* x and y coefficients */ - register fractpel (**fcnP)(); /* pointer to function to set */ -{ - if (cx == 0.0) - *fcnP = FYonly; - else if (cy == 0.0) - *fcnP = FXonly; - else - *fcnP = FXYboth; - return(0); - -} - -/* -:h4.FindIfcn() - Subroutine of FillOutFcns() to Fill Out Integer Functions - -There are two types of integer functions, the 'I' type and the 'FP' type. -We use the I type functions when we are satisfied with simple integer -arithmetic. We used the FP functions when we feel we need higher -precision (but still fixed point) arithmetic. If all else fails, -we store a NULL indicating that this we should do the conversion in -floating point. -*/ - -static int FindIfcn(cx, cy, icxP, icyP, fcnP) - register DOUBLE cx,cy; /* x and y coefficients */ - register fractpel *icxP,*icyP; /* fixed point coefficients to set */ - register fractpel (**fcnP)(); /* pointer to function to set */ -{ - register fractpel imax; /* maximum of cx and cy */ - - *icxP = cx; - *icyP = cy; - - if (cx != (float) (*icxP) || cy != (float) (*icyP)) { -/* -At this point we know our integer approximations of the coefficients -are not exact. However, we will still use them if the maximum -coefficient will not fit in a 'fractpel'. Of course, we have little -choice at that point, but we haven't lost that much precision by -staying with integer arithmetic. We have enough significant digits -so that -any error we introduce is less than one part in 2:sup/16/. -*/ - - imax = TYPE1_MAX(TYPE1_ABS(*icxP), TYPE1_ABS(*icyP)); - if (imax < (fractpel) (1<<(FRACTBITS-1)) ) { -/* -At this point we know our integer approximations just do not have -enough significant digits for accuracy. We will add FRACTBITS -significant digits to the coefficients (by multiplying them by -1<x; - y = pt->y; - *xp = S->tofract.inverse[0][0] * x + S->tofract.inverse[1][0] * y; - *yp = S->tofract.inverse[0][1] * x + S->tofract.inverse[1][1] * y; -} - -/* -:h2.Transformations -*/ -/* -:h3 id=xform.Xform() - Transform Object in X and Y - -TYPE1IMAGER wants transformations of objects like paths to be identical -to transformations of spaces. For example, if you scale a line(1,1) -by 10 it should yield the same result as generating the line(1,1) in -a coordinate space that has been scaled by 10. - -We handle fonts by storing the accumulated transform, for example, SR -(accumulating on the right). Then when we map the font through space TD, -for example, we multiply the accumulated font transform on the left by -the space transform on the right, yielding SRTD in this case. We will -get the same result if we did S, then R, then T on the space and mapping -an unmodified font through that space. -*/ - -struct xobject *t1_Xform(obj, M) - register struct xobject *obj; /* object to transform */ - register DOUBLE M[2][2]; /* transformation matrix */ -{ - if (obj == NULL) - return(NULL); - - if (obj->type == FONTTYPE) { - register struct font *F = (struct font *) obj; - - F = UniqueFont(F); - return((struct xobject*)F); - } - if (obj->type == PICTURETYPE) { -/* -In the case of a picture, we choose both to update the picture's -transformation matrix and keep the handles up to date. -*/ - register struct picture *P = (struct picture *) obj; - register struct segment *handles; /* temporary path to transform handles */ - - P = UniquePicture(P); - handles = PathSegment(LINETYPE, P->origin.x, P->origin.y); - handles = Join(handles, - PathSegment(LINETYPE, P->ending.x, P->ending.y) ); - handles = (struct segment *)Xform((struct xobject *) handles, M); - P->origin = handles->dest; - P->ending = handles->link->dest; - KillPath(handles); - return((struct xobject *)P); - } - - if (ISPATHTYPE(obj->type)) { - struct XYspace pseudo; /* local temporary space */ - PseudoSpace(&pseudo, M); - return((struct xobject *) PathTransform(obj, &pseudo)); - } - - - if (obj->type == SPACETYPE) { - register struct XYspace *S = (struct XYspace *) obj; - -/* replaced ISPERMANENT(S->flag) with S->references > 1 3-26-91 PNM */ - if (S->references > 1) - S = CopySpace(S); - else - S->ID = NEXTID; - - MatrixMultiply(S->tofract.normal, M, S->tofract.normal); - /* - * mark inverted matrix invalid: - */ - S->flag &= ~HASINVERSE(ON); - - FillOutFcns(S); - return((struct xobject *) S); - } - - return(ArgErr("Untransformable object", obj, obj)); -} - -/* -:h3.Transform() - Transform an Object - -This is the external user's entry point. -*/ -struct xobject *t1_Transform(obj, cxx, cyx, cxy, cyy) - struct xobject *obj; - DOUBLE cxx,cyx,cxy,cyy; /* 2x2 transform matrix elements in row order */ -{ - DOUBLE M[2][2]; - - IfTrace1((MustTraceCalls),"Transform(%p,", obj); - IfTrace4((MustTraceCalls)," %f %f %f %f)\n", cxx, cyx, cxy, cyy); - - M[0][0] = cxx; - M[0][1] = cyx; - M[1][0] = cxy; - M[1][1] = cyy; - ConsiderContext(obj, M); - return(Xform(obj, M)); -} -/* -:h3.Scale() - Special Case of Transform() - -This is a user operator. -*/ - -struct xobject *t1_Scale(obj, sx, sy) - struct xobject *obj; /* object to scale */ - DOUBLE sx,sy; /* scale factors in x and y */ -{ - DOUBLE M[2][2]; - IfTrace3((MustTraceCalls),"Scale(%p, %f, %f)\n", obj, sx, sy); - M[0][0] = sx; - M[1][1] = sy; - M[1][0] = M[0][1] = 0.0; - ConsiderContext(obj, M); - return(Xform(obj, M)); -} - -/* -:h3 id=rotate.Rotate() - Special Case of Transform() - -We special-case different settings of 'degrees' for performance -and accuracy within the DegreeSin() and DegreeCos() routines themselves. -*/ - -#ifdef notdef -struct xobject *xiRotate(obj, degrees) - struct xobject *obj; /* object to be transformed */ - DOUBLE degrees; /* degrees of COUNTER-clockwise rotation */ -{ - DOUBLE M[2][2]; - - - IfTrace2((MustTraceCalls),"Rotate(%z, %f)\n", obj, °rees); - - M[0][0] = M[1][1] = DegreeCos(degrees); - M[1][0] = - (M[0][1] = DegreeSin(degrees)); - ConsiderContext(obj, M); - return(Xform(obj, M)); -} -#endif - -/* -:h3.PseudoSpace() - Build a Coordinate Space from a Matrix - -Since we have built all this optimized code that, given an (x,y) and -a coordinate space, yield transformed (x,y), it seems a shame not to -use the same logic when we need to multiply an (x,y) by an arbitrary -matrix that is not (initially) part of a coordinate space. This -subroutine takes the arbitrary matrix and builds a coordinate -space, with all its nifty function pointers. -*/ - -void PseudoSpace(S, M) - struct XYspace *S; /* coordinate space structure to fill out */ - DOUBLE M[2][2]; /* matrix that will become 'tofract.normal' */ -{ - S->type = SPACETYPE; - S->flag = ISPERMANENT(ON) + ISIMMORTAL(ON); - S->references = 2; /* 3-26-91 added PNM */ - S->tofract.normal[0][0] = M[0][0]; - S->tofract.normal[1][0] = M[1][0]; - S->tofract.normal[0][1] = M[0][1]; - S->tofract.normal[1][1] = M[1][1]; - - FillOutFcns(S); -} - -/* -:h2 id=matrixa.Matrix Arithmetic - -Following the convention in Newman and Sproull, :hp1/Interactive -Computer Graphics/, -matrices are organized: -:xmp. - | cxx cyx | - | cxy cyy | -:exmp. -A point is horizontal, for example: -:xmp. - [ x y ] -:exmp. -This means that: -:formula/x prime = cxx times x + cxy times y/ -:formula/y prime = cyx times x + cyy times y/ -I've seen the other convention, where transform matrices are -transposed, equally often in the literature. -*/ - -/* -:h3.MatrixMultiply() - Implements Multiplication of Two Matrices - -Implements matrix multiplication, A * B = C. - -To remind myself, matrix multiplication goes rows of A times columns -of B. -The output matrix may be the same as one of the input matrices. -*/ -void MatrixMultiply(A, B, C) - register DOUBLE A[2][2],B[2][2]; /* input matrices */ - register DOUBLE C[2][2]; /* output matrix */ -{ - register DOUBLE txx,txy,tyx,tyy; - - txx = A[0][0] * B[0][0] + A[0][1] * B[1][0]; - txy = A[1][0] * B[0][0] + A[1][1] * B[1][0]; - tyx = A[0][0] * B[0][1] + A[0][1] * B[1][1]; - tyy = A[1][0] * B[0][1] + A[1][1] * B[1][1]; - - C[0][0] = txx; - C[1][0] = txy; - C[0][1] = tyx; - C[1][1] = tyy; -} -/* -:h3.MatrixInvert() - Invert a Matrix - -My reference for matrix inversion was :hp1/Elementary Linear Algebra/ -by Paul C. Shields, Worth Publishers, Inc., 1968. -*/ -void MatrixInvert(M, Mprime) - DOUBLE M[2][2]; /* input matrix */ - DOUBLE Mprime[2][2]; /* output inverted matrix */ -{ - register DOUBLE D; /* determinant of matrix M */ - register DOUBLE txx,txy,tyx,tyy; - - txx = M[0][0]; - txy = M[1][0]; - tyx = M[0][1]; - tyy = M[1][1]; - - D = M[1][1] * M[0][0] - M[1][0] * M[0][1]; - if (D == 0.0) - abort("MatrixInvert: can't", 47); - - Mprime[0][0] = tyy / D; - Mprime[1][0] = -txy / D; - Mprime[0][1] = -tyx / D; - Mprime[1][1] = txx / D; -} -/* -:h2.Initialization, Queries, and Debug -*/ -/* -:h3.InitSpaces() - Initialize Constant Spaces - -For compatibility, we initialize a coordinate space called USER which -maps 72nds of an inch to pels on the default device. -*/ - -struct XYspace *USER = &identity; - -void InitSpaces() -{ - /* extern char *DEFAULTDEVICE; */ - - IDENTITY->type = SPACETYPE; - FillOutFcns(IDENTITY); - - contexts[NULLCONTEXT].normal[1][0] - = contexts[NULLCONTEXT].normal[0][1] - = contexts[NULLCONTEXT].inverse[1][0] - = contexts[NULLCONTEXT].inverse[0][1] = 0.0; - contexts[NULLCONTEXT].normal[0][0] - = contexts[NULLCONTEXT].normal[1][1] - = contexts[NULLCONTEXT].inverse[0][0] - = contexts[NULLCONTEXT].inverse[1][1] = 1.0; - - USER->flag |= ISIMMORTAL(ON); - CoerceInverse(USER); -} -/* -:h3.QuerySpace() - Returns the Transformation Matrix of a Space - -Since the tofract matrix of an XYspace includes the scale factor -necessary to produce fractpel results (i.e., FRACTFLOAT), this -must be taken out before we return the matrix to the user. Fortunately, -this is simple: just multiply by the inverse of IDENTITY! -*/ - -void QuerySpace(S, cxxP, cyxP, cxyP, cyyP) - register struct XYspace *S; /* space asked about */ - register DOUBLE *cxxP,*cyxP,*cxyP,*cyyP; /* where to put answer */ -{ - DOUBLE M[2][2]; /* temp matrix to build user's answer */ - - if (S->type != SPACETYPE) { - ArgErr("QuerySpace: not a space", S, NULL); - return; - } - MatrixMultiply(S->tofract.normal, IDENTITY->tofract.inverse, M); - *cxxP = M[0][0]; - *cxyP = M[1][0]; - *cyxP = M[0][1]; - *cyyP = M[1][1]; -} - -/* -:h3.FormatFP() - Format a Fixed Point Pel - -We format the pel as "dddd.XXXX", where XX's are hexidecimal digits, -and the dd's are decimal digits. This might be a little confusing -mixing hexidecimal and decimal like that, but it is convenient -to use for debug. - -We make sure we have N (FRACTBITS/4) digits past the decimal point. -*/ -#define FRACTMASK ((1<> FRACTBITS, s); -} - -/* -:h3.DumpSpace() - Display a Coordinate Space -*/ -/*ARGSUSED*/ -void DumpSpace(S) - register struct XYspace *S; -{ - IfTrace4(TRUE,"--Coordinate space at %p,ID=%d,convert=%p,iconvert=%p\n", - S, S->ID, S->convert, S->iconvert); - IfTrace2(TRUE," | %12.3f %12.3f |", - S->tofract.normal[0][0], S->tofract.normal[0][1]); - IfTrace2(TRUE," [ %d %d ]\n", S->itofract[0][0], S->itofract[0][1]); - IfTrace2(TRUE," | %12.3f %12.3f |", - S->tofract.normal[1][0], S->tofract.normal[1][1]); - IfTrace2(TRUE," [ %d %d ]\n", S->itofract[1][0], S->itofract[1][1]); -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/spaces.h xdvik-22.40n/libs/t1lib/lib/type1/spaces.h --- xdvik-22.40l/libs/t1lib/lib/type1/spaces.h Wed Apr 18 14:24:13 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/spaces.h Thu Jan 1 00:00:00 1970 @@ -1,142 +0,0 @@ -/* $XConsortium: spaces.h,v 1.3 91/10/10 11:19:22 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF - * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, - * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE - * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE - * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE - * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL - * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -/*SHARED*/ - -#include "types.h" - -#define USER t1_User -#define IDENTITY t1_Identity - -#define Context(d,u) t1_Context(d,u) -#define Transform(o,f1,f2,f3,f4) t1_Transform(o,f1,f2,f3,f4) -#define Rotate(o,d) t1_Rotate(o,d) -#define Scale(o,sx,sy) t1_Scale(o,sx,sy) -#define QuerySpace(S,f1,f2,f3,f4) t1_QuerySpace(S,f1,f2,f3,f4) -#define Warp(s1,o,s2) t1_Warp(s1,o,s2) - -struct XYspace *t1_Context(); /* creates a coordinate space for a device */ -struct xobject *t1_Transform(); /* transform an object */ -struct xobject *t1_Rotate(); /* rotate an object */ -struct xobject *t1_Scale(); /* scale an object */ -struct xobject *t1_Warp(); /* transform like delta of two spaces */ -void t1_QuerySpace(); /* returns coordinate space matrix */ - -/*END SHARED*/ -/*SHARED*/ - -#define DeviceResolution t1_DeviceResolution -#define InitSpaces() t1_InitSpaces() -#define CopySpace(s) t1_CopySpace(s) -#define Xform(o,M) t1_Xform(o,M) -#define UnConvert(S,pt,xp,yp) t1_UnConvert(S,pt,xp,yp) -#define MatrixMultiply(A,B,C) t1_MMultiply(A,B,C) -#define MatrixInvert(A,B) t1_MInvert(A,B) -#define PseudoSpace(S,M) t1_PseudoSpace(S,M) -#define FindContext(M) t1_FindContext(M) - -void t1_InitSpaces(); /* initialize pre-defined coordinate spaces */ -struct XYspace *t1_CopySpace(); /* duplicate a coordinate space */ -struct xobject *t1_Xform(); /* transform object by matrix */ -void t1_UnConvert(); /* return user coordinates from device coordinates */ -void t1_MMultiply(); /* multiply two matrices */ -void t1_MInvert(); /* invert a matrix */ -void t1_PseudoSpace(); /* force a coordinate space from a matrix */ -int t1_FindContext(); /* return the "context" represented by a matrix */ - -/*END SHARED*/ -/*SHARED*/ - -/* #define KillSpace(s) Free(s) -Note - redefined KillSpace() to check references ! -3-26-91 PNM */ - -#define KillSpace(s) if ( (--(s->references) == 0) ||\ - ( (s->references == 1) && ISPERMANENT(s->flag) ) )\ - Free(s) - -#define ConsumeSpace(s) MAKECONSUME(s,KillSpace(s)) -#define UniqueSpace(s) MAKEUNIQUE(s,CopySpace(s)) - -/*END SHARED*/ -/*SHARED*/ - -typedef SHORT pel; /* integer pel locations */ -typedef LONG fractpel; /* fractional pel locations */ - -#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ -/* -We define the following macros to convert from 'fractpel' to 'pel' and -vice versa: -*/ -#define TOFRACTPEL(p) (((fractpel)p)<>FRACTBITS) -#define FRACTFLOAT (DOUBLE)(1L<references) == 0) ||\ - ( (s->references == 1) && ISPERMANENT(s->flag) ) )\ - Free(s) - -#define ConsumeSpace(s) MAKECONSUME(s,KillSpace(s)) -#define UniqueSpace(s) MAKEUNIQUE(s,CopySpace(s)) - -/*END SHARED*/ -/*SHARED*/ - -typedef SHORT pel; /* integer pel locations */ -typedef LONG fractpel; /* fractional pel locations */ - -#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ -/* -We define the following macros to convert from 'fractpel' to 'pel' and -vice versa: -*/ -#define TOFRACTPEL(p) (((fractpel)p)<>FRACTBITS) -#define FRACTFLOAT (DOUBLE)(1L< -# include -# include -#else -# include -#endif -#include -#include -#include -#include -#include - -#include "t1stdio.h" -#include "t1hdigit.h" - -/* we define this to switch to decrypt-debugging mode. The stream of - decrypted bytes will be written to stdout! This contains binary - charstring data */ -/* #define DEBUG_DECRYPTION */ -/* #define DEBUG_PFB_BLOCKS */ - -/* Constants and variables used in the decryption */ -#define c1 ((unsigned short)52845) -#define c2 ((unsigned short)22719) -static unsigned short r; -static int asc, Decrypt; -static int extrach; -static int haveextrach; - -static int starthex80=0; -static long pfbblocklen=0; -static long accu=0; -static unsigned long bytecnt=0; -static int eexec_startOK=0; -static int eexec_endOK=0; -static int in_eexec=0; - - -/* Our single FILE structure and buffer for this package */ -STATIC F_FILE TheFile; -STATIC unsigned char TheBuffer[F_BUFSIZ]; - -/* Our routines */ -F_FILE *T1Open(), *T1eexec(); -int T1Close(); -int T1Read(), T1Getc(), T1Ungetc(); -void T1io_reset(void); -STATIC int T1Decrypt(), T1Fill(); - -/* -------------------------------------------------------------- */ -/*ARGSUSED*/ -F_FILE *T1Open(fn, mode) - char *fn; /* Pointer to filename */ - char *mode; /* Pointer to open mode string */ -{ - F_FILE *of = &TheFile; - char c; - - - Decrypt = 0; - eexec_startOK=0; - eexec_endOK=0; - - /* We know we are only reading */ - /* cygwin32 also needs the binary flag to be set */ -#if defined(MSDOS) | defined(_WIN32) | defined (__EMX__) - if ((of->fd=open(fn, O_RDONLY | O_BINARY)) < 0) return NULL; -#else - if ((of->fd=open(fn, O_RDONLY)) < 0) return NULL; -#endif - - /* We check for pfa/pfb file */ - if (read( of->fd, &c, 1)!=1) { - close( of->fd); - return(NULL); - } - else - if (c==(char)0x80){ - starthex80=1; - } - lseek( of->fd, 0, SEEK_SET); - - /* Initialize the buffer information of our file descriptor */ - of->b_base = TheBuffer; - of->b_size = F_BUFSIZ; - of->b_ptr = NULL; - of->b_cnt = 0; - of->flags = 0; - of->error = 0; - haveextrach = 0; - return &TheFile; -} /* end Open */ - -/* -------------------------------------------------------------- */ -int T1Getc(f) /* Read one character */ - F_FILE *f; /* Stream descriptor */ -{ - if (f->b_base == NULL) return EOF; /* already closed */ - - if (f->flags & UNGOTTENC) { /* there is an ungotten c */ - f->flags &= ~UNGOTTENC; - return (int) f->ungotc; - } - - if (f->b_cnt == 0) /* Buffer needs to be (re)filled */ - f->b_cnt = T1Fill(f); - if (f->b_cnt > 0) return (f->b_cnt--, (int) *(f->b_ptr++)); - else { - f->flags |= FIOEOF; - return EOF; - } -} /* end Getc */ - -/* This function is added by RMz: - T1Gets(): Read a line of the file and save it to string. At most, - (size-1) bytes are read. The user *must* ensure (by making size large - enough) that "eexec" does not get split between two calls because - in this case, eexec-encryption does not set in. - ------------------------------------------------------------ */ -int T1Gets(char *string, - int size, - F_FILE *f) /* Read a line */ -{ - int i=0; - char *eexecP; - - if (string == NULL) { - return( i); - } - if (f->b_base == NULL) - return( i); /* already closed */ - if (size<2) /* no bytes to be read. For size = 1 we only had - room for the \0-character. */ - return( i); - - if (f->flags & UNGOTTENC) { /* there is an ungotten c */ - f->flags &= ~UNGOTTENC; - string[i++]=f->ungotc; - size--; - } - - size--; /* we have to leave room for one \0-character */ - - while ( size>0) { - if (f->b_cnt == 0) { /* Buffer needs to be (re)filled */ - f->b_cnt = T1Fill(f); - } - if (f->b_cnt == 0) { /* no more bytes available. Put \0-char - and return. */ - if ( i==0) { /* we did not already store one single char to string */ - f->flags |= FIOEOF; - return( i); - } - else { - f->flags |= FIOEOF; - string[i]='\0'; - return( i); - } - } - - /* do not skip white space as required by Adobe spec, because - if have found fonts where the first encrypted byte was of - white space type. */ - if ( (eexec_startOK==1) && (eexec_endOK==1)) { - T1eexec( f); - eexec_startOK=0; - eexec_endOK=0; - in_eexec=1; - /* we are now in the encrypted portion. */ - } - string[i]=*(f->b_ptr); - - /* Check whether eexec appears in the string just setup */ - if ( (Decrypt==0) && - ((eexecP=strstr( string, "eexec"))!=NULL) ) { - /* if eexec is an isolated token, start decryption */ - if ( (eexec_startOK==1) && - (isspace( (int)string[i])!=0) ) { - eexec_endOK=1; - } - if ( (eexec_startOK==0) && - (isspace( (int)string[i-5])!=0) ) { - eexec_startOK=1; - } - } - i++; - /* Under UNIX, '\n' is the accepted newline. For pfb-files it is also - common to use '\r' as the newline indicator. I have, however, never - seen a pfb-file which uses the sequence '\r''\n' as a newline - indicator, as known from DOS. So we don't take care for this case - and simply map both single characters \r and \n into \n. Of course, - this can only be done in the ASCII section of the font. */ - if ( *(f->b_ptr)=='\n' || *(f->b_ptr)=='\r') { - if (in_eexec==0) - string[i-1]='\n'; - string[i]='\0'; - f->b_cnt--; - f->b_ptr++; - return( i); - } - - f->b_cnt--; - f->b_ptr++; - size--; - } /* end of while (size>0) */ - - string[i]='\0'; /* finish string */ - return( i); - -} /* end of T1Gets() */ - - - -int T1GetDecrypt( void) -{ - return( in_eexec); -} - - -/* Return the optional contents after the final cleartomark token. - There might appear some PostScript code which is not important - for t1lib, but which becomes important if subsetted fonts are - embedded in PostScript files. */ -int T1GetTrailer(char *string, - int size, - F_FILE *f) -{ - unsigned long off_save; - char *buf; - char *ctmP; - int i=0, j; - int datasize; - - datasize=size; - - off_save=lseek( f->fd, 0, SEEK_CUR); - if ((buf=(char *)malloc( size+1))==NULL ) { - return( -1); - } - lseek( f->fd, -size, SEEK_END); - read(f->fd, buf, size); - buf[size]='\0'; /* to be ablo perform a strstr() on this memory */ - - i=datasize; - j=datasize-11; /* length of "cleartomark" plus terminating white - space or newline */ - - while ((j--)>-1) { - if ((unsigned char)buf[i]==0x80) { - datasize=i; /* we skip the segment marker of pfb-files */ - } - if ((ctmP=strstr( &(buf[j]), "cleartomark"))!=NULL) { - memcpy( string, &(buf[i]), datasize-i); - string[datasize-i]='\0'; - lseek( f->fd, off_save, SEEK_SET); - free( buf); - return( datasize-i); - } - i--; - } - lseek( f->fd, off_save, SEEK_SET); - free( buf); - return( -1); -} - - - -unsigned long T1GetFileSize( F_FILE *f) -{ - unsigned long off_save; - unsigned long filesize; - - off_save=lseek( f->fd, 0, SEEK_CUR); - filesize=lseek( f->fd, 0, SEEK_END); - lseek( f->fd, off_save, SEEK_SET); - return( filesize); -} - - - -/* -------------------------------------------------------------- */ -int T1Ungetc(c, f) /* Put back one character */ - int c; - F_FILE *f; /* Stream descriptor */ -{ - if (c != EOF) { - f->ungotc = c; - f->flags |= UNGOTTENC; /* set flag */ - f->flags &= ~FIOEOF; /* reset EOF */ - } - return c; -} /* end Ungetc */ - -/* -------------------------------------------------------------- */ -int T1Read(buffP, size, n, f) /* Read n items into caller's buffer */ - char *buffP; /* Buffer to be filled */ - int size; /* Size of each item */ - int n; /* Number of items to read */ - F_FILE *f; /* Stream descriptor */ -{ - int bytelen, cnt, i; - F_char *p = (F_char *)buffP; - int icnt; /* Number of characters to read */ - - if (f->b_base == NULL) return 0; /* closed */ - icnt = (size!=1)?n*size:n; /* Number of bytes we want */ - - if (f->flags & UNGOTTENC) { /* there is an ungotten c */ - f->flags &= ~UNGOTTENC; - *(p++) = f->ungotc; - icnt--; bytelen = 1; - } - else bytelen = 0; - - while (icnt > 0) { - /* First use any bytes we have buffered in the stream buffer */ - if ((cnt=f->b_cnt) > 0) { - if (cnt > icnt) cnt = icnt; - for (i=0; ib_ptr++); - f->b_cnt -= cnt; - icnt -= cnt; - bytelen += cnt; - } - - if ((icnt == 0) || (f->flags & FIOEOF)) break; - - f->b_cnt = T1Fill(f); - } - return ((size!=1)?bytelen/size:bytelen); -} /* end Read */ - -/* -------------------------------------------------------------- */ -int T1Close(f) /* Close the file */ - F_FILE *f; /* Stream descriptor */ -{ - if (f->b_base == NULL) return 0; /* already closed */ - f->b_base = NULL; /* no valid stream */ - return close(f->fd); -} /* end Close */ - - -/* -------------------------------------------------------------- */ -F_FILE *T1eexec(f) /* Initialization */ - F_FILE *f; /* Stream descriptor */ -{ - int i; - int H; - - unsigned char *p; - unsigned char randomP[8]; - - r = 55665; /* initial key */ - asc = 1; /* indicate ASCII form */ - -#ifdef DEBUG_DECRYPTION - printf("T1eexec(1): first 20 bytes=%.20s, b_cnt=%d\n", f->b_ptr, f->b_cnt); -#endif - - /* Consume the 4 random bytes, determining if we are also to - ASCIIDecodeHex as we process our input. (See pages 63-64 - of the Adobe Type 1 Font Format book.) */ - - /* Skipping over initial white space chars has been removed since - it could lead to unprocessable pfb-fonts if accindentally the - first cipher text byte was of the class HWHITE_SPACE. - Instead, we just read ahead, this should suffice for any - Type 1 font program. (RMz, 08/02/1998) */ - - /* If ASCII, the next 7 chars are guaranteed consecutive */ - randomP[0] = getc(f); /* store first non white space char */ - fread(randomP+1, 1, 3, f); /* read 3 more, for a total of 4 */ - /* store first four chars */ - for (i=0,p=randomP; i<4; i++) { /* Check 4 valid ASCIIEncode chars */ - if (HighHexP[*p++] > LAST_HDIGIT) { /* non-ASCII byte */ - asc = 0; - break; - } - } - if (asc) { /* ASCII form, convert first eight bytes to binary */ - fread(randomP+4, 1, 4, f); /* Need four more */ - for (i=0,p=randomP; i<4; i++) { /* Convert */ - H = HighHexP[*p++]; - randomP[i] = H | LowHexP[*p++]; - } - } - - /* Adjust our key */ - for (i=0,p=randomP; i<4; i++) { - r = (*p++ + r) * c1 + c2; - } - - /* Decrypt the remaining buffered bytes */ - f->b_cnt = T1Decrypt(f->b_ptr, f->b_cnt); - Decrypt = 1; - -#ifdef DEBUG_DECRYPTION - printf("T1eexec(2): first 120 bytes=%.120s, b_cnt=%d\n", f->b_ptr, f->b_cnt); -#endif - - return (feof(f))?NULL:f; -} /* end eexec */ - -/* -------------------------------------------------------------- */ -STATIC int T1Decrypt(p, len) - unsigned char *p; - int len; -{ - int n; - int H=0, L=0; - unsigned char *inp = p; - unsigned char *tblP; - -#ifdef DEBUG_DECRYPTION - printf("T1_Decrypt(): called with len=%d\n",len); -#endif - if (asc) { - if (haveextrach) { - H = extrach; - tblP = LowHexP; - } - else tblP = HighHexP; - for (n=0; len>0; len--) { - L = tblP[*inp++]; -#ifdef DEBUG_DECRYPTION - printf("L=0x%X, %d, inp=%c (%d)\n", L,L, *(inp-1), *(inp-1)); -#endif - if (L == HWHITE_SPACE) { -#ifdef DEBUG_DECRYPTION - printf("continue\n"); -#endif - continue; - } - if (L > LAST_HDIGIT) { -#ifdef DEBUG_DECRYPTION - printf("L=0x%X, --> break\n", L); -#endif - break; - } - - if (tblP == HighHexP) { /* Got first hexit value */ - H = L; - tblP = LowHexP; - } else { /* Got second hexit value; compute value and store it */ - n++; - tblP = HighHexP; - H |= L; - /* H is an int, 0 <= H <= 255, so all of this will work */ - *p++ = H ^ (r >> 8); - r = (H + r) * c1 + c2; - } - } - if (tblP != HighHexP) { /* We had an odd number of hexits */ - extrach = H; - haveextrach = 1; - } else haveextrach = 0; -#ifdef DEBUG_DECRYPTION - printf("T1_Decrypt(): Decrypted %d bytes\n",n); -#endif - return n; - } else { - for (n = len; n>0; n--) { - H = *inp++; - *p++ = H ^ (r >> 8); - r = (H + r) * c1 + c2; - } - return len; - } -} /* end Decrypt */ - -/* -------------------------------------------------------------- */ -/* This function has been adapted to support pfb-files with multiple - data segments */ -STATIC int T1Fill(f) /* Refill stream buffer */ - F_FILE *f; /* Stream descriptor */ -{ - int rc,i; - static unsigned char hdr_buf[6]; - - if (starthex80){ /* we have a pfb-file -> be aware of pfb-blocks */ - if ( pfbblocklen-accu >= F_BUFSIZ){ - /* fill the buffer */ - rc = read(f->fd, f->b_base, F_BUFSIZ); - bytecnt+=rc; - accu +=rc; - } - else{ - if (pfbblocklen-accu>0){ - /* read the remaining of the pfb-block ... */ - rc = read(f->fd, f->b_base, pfbblocklen-accu); - bytecnt +=rc; - accu +=rc; - /* ... and examine the next header */ - i=read(f->fd, hdr_buf, 6); - bytecnt +=i; - pfbblocklen=0; - pfbblocklen += hdr_buf[2]&0xFF ; - pfbblocklen += (hdr_buf[3] & 0xFF) <<8; - pfbblocklen += (hdr_buf[4] & 0xFF) <<16; - pfbblocklen += (hdr_buf[5] & 0xFF) <<24; -#ifdef DEBUG_PFB_BLOCKS - printf("t1io: New segment, length=%d, type=%d\n", - pfbblocklen, hdr_buf[1]); -#endif - accu=0; - } - else{ - /* We are at the beginning of a new block -> - examine header */ - i=read(f->fd, hdr_buf, 6); - pfbblocklen=0; - pfbblocklen += hdr_buf[2]&0xFF ; - pfbblocklen += (hdr_buf[3] & 0xFF) <<8; - pfbblocklen += (hdr_buf[4] & 0xFF) <<16; - pfbblocklen += (hdr_buf[5] & 0xFF) <<24; -#ifdef DEBUG_PFB_BLOCKS - printf("t1io: New segment, length=%d, type=%d\n", - pfbblocklen, hdr_buf[1]); -#endif - accu=0; - /* header read, now fill the buffer */ - if (pfbblocklen-accu >= F_BUFSIZ){ - rc = read(f->fd, f->b_base, F_BUFSIZ); - accu +=rc; - } - else{ - /* we have the unusual case that the pfb-block size is - shorter than F_BUFSIZ -> Read this block only */ - rc = read(f->fd, f->b_base, pfbblocklen); - accu +=rc; - } - } - } - } - else{ - /* We have a pfa-file -> read straight ahead and fill buffer */ - rc = read(f->fd, f->b_base, F_BUFSIZ); - } - - /* propagate any error or eof to current file */ - if (rc <= 0) { - if (rc == 0) /* means EOF */ - f->flags |= FIOEOF; - else { - f->error = (short)-rc; - f->flags |= FIOERROR; - rc = 0; - } - } - - f->b_ptr = f->b_base; -#ifdef DEBUG_DECRYPTION - printf("T1_Fill(): read %d bytes\n", rc); -#endif - - if (Decrypt){ - rc = T1Decrypt(f->b_base, rc); -#ifdef DEBUG_DECRYPTION - printf("T1_Fill(): decrypted %d bytes\n", rc); -#endif - } - - return rc; -} /* end Fill */ - - -void T1io_reset(void) -{ - pfbblocklen=0; - accu=0; - starthex80=0; - eexec_startOK=0; - eexec_endOK=0; - in_eexec=0; -} - - - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/t1snap.c xdvik-22.40n/libs/t1lib/lib/type1/t1snap.c --- xdvik-22.40l/libs/t1lib/lib/type1/t1snap.c Wed Apr 18 14:24:13 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/t1snap.c Thu Jan 1 00:00:00 1970 @@ -1,79 +0,0 @@ -/* $XConsortium: t1snap.c,v 1.3 91/10/10 11:19:47 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#include "objects.h" -#include "spaces.h" -#include "paths.h" - -/* -:h2.Handle Functions - -:h3.Phantom() - Returns a Move Segment Equivalent to Handles - -This is a user operator. Its new name is QueryHandle. -*/ - -struct segment *t1_Phantom(obj) - register struct xobject *obj; /* object to take the Phantom of */ -{ - struct fractpoint pt; /* handle size will built here */ - - if (obj == NULL) - pt.x = pt.y = 0; - else - PathDelta(obj, &pt); - - return(PathSegment(MOVETYPE, pt.x, pt.y)); -} - -/* -:h3.Snap() - Force Ending Handle of Object to Origin - -This is a user operator. -*/ - -struct xobject *t1_Snap(p) - register struct segment *p; /* path to snap */ -{ - struct fractpoint pt; /* for finding length of path */ - - if (p == NULL) - return(NULL); - p = UniquePath(p); - - PathDelta(p, &pt); - if (p->last->type == MOVETYPE) { - p->last->dest.x -= pt.x; - p->last->dest.y -= pt.y; - } - else - p = JoinSegment(p, MOVETYPE, -pt.x, -pt.y, NULL); - return((struct xobject *)p); -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/t1stdio.h xdvik-22.40n/libs/t1lib/lib/type1/t1stdio.h --- xdvik-22.40l/libs/t1lib/lib/type1/t1stdio.h Wed Apr 18 14:24:13 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/t1stdio.h Thu Jan 1 00:00:00 1970 @@ -1,85 +0,0 @@ -/* $XConsortium: t1stdio.h,v 1.4 91/10/10 11:19:49 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* T1IO FILE structure and related stuff */ - -#include "types.h" - -#undef getc -#undef fclose -#undef ungetc -#undef fgetc -#undef fread -#undef feof -#undef ferror -#undef FILE - -#define FILE F_FILE -typedef unsigned char F_char; - -typedef struct F_FILE { - F_char *b_base; /* Pointer to beginning of buffer */ - LONG b_size; /* Size of the buffer */ - F_char *b_ptr; /* Pointer to next char in buffer */ - LONG b_cnt; /* Number of chars remaining in buffer */ - F_char flags; /* other flags; != 0 means getc must call fgetc */ - F_char ungotc; /* Place for ungotten char; flag set if present */ - short error; /* error status */ - int fd; /* underlying file descriptor */ -} F_FILE; - - -/* defines for flags */ -#define UNGOTTENC (0x01) -#define FIOEOF (0x80) -#define FIOERROR (0x40) - -#ifndef NULL -#define NULL 0 /* null pointer */ -#endif -#define EOF (-1) /* end of file */ -#define F_BUFSIZ (512) - -#define getc(f) \ - ( \ - ( ((f)->b_cnt > 0) && ((f)->flags == 0) ) ? \ - ( (f)->b_cnt--, (unsigned int)*( (f)->b_ptr++ ) ) : \ - T1Getc(f) \ - ) - -extern FILE *T1Open(), *T1eexec(); -extern int T1Close(), T1Ungetc(), T1Read(); - -#define fclose(f) T1Close(f) -#define fopen(name,mode) T1Open(name,mode) -#define ungetc(c,f) T1Ungetc(c,f) -#define fgetc(f) T1Getc(f) -#define fread(bufP,size,n,f) T1Read(bufP,size,n,f) -#define feof(f) (((f)->flags & FIOEOF) && ((f)->b_cnt==0)) -#define ferror(f) (((f)->flags & FIOERROR)?(f)->error:0) diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/t1stub.c xdvik-22.40n/libs/t1lib/lib/type1/t1stub.c --- xdvik-22.40l/libs/t1lib/lib/type1/t1stub.c Wed Apr 18 14:24:13 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/t1stub.c Thu Jan 1 00:00:00 1970 @@ -1,47 +0,0 @@ -/* $XConsortium: t1stub.c,v 1.3 92/03/20 15:58:40 eswu Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#include - -#include "objects.h" /* get #define for abort() */ - -int xiStub( void) -{ - printf("xiStub called\n"); - abort("xiStub called", 48); - return(0); - -} - -void t1_DumpText( void) -{ - xiStub(); - -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/token.c xdvik-22.40n/libs/t1lib/lib/type1/token.c --- xdvik-22.40l/libs/t1lib/lib/type1/token.c Wed Apr 18 14:24:13 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/token.c Thu Jan 1 00:00:00 1970 @@ -1,1208 +0,0 @@ -/* $XConsortium: token.c,v 1.2 91/10/10 11:19:55 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* Authors: Sig Nin & Carol Thompson IBM Almaden Research Laboratory */ -#include "types.h" -#include "t1stdio.h" -#include "util.h" -#include "digit.h" -#include "token.h" -#include "tokst.h" -#include "hdigit.h" - -/* - * ------------------------------------------------------------------- - * Globals - * ------------------------------------------------------------------- - */ - -extern int T1Getc(F_FILE * ), T1Ungetc( int,F_FILE *); - -/* These variables are set by the caller */ -char *tokenStartP; /* Pointer to token buffer in VM */ -char *tokenMaxP; /* Pointer to last byte in buffer + 1 */ - -/* These variables are set by TOKEN */ -int tokenLength; /* Characters in token */ -boolean tokenTooLong; /* Token too long for buffer */ -int tokenType; /* Type of token identified */ -psvalue tokenValue; /* Token value */ - -/* - * ------------------------------------------------------------------- - * Private variables - * ------------------------------------------------------------------- - */ - -static FILE *inputFileP; /* Current input file */ - - -/* Token */ -static char *tokenCharP; /* Pointer to next character in token */ - -/* - * ------------------------------------------------------------------- - * Private routines for manipulating numbers - * ------------------------------------------------------------------- - */ - -#define Exp10(e) \ -((e) == 0\ - ? (DOUBLE)(1.0)\ - : (-64 <= (e) && (e) <= 63\ - ? Exp10T[(e)+64]\ - : P10(e)\ - )\ -) - -static DOUBLE Exp10T[128] = { - 1e-64, 1e-63, 1e-62, 1e-61, 1e-60, 1e-59, 1e-58, 1e-57, - 1e-56, 1e-55, 1e-54, 1e-53, 1e-52, 1e-51, 1e-50, 1e-49, - 1e-48, 1e-47, 1e-46, 1e-45, 1e-44, 1e-43, 1e-42, 1e-41, - 1e-40, 1e-39, 1e-38, 1e-37, 1e-36, 1e-35, 1e-34, 1e-33, - 1e-32, 1e-31, 1e-30, 1e-29, 1e-28, 1e-27, 1e-26, 1e-25, - 1e-24, 1e-23, 1e-22, 1e-21, 1e-20, 1e-19, 1e-18, 1e-17, - 1e-16, 1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9, - 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, - 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, - 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22, 1e23, - 1e24, 1e25, 1e26, 1e27, 1e28, 1e29, 1e30, 1e31, - 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39, - 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, - 1e48, 1e49, 1e50, 1e51, 1e52, 1e53, 1e54, 1e55, - 1e56, 1e57, 1e58, 1e59, 1e60, 1e61, 1e62, 1e63 -}; - -static DOUBLE P10(exponent) - LONG exponent; -{ - DOUBLE value, power; - - if (exponent < 0) { - power = 0.1; - value = (exponent & 1 ? power : 1.0); - exponent = -((exponent+1) >> 1); /* portable C for -(exponent/2) */ - } - else { - power = 10.0; - value = (exponent & 1 ? power : 1.0); - exponent = exponent >> 1; - } - - while(exponent > 0) { - power *= power; - if (exponent & 1) - value *= power; - exponent >>= 1; - } - - return(value); -} - -/* - * ------------------------------------------------------------------- - * Private routines and macros for manipulating the input - * ------------------------------------------------------------------- - */ - -/* Get next character from the input -- - * - */ -#define next_ch() (getc(inputFileP)) - -/* Push a character back into the input -- - * - * Ungetc of EOF will fail, but that's ok: the next getc will - * return EOF. - * - * NOTE: These macros are presently written to return the character - * pushed, or EOF if none was pushed. However, they are not - * required to return anything in particular, and callers should - * not rely on the returned value. - */ -#define back_ch(ch) (ungetc(ch, inputFileP)) - -/* Push a character back into the input if it was not white space. - * If it is a carriage return (\r) then check next char for - * linefeed and consume them both, otherwise put next char back. - * - */ -#define back_ch_not_white(ch) \ -(\ -isWHITE_SPACE(ch)\ - ? ((ch == '\r')\ - ? (((ch = next_ch()) == '\n')\ - ? EOF\ - : back_ch(ch)\ - )\ - : EOF\ - )\ - : back_ch(ch)\ -) - -/* - * ------------------------------------------------------------------- - * Private routines and macros for manipulating the token buffer - * ------------------------------------------------------------------- - */ - -/* Add a character to the token - * ---- use ONLY when you KNOW that this character will - * be stored within the token buffer. - */ -#define save_unsafe_ch(ch) (*tokenCharP++ = ch) - -/* Add a character to the token, if not too long to fit */ -#define save_ch(ch) \ -((tokenCharP < tokenMaxP)\ - ? save_unsafe_ch(ch)\ - : (tokenTooLong = TRUE)\ -) - -/* - * ------------------------------------------------------------------- - * Action Routines - * - * These routines all - * -- take int ch as a parameter - * -- return int ch if no token was recognized, DONE otherwise - * -- leave the next character in the input, if returning DONE - * ------------------------------------------------------------------- - */ - -#define DONE (256) - -/* Get the next input character */ -static int next_char(ch) - int ch; -{ - return(next_ch()); -} - -/* Add character to token */ -static int add_char(ch) - int ch; -{ - save_ch(ch); - return(next_ch()); -} - - -/* ------------------------------------------------------------------- - * Skip white space and comments - */ - -/* Skip white space */ -static int skip_space(ch) - int ch; -{ - do { - ch = next_ch(); - } while(isWHITE_SPACE(ch)); - return(ch); -} - -/* Skip comments */ -static int skip_comment(ch) - int ch; -{ - do { - ch = next_ch(); - } while(isCOMMENT(ch)); - return(ch); -} - -/* ------------------------------------------------------------------- - * Collect value elements for a number - */ - -/* decimal integer or real number mantissa */ -static int m_sign; -static LONG m_value; -static LONG m_scale; - -/* real number exponent */ -static int e_sign; -static LONG e_value; -static LONG e_scale; - -/* radix number */ -static LONG r_base; -static LONG r_value; -static LONG r_scale; - -static int add_sign(ch) - int ch; -{ - m_sign = ch; - save_unsafe_ch(ch); - return(next_ch()); -} - -static int add_1st_digits(ch) - int ch; -{ - m_sign = '+'; - return(add_digits(ch)); -} - -static int add_digits(ch) - int ch; -{ - LONG value, p_value, scale; - int digit; - - /* On entry, expect m_sign to be set to '+' or '-'; - * ch is a decimal digit. - * Expect at most one character saved at this point, - * a sign. This routine will save up to 10 more - * characters without checking the buffer boundary. - */ - - value = ch - '0'; - save_unsafe_ch(ch); - ch = next_ch(); - - while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) { - value = (value << 3) + (value << 1) + (ch - '0'); - save_unsafe_ch(ch); - ch = next_ch(); - } - - /* Quick exit for small integers -- - * |x| <= 10*((MAX_INTEGER/10)-1)+9 - * |x| <= 2,147,483,639 for 32 bit integers - */ - if (isNUMBER_ENDER(ch)) { - back_ch_not_white(ch); - tokenValue.integer = (m_sign == '-' ? -value : value); - tokenType = TOKEN_INTEGER; - return(DONE); - } - - /* Handle additional digits. Beyond the boundary case, - * 10*(MAX_INTEGER/10) <= |number| <= MAX_INTEGER - * just count the digits: the number is too large to - * represent as an integer and will be returned as a real. - * The mantissa of a real holds fewer bits than an integer. - */ - p_value = value; - value = (m_sign == '-' ? -value : value); - scale = 0; - - if (isDECIMAL_DIGIT(ch)) { - - /* Handle the boundary case */ - if (p_value == (MAX_INTEGER/10)) { - digit = ch - '0'; - - /* Must handle positive and negative values separately */ - /* for 2's complement arithmetic */ - if (value > 0) { - if (digit <= MAX_INTEGER%10) - value = (value << 3) + (value << 1) + digit; - else - ++scale; /* Too big, just count it */ - } - else { - /* Use positive % operands for portability */ - if (digit <= -(MIN_INTEGER+10)%10) - value = (value << 3) + (value << 1) - digit; - else - ++scale; /* Too big, just count it */ - } - } - else - ++scale; /* Not boundary case, just count digit */ - - save_unsafe_ch(ch); - ch = next_ch(); - - /* Continue scanning digits, but can't store them */ - while(isDECIMAL_DIGIT(ch)) { - ++scale; - save_ch(ch); - ch = next_ch(); - } - } - - /* Continue from here scanning radix integer or real */ - m_value = value; - m_scale = scale; - - /* Initialize for possible real */ - e_sign = '+'; - e_value = 0; - e_scale = 0; - - return(ch); -} - -static int add_1st_decpt(ch) - int ch; -{ - m_sign = '+'; - return(add_decpt(ch)); -} - -static int add_decpt(ch) - int ch; -{ - /* On entry, expect m_sign to be set to '+' or '-' */ - m_value = 0; - m_scale = 0; - save_unsafe_ch(ch); - return(next_ch()); -} - -static int add_fraction(ch) - int ch; -{ - LONG value, scale; - int digit; - - /* On entry, expect m_value and m_scale to be initialized, - * and m_sign to be set to '+' or '-'. Expect m_value and m_sign - * to be consistent (this is not checked). - */ - value = m_value; - scale = m_scale; - - /* Scan leading zeroes */ - if (value == 0) { - while(ch == '0') { - --scale; - save_ch(ch); - ch = next_ch(); - } - - /* Scan first significant digit */ - if (isDECIMAL_DIGIT(ch)) { - --scale; - value = ch - '0'; - value = (m_sign == '-' ? -value : value); - save_ch(ch); - ch = next_ch(); - } - else - /* no significant digits -- number is zero */ - scale = 0; - } - /* value != 0 || value == 0 && !isDECIMAL_DIGIT(ch) */ - - /* Scan additional significant digits */ - if (isDECIMAL_DIGIT(ch)) { - if (value > 0) { - while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) { - --scale; - value = (value << 3) + (value << 1) + (ch - '0'); - save_ch(ch); - ch = next_ch(); - } - /* Check boundary case */ - if (isDECIMAL_DIGIT(ch) && value == (MAX_INTEGER/10)) { - digit = ch - '0'; - if (digit <= MAX_INTEGER%10) { - --scale; - value = (value << 3) + (value << 1) + digit; - save_ch(ch); - ch = next_ch(); - } - } - } - else { - /* value < 0 */ - while(isDECIMAL_DIGIT(ch) && value > -(-(MIN_INTEGER+10)/10+1)) { - /* Use positive / operands for portability */ - --scale; - value = (value << 3) + (value << 1) - (ch - '0'); - save_ch(ch); - ch = next_ch(); - } - /* Check boundary case */ - if (isDECIMAL_DIGIT(ch) - && value == -(-(MIN_INTEGER+10)/10+1)) { - digit = ch - '0'; - if (digit <= -(MIN_INTEGER+10)%10) { - /* Use positive % operands for portability */ - --scale; - value = (value << 3) + (value << 1) - digit; - save_ch(ch); - ch = next_ch(); - } - } - } - - /* Additional digits can be discarded */ - while(isDECIMAL_DIGIT(ch)) { - save_ch(ch); - ch = next_ch(); - } - } - - /* Store results */ - m_value = value; - m_scale = scale; - - /* Initialize for possible real */ - e_sign = '+'; - e_value = 0; - e_scale = 0; - - return(ch); -} - -static int add_e_sign(ch) - int ch; -{ - e_sign = ch; - save_ch(ch); - return(next_ch()); -} - -static int add_exponent(ch) - int ch; -{ - LONG value, p_value; - LONG scale = 0; - int digit; - - /* On entry, expect e_sign to be set to '+' or '-' */ - - value = ch - '0'; - save_ch(ch); - ch = next_ch(); - - while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) { - value = (value << 3) + (value << 1) + (ch - '0'); - save_ch(ch); - ch = next_ch(); - } - - p_value = value; - value = (e_sign == '-' ? -value : value); - - /* Handle additional digits. Beyond the boundary case, - * 10*(MAX_INTEGER/10) <= |number| <= MAX_INTEGER - * just count the digits: the number is too large to - * represent as an integer. - */ - if (isDECIMAL_DIGIT(ch)) { - - /* Examine boundary case */ - if (p_value == (MAX_INTEGER/10)) { - digit = ch - '0'; - - /* Must handle positive and negative values separately */ - /* for 2's complement arithmetic */ - if (value > 0) { - if (digit <= MAX_INTEGER%10) - value = (value << 3) + (value << 1) + digit; - else - ++scale; /* Too big, just count it */ - } - else { - /* Use positive % operands for portability */ - if (digit <= -(MIN_INTEGER+10)%10) - value = (value << 3) + (value << 1) - digit; - else - ++scale; /* Too big, just count it */ - } - } - else - ++scale; /* Not boundary case, just count digit */ - - save_ch(ch); - ch = next_ch(); - - /* Continue scanning digits, but can't store any more */ - while(isDECIMAL_DIGIT(ch)) { - ++scale; - save_ch(ch); - ch = next_ch(); - } - } - - /* Store results */ - e_value = value; - e_scale = scale; - - return(ch); -} - -static int add_radix(ch) - int ch; -{ - if (2 <= m_value && m_value <= 36 && m_scale == 0) { - r_base = m_value; - save_ch(ch); - return(next_ch()); - } - else { - /* Radix invalid, complete a name token */ - return(AAH_NAME(ch)); - } -} - -static int add_r_digits(ch) - int ch; -{ - ULONG value; - LONG radix, scale; - int digit; - - /* NOTE: The syntax of a radix number allows only for - * values of zero or more. The value will be stored as - * a 32 bit integer, which PostScript then interprets - * as signed. This means, for example, that the numbers: - * - * 8#37777777777 - * 10#4294967295 - * 16#FFFFFFFF - * 36#1Z141Z3 - * - * are all interpreted as -1. This routine implements this - * idea explicitly: it accumulates the number's value - * as unsigned, then casts it to signed when done. - */ - - /* Expect r_base to be initialized */ - radix = r_base; - value = 0; - scale = 0; - - /* Scan leading zeroes */ - while(ch == '0') { - save_ch(ch); - ch = next_ch(); - } - - /* Handle first non-zero digit */ - if ((digit=digit_value[ch]) < radix) { - value = digit; - save_ch(ch); - ch = next_ch(); - - /* Add digits until boundary case reached */ - while((digit=digit_value[ch]) < radix - && value < (MAX_ULONG / radix)) { - value = value * radix + digit; - save_ch(ch); - ch = next_ch(); - }; - - /* Scan remaining digits */ - if ((digit=digit_value[ch]) < radix) { - - /* Examine boundary case --- - * radix*(MAX_ULONG/radix) <= number <= MAX_ULONG - */ - if (value == (MAX_ULONG/radix) && digit <= MAX_ULONG%radix) - value = value * radix + digit; - else - ++scale; - - /* Continue scanning digits, but can't store them */ - save_ch(ch); - ch = next_ch(); - while(digit_value[ch] < radix) { - ++scale; - save_ch(ch); - ch = next_ch(); - } - } - } - - /* Store result */ - r_value = (LONG) value; /* result is signed */ - r_scale = scale; - - return(ch); -} - -/* ------------------------------------------------------------------- - * Complete a number; set token type and done flag. - * Put current input character back, if it is not white space. - */ - -/* Done: Radix Number */ -static int RADIX_NUMBER(ch) - int ch; -{ - back_ch_not_white(ch); - if (r_scale == 0) { - tokenValue.integer = r_value; - tokenType = TOKEN_INTEGER; - } - else { - tokenType = TOKEN_NAME; - } - return(DONE); -} - -/* Done: Integer */ -static int INTEGER(ch) - int ch; -{ - back_ch_not_white(ch); - if (m_scale == 0) { - tokenValue.integer = m_value; - tokenType = TOKEN_INTEGER; - } - else { - tokenValue.real = (DOUBLE)(m_value) * Exp10(m_scale); - tokenType = TOKEN_REAL; - } - return(DONE); -} - -/* Done: Real */ -static int REAL(ch) - int ch; -{ - DOUBLE temp; - - back_ch_not_white(ch); - - /* NOTE: ignore e_scale, since e_value alone will cause - * exponent overflow if e_scale > 0. - */ - - /* HAZARD: exponent overflow of intermediate result - * (e.g., in 370 floating point); this should not be a problem - * with IEEE floating point. Reduce exponent overflow hazard by - * combining m_scale and e_value first, if they have different signs, - * or multiplying m_value and one of the other factors, if both - * m_scale and e_value are negative. - */ - if ((m_scale >= 0 && e_value <= 0) - || (m_scale <= 0 && e_value >= 0)) { - tokenValue.real = (DOUBLE)(m_value) * Exp10(m_scale + e_value); - } - else { - temp = (DOUBLE)(m_value) * Exp10(m_scale); - tokenValue.real = temp * Exp10(e_value); - } - - tokenType = TOKEN_REAL; - return(DONE); -} - - -/* ------------------------------------------------------------------- - * Assemble a hex string; set token type and done flag. - */ - -/* Done: Hex String */ -static int HEX_STRING(ch) - int ch; -{ - int value; - - while(TRUE) { - - /* Process odd digit */ - ch = next_ch(); - if (!isHEX_DIGIT(ch)) { - - /* Skip white space */ - while(isWHITE_SPACE(ch)) - ch = next_ch(); - - /* Check for terminator */ - if (!isHEX_DIGIT(ch)) { - break; - } - } - value = digit_value[ch] << 4; - - /* Process even digit */ - ch = next_ch(); - if (!isHEX_DIGIT(ch)) { - - /* Skip white space */ - while(isWHITE_SPACE(ch)) - ch = next_ch(); - - /* Check for terminator */ - if (!isHEX_DIGIT(ch)) { - save_ch(value); - break; - } - } - save_ch(value + digit_value[ch]); - } - - /* Classify result, based on why loop ended */ - if (ch == '>') - tokenType = TOKEN_HEX_STRING; - else { - /* save the invalid character for error reporting */ - save_ch(ch); - tokenType = TOKEN_INVALID; - } - - return(DONE); -} - -/* ------------------------------------------------------------------- - * Assemble a string; set token type and done flag - */ - -/* Save a backslash-coded character in a string -- - * - * Store the proper character for special cases - * "\b", "\f", "\n", "\r", and "\t". - * - * Decode and store octal-coded character, up to - * three octal digits, "\o", "\oo", and "\ooo". - * - * The sequence "\" is a line continuation, - * so consume both without storing anything. - * - * The sequence "\" is an error; exit without - * storing anything and let the caller handle it. - * - * For other characters, including the sequences - * "\\", "\(", and "\)", simply store the second - * character. - */ -static void save_digraph(ch) - int ch; -{ - int value; - - switch (ch) { - - case 'b': /* backspace */ - ch = '\b'; - break; - - case 'f': /* formfeed */ - ch = '\f'; - break; - - case 'n': /* newline */ - ch = '\n'; - break; - - case 'r': /* carriage return */ - ch = '\r'; - break; - - case 't': /* horizontal tab */ - ch = '\t'; - break; - - case '\n': /* line continuation -- consume it */ - return; - - case '\r': /* carriage return -- consume it */ - ch = next_ch(); /* look at next character, is it \n? */ - if (ch == '\n') return; - back_ch(ch); /* if not a line feed, then return it */ - return; - - case EOF: /* end of file -- forget it */ - return; - - default: - /* scan up to three octal digits to get value */ - if (isOCTAL_DIGIT(ch)) { - value = digit_value[ch]; - ch = next_ch(); - if (isOCTAL_DIGIT(ch)) { - value = (value << 3) + digit_value[ch]; - ch = next_ch(); - if (isOCTAL_DIGIT(ch)) - value = (value << 3) + digit_value[ch]; - else - back_ch(ch); - } - else - back_ch(ch); - ch = value; - } - } - - /* Found a character to save */ - save_ch(ch); -} - -/* Done: String */ -static int STRING(ch) - int ch; -{ - int nest_level = 1; - - tokenType = TOKEN_STRING; - - do { - - ch = next_ch(); - while(!isSTRING_SPECIAL(ch)) { - save_ch(ch); - ch = next_ch(); - }; - - switch (ch) { - - case '(': - ++nest_level; - save_ch(ch); - break; - - case ')': - if (--nest_level > 0) - save_ch(ch); - break; - - case '\\': - save_digraph(next_ch()); - break; - - case '\r': - /* All carriage returns (\r) are turned into linefeeds (\n)*/ - ch = next_ch(); /* get the next one, is it \n? */ - if (ch != '\n') { /* if not, then put it back. */ - back_ch(ch); - } - save_ch('\n'); /* in either case, save a linefeed */ - break; - - - case EOF: - tokenType = TOKEN_INVALID; /* Unterminated string */ - nest_level = 0; - break; - } - - } while(nest_level > 0); - - return(DONE); -} - - -/* ------------------------------------------------------------------- - * Assemble a name; set token type and done flag. - * Put current input character back, if it is not white space. - */ - -/* Done: Name - * (Safe version used to complete name tokens that - * start out looking like something else). - */ - -static int AAH_NAME(ch) - int ch; -{ - do { - save_ch(ch); - ch = next_ch(); - } while(isNAME(ch)); - - back_ch_not_white(ch); - tokenType = TOKEN_NAME; - return(DONE); -} - -/* Done: Name */ -static int NAME(ch) - int ch; -{ - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - while(isNAME(ch)) { - save_ch(ch); - ch = next_ch(); - } - } - } - } - } - } - } - - back_ch_not_white(ch); - tokenType = TOKEN_NAME; - return(DONE); -} - -/* Done: Literal Name */ -static int LITERAL_NAME(ch) - int ch; -{ - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - while(isNAME(ch)) { - save_ch(ch); - ch = next_ch(); - } - } - } - } - } - } - } - - back_ch_not_white(ch); - tokenType = TOKEN_LITERAL_NAME; - return(DONE); -} - -/* Done: immediate Name */ -static int IMMED_NAME(ch) - int ch; -{ - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - if (isNAME(ch)) { - save_unsafe_ch(ch); - ch = next_ch(); - while(isNAME(ch)) { - save_ch(ch); - ch = next_ch(); - } - } - } - } - } - } - } - - back_ch_not_white(ch); - tokenType = TOKEN_IMMED_NAME; - return(DONE); -} - -/* Done: Name found while looking for something else */ -static int OOPS_NAME(ch) - int ch; -{ - back_ch_not_white(ch); - tokenType = TOKEN_NAME; - return(DONE); -} - - -/* ------------------------------------------------------------------- - * Complete a miscellaneous token; set token type and done flag. - */ - -/* Done: Unmatched Right Angle-Bracket */ -static int RIGHT_ANGLE(ch) - int ch; -{ - tokenType = TOKEN_RIGHT_ANGLE; - return(DONE); -} - -/* Done: Unmatched Right Parenthesis */ -static int RIGHT_PAREN(ch) - int ch; -{ - tokenType = TOKEN_RIGHT_PAREN; - return(DONE); -} - -/* Done: Left Brace */ -static int LEFT_BRACE(ch) - int ch; -{ - tokenType = TOKEN_LEFT_BRACE; - return(DONE); -} - -/* Done: Right Brace */ -static int RIGHT_BRACE(ch) - int ch; -{ - tokenType = TOKEN_RIGHT_BRACE; - return(DONE); -} - -/* Done: Left Bracket */ -static int LEFT_BRACKET(ch) - int ch; -{ - save_unsafe_ch(ch); - tokenType = TOKEN_LEFT_BRACKET; - return(DONE); -} - -/* Done: Right Bracket */ -static int RIGHT_BRACKET(ch) - int ch; -{ - save_unsafe_ch(ch); - tokenType = TOKEN_RIGHT_BRACKET; - return(DONE); -} - -/* Done: Break */ -static int BREAK_SIGNAL(ch) - int ch; -{ - tokenType = TOKEN_BREAK; - return(DONE); -} - -/* Done: No Token Found */ -static int NO_TOKEN(ch) - int ch; -{ - tokenType = TOKEN_EOF; - return(DONE); -} - - -/* - * ------------------------------------------------------------------- - * scan_token -- scan one token from the input. It uses a simple - * finite state machine to recognize token classes. - * - * The input is from a file. - * - * On entry -- - * - * inputP -> input PostScript object, a file. - * tokenStartP -> buffer in VM for accumulating the token. - * tokenMaxP -> last character in the token buffer - * - * On exit -- - * - * tokenLength = number of characters in the token - * tokenTooLong = TRUE if the token did not fit in the buffer - * tokenType = code for the type of token parsed. - * tokenValue = converted value of a numeric token. - * - * - * ------------------------------------------------------------------- - */ -void scan_token(inputP) - psobj *inputP; -{ - int ch; - unsigned char *stateP = s0; - unsigned char entry; - int (*actionP)(); - - /* Define input source */ - inputFileP = inputP->data.fileP; - if (inputFileP == NULL) { - tokenType = TOKEN_EOF; - return; - } - - /* Ensure enough space for most cases - * (so we don't have to keep checking) - * The length needs to cover the maximum number - * of save_unsafe_ch() calls that might be executed. - * That number is 11 (a sign and 10 decimal digits, e.g., - * when scanning -2147483648), but use MAX_NAME_LEN - * in case someone changes that without checking. - */ - if (vm_free_bytes() < (MAX_NAME_LEN)) { - if (!(vm_init())) { - tokenLength = 0; - tokenTooLong = TRUE; - tokenType = TOKEN_NONE; - tokenValue.integer = 0; - return; - } - } - - tokenStartP = vm_next_byte(); - - /* Reset token */ - tokenCharP = tokenStartP; - tokenTooLong = FALSE; - - /* Scan one token */ - ch = next_ch(); - do { - entry = stateP[ch]; - stateP = classActionTable[entry].nextStateP; - actionP = classActionTable[entry].actionRoutineP; - ch = (*actionP)(ch); - } while(ch != DONE); - - - /* Return results */ - tokenLength = tokenCharP - tokenStartP; -} diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/token.h xdvik-22.40n/libs/t1lib/lib/type1/token.h --- xdvik-22.40l/libs/t1lib/lib/type1/token.h Wed Apr 18 14:24:13 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/token.h Thu Jan 1 00:00:00 1970 @@ -1,77 +0,0 @@ -/* $XConsortium: token.h,v 1.2 91/10/10 11:19:58 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -#ifndef TOKEN_H -#define TOKEN_H - -/* Special characters */ -#define CONTROL_C (3) - -/* Token type codes */ -#define TOKEN_INVALID (-3) -#define TOKEN_BREAK (-2) -#define TOKEN_EOF (-1) -#define TOKEN_NONE (0) -#define TOKEN_LEFT_PAREN (1) -#define TOKEN_RIGHT_PAREN (2) -#define TOKEN_LEFT_ANGLE (3) -#define TOKEN_RIGHT_ANGLE (4) -#define TOKEN_LEFT_BRACE (5) -#define TOKEN_RIGHT_BRACE (6) -#define TOKEN_LEFT_BRACKET (7) -#define TOKEN_RIGHT_BRACKET (8) -#define TOKEN_NAME (9) -#define TOKEN_LITERAL_NAME (10) -#define TOKEN_INTEGER (11) -#define TOKEN_REAL (12) -#define TOKEN_RADIX_NUMBER (13) -#define TOKEN_HEX_STRING (14) -#define TOKEN_STRING (15) -#define TOKEN_IMMED_NAME (16) - -/* Token routines */ -extern void scan_token(); - -/* - * ------------------------------------------------------------------------- - * Globals shared -- (everyone else KEEP YOUR MITTS OFF THEM!) - * ------------------------------------------------------------------------- - */ - -/* These variables are set by the caller */ -extern char *tokenStartP; /* Pointer to token buffer in VM */ -extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */ - -/* These variables are set by P_TOKEN */ -extern int tokenLength; /* Characters in token */ -extern boolean tokenTooLong; /* Token too long for space available */ -extern int tokenType; /* Type of token identified */ -extern psvalue tokenValue; /* Token value */ - -#endif /* TOKEN_H */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/tokst.h xdvik-22.40n/libs/t1lib/lib/type1/tokst.h --- xdvik-22.40l/libs/t1lib/lib/type1/tokst.h Wed Apr 18 14:24:13 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/tokst.h Thu Jan 1 00:00:00 1970 @@ -1,508 +0,0 @@ -/* $XConsortium: tokst.h,v 1.2 91/10/10 11:20:00 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* -------------------------------------- */ -/* --- MACHINE GENERATED, DO NOT EDIT --- */ -/* -------------------------------------- */ - -#ifndef TOKST -#define TOKST 1 - -/* - * State Index Tables -- - * - * These tables map the input character to the - * proper entry in the Class Action Table. - * There is one table for each state. - * - */ -#define s0 (si0+2) -static unsigned char si0[258] = { 0x10,0x11, - 0x02,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x02,0x02,0x0F,0x0F,0x02,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x02,0x0F,0x0F,0x0F,0x0F,0x03,0x0F,0x0F,0x05,0x0B,0x0F,0x0D,0x0F,0x0D,0x0E,0x04, - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x0F,0x0F,0x08,0x0F,0x0C,0x0F, - 0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x0F,0x0A,0x0F,0x0F, - 0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x0F,0x09,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, - 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F -}; - -#define s1 (si1+2) -static unsigned char si1[258] = { 0x14,0x15, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, - 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13 -}; - -#define s2 (si2+2) -static unsigned char si2[258] = { 0x1B,0x1C, - 0x16,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x16,0x16,0x1A,0x1A,0x16,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x16,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x1A,0x17,0x17,0x1A,0x1A,0x1A,0x1A,0x19,0x17, - 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1A,0x1A,0x17,0x1A,0x17,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x17,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x17,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, - 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A -}; - -#define s3 (si3+2) -static unsigned char si3[258] = { 0x23,0x24, - 0x1D,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1D,0x1D,0x22,0x22,0x1D,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x1D,0x22,0x22,0x20,0x22,0x1E,0x22,0x22,0x1E,0x1E,0x22,0x22,0x22,0x22,0x1F,0x1E, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22, - 0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, - 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22 -}; - -#define s4 (si4+2) -static unsigned char si4[258] = { 0x29,0x2A, - 0x25,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x25,0x25,0x28,0x28,0x25,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x25,0x28,0x28,0x28,0x28,0x26,0x28,0x28,0x26,0x26,0x28,0x28,0x28,0x28,0x28,0x26, - 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x26,0x28,0x26,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x26,0x28,0x26,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x26,0x28,0x26,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, - 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28 -}; - -#define s5 (si5+2) -static unsigned char si5[258] = { 0x30,0x31, - 0x2B,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2B,0x2B,0x2F,0x2F,0x2B,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2B,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2F,0x2C,0x2C,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C, - 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2D,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2D,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, - 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F -}; - -#define s6 (si6+2) -static unsigned char si6[258] = { 0x36,0x37, - 0x32,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x32,0x32,0x35,0x35,0x32,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x32,0x35,0x35,0x35,0x35,0x33,0x35,0x35,0x33,0x33,0x35,0x35,0x35,0x35,0x35,0x33, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35, - 0x35,0x35,0x35,0x35,0x35,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, - 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35 -}; - -#define s7 (si7+2) -static unsigned char si7[258] = { 0x3D,0x3E, - 0x38,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x38,0x38,0x3C,0x3C,0x38,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x38,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x3C,0x39,0x39,0x3C,0x3A,0x3C,0x3A,0x3C,0x39, - 0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3C,0x3C,0x39,0x3C,0x39,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x39,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x39,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, - 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C -}; - -#define s8 (si8+2) -static unsigned char si8[258] = { 0x43,0x44, - 0x3F,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3F,0x3F,0x42,0x42,0x3F,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x3F,0x42,0x42,0x42,0x42,0x40,0x42,0x42,0x40,0x40,0x42,0x42,0x42,0x42,0x42,0x40, - 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x40,0x42,0x40,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x40,0x42,0x40,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x40,0x42,0x40,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, - 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42 -}; - -#define s9 (si9+2) -static unsigned char si9[258] = { 0x48,0x49, - 0x45,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x45,0x45,0x47,0x47,0x45,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x45,0x47,0x47,0x47,0x47,0x46,0x47,0x47,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x46, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, - 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47 -}; - -#define s10 (si10+2) -static unsigned char si10[258] = { 0x4E,0x4F, - 0x4A,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4A,0x4A,0x4D,0x4D,0x4A,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, - 0x4A,0x4D,0x4D,0x4D,0x4D,0x4B,0x4D,0x4D,0x4B,0x4B,0x4D,0x4D,0x4D,0x4D,0x4D,0x4B, - 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4D,0x4D,0x4B,0x4D,0x4B,0x4D, - 0x4D,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C, - 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4B,0x4D,0x4B,0x4D,0x4D, - 0x4D,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C, - 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4B,0x4D,0x4B,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, - 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D -}; - -#define s11 (si11+2) -static unsigned char si11[258] = { 0x53,0x54, - 0x50,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x50,0x50,0x52,0x52,0x50,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x50,0x52,0x52,0x52,0x52,0x51,0x52,0x52,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x51, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, - 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52 -}; - -/* - * Class Action Table -- - * - * The entries in the Class Action Table indicate the - * action routine to be called, and the next state to - * enter, for each relevant character class in each. - * state. There are several entries for each state. - * - */ -static int AAH_NAME(); -static int BREAK_SIGNAL(); -static int HEX_STRING(); -static int IMMED_NAME(); -static int INTEGER(); -static int LEFT_BRACE(); -static int LEFT_BRACKET(); -static int LITERAL_NAME(); -static int NAME(); -static int NO_TOKEN(); -static int OOPS_NAME(); -static int RADIX_NUMBER(); -static int REAL(); -static int RIGHT_ANGLE(); -static int RIGHT_BRACE(); -static int RIGHT_BRACKET(); -static int RIGHT_PAREN(); -static int STRING(); -static int add_1st_decpt(); -static int add_1st_digits(); -static int add_char(); -static int add_decpt(); -static int add_digits(); -static int add_e_sign(); -static int add_exponent(); -static int add_fraction(); -static int add_r_digits(); -static int add_radix(); -static int add_sign(); -static int next_char(); -static int skip_comment(); -static int skip_space(); - -static struct cat { - int (*actionRoutineP)(); - unsigned char *nextStateP; -} classActionTable[] = { - - /* s0: Classify initial character */ - /* 00 ALPHA */ {NAME, s0}, /* executable name */ - /* 01 DIGIT */ {add_1st_digits, s3}, /* number? */ - /* 02 WHITE_SPACE */ {skip_space, s0}, /* skip white space */ - /* 03 PERCENT */ {skip_comment, s0}, /* comment? */ - /* 04 SLASH */ {next_char, s1}, /* literal or imm name */ - /* 05 LEFT_PAREN */ {STRING, s0}, /* string */ - /* 06 LEFT_BRACE */ {LEFT_BRACE, s0}, /* begin procedure body */ - /* 07 LEFT_BRACKET */ {LEFT_BRACKET, s0}, /* begin array */ - /* 08 LEFT_ANGLE */ {HEX_STRING, s0}, /* hex string? */ - /* 09 RIGHT_BRACE */ {RIGHT_BRACE, s0}, /* end procedure body */ - /* 0A RIGHT_BRACKET */ {RIGHT_BRACKET, s0}, /* end array */ - /* 0B RIGHT_PAREN */ {RIGHT_PAREN, s0}, /* unmatched right paren */ - /* 0C RIGHT_ANGLE */ {RIGHT_ANGLE, s0}, /* unmatched right angle */ - /* 0D SIGN */ {add_sign, s2}, /* signed number? */ - /* 0E DECIMAL_POINT */ {add_1st_decpt, s4}, /* real number? */ - /* 0F ANY */ {NAME, s0}, /* executable name */ - /* 10 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 11 EOF */ {NO_TOKEN, s0}, /* no token found */ - - /* s1: Further classify a '/' */ - /* 12 SLASH */ {IMMED_NAME, s0}, /* immediate name */ - /* 13 ANY */ {LITERAL_NAME, s0}, /* literal name */ - /* 14 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 15 EOF */ {OOPS_NAME, s0}, /* isolated sign */ - - /* s2: sign */ - /* 16 WHITE_SPACE */ {OOPS_NAME, s0}, /* isolated sign */ - /* 17 SPECIAL */ {OOPS_NAME, s0}, /* isolated sign */ - /* 18 DIGIT */ {add_digits, s3}, /* number? */ - /* 19 DECIMAL_POINT */ {add_decpt, s4}, /* real number? */ - /* 1A ANY */ {NAME, s0}, /* executable name */ - /* 1B BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 1C EOF */ {OOPS_NAME, s0}, /* isolated sign */ - - /* s3: sign? digit+ */ - /* 1D WHITE_SPACE */ {INTEGER, s0}, /* n-digit integer */ - /* 1E SPECIAL */ {INTEGER, s0}, /* n-digit integer */ - /* 1F DECIMAL_POINT */ {add_char, s5}, /* real number? */ - /* 20 POUND */ {add_radix, s10}, /* radix number? */ - /* 21 eE */ {add_char, s7}, /* real with exponent? */ - /* 22 ANY */ {AAH_NAME, s0}, /* executable name */ - /* 23 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 24 EOF */ {INTEGER, s0}, /* n-digit integer */ - - /* s4: sign? . */ - /* 25 WHITE_SPACE */ {OOPS_NAME, s0}, /* isolated +. or -. */ - /* 26 SPECIAL */ {OOPS_NAME, s0}, /* isolated +. or -. */ - /* 27 DIGIT */ {add_fraction, s6}, /* number? */ - /* 28 ANY */ {NAME, s0}, /* executable name */ - /* 29 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 2A EOF */ {OOPS_NAME, s0}, /* isolated +. or -. */ - - /* s5: sign? digit+ . */ - /* 2B WHITE_SPACE */ {REAL, s0}, /* real with fraction */ - /* 2C SPECIAL */ {REAL, s0}, /* real with fraction */ - /* 2D eE */ {add_char, s7}, /* real with exponent? */ - /* 2E DIGIT */ {add_fraction, s6}, /* number? */ - /* 2F ANY */ {AAH_NAME, s0}, /* executable name */ - /* 30 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 31 EOF */ {REAL, s0}, /* real with fraction */ - - /* s6: sign? (digit+ . digit+) | (. digit+) */ - /* 32 WHITE_SPACE */ {REAL, s0}, /* real with fraction */ - /* 33 SPECIAL */ {REAL, s0}, /* real with fraction */ - /* 34 eE */ {add_char, s7}, /* real with exponent? */ - /* 35 ANY */ {AAH_NAME, s0}, /* executable name */ - /* 36 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 37 EOF */ {REAL, s0}, /* real with fraction */ - - /* s7: sign? ((digit+ (. digit*)?) | (. digit+)) Ee */ - /* 38 WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid real number */ - /* 39 SPECIAL */ {OOPS_NAME, s0}, /* invalid real number */ - /* 3A SIGN */ {add_e_sign, s8}, /* real w signed exponent? */ - /* 3B DIGIT */ {add_exponent, s9}, /* real w exponent ? */ - /* 3C ANY */ {AAH_NAME, s0}, /* executable name */ - /* 3D BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 3E EOF */ {OOPS_NAME, s0}, /* invalid real number */ - - /* s8: sign? (digit+ (. digit*)? | (digit* . digit+) Ee sign */ - /* 3F WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid real number */ - /* 40 SPECIAL */ {OOPS_NAME, s0}, /* invalid real number */ - /* 41 DIGIT */ {add_exponent, s9}, /* real w exponent? */ - /* 42 ANY */ {AAH_NAME, s0}, /* executable name */ - /* 43 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 44 EOF */ {OOPS_NAME, s0}, /* invalid real number */ - - /* s9: sign? (digit+ (. digit*)? | (digit* . digit+) Ee sign? digit+ */ - /* 45 WHITE_SPACE */ {REAL, s0}, /* real w exponent */ - /* 46 SPECIAL */ {REAL, s0}, /* real w exponent */ - /* 47 ANY */ {AAH_NAME, s0}, /* executable name */ - /* 48 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 49 EOF */ {REAL, s0}, /* real w exponent */ - - /* s10: digit+ # */ - /* 4A WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid radix number */ - /* 4B SPECIAL */ {OOPS_NAME, s0}, /* invalid radix number */ - /* 4C R_DIGIT */ {add_r_digits, s11}, /* radix number? */ - /* 4D ANY */ {AAH_NAME, s0}, /* executable name */ - /* 4E BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 4F EOF */ {OOPS_NAME, s0}, /* invalid radix number */ - - /* s11: digit+ # r_digit+ */ - /* 50 WHITE_SPACE */ {RADIX_NUMBER, s0}, /* radix number */ - /* 51 SPECIAL */ {RADIX_NUMBER, s0}, /* radix number */ - /* 52 ANY */ {AAH_NAME, s0}, /* executable name */ - /* 53 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ - /* 54 EOF */ {RADIX_NUMBER, s0} /* radix number */ -}; - -/* - * Character Classification Tables -- - * - * The entries in the Character Classification Tables - * map character codes to character classes. The - * tables contains one entry per code. The bits in - * each entry indicate which classes the character - * code belongs to. - * - * The macros 'isInCLASS(ch)' generate code to test - * whether 'ch' is a character in 'CLASS'. - * - */ -/* Membership macros for classes defined in table 1 ... */ -#define isRADIX_DIGIT(c) ((isInP1[c] & 0x80) != 0) -#define isHEX_DIGIT(c) ((isInP1[c] & 0x40) != 0) -#define isDECIMAL_DIGIT(c) ((isInP1[c] & 0x10) != 0) -#define isOCTAL_DIGIT(c) ((isInP1[c] & 0x20) != 0) - -/* Membership macros for classes defined in table 2 ... */ -#define isWHITE_SPACE(c) ((isInP2[c] & 0x80) != 0) -#define isCOMMENT(c) ((isInP2[c] & 0x40) != 0) -#define isNAME(c) ((isInP2[c] & 0x20) != 0) -#define isSTRING_SPECIAL(c) ((isInP2[c] & 0x10) != 0) -#define isNUMBER_ENDER(c) ((isInP2[c] & 0x08) != 0) - -#define isInP1 (isInT1+2) -static unsigned char isInT1[258] = { 0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xD0,0xD0,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00, - 0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, - 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; - -#define isInP2 (isInT2+2) -static unsigned char isInT2[258] = { 0x18,0x18, - 0xC8,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC8,0x88,0x60,0x60,0x98,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0xC8,0x60,0x60,0x60,0x60,0x48,0x60,0x60,0x58,0x58,0x60,0x60,0x60,0x60,0x60,0x48, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x60,0x48,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x70,0x48,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x60,0x48,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, - 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60 -}; - -#endif diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/trig.h xdvik-22.40n/libs/t1lib/lib/type1/trig.h --- xdvik-22.40l/libs/t1lib/lib/type1/trig.h Wed Apr 18 14:24:13 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/trig.h Thu Jan 1 00:00:00 1970 @@ -1,35 +0,0 @@ -/* $XConsortium: trig.h,v 1.2 91/10/10 11:20:04 rws Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/*SHARED*/ - -#define DegreeCos(d) xiStub() -#define DegreeSin(d) xiStub() -#define sqrt(d) xiStub() - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/type1.c xdvik-22.40n/libs/t1lib/lib/type1/type1.c --- xdvik-22.40l/libs/t1lib/lib/type1/type1.c Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/type1.c Thu Jan 1 00:00:00 1970 @@ -1,2085 +0,0 @@ -/* $XConsortium: type1.c,v 1.5 91/10/10 11:20:06 rws Exp $ */ -/* Copyright International Business Machines, Corp. 1991 - * All Rights Reserved - * Copyright Lexmark International, Inc. 1991 - * All Rights Reserved - * Portions Copyright (c) 1990 Adobe Systems Incorporated. - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of IBM or Lexmark or Adobe - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. - * - * IBM, LEXMARK, AND ADOBE PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY - * WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE - * ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING - * ANY DUTY TO SUPPORT OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY - * PORTION OF THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM, - * LEXMARK, OR ADOBE) ASSUMES THE ENTIRE COST OF ALL SERVICING, REPAIR AND - * CORRECTION. IN NO EVENT SHALL IBM, LEXMARK, OR ADOBE BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/*********************************************************************/ -/* */ -/* Type 1 module - Converting fonts in Adobe Type 1 Font Format */ -/* to scaled and hinted paths for rasterization. */ -/* Files: type1.c, type1.h, and blues.h. */ -/* */ -/* Authors: Sten F. Andler, IBM Almaden Research Center */ -/* (Type 1 interpreter, stem & flex hints) */ -/* */ -/* Patrick A. Casey, Lexmark International, Inc. */ -/* (Font level hints & stem hints) */ -/* */ -/*********************************************************************/ - -/******************/ -/* Include Files: */ -/******************/ -#include "types.h" -#include /* a system-dependent include, usually */ -#include - -#include "objects.h" -#include "spaces.h" -#include "paths.h" -#include "fonts.h" /* understands about TEXTTYPEs */ -#include "pictures.h" /* understands about handles */ - -typedef struct xobject xobject; -#include "util.h" /* PostScript objects */ -#include "fontfcn.h" -#include "blues.h" /* Blues structure for font-level hints */ - -/**********************************/ -/* Type1 Constants and Structures */ -/**********************************/ -#define MAXSTACK 24 /* Adobe Type1 limit */ -#define MAXCALLSTACK 10 /* Adobe Type1 limit */ -#define MAXPSFAKESTACK 32 /* Max depth of fake PostScript stack (local) */ -#define MAXSTRLEN 512 /* Max length of a Type 1 string (local) */ -#define MAXLABEL 256 /* Maximum number of new hints */ -#define MAXSTEMS 512 /* Maximum number of VSTEM and HSTEM hints */ -#define EPS 0.001 /* Small number for comparisons */ - -/************************************/ -/* Adobe Type 1 CharString commands */ -/************************************/ -#define HSTEM 1 -#define VSTEM 3 -#define VMOVETO 4 -#define RLINETO 5 -#define HLINETO 6 -#define VLINETO 7 -#define RRCURVETO 8 -#define CLOSEPATH 9 -#define CALLSUBR 10 -#define RETURN 11 -#define ESCAPE 12 -#define HSBW 13 -#define ENDCHAR 14 -#define RMOVETO 21 -#define HMOVETO 22 -#define VHCURVETO 30 -#define HVCURVETO 31 - -/* The following charstring code appears in some old Adobe font files - in space and .notdef character and does not seems to do anything - useful aside from taking two args from the stack. We allow this - command and ignore it. The source code of ghostscript states that - this command is obsolete *and* undocumented. - This code may also appear in an Escape-sequence! */ -#define UNKNOWN_15 15 - -/*******************************************/ -/* Adobe Type 1 CharString Escape commands */ -/*******************************************/ -#define DOTSECTION 0 -#define VSTEM3 1 -#define HSTEM3 2 -#define SEAC 6 -#define SBW 7 -#define DIV 12 -#define CALLOTHERSUBR 16 -#define POP 17 -#define SETCURRENTPOINT 33 - - -/* Note: We use routines from libm because in the original macro definitions, - the evaluation order of tmpx is undefined by C-standard! */ -#define USE_MATHLIB_ROUTINES - -#ifdef USE_MATHLIB_ROUTINES - -#define FABS(x) (fabs (x)) -#define CEIL(x) ((LONG) ceil (x)) -#define FLOOR(x) ((LONG) floor (x)) - -#else - -/*****************/ -/* Useful macros */ -/*****************/ -static DOUBLE tmpx; /* Store macro argument in tmpx to avoid re-evaluation */ -static LONG tmpi; /* Store converted value in tmpi to avoid re-evaluation */ -#define FABS(x) (((tmpx = (x)) < 0.0) ? -tmpx : tmpx) -#define CEIL(x) (((tmpi = (LONG) (tmpx = (x))) < tmpx) ? ++tmpi : tmpi) -#define FLOOR(x) (((tmpi = (LONG) (tmpx = (x))) > tmpx) ? --tmpi : tmpi) - -#endif - -#define ROUND(x) FLOOR((x) + 0.5) -#define ODD(x) (((int)(x)) & 01) - -#define CC IfTrace1(TRUE, "Char \"%s\": ", currentchar) - -/* To make some compiler happy we have to care about return types! */ -#define Errori {errflag = TRUE; return 0;} /* integer */ -#define Errord {errflag = TRUE; return 0.0;} /* double */ -#define Errorv {errflag = TRUE; return;} /* void */ - -#define Error0i(errmsg) { CC; IfTrace0(TRUE, errmsg); Errori;} -#define Error0d(errmsg) { CC; IfTrace0(TRUE, errmsg); Errord;} -#define Error0v(errmsg) { CC; IfTrace0(TRUE, errmsg); Errorv;} - -#define Error1i(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Errori;} -#define Error1d(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Errord;} -#define Error1v(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Errorv;} - -/********************/ -/* global variables */ -/********************/ -struct stem { /* representation of a STEM hint */ - int vertical; /* TRUE if vertical, FALSE otherwise */ - DOUBLE x, dx; /* interval of vertical stem */ - DOUBLE y, dy; /* interval of horizontal stem */ - struct segment *lbhint, *lbrevhint; /* left or bottom hint adjustment */ - struct segment *rthint, *rtrevhint; /* right or top hint adjustment */ -}; - -extern struct XYspace *IDENTITY; - -static DOUBLE escapementX, escapementY; -static DOUBLE sidebearingX, sidebearingY; -static DOUBLE accentoffsetX, accentoffsetY; - -static struct segment *path; -static int errflag; - -/*************************************************/ -/* Global variables to hold Type1Char parameters */ -/*************************************************/ -static char *Environment; -static char *currentchar; -static struct XYspace *CharSpace; -static psobj *CharStringP, *SubrsP, *OtherSubrsP; -static int *ModeP; - -/************************/ -/* Forward declarations */ -/************************/ -static DOUBLE Div(); -static DOUBLE PSFakePop(); -static int DoCommand(); -static int Escape(); -static int HStem(); -static int VStem(); -static int RLineTo(); -static int RRCurveTo(); -static int DoClosePath(); -static int CallSubr(); -static int Return(); -static int EndChar(); -static int RMoveTo(); -static int DotSection(); -static int Seac(); -static int Sbw(); -static int CallOtherSubr(); -static int SetCurrentPoint(); - -/*****************************************/ -/* statics for Flex procedures (FlxProc) */ -/*****************************************/ -static struct segment *FlxOldPath; /* save path before Flex feature */ - -/******************************************************/ -/* statics for Font level hints (Blues) (see blues.h) */ -/******************************************************/ -static struct blues_struct *blues; /* the blues structure */ -static struct alignmentzone alignmentzones[MAXALIGNMENTZONES]; -int numalignmentzones; /* total number of alignment zones */ - -/****************************************************************/ -/* Subroutines for the Font level hints (Alignment zones, etc.) */ -/****************************************************************/ - - - -/* Flags to control the rasterizer */ -#define T1_IGNORE_FORCEBOLD 0x0001 -#define T1_IGNORE_FAMILYALIGNMENT 0x0002 -#define T1_IGNORE_HINTING 0x0004 - -#define T1_DEBUG_LINE 0x0100 -#define T1_DEBUG_REGION 0x0200 -#define T1_DEBUG_PATH 0x0400 -#define T1_DEBUG_FONT 0x0800 -#define T1_DEBUG_HINT 0x1000 - -int T1_Type1OperatorFlags; /* for manipulation from t1lib */ - - -static void SetRasterFlags( void) -{ - - if (T1_Type1OperatorFlags & T1_IGNORE_HINTING) - ProcessHints=0; - else - ProcessHints=1; - - if ( T1_Type1OperatorFlags & T1_DEBUG_LINE) - LineDebug=1; - else - LineDebug=0; - if ( T1_Type1OperatorFlags & T1_DEBUG_REGION) - RegionDebug=1; - else - RegionDebug=0; - if ( T1_Type1OperatorFlags & T1_DEBUG_PATH) - PathDebug=1; - else - PathDebug=0; - if ( T1_Type1OperatorFlags & T1_DEBUG_FONT) - FontDebug=1; - else - FontDebug=0; - if ( T1_Type1OperatorFlags & T1_DEBUG_HINT) - HintDebug=1; - else - HintDebug=0; - return; - -} - - -/******************************************/ -/* Fill in the alignment zone structures. */ -/******************************************/ -static int ComputeAlignmentZones() -{ - int i; - DOUBLE dummy, bluezonepixels, familyzonepixels; - struct segment *p; - - numalignmentzones = 0; /* initialize total # of zones */ - - /* Remarks by RMz (Author of t1lib): The handling of substitution of - the BlueValues by the FamilyBlues and correspondingly for the - OtherBlues and FamilyOtherBlues is not clearly documented. - These are the problems: - - 1) Does the number of FamilyBlues entries need to be identical to - that of BlueValues? - - 2) Obviously, the order of the alignment zones in the BlueValues - and the FamilyBlues need not be same (see TimesBold.pfa) - - 3) Is it wise/recommended to make the substitution on a per - alignment-zone level or global, i.e., if once then for all - zones? - - 4) The principle found below, checking the delta-height of an - alignment-zone and making a decision based on this is incorrect. - The decision has to be done according to absolute pixel values - at which a feature would be rendered with the BlueValues and the - FamilyBlues respectively. - - To conclude, it seems better to disable the Family-feature until - these things are well-known/defined. - */ - - /* do the BlueValues zones */ - for (i = 0; i < blues->numBlueValues; i +=2, ++numalignmentzones) { - /* the 0th & 1st numbers in BlueValues are for a bottom zone */ - /* the rest are topzones */ - if (i == 0) /* bottom zone */ - alignmentzones[numalignmentzones].topzone = FALSE; - else /* top zone */ - alignmentzones[numalignmentzones].topzone = TRUE; - /* Check FamilyAlignment suppression */ - if ( (T1_Type1OperatorFlags & T1_IGNORE_FAMILYALIGNMENT)==0) { - if (i < blues->numFamilyBlues) { /* we must consider FamilyBlues */ - p = ILoc(CharSpace,0,blues->BlueValues[i] - blues->BlueValues[i+1]); - QueryLoc(p, IDENTITY, &dummy, &bluezonepixels); - Destroy(p); - p = ILoc(CharSpace,0,blues->FamilyBlues[i] - blues->FamilyBlues[i+1]); - QueryLoc(p, IDENTITY, &dummy, &familyzonepixels); - Destroy(p); - /* is the difference in size of the zones less than 1 pixel? */ - if (FABS(bluezonepixels - familyzonepixels) < 1.0) { - /* use the Family zones */ - alignmentzones[numalignmentzones].bottomy = - blues->FamilyBlues[i]; - alignmentzones[numalignmentzones].topy = - blues->FamilyBlues[i+1]; - continue; - } - } - } - /* use this font's Blue zones */ - alignmentzones[numalignmentzones].bottomy = blues->BlueValues[i]; - alignmentzones[numalignmentzones].topy = blues->BlueValues[i+1]; - } - - /* do the OtherBlues zones */ - for (i = 0; i < blues->numOtherBlues; i +=2, ++numalignmentzones) { - /* all of the OtherBlues zones are bottom zones */ - alignmentzones[numalignmentzones].topzone = FALSE; - /* Check FamilyAlignment suppression */ - if ( (T1_Type1OperatorFlags & T1_IGNORE_FAMILYALIGNMENT)==0) { - if (i < blues->numFamilyOtherBlues) {/* consider FamilyOtherBlues */ - p = ILoc(CharSpace,0,blues->OtherBlues[i] - blues->OtherBlues[i+1]); - QueryLoc(p, IDENTITY, &dummy, &bluezonepixels); - Destroy(p); - p = ILoc(CharSpace,0,blues->FamilyOtherBlues[i] - - blues->FamilyOtherBlues[i+1]); - QueryLoc(p, IDENTITY, &dummy, &familyzonepixels); - Destroy(p); - /* is the difference in size of the zones less than 1 pixel? */ - if (FABS(bluezonepixels - familyzonepixels) < 1.0) { - /* use the Family zones */ - alignmentzones[numalignmentzones].bottomy = - blues->FamilyOtherBlues[i]; - alignmentzones[numalignmentzones].topy = - blues->FamilyOtherBlues[i+1]; - continue; - } - } - } - /* use this font's Blue zones (as opposed to the Family Blues */ - alignmentzones[numalignmentzones].bottomy = blues->OtherBlues[i]; - alignmentzones[numalignmentzones].topy = blues->OtherBlues[i+1]; - } - return(0); - -} - -/**********************************************************************/ -/* Subroutines and statics for handling of the VSTEM and HSTEM hints. */ -/**********************************************************************/ -int InDotSection; /* DotSection flag */ -struct stem stems[MAXSTEMS]; /* All STEM hints */ -int numstems; /* Number of STEM hints */ -int currstartstem; /* The current starting stem. */ -int oldvert, oldhor; /* Remember hint in effect */ -int oldhorhalf, oldverthalf; /* Remember which half of the stem */ -DOUBLE wsoffsetX, wsoffsetY; /* White space offset - for VSTEM3,HSTEM3 */ -int wsset; /* Flag for whether we've set wsoffsetX,Y */ - -static int InitStems() /* Initialize the STEM hint data structures */ -{ - InDotSection = FALSE; - currstartstem = numstems = 0; - oldvert = oldhor = -1; - return(0); - -} - -static int FinitStems() /* Terminate the STEM hint data structures */ -{ - int i; - - for (i = 0; i < numstems; i++) { - Destroy(stems[i].lbhint); - Destroy(stems[i].lbrevhint); - Destroy(stems[i].rthint); - Destroy(stems[i].rtrevhint); - } - return(0); - -} - -/*******************************************************************/ -/* Compute the dislocation that a stemhint should cause for points */ -/* inside the stem. */ -/*******************************************************************/ -static int ComputeStem(stemno) -int stemno; -{ - int verticalondevice, idealwidth; - DOUBLE stemstart, stemwidth; - struct segment *p; - int i; - DOUBLE stembottom, stemtop, flatposition; - DOUBLE Xpixels, Ypixels; - DOUBLE unitpixels, onepixel; - int suppressovershoot, enforceovershoot; - DOUBLE stemshift, flatpospixels, overshoot; - DOUBLE widthdiff; /* Number of character space units to adjust width */ - DOUBLE lbhintvalue, rthintvalue; - DOUBLE cxx, cyx, cxy, cyy; /* Transformation matrix */ - int rotated; /* TRUE if character is on the side, FALSE if upright */ - - /************************************************/ - /* DETERMINE ORIENTATION OF CHARACTER ON DEVICE */ - /************************************************/ - - QuerySpace(CharSpace, &cxx, &cyx, &cxy, &cyy); /* Transformation matrix */ - - if (FABS(cxx) < 0.00001 || FABS(cyy) < 0.00001) - rotated = TRUE; /* Char is on side (90 or 270 degrees), possibly oblique. */ - else if (FABS(cyx) < 0.00001 || FABS(cxy) < 0.00001) - rotated = FALSE; /* Char is upright (0 or 180 degrees), possibly oblique. */ - else { - stems[stemno].lbhint = NULL; /* Char is at non-axial angle, ignore hints. */ - stems[stemno].lbrevhint = NULL; - stems[stemno].rthint = NULL; - stems[stemno].rtrevhint = NULL; - return(0); - } - - /* Determine orientation of stem */ - - if (stems[stemno].vertical) { - verticalondevice = !rotated; - stemstart = stems[stemno].x; - stemwidth = stems[stemno].dx; - } else { - verticalondevice = rotated; - stemstart = stems[stemno].y; - stemwidth = stems[stemno].dy; - } - - /* Determine how many pixels (non-negative) correspond to 1 character space - unit (unitpixels), and how many character space units (non-negative) - correspond to one pixel (onepixel). */ - - if (stems[stemno].vertical) - p = ILoc(CharSpace, 1, 0); - else - p = ILoc(CharSpace, 0, 1); - QueryLoc(p, IDENTITY, &Xpixels, &Ypixels); - Destroy(p); - if (verticalondevice) - unitpixels = FABS(Xpixels); - else - unitpixels = FABS(Ypixels); - - onepixel = 1.0 / unitpixels; - - /**********************/ - /* ADJUST STEM WIDTHS */ - /**********************/ - - widthdiff = 0.0; - - /* Find standard stem with smallest width difference from this stem */ - if (stems[stemno].vertical) { /* vertical stem */ - if (blues->StdVW != 0) /* there is an entry for StdVW */ - widthdiff = blues->StdVW - stemwidth; - for (i = 0; i < blues->numStemSnapV; ++i) { /* now look at StemSnapV */ - if (FABS(blues->StemSnapV[i] - stemwidth) < FABS(widthdiff)) - /* this standard width is the best match so far for this stem */ - widthdiff = blues->StemSnapV[i] - stemwidth; - } - } else { /* horizontal stem */ - if (blues->StdHW != 0) /* there is an entry for StdHW */ - widthdiff = blues->StdHW - stemwidth; - for (i = 0; i < blues->numStemSnapH; ++i) { /* now look at StemSnapH */ - if (FABS(blues->StemSnapH[i] - stemwidth) < FABS(widthdiff)) - /* this standard width is the best match so far for this stem */ - widthdiff = blues->StemSnapH[i] - stemwidth; - } - } - - /* Only expand or contract stems if they differ by less than 1 pixel from - the closest standard width, otherwise make the width difference = 0. */ - if (FABS(widthdiff) > onepixel) - widthdiff = 0.0; - - /* Expand or contract stem to the nearest integral number of pixels. */ - idealwidth = ROUND((stemwidth + widthdiff) * unitpixels); - /* Ensure that all stems are at least one pixel wide. */ - if (idealwidth == 0) - idealwidth = 1; - - /* Apply ForceBold to vertical stems. */ - if (blues->ForceBold && stems[stemno].vertical && - ((T1_Type1OperatorFlags & T1_IGNORE_FORCEBOLD)==0)) - /* Force this vertical stem to be at least DEFAULTBOLDSTEMWIDTH wide. */ - if (idealwidth < DEFAULTBOLDSTEMWIDTH) - idealwidth = DEFAULTBOLDSTEMWIDTH; - /* Now compute the number of character space units necessary */ - widthdiff = idealwidth * onepixel - stemwidth; - - /*********************************************************************/ - /* ALIGNMENT ZONES AND OVERSHOOT SUPPRESSION - HORIZONTAL STEMS ONLY */ - /*********************************************************************/ - - stemshift = 0.0; - - if (!stems[stemno].vertical) { - - /* Get bottom and top boundaries of the stem. */ - stembottom = stemstart; - stemtop = stemstart + stemwidth; - - /* Find out if this stem intersects an alignment zone (the BlueFuzz */ - /* entry in the Private dictionary specifies the number of character */ - /* units to extend (in both directions) the effect of an alignment */ - /* zone on a horizontal stem. The default value of BlueFuzz is 1. */ - for (i = 0; i < numalignmentzones; ++i) { - if (alignmentzones[i].topzone) { - if (stemtop >= alignmentzones[i].bottomy && - stemtop <= alignmentzones[i].topy + blues->BlueFuzz) { - break; /* We found a top-zone */ - } - } else { - if (stembottom <= alignmentzones[i].topy && - stembottom >= alignmentzones[i].bottomy - blues->BlueFuzz) { - break; /* We found a bottom-zone */ - } - } - } - - if (i < numalignmentzones) { /* We found an intersecting zone (number i). */ - suppressovershoot = FALSE; - enforceovershoot = FALSE; - - /* When 1 character space unit is rendered smaller than BlueScale - device units (pixels), we must SUPPRESS overshoots. Otherwise, - if the top (or bottom) of this stem is more than BlueShift character - space units away from the flat position, we must ENFORCE overshoot. */ - - if (unitpixels < blues->BlueScale){ - suppressovershoot = TRUE; - } - else{ - if (alignmentzones[i].topzone){ - if (stemtop >= alignmentzones[i].bottomy + blues->BlueShift){ - enforceovershoot = TRUE; - } - else - if (stembottom <= alignmentzones[i].topy - blues->BlueShift){ - enforceovershoot = TRUE; - } - } - } - - - /*************************************************/ - /* ALIGN THE FLAT POSITION OF THE ALIGNMENT ZONE */ - /*************************************************/ - - /* Compute the position of the alignment zone's flat position in - device space and the amount of shift needed to align it on a - pixel boundary. Move all stems this amount. */ - - if (alignmentzones[i].topzone) - flatposition = alignmentzones[i].bottomy; - else - flatposition = alignmentzones[i].topy; - - /* Find the flat position in pixels */ - flatpospixels = flatposition * unitpixels; - - /* Find the stem shift necessary to align the flat - position on a pixel boundary, and use this shift for all stems */ - stemshift = (ROUND(flatpospixels) - flatpospixels) * onepixel; - - /************************************************/ - /* HANDLE OVERSHOOT ENFORCEMENT AND SUPPRESSION */ - /************************************************/ - - /* Compute overshoot amount (non-negative) */ - if (alignmentzones[i].topzone) - overshoot = stemtop - flatposition; - else - overshoot = flatposition - stembottom; - - if (overshoot > 0.0) { - /* ENFORCE overshoot by shifting the entire stem (if necessary) so that - it falls at least one pixel beyond the flat position. */ - - if (enforceovershoot){ - if (overshoot < onepixel){ - if (alignmentzones[i].topzone) - stemshift += onepixel - overshoot; - else - stemshift -= onepixel - overshoot; - } - } - - - /* SUPPRESS overshoot by aligning the stem to the alignment zone's - flat position. */ - - if (suppressovershoot){ - if (alignmentzones[i].topzone) - stemshift -= overshoot; - else - stemshift += overshoot; - } - } - - /************************************************************/ - /* COMPUTE HINT VALUES FOR EACH SIDE OF THE HORIZONTAL STEM */ - /************************************************************/ - - /* If the stem was aligned by a topzone, we expand or contract the stem - only at the bottom - since the stem top was aligned by the zone. - If the stem was aligned by a bottomzone, we expand or contract the stem - only at the top - since the stem bottom was aligned by the zone. */ - if (alignmentzones[i].topzone) { - lbhintvalue = stemshift - widthdiff; /* bottom */ - rthintvalue = stemshift; /* top */ - } else { - lbhintvalue = stemshift; /* bottom */ - rthintvalue = stemshift + widthdiff; /* top */ - } - - stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, lbhintvalue)); - stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -lbhintvalue)); - stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, 0.0, rthintvalue)); - stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -rthintvalue)); - - return(0); - - } /* endif (i < numalignmentzones) */ - - /* We didn't find any alignment zones intersecting this stem, so - proceed with normal stem alignment below. */ - - } /* endif (!stems[stemno].vertical) */ - - /* Align stem with pixel boundaries on device */ - stemstart = stemstart - widthdiff / 2; - stemshift = ROUND(stemstart * unitpixels) * onepixel - stemstart; - - /* Adjust the boundaries of the stem */ - lbhintvalue = stemshift - widthdiff / 2; /* left or bottom */ - rthintvalue = stemshift + widthdiff / 2; /* right or top */ - - if (stems[stemno].vertical) { - stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, lbhintvalue, 0.0)); - stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, -lbhintvalue, 0.0)); - stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, rthintvalue, 0.0)); - stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, -rthintvalue, 0.0)); - } else { - stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, lbhintvalue)); - stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -lbhintvalue)); - stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, 0.0, rthintvalue)); - stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -rthintvalue)); - } - return(0); - -} - -#define LEFT 1 -#define RIGHT 2 -#define BOTTOM 3 -#define TOP 4 - -/*********************************************************************/ -/* Adjust a point using the given stem hint. Use the left/bottom */ -/* hint value or the right/top hint value depending on where the */ -/* point lies in the stem. */ -/*********************************************************************/ -static struct segment *Applyhint(p, stemnumber, half) -struct segment *p; -int stemnumber, half; -{ - if (half == LEFT || half == BOTTOM) - return Join(p, stems[stemnumber].lbhint); /* left or bottom hint */ - else - return Join(p, stems[stemnumber].rthint); /* right or top hint */ -} - -/*********************************************************************/ -/* Adjust a point using the given reverse hint. Use the left/bottom */ -/* hint value or the right/top hint value depending on where the */ -/* point lies in the stem. */ -/*********************************************************************/ -static struct segment *Applyrevhint(p, stemnumber, half) -struct segment *p; -int stemnumber, half; -{ - if (half == LEFT || half == BOTTOM) - return Join(p, stems[stemnumber].lbrevhint); /* left or bottom hint */ - else - return Join(p, stems[stemnumber].rtrevhint); /* right or top hint */ -} - -/***********************************************************************/ -/* Find the vertical and horizontal stems that the current point */ -/* (x, y) may be involved in. At most one horizontal and one vertical */ -/* stem can apply to a single point, since there are no overlaps */ -/* allowed. */ -/* The actual hintvalue is returned as a location. */ -/* Hints are ignored inside a DotSection. */ -/***********************************************************************/ -static struct segment *FindStems(x, y, dx, dy) -DOUBLE x, y, dx, dy; -{ - int i; - int newvert, newhor; - struct segment *p; - int newhorhalf, newverthalf; - - if (InDotSection) return(NULL); - - newvert = newhor = -1; - newhorhalf = newverthalf = -1; - - for (i = currstartstem; i < numstems; i++) { - if (stems[i].vertical) { /* VSTEM hint */ - if ((x >= stems[i].x - EPS) && - (x <= stems[i].x+stems[i].dx + EPS)) { - newvert = i; - if (dy != 0.0) { - if (dy < 0) newverthalf = LEFT; - else newverthalf = RIGHT; - } else { - if (x < stems[i].x+stems[i].dx / 2) newverthalf = LEFT; - else newverthalf = RIGHT; - } - } - } else { /* HSTEM hint */ - if ((y >= stems[i].y - EPS) && - (y <= stems[i].y+stems[i].dy + EPS)) { - newhor = i; - if (dx != 0.0) { - if (dx < 0) newhorhalf = TOP; - else newhorhalf = BOTTOM; - } else { - if (y < stems[i].y+stems[i].dy / 2) newhorhalf = BOTTOM; - else newhorhalf = TOP; - } - } - } - } - - p = NULL; - - if (newvert == -1 && oldvert == -1) ; /* Outside of any hints */ - else if (newvert == oldvert && - newverthalf == oldverthalf); /* No hint change */ - else if (oldvert == -1) { /* New vertical hint in effect */ - p = Applyhint(p, newvert, newverthalf); - } else if (newvert == -1) { /* Old vertical hint no longer in effect */ - p = Applyrevhint(p, oldvert, oldverthalf); - } else { /* New vertical hint in effect, old hint no longer in effect */ - p = Applyrevhint(p, oldvert, oldverthalf); - p = Applyhint(p, newvert, newverthalf); - } - - if (newhor == -1 && oldhor == -1) ; /* Outside of any hints */ - else if (newhor == oldhor && - newhorhalf == oldhorhalf) ; /* No hint change */ - else if (oldhor == -1) { /* New horizontal hint in effect */ - p = Applyhint(p, newhor, newhorhalf); - } else if (newhor == -1) { /* Old horizontal hint no longer in effect */ - p = Applyrevhint(p, oldhor, oldhorhalf); - } - else { /* New horizontal hint in effect, old hint no longer in effect */ - p = Applyrevhint(p, oldhor, oldhorhalf); - p = Applyhint(p, newhor, newhorhalf); - } - - oldvert = newvert; oldverthalf = newverthalf; - oldhor = newhor; oldhorhalf = newhorhalf; - - return p; -} - -/******************************************************/ -/* Subroutines and statics for the Type1Char routines */ -/******************************************************/ - -static int strindex; /* index into PostScript string being interpreted */ -static DOUBLE currx, curry; /* accumulated x and y values for hints */ - -struct callstackentry { - psobj *currstrP; /* current CharStringP */ - int currindex; /* current strindex */ - unsigned short currkey; /* current decryption key */ - }; - -static DOUBLE Stack[MAXSTACK]; -static int Top; -static struct callstackentry CallStack[MAXCALLSTACK]; -static int CallTop; -static DOUBLE PSFakeStack[MAXPSFAKESTACK]; -static int PSFakeTop; - -static int ClearStack() -{ - Top = -1; - return(0); - -} - -static int Push(Num) - DOUBLE Num; -{ - if (++Top < MAXSTACK) Stack[Top] = Num; - else Error0i("Push: Stack full\n"); - return(0); - -} - -static int ClearCallStack() -{ - CallTop = -1; - return(0); -} - -static int PushCall(CurrStrP, CurrIndex, CurrKey) - psobj *CurrStrP; - int CurrIndex; - unsigned short CurrKey; -{ - if (++CallTop < MAXCALLSTACK) { - CallStack[CallTop].currstrP = CurrStrP; /* save CharString pointer */ - CallStack[CallTop].currindex = CurrIndex; /* save CharString index */ - CallStack[CallTop].currkey = CurrKey; /* save decryption key */ - } - else Error0i("PushCall: Stack full\n"); - return(0); -} - -static int PopCall(CurrStrPP, CurrIndexP, CurrKeyP) - psobj **CurrStrPP; - int *CurrIndexP; - unsigned short *CurrKeyP; -{ - if (CallTop >= 0) { - *CurrStrPP = CallStack[CallTop].currstrP; /* restore CharString pointer */ - *CurrIndexP = CallStack[CallTop].currindex; /* restore CharString index */ - *CurrKeyP = CallStack[CallTop--].currkey; /* restore decryption key */ - } - else Error0i("PopCall: Stack empty\n"); - return(0); -} - - -static int ClearPSFakeStack() -{ - PSFakeTop = -1; - return(0); -} - -/* PSFakePush: Pushes a number onto the fake PostScript stack */ -static int PSFakePush(Num) - DOUBLE Num; -{ - if (++PSFakeTop < MAXPSFAKESTACK) PSFakeStack[PSFakeTop] = Num; - else Error0i("PSFakePush: Stack full\n"); - return(0); -} - -/* PSFakePop: Removes a number from the top of the fake PostScript stack */ -static DOUBLE PSFakePop () -{ - if (PSFakeTop >= 0) return(PSFakeStack[PSFakeTop--]); - - else Error0d("PSFakePop : Stack empty\n"); - - /*NOTREACHED*/ -} - -/***********************************************************************/ -/* Center a stem on the pixel grid -- used by HStem3 and VStem3 */ -/***********************************************************************/ -static struct segment *CenterStem(edge1, edge2) - DOUBLE edge1; - DOUBLE edge2; -{ - int idealwidth, verticalondevice; - DOUBLE leftx, lefty, rightx, righty, center, width; - DOUBLE widthx, widthy; - DOUBLE shift, shiftx, shifty; - DOUBLE Xpixels, Ypixels; - struct segment *p; - - p = Loc(CharSpace, edge1, 0.0); - QueryLoc(p, IDENTITY, &leftx, &lefty); - - p = Join(p, Loc(CharSpace, edge2, 0.0)); - QueryLoc(p, IDENTITY, &rightx, &righty); - Destroy(p); - - widthx = FABS(rightx - leftx); - widthy = FABS(righty - lefty); - - if (widthy <= EPS) { /* verticalondevice hint */ - verticalondevice = TRUE; - center = (rightx + leftx) / 2.0; - width = widthx; - } - else if (widthx <= EPS) { /* horizontal hint */ - verticalondevice = FALSE; - center = (righty + lefty) / 2.0; - width = widthy; - } - else { /* neither horizontal nor verticalondevice and not oblique */ - return (NULL); - } - - idealwidth = ROUND(width); - if (idealwidth == 0) idealwidth = 1; - if (ODD(idealwidth)) { /* is ideal width odd? */ - /* center stem over pixel */ - shift = FLOOR(center) + 0.5 - center; - } - else { - /* align stem on pixel boundary */ - shift = ROUND(center) - center; - } - - if (verticalondevice) { - shiftx = shift; - shifty = 0.0; - } else { - shifty = shift; - shiftx = 0.0; - } - - p = Loc(IDENTITY, shiftx, shifty); - QueryLoc(p, CharSpace, &Xpixels, &Ypixels); - wsoffsetX = Xpixels; wsoffsetY = Ypixels; - currx += wsoffsetX; curry += wsoffsetY; - - return (p); -} - -/*----------------------------------------------------------------------- - Decrypt - From Adobe Type 1 book page 63, with some modifications ------------------------------------------------------------------------*/ -#define KEY 4330 /* Initial key (seed) for CharStrings decryption */ -#define C1 52845 /* Multiplier for pseudo-random number generator */ -#define C2 22719 /* Constant for pseudo-random number generator */ - -static unsigned short r; /* Pseudo-random sequence of keys */ - -static unsigned char Decrypt(cipher) -unsigned char cipher; -{ - unsigned char plain; - - plain = cipher ^ (r >> 8); - r = (cipher + r) * C1 + C2; - return plain; -} - -/* Get the next byte from the codestring being interpreted */ -static int DoRead(CodeP) - int *CodeP; -{ - if (strindex >= CharStringP->len) return(FALSE); /* end of string */ - /* We handle the non-documented Adobe convention to use lenIV=-1 to - suppress charstring encryption. */ - if (blues->lenIV==-1) { - *CodeP = (unsigned char) CharStringP->data.stringP[strindex++]; - } - else { - *CodeP = Decrypt((unsigned char) CharStringP->data.stringP[strindex++]); - } - - return(TRUE); -} - -/* Strip blues->lenIV bytes from CharString and update encryption key */ -/* (the lenIV entry in the Private dictionary specifies the number of */ -/* random bytes at the beginning of each CharString; default is 4) */ -static void StartDecrypt() -{ - int Code; - - r = KEY; /* Initial key (seed) for CharStrings decryption */ - for (strindex = 0; strindex < blues->lenIV;){ - if (!DoRead(&Code)) /* Read a byte and update decryption key */ - Error0v("StartDecrypt: Premature end of CharString\n"); - } - -} - -#undef DecodeDebug - -static int Decode(Code) - int Code; -{ - int Code1, Code2, Code3, Code4; - - if (Code <= 31){ /* Code is [0,31] */ -#ifdef DecodeDebug - fprintf(stderr, "Decode: Code=%d -> Command\n", Code); -#endif - DoCommand(Code); - } - else if (Code <= 246){ /* Code is [32,246] */ -#ifdef DecodeDebug - fprintf(stderr, "Decode: Code=%d -> number=%f\n", - Code, (DOUBLE)(Code-139)); -#endif - Push((DOUBLE)(Code - 139)); - } - else if (Code <= 250) { /* Code is [247,250] */ - if (!DoRead(&Code2)) goto ended; -#ifdef DecodeDebug - fprintf(stderr, "Decode: Code=%d next Code=%d -> number=%f\n", - Code, Code2, (DOUBLE)(((Code - 247) << 8) + Code2 + 108)); -#endif - Push((DOUBLE)(((Code - 247) << 8) + Code2 + 108)); - } - else if (Code <= 254) { /* Code is [251,254] */ - if (!DoRead(&Code2)) goto ended; -#ifdef DecodeDebug - fprintf(stderr, "Decode: Code=%d, next Code=%d -> number=%f\n", - Code, Code2, (DOUBLE)( -((Code - 251) << 8) - Code2 - 108)); -#endif - Push((DOUBLE)( -((Code - 251) << 8) - Code2 - 108)); - } - else { /* Code is 255 */ - if (!DoRead(&Code1)) goto ended; - if (!DoRead(&Code2)) goto ended; - if (!DoRead(&Code3)) goto ended; - if (!DoRead(&Code4)) goto ended; -#ifdef DecodeDebug - fprintf(stderr, "Decode: Code=255, Code1=%d, Code2=%d, Code3=%d, Code4=%d -> number=%f\n", - Code1, Code2, Code3, Code4, - (DOUBLE)((((((Code1<<8) + Code2)<<8) + Code3)<<8) + Code4)); -#endif - Push((DOUBLE)((((((Code1<<8) + Code2)<<8) + Code3)<<8) + Code4)); - } - return(0); - -ended: Error0i("Decode: Premature end of Type 1 CharString"); -} - -#undef DoCommandDebug - -/* Interpret a command code */ -static int DoCommand(Code) - int Code; -{ - switch(Code) { - case HSTEM: /* |- y dy HSTEM |- */ -#ifdef DoCommandDebug - printf("DoCommand: HStem\n"); -#endif - /* Vertical range of a horizontal stem zone */ - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - HStem(Stack[0], Stack[1]); - ClearStack(); - break; - case VSTEM: /* |- x dx VSTEM |- */ -#ifdef DoCommandDebug - printf("DoCommand: VStem\n"); -#endif - /* Horizontal range of a vertical stem zone */ - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - VStem(Stack[0], Stack[1]); - ClearStack(); - break; - case VMOVETO: /* |- dy VMOVETO |- */ -#ifdef DoCommandDebug - printf("DoCommand: VMoveto\n"); -#endif - /* Vertical MOVETO, equivalent to 0 dy RMOVETO */ - if (Top < 0) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RMoveTo(0.0, Stack[0]); - ClearStack(); - break; - case RLINETO: /* |- dx dy RLINETO |- */ -#ifdef DoCommandDebug - printf("DoCommand: RLineto\n"); -#endif - /* Like RLINETO in PostScript */ - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RLineTo(Stack[0], Stack[1]); - ClearStack(); - break; - case HLINETO: /* |- dx HLINETO |- */ -#ifdef DoCommandDebug - printf("DoCommand: HLineto\n"); -#endif - /* Horizontal LINETO, equivalent to dx 0 RLINETO */ - if (Top < 0) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RLineTo(Stack[0], 0.0); - ClearStack(); - break; - case VLINETO: /* |- dy VLINETO |- */ -#ifdef DoCommandDebug - printf("DoCommand: VLineto\n"); -#endif - /* Vertical LINETO, equivalent to 0 dy RLINETO */ - if (Top < 0) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RLineTo(0.0, Stack[0]); - ClearStack(); - break; - case RRCURVETO: -#ifdef DoCommandDebug - printf("DoCommand: RRCurveto\n"); -#endif - /* |- dx1 dy1 dx2 dy2 dx3 dy3 RRCURVETO |- */ - /* Relative RCURVETO, equivalent to dx1 dy1 */ - /* (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) */ - /* (dy1+dy2+dy3) RCURVETO in PostScript */ - if (Top < 5) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RRCurveTo(Stack[0], Stack[1], Stack[2], Stack[3], - Stack[4], Stack[5]); - ClearStack(); - break; - case CLOSEPATH: /* - CLOSEPATH |- */ -#ifdef DoCommandDebug - printf("DoCommand: ClosePath\n"); -#endif - /* Closes a subpath without repositioning the */ - /* current point */ - DoClosePath(); - ClearStack(); - break; - case CALLSUBR: /* subr# CALLSUBR - */ -#ifdef DoCommandDebug - printf("DoCommand: CallSubr\n"); -#endif - /* Calls a CharString subroutine with index */ - /* subr# from the Subrs array */ - if (Top < 0) Error1i("DoCommand: Stack low\n (Code=%d)", Code); - CallSubr((int)Stack[Top--]); - break; - case RETURN: /* - RETURN - */ -#ifdef DoCommandDebug - printf("DoCommand: Return\n"); -#endif - /* Returns from a Subrs array CharString */ - /* subroutine called with CALLSUBR */ - Return(); - break; - case ESCAPE: /* ESCAPE to two-byte command code */ -#ifdef DoCommandDebug - printf("DoCommand: Escape to 2 Byte Code (Code=%d)\n", Code); -#endif - if (!DoRead(&Code)) Error0i("DoCommand: ESCAPE is last byte\n"); - Escape(Code); - break; - case HSBW: /* |- sbx wx HSBW |- */ -#ifdef DoCommandDebug - printf("DoCommand: HSBW\n"); -#endif - /* Set the left sidebearing point to (sbx,0), */ - /* set the character width vector to (wx,0). */ - /* Equivalent to sbx 0 wx 0 SBW. Space */ - /* character should have sbx = 0 */ - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - Sbw(Stack[0], 0.0, Stack[1], 0.0); - ClearStack(); - break; - case ENDCHAR: /* - ENDCHAR |- */ -#ifdef DoCommandDebug - printf("DoCommand: EndChar\n"); -#endif - /* Finishes a CharString outline */ - EndChar(); - ClearStack(); - break; - case RMOVETO: /* |- dx dy RMOVETO |- */ -#ifdef DoCommandDebug - printf("DoCommand: RMoveto\n"); -#endif - /* Behaves like RMOVETO in PostScript */ - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RMoveTo(Stack[0], Stack[1]); - ClearStack(); - break; - case HMOVETO: /* |- dx HMOVETO |- */ -#ifdef DoCommandDebug - printf("DoCommand: HMovetoUnassigned\n"); -#endif - /* Horizontal MOVETO. Equivalent to dx 0 RMOVETO */ - if (Top < 0) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RMoveTo(Stack[0], 0.0); - ClearStack(); - break; - case VHCURVETO: /* |- dy1 dx2 dy2 dx3 VHCURVETO |- */ -#ifdef DoCommandDebug - printf("DoCommand: VHCurveto\n"); -#endif - /* Vertical-Horizontal CURVETO, equivalent to */ - /* 0 dy1 dx2 dy2 dx3 0 RRCURVETO */ - if (Top < 3) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RRCurveTo(0.0, Stack[0], Stack[1], Stack[2], - Stack[3], 0.0); - ClearStack(); - break; - case HVCURVETO: /* |- dx1 dx2 dy2 dy3 HVCURVETO |- */ -#ifdef DoCommandDebug - printf("DoCommand: HCurveto\n"); -#endif - /* Horizontal-Vertical CURVETO, equivalent to */ - /* dx1 0 dx2 dy2 0 dy3 RRCURVETO */ - if (Top < 3) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - RRCurveTo(Stack[0], 0.0, Stack[1], Stack[2], 0.0, Stack[3]); - ClearStack(); - break; - case UNKNOWN_15: - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - ClearStack(); - break; - default: /* Unassigned command code */ -#ifdef DoCommandDebug - printf("DoCommand: Unassigned\n"); -#endif - ClearStack(); - Error1i("DoCommand: Unassigned code %d\n", Code); - } - return(0); - -} - -static int Escape(Code) - int Code; -{ - int i, Num; - struct segment *p; - - switch(Code) { - case DOTSECTION: /* - DOTSECTION |- */ - /* Brackets an outline section for the dots in */ - /* letters such as "i", "j", and "!". */ - DotSection(); - ClearStack(); - break; - case VSTEM3: /* |- x0 dx0 x1 dx1 x2 dx2 VSTEM3 |- */ - /* Declares the horizontal ranges of three */ - /* vertical stem zones between x0 and x0+dx0, */ - /* x1 and x1+dx1, and x2 and x2+dx2. */ - if (Top < 5) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - if (!wsset && ProcessHints) { - /* Shift the whole character so that the middle stem is centered. */ - p = CenterStem(Stack[2] + sidebearingX, Stack[3]); - path = Join(path, p); - wsset = 1; - } - - VStem(Stack[0], Stack[1]); - VStem(Stack[2], Stack[3]); - VStem(Stack[4], Stack[5]); - ClearStack(); - break; - case HSTEM3: /* |- y0 dy0 y1 dy1 y2 dy2 HSTEM3 |- */ - /* Declares the vertical ranges of three hori- */ - /* zontal stem zones between y0 and y0+dy0, */ - /* y1 and y1+dy1, and y2 and y2+dy2. */ - if (Top < 5) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - HStem(Stack[0], Stack[1]); - HStem(Stack[2], Stack[3]); - HStem(Stack[4], Stack[5]); - ClearStack(); - break; - case SEAC: /* |- asb adx ady bchar achar SEAC |- */ - /* Standard Encoding Accented Character. */ - if (Top < 4) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - Seac(Stack[0], Stack[1], Stack[2], - (unsigned char) Stack[3], - (unsigned char) Stack[4]); - ClearStack(); - break; - case SBW: /* |- sbx sby wx wy SBW |- */ - /* Set the left sidebearing point to (sbx,sby), */ - /* set the character width vector to (wx,wy). */ - if (Top < 3) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - Sbw(Stack[0], Stack[1], Stack[2], Stack[3]); - ClearStack(); - break; - case DIV: /* num1 num2 DIV quotient */ - /* Behaves like DIV in the PostScript language */ - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - Stack[Top-1] = Div(Stack[Top-1], Stack[Top]); - Top--; - break; - case CALLOTHERSUBR: - /* arg1 ... argn n othersubr# CALLOTHERSUBR - */ - /* Make calls on the PostScript interpreter */ - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - Num = Stack[Top-1]; - if (Top < Num+1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - for (i = 0; i < Num; i++) PSFakePush(Stack[Top - i - 2]); - Top -= Num + 2; - CallOtherSubr((int)Stack[Top + Num + 2]); - break; - case POP: /* - POP number */ - /* Removes a number from the top of the */ - /* PostScript interpreter stack and pushes it */ - /* onto the Type 1 BuildChar operand stack */ - Push(PSFakePop()); - break; - case SETCURRENTPOINT: /* |- x y SETCURRENTPOINT |- */ - /* Sets the current point to (x,y) in absolute */ - /* character space coordinates without per- */ - /* forming a CharString MOVETO command */ - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - SetCurrentPoint(Stack[0], Stack[1]); - ClearStack(); - break; - case UNKNOWN_15: - if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); - ClearStack(); - break; - default: /* Unassigned escape code command */ - ClearStack(); - Error1i("Escape: Unassigned code %d\n", Code); - } - return(0); - -} - -/* |- y dy HSTEM |- */ -/* Declares the vertical range of a horizontal stem zone */ -/* between coordinates y and y + dy */ -/* y is relative to the left sidebearing point */ -static int HStem(y, dy) - DOUBLE y, dy; -{ - IfTrace2((FontDebug), "Hstem %f %f\n", y, dy); - if (ProcessHints) { - if (numstems >= MAXSTEMS) Error0i("HStem: Too many hints\n"); - if (dy < 0.0) {y += dy; dy = -dy;} - stems[numstems].vertical = FALSE; - stems[numstems].x = 0.0; - stems[numstems].y = sidebearingY + y + wsoffsetY; - stems[numstems].dx = 0.0; - stems[numstems].dy = dy; - ComputeStem(numstems); - numstems++; - } - return(0); -} - -/* |- x dx VSTEM |- */ -/* Declares the horizontal range of a vertical stem zone */ -/* between coordinates x and x + dx */ -/* x is relative to the left sidebearing point */ -static int VStem(x, dx) - DOUBLE x, dx; -{ - IfTrace2((FontDebug), "Vstem %f %f\n", x, dx); - if (ProcessHints) { - if (numstems >= MAXSTEMS) Error0i("VStem: Too many hints\n"); - if (dx < 0.0) {x += dx; dx = -dx;} - stems[numstems].vertical = TRUE; - stems[numstems].x = sidebearingX + x + wsoffsetX; - stems[numstems].y = 0.0; - stems[numstems].dx = dx; - stems[numstems].dy = 0.0; - ComputeStem(numstems); - numstems++; - } - return(0); -} - -/* |- dx dy RLINETO |- */ -/* Behaves like RLINETO in PostScript */ -static int RLineTo(dx, dy) - DOUBLE dx, dy; -{ - struct segment *B; - - IfTrace2((FontDebug), "RLineTo %f %f\n", dx, dy); - - B = Loc(CharSpace, dx, dy); - - if (ProcessHints) { - currx += dx; - curry += dy; - /* B = Join(B, FindStems(currx, curry)); */ - B = Join(B, FindStems(currx, curry, dx, dy)); - } - - path = Join(path, Line(B)); - return(0); -} - -/* |- dx1 dy1 dx2 dy2 dx3 dy3 RRCURVETO |- */ -/* Relative RCURVETO, equivalent to dx1 dy1 */ -/* (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) */ -/* (dy1+dy2+dy3) RCURVETO in PostScript */ -static int RRCurveTo(dx1, dy1, dx2, dy2, dx3, dy3) - DOUBLE dx1, dy1, dx2, dy2, dx3, dy3; -{ - struct segment *B, *C, *D; - - IfTrace4((FontDebug), "RRCurveTo %f %f %f %f ", dx1, dy1, dx2, dy2); - IfTrace2((FontDebug), "%f %f\n", dx3, dy3); - - B = Loc(CharSpace, dx1, dy1); - C = Loc(CharSpace, dx2, dy2); - D = Loc(CharSpace, dx3, dy3); - - if (ProcessHints) { - /* For a Bezier curve, we apply the full hint value to - the Bezier C point (and thereby D point). */ - currx += dx1 + dx2 + dx3; - curry += dy1 + dy2 + dy3; - /* C = Join(C, FindStems(currx, curry)); */ - C = Join(C, FindStems(currx, curry, dx3, dy3)); - } - - /* Since XIMAGER is not completely relative, */ - /* we need to add up the delta values */ - - C = Join(C, Dup(B)); - D = Join(D, Dup(C)); - - path = Join(path, Bezier(B, C, D)); - return(0); -} - -/* - CLOSEPATH |- */ -/* Closes a subpath WITHOUT repositioning the */ -/* current point */ -static int DoClosePath() -{ - struct segment *CurrentPoint; - - IfTrace0((FontDebug), "DoClosePath\n"); - CurrentPoint = Phantom(path); - path = ClosePath(path); - path = Join(Snap(path), CurrentPoint); - return(0); -} - -/* subr# CALLSUBR - */ -/* Calls a CharString subroutine with index */ -/* subr# from the Subrs array */ -static int CallSubr(subrno) - int subrno; -{ - IfTrace1((FontDebug), "CallSubr %d\n", subrno); - if ((subrno < 0) || (subrno >= SubrsP->len)) - Error0i("CallSubr: subrno out of range\n"); - PushCall(CharStringP, strindex, r); - CharStringP = &SubrsP->data.arrayP[subrno]; - StartDecrypt(); - return(0); -} - -/* - RETURN - */ -/* Returns from a Subrs array CharString */ -/* subroutine called with CALLSUBR */ -static int Return() -{ - IfTrace0((FontDebug), "Return\n"); - PopCall(&CharStringP, &strindex, &r); - return(0); -} - -/* - ENDCHAR |- */ -/* Finishes a CharString outline */ -/* Executes SETCHACHEDEVICE using a bounding box */ -/* it computes directly from the character outline */ -/* and using the width information acquired from a previous */ -/* HSBW or SBW. It then calls a special version of FILL */ -/* or STROKE depending on the value of PaintType in the */ -/* font dictionary */ -static int EndChar() -{ - IfTrace0((FontDebug), "EndChar\n"); - - /* There is no need to compute and set bounding box for - the cache, since XIMAGER does that on the fly. */ - - /* Perform a Closepath just in case the command was left out */ - path = ClosePath(path); - - /* Set character width */ - path = Join(Snap(path), Loc(CharSpace, escapementX, escapementY)); - return(0); - -} - -/* |- dx dy RMOVETO |- */ -/* Behaves like RMOVETO in PostScript */ -static int RMoveTo(dx,dy) - DOUBLE dx,dy; -{ - struct segment *B; - - IfTrace2((FontDebug), "RMoveTo %f %f\n", dx, dy); - - B = Loc(CharSpace, dx, dy); - - if (ProcessHints) { - currx += dx; - curry += dy; - /* B = Join(B, FindStems(currx, curry)); */ - B = Join(B, FindStems(currx, curry, 0.0, 0.0)); - } - - path = Join(path, B); - return(0); -} - -/* - DOTSECTION |- */ -/* Brackets an outline section for the dots in */ -/* letters such as "i", "j", and "!". */ -static int DotSection() -{ - IfTrace0((FontDebug), "DotSection\n"); - InDotSection = !InDotSection; - return(0); -} - -/* |- asb adx ady bchar achar SEAC |- */ -/* Standard Encoding Accented Character. */ -static int Seac(asb, adx, ady, bchar, achar) - DOUBLE asb, adx, ady; - unsigned char bchar, achar; -{ - int Code; - struct segment *mypath; - - IfTrace4((FontDebug), "SEAC %f %f %f %d ", asb, adx, ady, bchar); - IfTrace1((FontDebug), "%d\n", achar); - - /* Move adx - asb, ady over and up from base char's sbpoint. */ - /* (We use adx - asb to counteract the accents sb shift.) */ - /* The variables accentoffsetX/Y modify sidebearingX/Y in Sbw(). */ - /* Note that these incorporate the base character's sidebearing shift by */ - /* using the current sidebearingX, Y values. */ - accentoffsetX = sidebearingX + adx - asb; - accentoffsetY = sidebearingY + ady; - - /* Set path = NULL to avoid complaints from Sbw(). */ - path = NULL; - - /* Go find the CharString for the accent's code via an upcall */ - CharStringP = GetType1CharString(Environment, achar); - if (CharStringP == NULL) { - Error1i("Invalid accent ('%03o) in SEAC\n", achar); - } - StartDecrypt(); - - ClearStack(); - ClearPSFakeStack(); - ClearCallStack(); - - for (;;) { - if (!DoRead(&Code)) break; - Decode(Code); - if (errflag) return(0); - } - /* Copy snapped path to mypath and set path to NULL as above. */ - mypath = Snap(path); - path = NULL; - - /* We must reset these to null now. */ - accentoffsetX = accentoffsetY = 0; - - /* go find the CharString for the base char's code via an upcall */ - CharStringP = GetType1CharString(Environment, bchar); - StartDecrypt(); - - ClearStack(); - ClearPSFakeStack(); - ClearCallStack(); - - FinitStems(); - InitStems(); - - for (;;) { - if (!DoRead(&Code)) break; - Decode(Code); - if (errflag) return(0); - } - path = Join(mypath, path); - return(0); -} - - -/* |- sbx sby wx wy SBW |- */ -/* Set the left sidebearing point to (sbx,sby), */ -/* set the character width vector to (wx,wy). */ -static int Sbw(sbx, sby, wx, wy) - DOUBLE sbx, sby, wx, wy; -{ - IfTrace4((FontDebug), "SBW %f %f %f %f\n", sbx, sby, wx, wy); - - escapementX = wx; /* Character width vector */ - escapementY = wy; - - /* Sidebearing values are sbx, sby args, plus accent offset from Seac(). */ - sidebearingX = sbx + accentoffsetX; - sidebearingY = sby + accentoffsetY; - - path = Join(path, Loc(CharSpace, sidebearingX, sidebearingY)); - if (ProcessHints) {currx = sidebearingX; curry = sidebearingY;} - return(0); -} - - /* num1 num2 DIV quotient */ -/* Behaves like DIV in the PostScript language */ -static DOUBLE Div(num1, num2) - DOUBLE num1, num2; -{ - IfTrace2((FontDebug), "Div %f %f\n", num1, num2); - return(num1 / num2); -} - -/* - The following four subroutines (FlxProc, FlxProc1, FlxProc2, and - HintReplace) are C versions of the OtherSubrs Programs, which were - were published in the Adobe Type 1 Font Format book. - - The Flex outline fragment is described by - c1: (x0, y0) = c3: (x0, yshrink(y0)) or (xshrink(x0), y0) - " (x1, y1) = " (x1, yshrink(y1)) or (xshrink(x1), y1) - " (x2, y2) - reference point - c2: (x0, y0) = c4: (x0, yshrink(y0)) or (xshrink(x0), y0) - " (x1, y1) = " (x1, yshrink(y1)) or (xshrink(x1), y1) - " (x2, y2) = " (x2, y2), rightmost endpoint - c3: (x0, y0) - control point, 1st Bezier curve - " (x1, y1) - control point, -"- - " (x2, y2) - end point, -"- - c4: (x0, y0) - control point, 2nd Bezier curve - " (x1, y1) - control point, -"- - " (x2, y2) - end point, -"- - ep: (epY, epX) - final endpoint (should be same as c4: (x2, y2)) - idmin - minimum Flex height (1/100 pixel) at which to render curves -*/ - -#define dtransform(dxusr,dyusr,dxdev,dydev) { \ - register struct segment *point = Loc(CharSpace, dxusr, dyusr); \ - QueryLoc(point, IDENTITY, dxdev, dydev); \ - Destroy(point); \ -} - -#define itransform(xdev,ydev,xusr,yusr) { \ - register struct segment *point = Loc(IDENTITY, xdev, ydev); \ - QueryLoc(point, CharSpace, xusr, yusr); \ - Destroy(point); \ -} - -#define transform(xusr,yusr,xdev,ydev) dtransform(xusr,yusr,xdev,ydev) - -#define PaintType (0) - -#define lineto(x,y) { \ - struct segment *CurrentPoint; \ - DOUBLE CurrentX, CurrentY; \ - CurrentPoint = Phantom(path); \ - QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); \ - Destroy(CurrentPoint); \ - RLineTo(x - CurrentX, y - CurrentY); \ -} - -#define curveto(x0,y0,x1,y1,x2,y2) { \ - struct segment *CurrentPoint; \ - DOUBLE CurrentX, CurrentY; \ - CurrentPoint = Phantom(path); \ - QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); \ - Destroy(CurrentPoint); \ - RRCurveTo(x0 - CurrentX, y0 - CurrentY, x1 - x0, y1 - y0, x2 - x1, y2 - y1); \ -} - -#define xshrink(x) ((x - c4x2) * shrink +c4x2) -#define yshrink(y) ((y - c4y2) * shrink +c4y2) - -#define PickCoords(flag) \ - if (flag) { /* Pick "shrunk" coordinates */ \ - x0 = c1x0; y0 = c1y0; \ - x1 = c1x1; y1 = c1y1; \ - x2 = c1x2; y2 = c1y2; \ - x3 = c2x0; y3 = c2y0; \ - x4 = c2x1; y4 = c2y1; \ - x5 = c2x2; y5 = c2y2; \ - } else { /* Pick original coordinates */ \ - x0 = c3x0; y0 = c3y0; \ - x1 = c3x1; y1 = c3y1; \ - x2 = c3x2; y2 = c3y2; \ - x3 = c4x0; y3 = c4y0; \ - x4 = c4x1; y4 = c4y1; \ - x5 = c4x2; y5 = c4y2; \ - } - -/* FlxProc() = OtherSubrs[0]; Main part of Flex */ -/* Calling sequence: 'idmin epX epY 3 0 callothersubr' */ -/* Computes Flex values, and renders the Flex path, */ -/* and returns (leaves) ending coordinates on stack */ -static void FlxProc(c1x2, c1y2, c3x0, c3y0, c3x1, c3y1, c3x2, c3y2, - c4x0, c4y0, c4x1, c4y1, c4x2, c4y2, epY, epX, idmin) - DOUBLE c1x2, c1y2; - DOUBLE c3x0, c3y0, c3x1, c3y1, c3x2, c3y2; - DOUBLE c4x0, c4y0, c4x1, c4y1, c4x2, c4y2; - DOUBLE epX, epY; - int idmin; -{ - DOUBLE dmin; - DOUBLE c1x0, c1y0, c1x1, c1y1; - DOUBLE c2x0, c2y0, c2x1, c2y1, c2x2, c2y2; - char yflag; - DOUBLE x0, y0, x1, y1, x2, y2, x3, y3, x4, y4, x5, y5; - DOUBLE cxx, cyx, cxy, cyy; /* Transformation matrix */ - int flipXY; - DOUBLE x, y; - DOUBLE erosion = 1; /* Device parameter */ - /* Erosion may have different value specified in 'internaldict' */ - DOUBLE shrink; - DOUBLE dX, dY; - char erode; - DOUBLE eShift; - DOUBLE cx, cy; - DOUBLE ex, ey; - - Destroy(path); - path = FlxOldPath; /* Restore previous path (stored in FlxProc1) */ - - if (ProcessHints) { - dmin = TYPE1_ABS(idmin) / 100.0; /* Minimum Flex height in pixels */ - - c2x2 = c4x2; c2y2 = c4y2; /* Point c2 = c4 */ - - yflag = FABS(c1y2 - c3y2) > FABS(c1x2 - c3x2); /* Flex horizontal? */ - - QuerySpace(CharSpace, &cxx, &cyx, &cxy, &cyy); /* Transformation matrix */ - - if (FABS(cxx) < 0.00001 || FABS(cyy) < 0.00001) - flipXY = -1; /* Char on side */ - else if (FABS(cyx) < 0.00001 || FABS(cxy) < 0.00001) - flipXY = 1; /* Char upright */ - else - flipXY = 0; /* Char at angle */ - - if (yflag) { /* Flex horizontal */ - if (flipXY == 0 || c3y2 == c4y2) { /* Char at angle or Flex height = 0 */ - PickCoords(FALSE); /* Pick original control points */ - } else { - shrink = FABS((c1y2 - c4y2) / (c3y2 - c4y2)); /* Slope */ - - c1x0 = c3x0; c1y0 = yshrink(c3y0); - c1x1 = c3x1; c1y1 = yshrink(c3y1); - c2x0 = c4x0; c2y0 = yshrink(c4y0); - c2x1 = c4x1; c2y1 = yshrink(c4y1); - - dtransform(0.0, ROUND(c3y2-c1y2), &x, &y); /* Flex height in pixels */ - dY = FABS((flipXY == 1) ? y : x); - PickCoords(dY < dmin); /* If Flex small, pick 'shrunk' control points */ - - if (FABS(y2 - c1y2) > 0.001) { /* Flex 'non-zero'? */ - transform(c1x2, c1y2, &x, &y); - - if (flipXY == 1) { - cx = x; cy = y; - } else { - cx = y; cy = x; - } - - dtransform(0.0, ROUND(y2-c1y2), &x, &y); - dY = (flipXY == 1) ? y : x; - if (ROUND(dY) != 0) - dY = ROUND(dY); - else - dY = (dY < 0) ? -1 : 1; - - erode = PaintType != 2 && erosion >= 0.5; - if (erode) - cy -= 0.5; - ey = cy + dY; - ey = CEIL(ey) - ey + FLOOR(ey); - if (erode) - ey += 0.5; - - if (flipXY == 1) { - itransform(cx, ey, &x, &y); - } else { - itransform(ey, cx, &x, &y); - } - - eShift = y - y2; - y1 += eShift; - y2 += eShift; - y3 += eShift; - } - } - } else { /* Flex vertical */ - if (flipXY == 0 || c3x2 == c4x2) { /* Char at angle or Flex height = 0 */ - PickCoords(FALSE); /* Pick original control points */ - } else { - shrink = FABS((c1x2 - c4x2) / (c3x2 - c4x2)); /* Slope */ - - c1x0 = xshrink(c3x0); c1y0 = c3y0; - c1x1 = xshrink(c3x1); c1y1 = c3y1; - c2x0 = xshrink(c4x0); c2y0 = c4y0; - c2x1 = xshrink(c4x1); c2y1 = c4y1; - - dtransform(ROUND(c3x2 - c1x2), 0.0, &x, &y); /* Flex height in pixels */ - dX = FABS((flipXY == -1) ? y : x); - PickCoords(dX < dmin); /* If Flex small, pick 'shrunk' control points */ - - if (FABS(x2 - c1x2) > 0.001) { - transform(c1x2, c1y2, &x, &y); - if (flipXY == -1) { - cx = y; cy = x; - } else { - cx = x; cy = y; - } - - dtransform(ROUND(x2-c1x2), 0.0, &x, &y); - dX = (flipXY == -1) ? y : x; - if (ROUND(dX) != 0) - dX = ROUND(dX); - else - dX = (dX < 0) ? -1 : 1; - - erode = PaintType != 2 && erosion >= 0.5; - if (erode) - cx -= 0.5; - ex = cx + dX; - ex = CEIL(ex) - ex + FLOOR(ex); - if (erode) - ex += 0.5; - - if (flipXY == -1) { - itransform(cy, ex, &x, &y); - } else { - itransform(ex, cy, &x, &y); - } - - eShift = x - x2; - x1 += eShift; - x2 += eShift; - x3 += eShift; - } - } - } - - if (x2 == x5 || y2 == y5) { - lineto(x5, y5); - } else { - curveto(x0, y0, x1, y1, x2, y2); - curveto(x3, y3, x4, y4, x5, y5); - } - } else { /* ProcessHints is off */ - PickCoords(FALSE); /* Pick original control points */ - curveto(x0, y0, x1, y1, x2, y2); - curveto(x3, y3, x4, y4, x5, y5); - } - - PSFakePush(epY); - PSFakePush(epX); -} - -/* FlxProc1() = OtherSubrs[1]; Part of Flex */ -/* Calling sequence: '0 1 callothersubr' */ -/* Saves and clears path, then restores currentpoint */ -static void FlxProc1() -{ - struct segment *CurrentPoint; - - CurrentPoint = Phantom(path); - - FlxOldPath = path; - path = CurrentPoint; -} - -/* FlxProc2() = OtherSubrs[2]; Part of Flex */ -/* Calling sequence: '0 2 callothersubr' */ -/* Returns currentpoint on stack */ -static void FlxProc2() -{ - struct segment *CurrentPoint; - DOUBLE CurrentX, CurrentY; - - CurrentPoint = Phantom(path); - QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); - Destroy(CurrentPoint); - - /* Push CurrentPoint on fake PostScript stack */ - PSFakePush(CurrentX); - PSFakePush(CurrentY); -} - -/* HintReplace() = OtherSubrs[3]; Hint Replacement */ -/* Calling sequence: 'subr# 1 3 callothersubr pop callsubr' */ -/* Reinitializes stem hint structure */ -static void HintReplace() -{ - /* Effectively retire the current stems, but keep them around for */ - /* revhint use in case we are in a stem when we replace hints. */ - currstartstem = numstems; - - /* 'subr#' is left on PostScript stack (for 'pop callsubr') */ -} - -/* arg1 ... argn n othersubr# CALLOTHERSUBR - */ -/* Make calls on the PostScript interpreter (or call equivalent C code) */ -/* NOTE: The n arguments have been pushed on the fake PostScript stack */ -static int CallOtherSubr(othersubrno) - int othersubrno; -{ - IfTrace1((FontDebug), "CallOtherSubr %d\n", othersubrno); - - switch(othersubrno) { - case 0: /* OtherSubrs[0]; Main part of Flex */ - if (PSFakeTop < 16) Error0i("CallOtherSubr: PSFakeStack low"); - ClearPSFakeStack(); - FlxProc( - PSFakeStack[0], PSFakeStack[1], PSFakeStack[2], PSFakeStack[3], - PSFakeStack[4], PSFakeStack[5], PSFakeStack[6], PSFakeStack[7], - PSFakeStack[8], PSFakeStack[9], PSFakeStack[10], PSFakeStack[11], - PSFakeStack[12], PSFakeStack[13], PSFakeStack[14], PSFakeStack[15], - (int) PSFakeStack[16] - ); - break; - case 1: /* OtherSubrs[1]; Part of Flex */ - FlxProc1(); - break; - case 2: /* OtherSubrs[2]; Part of Flex */ - FlxProc2(); - break; - case 3: /* OtherSubrs[3]; Hint Replacement */ - HintReplace(); - break; - case 12: /* OtherSubrs[12]: Counter Control Hinting */ - /* We do nothing, because later OtherSubrs[13] will - remove data from the PS-stack */ - break; - case 13: - /* We pop all elements from PSFakeStack. They may either have been left - from previous calls to OtherSubr #12 or have been pushed for this - call */ - ClearPSFakeStack(); - break; - default: { /* call OtherSubrs[4] or higher if PostScript is present */ - - } - } - return(0); -} - -/* |- x y SETCURRENTPOINT |- */ -/* Sets the current point to (x,y) in absolute */ -/* character space coordinates without per- */ -/* forming a CharString MOVETO command */ -static int SetCurrentPoint(x, y) - DOUBLE x, y; -{ - IfTrace2((FontDebug), "SetCurrentPoint %f %f\n", x, y); - - currx = x; - curry = y; - return(0); -} - -/* The Type1Char routine for use by PostScript. */ -/************************************************/ -struct xobject *Type1Char(psfont *env, struct XYspace *S, - psobj *charstrP, psobj *subrsP, - psobj *osubrsP, - struct blues_struct *bluesP, - int *modeP, char *charname) -{ - int Code; - - path = NULL; - errflag = FALSE; - - /* Make parameters available to all Type1 routines */ - currentchar=charname; - Environment = (char *)env; - CharSpace = S; /* used when creating path elements */ - CharStringP = charstrP; - SubrsP = subrsP; - OtherSubrsP = osubrsP; - ModeP = modeP; - - blues = bluesP; - - /* compute the alignment zones */ - SetRasterFlags(); - ComputeAlignmentZones(); - StartDecrypt(); - ClearStack(); - ClearPSFakeStack(); - ClearCallStack(); - InitStems(); - - currx = curry = 0; - escapementX = escapementY = 0; - sidebearingX = sidebearingY = 0; - accentoffsetX = accentoffsetY = 0; - wsoffsetX = wsoffsetY = 0; /* No shift to preserve whitspace. */ - wsset = 0; /* wsoffsetX,Y haven't been set yet. */ - - for (;;) { - if (!DoRead(&Code)) break; - Decode(Code); - if (errflag) break; - } - FinitStems(); - - /* Report a possible error: */ - *modeP=errflag; - - /* Clean up if an error has occurred */ - if (errflag) { - if (path != NULL) { - Destroy(path); /* Reclaim storage */ - path = NULL; /* Indicate that character could not be built */ - } - } - - return((struct xobject *) path); -} - - -/* We add a function to implement underlining in Type1-Routines. */ -struct xobject *Type1Line(psfont *env, struct XYspace *S, - float line_position, - float line_thickness, - float line_length) -{ - - path = NULL; - errflag = FALSE; - - /* Make parameters available to all Type1 routines */ - Environment = (char *)env; - CharSpace = S; /* used when creating path elements */ - - currx = curry = 0; - escapementX = escapementY = 0; - sidebearingX = sidebearingY = 0; - /* We have to initialize the stems-structures because - the lineto commands refer to them! */ - SetRasterFlags(); - InitStems(); - - /* Draw Character */ - Sbw(-1.0*line_length, 0.0, 0.0, 0.0); - RMoveTo( 0.0, (double) (line_position+0.5*line_thickness)); - RLineTo( 0.0, (double) -line_thickness); - RLineTo( (double) line_length, 0.0); - RLineTo( 0.0, (double) line_thickness); - DoClosePath(); - EndChar(); - - /* De-Initialize the stems (of course there have not been - defined any) */ - FinitStems(); - - return((struct xobject *)path); - -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/types.h xdvik-22.40n/libs/t1lib/lib/type1/types.h --- xdvik-22.40l/libs/t1lib/lib/type1/types.h Wed Apr 18 14:24:14 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/types.h Thu Jan 1 00:00:00 1970 @@ -1,32 +0,0 @@ -/* - * File: types.h - * Purpose: define basic types so that program is portable to non 32 bits - * platforms - * Version: 1.0 (Dec. 1993) - * Author: Piet Tutelaers - */ - -#ifndef __TYPES__ -#define __TYPES__ - -#if defined(WORD16) -typedef unsigned short USHORT; /* 16 bits */ -typedef short SHORT; /* 16 bits */ -typedef long LONG; /* 32 bits */ -typedef unsigned long ULONG; /* 32 bits */ -typedef double DOUBLE; /* 64 bits */ -#elif defined(WORD64) -typedef unsigned short USHORT; /* 16 bits */ -typedef short SHORT; /* 16 bits */ -typedef int LONG; /* 32 bits */ -typedef unsigned long ULONG; /* 32 bits */ -typedef double DOUBLE; /* 64 bits */ -#else /* default: WORD32 */ -typedef unsigned short USHORT; /* 16 bits */ -typedef short SHORT; /* 16 bits */ -typedef int LONG; /* 32 bits */ -typedef unsigned int ULONG; /* 32 bits */ -typedef double DOUBLE; /* 64 bits */ -#endif - -#endif /* __TYPES__ */ diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/util.c xdvik-22.40n/libs/t1lib/lib/type1/util.c --- xdvik-22.40l/libs/t1lib/lib/type1/util.c Wed Apr 18 14:24:14 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/util.c Thu Jan 1 00:00:00 1970 @@ -1,204 +0,0 @@ -/* $XConsortium: util.c,v 1.6 92/03/26 16:42:26 eswu Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */ - -#include "types.h" -#include -#include -#include "util.h" -#include "fontmisc.h" - -static char *vm_base = NULL; /* Start of virtual memory area */ - char *vm_next = NULL; /* Pointer to first free byte */ - LONG vm_free = 0; /* Count of free bytes */ - LONG vm_size = 0; /* Total size of memory */ - -/* The following global variable is for detecting a trial to - allocate a second chunk---not to be done with the t1lib, since - a later reallocation would lead to segmentation faults! - */ -int vm_init_count; -/* This is the amount of VM, the font is tried to be loaded in. */ -int vm_init_amount; - - -/* - * Initialize memory. - */ - -extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */ - -boolean vm_init() -{ - /* Check whether it is the first piece of memory for the - current font or not. If so, simulate lacking memory to - indicate that the font should be tried to load with a - vitual memory twice as large! - */ - if (vm_init_count>0){ - vm_init_count++; - return(FALSE); - } - vm_init_count++; - - vm_next = vm_base = (char *) calloc( vm_init_amount, sizeof(char)); - - if (vm_base != NULL) { - vm_free = vm_init_amount; - vm_size = vm_init_amount; - tokenMaxP = vm_next_byte() + vm_init_amount; - return(TRUE); - } - else - return(FALSE); -} - -char *vm_alloc(bytes) - unsigned int bytes; -{ - char *answer; - - /* Align returned bytes to 64-bit boundary */ - bytes = (bytes + 7) & ~7; - - - /* take space from what is left otherwise allocate another CHUNK */ - if (bytes > vm_free){ - if (!vm_init()) return NULL; - } - else{ - answer = vm_next; - vm_free -= bytes; - vm_next += bytes; - return answer; - } - - /* Never reached, but compiler is happy: */ - return NULL; - -} - -/* - * Format an Integer object - */ -void objFormatInteger( psobj *objP, int value) -{ - if (objP != NULL) { - objP->type = OBJ_INTEGER; - objP->len = 0; - objP->data.integer = value; - } -} - -/* - * Format a Real object - */ -void objFormatReal(psobj *objP, float value) -{ - if (objP != NULL) { - objP->type = OBJ_REAL; - objP->len = 0; - objP->data.real = value; - } -} - -/* - * Format a Boolean object - */ -void objFormatBoolean(psobj *objP, boolean value) -{ - if (objP != NULL) { - objP->type = OBJ_BOOLEAN; - objP->len = 0; - objP->data.boolean = value; - } -} - -/* - * Format an Encoding object - */ -void objFormatEncoding(psobj *objP, int length, psobj *valueP) -{ - if (objP != NULL) { - objP->type = OBJ_ENCODING; - objP->len = length; - objP->data.arrayP = valueP; - } -} - -/* - * Format an Array object - */ -void objFormatArray(psobj *objP, int length, psobj *valueP) -{ - if (objP != NULL) { - objP->type = OBJ_ARRAY; - objP->len = length; - objP->data.arrayP = valueP; - } -} - - -/* - * Format a String object - */ -void objFormatString(psobj *objP, int length, char *valueP) -{ - if (objP != NULL) { - objP->type = OBJ_STRING; - objP->len = length; - objP->data.valueP = valueP; - } -} - -/* - * Format a Name object - */ -void objFormatName( psobj *objP, int length, char *valueP) -{ - if (objP != NULL) { - objP->type = OBJ_NAME; - objP->len = length; - objP->data.nameP = valueP; - } -} - -/* - * Format a File object - */ -void objFormatFile(psobj *objP, FILE *valueP) -{ - if (objP != NULL) { - objP->type = OBJ_FILE; - objP->len = 0; - objP->data.fileP = valueP; - } -} - diff -Naur xdvik-22.40l/libs/t1lib/lib/type1/util.h xdvik-22.40n/libs/t1lib/lib/type1/util.h --- xdvik-22.40l/libs/t1lib/lib/type1/util.h Wed Apr 18 14:24:14 2001 +++ xdvik-22.40n/libs/t1lib/lib/type1/util.h Thu Jan 1 00:00:00 1970 @@ -1,182 +0,0 @@ -/* $XConsortium: util.h,v 1.3 92/03/26 16:42:29 eswu Exp $ */ -/* Copyright International Business Machines,Corp. 1991 - * All Rights Reserved - * - * License to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the name of IBM not be used in advertising or - * publicity pertaining to distribution of the software without - * specific, written prior permission. - * - * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES - * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT - * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND - * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT - * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF - * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES - * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN - * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ -#ifndef UTIL_H -#define UTIL_H -#include "types.h" - -#ifndef boolean -typedef int boolean; -#endif - -#ifndef TRUE -#define TRUE (1) -#endif - -#ifndef FALSE -#define FALSE (0) -#endif - -/***================================================================***/ -/* Portable definitions for 2's complement machines. - * NOTE: These really should be based on PostScript types, - * for example, sizeof(ps_integer), or sizeof(ps_unsigned) - */ -#define MAX_ULONG (~(ULONG)(0)) -/* This code is portable, assuming K&R C and 2's complement arithmetic */ -#define MAX_INTEGER \ - ((LONG)((((ULONG) 1)<<(sizeof(ULONG)*8-1))-1)) -#define MIN_INTEGER ((-MAX_INTEGER)-1) - -#define MAX_ARRAY_CNT (65535) -#define MAX_DICT_CNT (65535) -#define MAX_STRING_LEN (65535) -#define MAX_NAME_LEN (128) - -/* this is the size of memory allocated for reading fonts */ - -#define VM_SIZE (50*1024) -/***================================================================***/ - -#ifndef TYPE1_MIN -#define TYPE1_MIN(a,b) (((a)<(b)) ? a : b ) -#endif - -/***================================================================***/ -/* Routines for managing virtual memory */ -/***================================================================***/ -extern boolean vm_init(); -extern LONG vm_free; -extern LONG vm_size; -extern char *vm_next; -extern char *vm_alloc(); -/***================================================================***/ -/* Macros for managing virtual memory */ -/***================================================================***/ -#define vm_next_byte() (vm_next) -#define vm_free_bytes() (vm_free) -#define vm_avail(B) (B <= vm_free) - - - -/***================================================================***/ -/* Types of PostScript objects */ -/***================================================================***/ -#define OBJ_INTEGER (0) -#define OBJ_REAL (1) -#define OBJ_BOOLEAN (2) -#define OBJ_ARRAY (3) -#define OBJ_STRING (4) -#define OBJ_NAME (5) -#define OBJ_FILE (6) -#define OBJ_ENCODING (7) - -/***================================================================***/ -/* Value of PostScript objects */ -/***================================================================***/ -typedef union ps_value { - char *valueP; /* value pointer for unspecified type */ - int value; /* value for unspecified type */ - int integer; /* when type is OBJ_INTEGER */ - float real; /* when type is OBJ_REAL */ - int boolean; /* when type is OBJ_BOOLEAN */ - struct ps_obj *arrayP; /* when type is OBJ_ARRAY */ - unsigned char *stringP; /* when type is OBJ_STRING */ - char *nameP; /* when type is OBJ_NAME */ - FILE *fileP; /* when type is OBJ_FILE */ -} psvalue; - -/***================================================================***/ -/* Definition of a PostScript object */ -/***================================================================***/ -typedef struct ps_obj { - char type; - char unused; - unsigned short len; - union ps_value data; -} psobj; - -/***================================================================***/ -/* Definition of a PostScript Dictionary Entry */ -/***================================================================***/ -typedef struct ps_dict { - psobj key; - psobj value; -} psdict; - -/***================================================================***/ -/* Macros for testing type of PostScript objects */ -/***================================================================***/ -#define objIsInteger(o) ((o).type == OBJ_INTEGER) -#define objIsReal(o) ((o).type == OBJ_REAL) -#define objIsBoolean(o) ((o).type == OBJ_BOOLEAN) -#define objIsArray(o) ((o).type == OBJ_ARRAY) -#define objIsString(o) ((o).type == OBJ_STRING) -#define objIsName(o) ((o).type == OBJ_NAME) -#define objIsFile(o) ((o).type == OBJ_FILE) - -/***================================================================***/ -/* Macros for setting type of PostScript objects */ -/***================================================================***/ -#define objSetInteger(o) ((o).type = OBJ_INTEGER) -#define objSetReal(o) ((o).type = OBJ_REAL) -#define objSetBoolean(o) ((o).type = OBJ_BOOLEAN) -#define objSetArray(o) ((o).type = OBJ_ARRAY) -#define objSetString(o) ((o).type = OBJ_STRING) -#define objSetName(o) ((o).type = OBJ_NAME) -#define objSetFile(o) ((o).type = OBJ_FILE) - -/***================================================================***/ -/* Macros for testing type of PostScript objects (pointer access) */ -/***================================================================***/ -#define objPIsInteger(o) ((o)->type == OBJ_INTEGER) -#define objPIsReal(o) ((o)->type == OBJ_REAL) -#define objPIsBoolean(o) ((o)->type == OBJ_BOOLEAN) -#define objPIsArray(o) ((o)->type == OBJ_ARRAY) -#define objPIsString(o) ((o)->type == OBJ_STRING) -#define objPIsName(o) ((o)->type == OBJ_NAME) -#define objPIsFile(o) ((o)->type == OBJ_FILE) - -/***================================================================***/ -/* Macros for setting type of PostScript objects (pointer access) */ -/***================================================================***/ -#define objPSetInteger(o) ((o)->type = OBJ_INTEGER) -#define objPSetReal(o) ((o)->type = OBJ_REAL) -#define objPSetBoolean(o) ((o)->type = OBJ_BOOLEAN) -#define objPSetArray(o) ((o)->type = OBJ_ARRAY) -#define objPSetString(o) ((o)->type = OBJ_STRING) -#define objPSetName(o) ((o)->type = OBJ_NAME) -#define objPSetFile(o) ((o)->type = OBJ_FILE) - -/***================================================================***/ -/* Entry point for Type1Char to get entry from CharStrings */ -/***================================================================***/ -extern psobj *GetType1CharString(); - -#endif diff -Naur xdvik-22.40l/libs/t1lib/libtool xdvik-22.40n/libs/t1lib/libtool --- xdvik-22.40l/libs/t1lib/libtool Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/libtool Sat Sep 14 00:24:47 2002 @@ -0,0 +1,4284 @@ +#! /bin/sh + +# libtool - Provide generalized library-building support services. +# Generated automatically by ltconfig (GNU libtool 1.3.5 (1.385.2.206 2000/05/27 11:12:27)) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +# Libtool was configured as follows, on host hekate.localdomain: +# +# CC="gcc" CFLAGS="-g -O2" CPPFLAGS="" \ +# LD="/usr/bin/ld" LDFLAGS="" LIBS="" \ +# NM="/usr/bin/nm -B" RANLIB="ranlib" LN_S="ln -s" \ +# DLLTOOL="" OBJDUMP="" AS="" \ +# /home/ulrich/projects/xdvik/libs/t1lib/ac-tools/ltconfig --cache-file=../.././config.cache --with-gcc --with-gnu-ld --no-verify /home/ulrich/projects/xdvik/libs/t1lib/ac-tools/ltmain.sh i686-pc-linux-gnu +# +# Compiler and other test output produced by ltconfig, useful for +# debugging ltconfig, is in ./config.log if it exists. + +# The version of ltconfig that generated this script. +LTCONFIG_VERSION="1.3.5" + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias=i686-pc-linux-gnu +host=i686-pc-linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" + +# The default C compiler. +CC="gcc" + +# The linker used to build libraries. +LD="/usr/bin/ld" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/bin/nm -B" + +# Used on cygwin: DLL creation program. +DLLTOOL="dlltool" + +# Used on cygwin: object dumper. +OBJDUMP="objdump" + +# Used on cygwin: assembler. +AS="as" + +# The name of the directory that contains temporary libtool files. +objdir=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC" + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Can we write directly to a .lo ? +compiler_o_lo="yes" + +# Must we lock files when doing compilation ? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin -fno-rtti -fno-exceptions" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec="\${libname}\${release}.so\$versuffix \${libname}\${release}.so\$major \$libname.so" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}.so\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR cru \$oldlib\$oldobjs~\$RANLIB \$oldlib" +old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared \$libobjs \$deplibs \$linkopts \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$CC -shared \$libobjs \$deplibs \$linkopts \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGISTW]\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern char \\1;/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# Compile-time system search path for libraries +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib" + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | sed 's/.* //' | sort | uniq > \$export_symbols" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + +# Symbols that must always be exported. +include_expsyms="" + +### END LIBTOOL CONFIG + +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case "$arg" in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + execute_dlfiles) + eval "$prev=\"\$$prev \$arg\"" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case "$arg" in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case "$nonopt" in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case "$arg" in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case "$mode" in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + # Accept any command-line options. + case "$arg" in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + esac + + case "$user_target" in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly in scan + # sets, so we specify it separately. + case "$lastarg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case "$user_target" in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case "$libobj" in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case "$libobj" in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag" && test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + command="$base_compile $srcfile" + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link) + modename="$modename: link" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (!dll) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case "$prev" in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case "$arg" in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case "$arg" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi + + prevarg="$arg" + + case "$arg" in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: not more than one -exported-symbols argument allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + dir="$absdir" + ;; + esac + case " $deplibs " in + *" $arg "*) ;; + *) deplibs="$deplibs $arg";; + esac + case " $lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir";; + esac + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + case ":$dllsearchpath:" in + ::) dllsearchpath="$dllsearchdir";; + *":$dllsearchdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dllsearchdir";; + esac + ;; + esac + ;; + + -l*) + if test "$arg" = "-lc"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # These systems don't actually have c library (as such) + continue + ;; + esac + elif test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # These systems don't actually have math library (as such) + continue + ;; + esac + fi + deplibs="$deplibs $arg" + ;; + + -module) + module=yes + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # If we have no pic_flag, then this is the same as -all-static. + if test -z "$pic_flag" && test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + + *.o | *.obj | *.a | *.lib) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A library object. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + fi + libobjs="$libobjs $arg" + ;; + + *.la) + # A libtool-controlled library. + + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + # If there is no directory component, then add one. + case "$arg" in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + + if test "X$installed" = Xyes; then + dir="$libdir" + else + dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + fi + + if test -n "$dependency_libs"; then + # Extract -R and -L from dependency_libs + temp_deplibs= + for deplib in $dependency_libs; do + case "$deplib" in + -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + case " $rpath $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + -L*) case "$compile_command $temp_deplibs " in + *" $deplib "*) ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` + case " $lib_search_path " in + *" $temp_dir "*) ;; + *) lib_search_path="$lib_search_path $temp_dir";; + esac + ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + done + dependency_libs="$temp_deplibs" + fi + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$deplibs$dependency_libs" + compile_command="$compile_command $dir/$old_library$dependency_libs" + finalize_command="$finalize_command $dir/$old_library$dependency_libs" + continue + fi + + # This library was specified with -dlopen. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking statically, + # we need to preload. + prev=dlprefiles + else + # We should not create a dependency on this library, but we + # may need any libraries it requires. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + prev= + continue + fi + fi + + # The library was specified with -dlpreopen. + if test "$prev" = dlprefiles; then + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + dlprefiles="$dlprefiles $dir/$old_library" + else + dlprefiles="$dlprefiles $dir/$linklib" + fi + prev= + fi + + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + link_against_libtool_libs="$link_against_libtool_libs $arg" + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # We need an absolute path. + case "$dir" in + [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + ;; + esac + + # This is the magic to use -rpath. + # Skip directories that are in the system default run-time + # search path, unless they have been requested with -R. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + deplibs="$deplibs $dir/$linklib" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + if test -n "$dllsearchpath"; then + dllsearchpath="$dllsearchpath:$dllsearchdir" + else + dllsearchpath="$dllsearchdir" + fi + ;; + esac + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + deplibs="$deplibs $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$absdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + fi + + # Add in any libraries that this one depends upon. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + esac + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + case "$output" in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *.a | *.lib) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + ;; + + *.la) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$outputname" in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + if test -n "$objs"; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + exit 1 + fi + + # How the heck are we supposed to write a wrapper for a shared library? + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 + exit 1 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + dependency_libs="$deplibs" + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$age" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case "$version_type" in + none) ;; + + irix) + major=`expr $current - $age + 1` + versuffix="$major.$revision" + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + windows) + # Like Linux, but with '-' rather than '.', since we only + # want one extension on Windows 95. + major=`expr $current - $age` + versuffix="-$major-$age-$revision" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + dependency_libs="$deplibs" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody*) + # rhapsody is a little odd... + deplibs="$deplibs -framework System" + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac + fi + + # Create the output directory, or remove our outputs if we need to. + if test -d $output_objdir; then + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + else + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + if test "$build_libtool_libs" = yes; then + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case "$deplibs_check_method" in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case "$potliblink" in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linkopts="$linkopts $flag" + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + *.lo | *.o | *.obj) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + # Anything else should be a program. + *) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case "$dlsyms" in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{\ +" + + sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ + -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ + < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr_t) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case "$host" in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case "$0" in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + link_against_libtool_libs='$link_against_libtool_libs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname' + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (cd \"\$thisdir\" && eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case "$output" in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + if test -n "$xrpath"; then + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + done + dependency_libs="$temp_xrpath $dependency_libs" + fi + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + fi + $rm $output + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$dlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Directory that this library needs to be installed in: +libdir='$install_libdir'\ +" + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case "$arg" in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case "$file" in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case "$file" in + *.a | *.lib) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$realname $destdir/$realname" + $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case "$destfile" in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.o | *.obj) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + link_against_libtool_libs= + relink_command= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$link_against_libtool_libs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $link_against_libtool_libs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case "$file" in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case "$file" in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool uninstall mode + uninstall) + modename="$modename: uninstall" + rm="$nonopt" + files= + + for arg + do + case "$arg" in + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + rmfiles="$file" + + case "$name" in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $dir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" + + $show "$rm $rmfiles" + $run $rm $rmfiles + + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + # FIXME: should reinstall the best remaining shared library. + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + + *) + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + esac + done + exit 0 + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case "$mode" in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff -Naur xdvik-22.40l/libs/t1lib/parseAFM.c xdvik-22.40n/libs/t1lib/parseAFM.c --- xdvik-22.40l/libs/t1lib/parseAFM.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/parseAFM.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1292 @@ +/*-------------------------------------------------------------------------- + ----- File: parseAFM.c + ----- Author: Adobe Systems Inc., modifications by + Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-11-01 + ----- Description: This file is part of the t1-library. It is the original + parseAFM.h modified at a few points, especially for + reading MSDOS-style AFM files.. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +/* + * (C) 1988, 1989, 1990 by Adobe Systems Incorporated. All rights reserved. + * + * This file may be freely copied and redistributed as long as: + * 1) This entire notice continues to be included in the file, + * 2) If the file has been modified in any way, a notice of such + * modification is conspicuously indicated. + * + * PostScript, Display PostScript, and Adobe are registered trademarks of + * Adobe Systems Incorporated. + * + * ************************************************************************ + * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT + * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS + * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR + * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY + * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, + * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + * ************************************************************************ + */ + +/* parseAFM.c + * + * This file is used in conjuction with the parseAFM.h header file. + * This file contains several procedures that are used to parse AFM + * files. It is intended to work with an application program that needs + * font metric information. The program can be used as is by making a + * procedure call to "parseFile" (passing in the expected parameters) + * and having it fill in a data structure with the data from the + * AFM file, or an application developer may wish to customize this + * code. + * + * There is also a file, parseAFMclient.c, that is a sample application + * showing how to call the "parseFile" procedure and how to use the data + * after "parseFile" has returned. + * + * Please read the comments in parseAFM.h and parseAFMclient.c. + * + * History: + * original: DSM Thu Oct 20 17:39:59 PDT 1988 + * modified: DSM Mon Jul 3 14:17:50 PDT 1989 + * - added 'storageProblem' return code + * - fixed bug of not allocating extra byte for string duplication + * - fixed typos + * modified: DSM Tue Apr 3 11:18:34 PDT 1990 + * - added free(ident) at end of parseFile routine + * modified: DSM Tue Jun 19 10:16:29 PDT 1990 + * - changed (width == 250) to (width = 250) in initializeArray + */ + +#include +#include +#include +#include /* this seems to be necessary on some SCO-systems */ +#if !defined(_MSC_VER) +# include +#endif +#include +#include +#include "parseAFM.h" + +#define lineterm EOL /* line terminating character */ +#define normalEOF 1 /* return code from parsing routines used only */ + /* in this module */ +#define Space "space" /* used in string comparison to look for the width */ + /* of the space character to init the widths array */ +#define False "false" /* used in string comparison to check the value of */ + /* boolean keys (e.g. IsFixedPitch) */ + +#define MATCH(A,B) (strncmp((A),(B), MAX_NAME) == 0) + + + +/* Note: The functions token and linetoken are extended to be able + to parse AFM files with DOS-style line-ends under UNIX. I don't know + why AFM files which according to Adobe are explicitly intended to + be used under UNIX have MSDOS-style line ends. + + However, we parse the tokens based on the following atoms. This should + work on any system. +*/ +#define CR '\r' /* a carriage return */ +#define LF '\n' /* a linefeed, which is a newline under UNIX */ +#define CTRL_Z 0x1A /* some AFM files have this characters as an end + of file indicator. Who know why :) ? */ + + +/*************************** GLOBALS ***********************/ + +static char *ident = NULL; /* storage buffer for keywords */ + + +/* "shorts" for fast case statement + * The values of each of these enumerated items correspond to an entry in the + * table of strings defined below. Therefore, if you add a new string as + * new keyword into the keyStrings table, you must also add a corresponding + * parseKey AND it MUST be in the same position! + * + * IMPORTANT: since the sorting algorithm is a binary search, the strings of + * keywords must be placed in lexicographical order, below. [Therefore, the + * enumerated items are not necessarily in lexicographical order, depending + * on the name chosen. BUT, they must be placed in the same position as the + * corresponding key string.] The NOPE shall remain in the last position, + * since it does not correspond to any key string, and it is used in the + * "recognize" procedure to calculate how many possible keys there are. + */ + +typedef enum { + ASCENDER, CHARBBOX, CODE, COMPCHAR, CAPHEIGHT, COMMENT, + DESCENDER, ENCODINGSCHEME, ENDCHARMETRICS, ENDCOMPOSITES, + ENDFONTMETRICS, ENDKERNDATA, ENDKERNPAIRS, ENDTRACKKERN, + FAMILYNAME, FONTBBOX, FONTNAME, FULLNAME, ISFIXEDPITCH, + ITALICANGLE, KERNPAIR, KERNPAIRXAMT, LIGATURE, CHARNAME, + NOTICE, COMPCHARPIECE, STARTCHARMETRICS, STARTCOMPOSITES, + STARTFONTMETRICS, STARTKERNDATA, STARTKERNPAIRS, + STARTTRACKKERN, TRACKKERN, UNDERLINEPOSITION, + UNDERLINETHICKNESS, VERSION, XYWIDTH, XWIDTH, WEIGHT, XHEIGHT, + NOPE} PARSEKEY; + + +/* keywords for the system: + * This a table of all of the current strings that are vaild AFM keys. + * Each entry can be referenced by the appropriate parseKey value (an + * enumerated data type defined above). If you add a new keyword here, + * a corresponding parseKey MUST be added to the enumerated data type + * defined above, AND it MUST be added in the same position as the + * string is in this table. + * + * IMPORTANT: since the sorting algorithm is a binary search, the keywords + * must be placed in lexicographical order. And, NULL should remain at the + * end. + */ + +static char *keyStrings[] = { + "Ascender", "B", "C", "CC", "CapHeight", "Comment", + "Descender", "EncodingScheme", "EndCharMetrics", "EndComposites", + "EndFontMetrics", "EndKernData", "EndKernPairs", "EndTrackKern", + "FamilyName", "FontBBox", "FontName", "FullName", "IsFixedPitch", + "ItalicAngle", "KP", "KPX", "L", "N", + "Notice", "PCC", "StartCharMetrics", "StartComposites", + "StartFontMetrics", "StartKernData", "StartKernPairs", + "StartTrackKern", "TrackKern", "UnderlinePosition", + "UnderlineThickness", "Version", "W", "WX", "Weight", "XHeight", + NULL }; + +/*************************** PARSING ROUTINES **************/ + +/*************************** token *************************/ + +/* A "AFM File Conventions" tokenizer. That means that it will + * return the next token delimited by white space. See also + * the `linetoken' routine, which does a similar thing but + * reads all tokens until the next end-of-line. + */ +static char *token(stream) + FILE *stream; +{ + int ch, idx; + + /* skip over white space, instead of the systems EOL-character we check + explicitly for CR and LF as well as for ^Z. */ + while ((ch = fgetc(stream)) == ' ' || ch == CR || ch == LF || ch == CTRL_Z || + ch == ',' || ch == '\t' || ch == ';'); + + idx = 0; + + while (ch != EOF && ch != ' ' && ch != CR && ch != LF && + ch != CTRL_Z && ch != '\t' && ch != ':' && ch != ';'){ + ident[idx++] = ch; + ch = fgetc(stream); + } /* while */ + + if (ch == EOF && idx < 1) { + return ((char *)NULL); + } + if (idx >= 1 && ch != ':' ) { + ungetc(ch, stream); + } + if (idx < 1 ) { + ident[idx++] = ch; /* single-character token */ + } + ident[idx] = 0; + + return(ident); /* returns pointer to the token */ + +} /* token */ + + +/*************************** linetoken *************************/ + +/* "linetoken" will get read all tokens until the EOL character from + * the given stream. This is used to get any arguments that can be + * more than one word (like Comment lines and FullName). + */ + +static char *linetoken(stream) + FILE *stream; +{ + int ch, idx; + + while ((ch = fgetc(stream)) == ' ' || ch == '\t' ); + + idx = 0; + while (ch != EOF && ch != CR && ch != LF && ch != CTRL_Z) + { + ident[idx++] = ch; + ch = fgetc(stream); + } /* while */ + + ungetc(ch, stream); + ident[idx] = 0; + + return(ident); /* returns pointer to the token */ + +} /* linetoken */ + + +/*************************** recognize *************************/ + +/* This function tries to match a string to a known list of + * valid AFM entries (check the keyStrings array above). + * "ident" contains everything from white space through the + * next space, tab, or ":" character. + * + * The algorithm is a standard Knuth binary search. + */ + +static PARSEKEY recognize(ident) + register char *ident; +{ + int lower = 0, upper = (int) NOPE, midpoint=NOPE, cmpvalue; + BOOL found = T1LIB_FALSE; + + while ((upper >= lower) && !found) + { + midpoint = (lower + upper)/2; + if (keyStrings[midpoint] == NULL) break; + cmpvalue = strncmp(ident, keyStrings[midpoint], MAX_NAME); + if (cmpvalue == 0) found = T1LIB_TRUE; + else if (cmpvalue < 0) upper = midpoint - 1; + else lower = midpoint + 1; + } /* while */ + + if (found) return (PARSEKEY) midpoint; + else return NOPE; + +} /* recognize */ + + +/************************* parseGlobals *****************************/ + +/* This function is called by "parseFile". It will parse the AFM File + * up to the "StartCharMetrics" keyword, which essentially marks the + * end of the Global Font Information and the beginning of the character + * metrics information. + * + * If the caller of "parseFile" specified that it wanted the Global + * Font Information (as defined by the "AFM File Specification" + * document), then that information will be stored in the returned + * data structure. + * + * Any Global Font Information entries that are not found in a + * given file, will have the usual default initialization value + * for its type (i.e. entries of type int will be 0, etc). + * + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by + * parseFile to determine if there is more file to parse. + */ + +static BOOL parseGlobals(fp, gfi) + FILE *fp; + register GlobalFontInfo *gfi; +{ + BOOL cont = T1LIB_TRUE, save = (gfi != NULL); + int error = ok; + register char *keyword; + + while (cont) + { + keyword = token(fp); + + if (keyword == NULL) + /* Have reached an early and unexpected EOF. */ + /* Set flag and stop parsing */ + { + error = earlyEOF; + break; /* get out of loop */ + } + if (!save) + /* get tokens until the end of the Global Font info section */ + /* without saving any of the data */ + switch (recognize(keyword)) + { + case STARTCHARMETRICS: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + default: + break; + } /* switch */ + else + /* otherwise parse entire global font info section, */ + /* saving the data */ + switch(recognize(keyword)) + { + case STARTFONTMETRICS: + keyword = token(fp); + gfi->afmVersion = (char *) malloc(strlen(keyword) + 1); + strcpy(gfi->afmVersion, keyword); + break; + case COMMENT: + keyword = linetoken(fp); + break; + case FONTNAME: + keyword = linetoken(fp); + gfi->fontName = (char *) malloc(strlen(keyword) + 1); + strcpy(gfi->fontName, keyword); + break; + case ENCODINGSCHEME: + keyword = linetoken(fp); + gfi->encodingScheme = (char *) + malloc(strlen(keyword) + 1); + strcpy(gfi->encodingScheme, keyword); + break; + case FULLNAME: + keyword = linetoken(fp); + gfi->fullName = (char *) malloc(strlen(keyword) + 1); + strcpy(gfi->fullName, keyword); + break; + case FAMILYNAME: + keyword = linetoken(fp); + gfi->familyName = (char *) malloc(strlen(keyword) + 1); + strcpy(gfi->familyName, keyword); + break; + case WEIGHT: + keyword = linetoken(fp); + gfi->weight = (char *) malloc(strlen(keyword) + 1); + strcpy(gfi->weight, keyword); + break; + case ITALICANGLE: + keyword = token(fp); + gfi->italicAngle = atof(keyword); + if (errno == ERANGE) error = parseError; + break; + case ISFIXEDPITCH: + keyword = token(fp); + if (MATCH(keyword, False)) + gfi->isFixedPitch = 0; + else + gfi->isFixedPitch = 1; + break; + case UNDERLINEPOSITION: + keyword = token(fp); + gfi->underlinePosition = atoi(keyword); + break; + case UNDERLINETHICKNESS: + keyword = token(fp); + gfi->underlineThickness = atoi(keyword); + break; + case VERSION: + keyword = linetoken(fp); + gfi->version = (char *) malloc(strlen(keyword) + 1); + strcpy(gfi->version, keyword); + break; + case NOTICE: + keyword = linetoken(fp); + gfi->notice = (char *) malloc(strlen(keyword) + 1); + strcpy(gfi->notice, keyword); + break; + case FONTBBOX: + keyword = token(fp); + gfi->fontBBox.llx = atoi(keyword); + keyword = token(fp); + gfi->fontBBox.lly = atoi(keyword); + keyword = token(fp); + gfi->fontBBox.urx = atoi(keyword); + keyword = token(fp); + gfi->fontBBox.ury = atoi(keyword); + break; + case CAPHEIGHT: + keyword = token(fp); + gfi->capHeight = atoi(keyword); + break; + case XHEIGHT: + keyword = token(fp); + gfi->xHeight = atoi(keyword); + break; + case DESCENDER: + keyword = token(fp); + gfi->descender = atoi(keyword); + break; + case ASCENDER: + keyword = token(fp); + gfi->ascender = atoi(keyword); + break; + case STARTCHARMETRICS: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + case NOPE: + default: + error = parseError; + break; + } /* switch */ + } /* while */ + + return(error); + +} /* parseGlobals */ + + + +/************************* initializeArray ************************/ + +/* Unmapped character codes are (at Adobe Systems) assigned the + * width of the space character (if one exists) else they get the + * value of 250 ems. This function initializes all entries in the + * char widths array to have this value. Then any mapped character + * codes will be replaced with the width of the appropriate character + * when parsing the character metric section. + + * This function parses the Character Metrics Section looking + * for a space character (by comparing character names). If found, + * the width of the space character will be used to initialize the + * values in the array of character widths. + * + * Before returning, the position of the read/write pointer of the + * file is reset to be where it was upon entering this function. + */ + +/* We comment out the following function since it is not needed in t1lib + and we don't want compiler warnings */ +/* +static int initializeArray(fp, cwi) + FILE *fp; + register int *cwi; +{ + BOOL cont = T1LIB_TRUE, found = T1LIB_FALSE; + long opos = ftell(fp); + int code = 0, width = 0, i = 0, error = 0; + register char *keyword; + + while (cont) + { + keyword = token(fp); + if (keyword == NULL) + { + error = earlyEOF; + break; + } + switch(recognize(keyword)) + { + case COMMENT: + keyword = linetoken(fp); + break; + case CODE: + code = atoi(token(fp)); + break; + case XWIDTH: + width = atoi(token(fp)); + break; + case CHARNAME: + keyword = token(fp); + if (MATCH(keyword, Space)) + { + cont = T1LIB_FALSE; + found = T1LIB_TRUE; + } + break; + case ENDCHARMETRICS: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + case NOPE: + default: + error = parseError; + break; + } + } + + if (!found) + width = 250; + + for (i = 0; i < 256; ++i) + cwi[i] = width; + + fseek(fp, opos, 0); + + return(error); + +} +*/ + +/************************* parseCharWidths **************************/ + +/* This function is called by "parseFile". It will parse the AFM File + * up to the "EndCharMetrics" keyword. It will save the character + * width info (as opposed to all of the character metric information) + * if requested by the caller of parseFile. Otherwise, it will just + * parse through the section without saving any information. + * + * If data is to be saved, parseCharWidths is passed in a pointer + * to an array of widths that has already been initialized by the + * standard value for unmapped character codes. This function parses + * the Character Metrics section only storing the width information + * for the encoded characters into the array using the character code + * as the index into that array. + * + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by + * parseFile to determine if there is more file to parse. + */ + +static int parseCharWidths(fp, cwi) + FILE *fp; + register int *cwi; +{ + BOOL cont = T1LIB_TRUE, save = (cwi != NULL); + int pos = 0, error = ok; + register char *keyword; + + while (cont) + { + keyword = token(fp); + /* Have reached an early and unexpected EOF. */ + /* Set flag and stop parsing */ + if (keyword == NULL) + { + error = earlyEOF; + break; /* get out of loop */ + } + if (!save) + /* get tokens until the end of the Char Metrics section without */ + /* saving any of the data*/ + switch (recognize(keyword)) + { + case ENDCHARMETRICS: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + default: + break; + } /* switch */ + else + /* otherwise parse entire char metrics section, saving */ + /* only the char x-width info */ + switch(recognize(keyword)) + { + case COMMENT: + keyword = linetoken(fp); + break; + case CODE: + keyword = token(fp); + pos = atoi(keyword); + break; + case XYWIDTH: + /* PROBLEM: Should be no Y-WIDTH when doing "quick & dirty" */ + keyword = token(fp); keyword = token(fp); /* eat values */ + error = parseError; + break; + case XWIDTH: + keyword = token(fp); + if (pos >= 0) /* ignore unmapped chars */ + cwi[pos] = atoi(keyword); + break; + case ENDCHARMETRICS: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + case CHARNAME: /* eat values (so doesn't cause parseError) */ + keyword = token(fp); + break; + case CHARBBOX: + keyword = token(fp); keyword = token(fp); + keyword = token(fp); keyword = token(fp); + break; + case LIGATURE: + keyword = token(fp); keyword = token(fp); + break; + case NOPE: + default: + error = parseError; + break; + } /* switch */ + } /* while */ + + return(error); + +} /* parseCharWidths */ + + +/************************* parseCharMetrics ************************/ + +/* This function is called by parseFile if the caller of parseFile + * requested that all character metric information be saved + * (as opposed to only the character width information). + * + * parseCharMetrics is passed in a pointer to an array of records + * to hold information on a per character basis. This function + * parses the Character Metrics section storing all character + * metric information for the ALL characters (mapped and unmapped) + * into the array. + * + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by + * parseFile to determine if there is more file to parse. + */ + +static int parseCharMetrics(fp, fi) + FILE *fp; + register FontInfo *fi; +{ + BOOL cont = T1LIB_TRUE, firstTime = T1LIB_TRUE; + int error = ok, count = 0; + register CharMetricInfo *temp = fi->cmi; + register char *keyword; + + while (cont) + { + keyword = token(fp); + if (keyword == NULL) + { + error = earlyEOF; + break; /* get out of loop */ + } + switch(recognize(keyword)) + { + case COMMENT: + keyword = linetoken(fp); + break; + case CODE: + if (count < fi->numOfChars) + { + if (firstTime) firstTime = T1LIB_FALSE; + else temp++; + temp->code = atoi(token(fp)); + count++; + } + else + { + error = parseError; + cont = T1LIB_FALSE; + } + break; + case XYWIDTH: + temp->wx = atoi(token(fp)); + temp->wy = atoi(token(fp)); + break; + case XWIDTH: + temp->wx = atoi(token(fp)); + break; + case CHARNAME: + keyword = token(fp); + temp->name = (char *) malloc(strlen(keyword) + 1); + strcpy(temp->name, keyword); + break; + case CHARBBOX: + temp->charBBox.llx = atoi(token(fp)); + temp->charBBox.lly = atoi(token(fp)); + temp->charBBox.urx = atoi(token(fp)); + temp->charBBox.ury = atoi(token(fp)); + break; + case LIGATURE: { + Ligature **tail = &(temp->ligs); + Ligature *node = *tail; + + if (*tail != NULL) + { + while (node->next != NULL) + node = node->next; + tail = &(node->next); + } + + *tail = (Ligature *) calloc(1, sizeof(Ligature)); + keyword = token(fp); + (*tail)->succ = (char *) malloc(strlen(keyword) + 1); + strcpy((*tail)->succ, keyword); + keyword = token(fp); + (*tail)->lig = (char *) malloc(strlen(keyword) + 1); + strcpy((*tail)->lig, keyword); + break; } + case ENDCHARMETRICS: + cont = T1LIB_FALSE;; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + case NOPE: + default: + error = parseError; + break; + } /* switch */ + } /* while */ + + if ((error == ok) && (count != fi->numOfChars)) + error = parseError; + + return(error); + +} /* parseCharMetrics */ + + + +/************************* parseTrackKernData ***********************/ + +/* This function is called by "parseFile". It will parse the AFM File + * up to the "EndTrackKern" or "EndKernData" keywords. It will save the + * track kerning data if requested by the caller of parseFile. + * + * parseTrackKernData is passed in a pointer to the FontInfo record. + * If data is to be saved, the FontInfo record will already contain + * a valid pointer to storage for the track kerning data. + * + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by + * parseFile to determine if there is more file to parse. + */ + +static int parseTrackKernData(fp, fi) + FILE *fp; + register FontInfo *fi; +{ + BOOL cont = T1LIB_TRUE, save = (fi->tkd != NULL); + int pos = 0, error = ok, tcount = 0; + register char *keyword; + + while (cont) + { + keyword = token(fp); + + if (keyword == NULL) + { + error = earlyEOF; + break; /* get out of loop */ + } + if (!save) + /* get tokens until the end of the Track Kerning Data */ + /* section without saving any of the data */ + switch(recognize(keyword)) + { + case ENDTRACKKERN: + case ENDKERNDATA: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + default: + break; + } /* switch */ + else + /* otherwise parse entire Track Kerning Data section, */ + /* saving the data */ + switch(recognize(keyword)) + { + case COMMENT: + keyword = linetoken(fp); + break; + case TRACKKERN: + if (tcount < fi->numOfTracks) + { + keyword = token(fp); + fi->tkd[pos].degree = atoi(keyword); + keyword = token(fp); + fi->tkd[pos].minPtSize = atof(keyword); + if (errno == ERANGE) error = parseError; + keyword = token(fp); + fi->tkd[pos].minKernAmt = atof(keyword); + if (errno == ERANGE) error = parseError; + keyword = token(fp); + fi->tkd[pos].maxPtSize = atof(keyword); + if (errno == ERANGE) error = parseError; + keyword = token(fp); + fi->tkd[pos++].maxKernAmt = atof(keyword); + if (errno == ERANGE) error = parseError; + tcount++; + } + else + { + error = parseError; + cont = T1LIB_FALSE; + } + break; + case ENDTRACKKERN: + case ENDKERNDATA: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + case NOPE: + default: + error = parseError; + break; + } /* switch */ + } /* while */ + + if (error == ok && tcount != fi->numOfTracks) + error = parseError; + + return(error); + +} /* parseTrackKernData */ + + +/************************* parsePairKernData ************************/ + +/* This function is called by "parseFile". It will parse the AFM File + * up to the "EndKernPairs" or "EndKernData" keywords. It will save + * the pair kerning data if requested by the caller of parseFile. + * + * parsePairKernData is passed in a pointer to the FontInfo record. + * If data is to be saved, the FontInfo record will already contain + * a valid pointer to storage for the pair kerning data. + * + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by + * parseFile to determine if there is more file to parse. + */ + +static int parsePairKernData(fp, fi) + FILE *fp; + register FontInfo *fi; +{ + BOOL cont = T1LIB_TRUE, save = (fi->pkd != NULL); + int pos = 0, error = ok, pcount = 0; + register char *keyword; + + while (cont) + { + keyword = token(fp); + + if (keyword == NULL) + { + error = earlyEOF; + break; /* get out of loop */ + } + if (!save) + /* get tokens until the end of the Pair Kerning Data */ + /* section without saving any of the data */ + switch(recognize(keyword)) + { + case ENDKERNPAIRS: + case ENDKERNDATA: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + default: + break; + } /* switch */ + else + /* otherwise parse entire Pair Kerning Data section, */ + /* saving the data */ + switch(recognize(keyword)) + { + case COMMENT: + keyword = linetoken(fp); + break; + case KERNPAIR: + if (pcount < fi->numOfPairs) + { + keyword = token(fp); + fi->pkd[pos].name1 = (char *) + malloc(strlen(keyword) + 1); + strcpy(fi->pkd[pos].name1, keyword); + keyword = token(fp); + fi->pkd[pos].name2 = (char *) + malloc(strlen(keyword) + 1); + strcpy(fi->pkd[pos].name2, keyword); + keyword = token(fp); + fi->pkd[pos].xamt = atoi(keyword); + keyword = token(fp); + fi->pkd[pos++].yamt = atoi(keyword); + pcount++; + } + else + { + error = parseError; + cont = T1LIB_FALSE; + } + break; + case KERNPAIRXAMT: + if (pcount < fi->numOfPairs) + { + keyword = token(fp); + fi->pkd[pos].name1 = (char *) + malloc(strlen(keyword) + 1); + strcpy(fi->pkd[pos].name1, keyword); + keyword = token(fp); + fi->pkd[pos].name2 = (char *) + malloc(strlen(keyword) + 1); + strcpy(fi->pkd[pos].name2, keyword); + keyword = token(fp); + fi->pkd[pos++].xamt = atoi(keyword); + pcount++; + } + else + { + error = parseError; + cont = T1LIB_FALSE; + } + break; + case ENDKERNPAIRS: + case ENDKERNDATA: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + case NOPE: + default: + error = parseError; + break; + } /* switch */ + } /* while */ + + if (error == ok && pcount != fi->numOfPairs) + error = parseError; + + return(error); + +} /* parsePairKernData */ + + +/************************* parseCompCharData **************************/ + +/* This function is called by "parseFile". It will parse the AFM File + * up to the "EndComposites" keyword. It will save the composite + * character data if requested by the caller of parseFile. + * + * parseCompCharData is passed in a pointer to the FontInfo record, and + * a boolean representing if the data should be saved. + * + * This function will create the appropriate amount of storage for + * the composite character data and store a pointer to the storage + * in the FontInfo record. + * + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by + * parseFile to determine if there is more file to parse. + */ + +static int parseCompCharData(fp, fi) + FILE *fp; + register FontInfo *fi; +{ + BOOL cont = T1LIB_TRUE, firstTime = T1LIB_TRUE, save = (fi->ccd != NULL); + int pos = 0, j = 0, error = ok, ccount = 0, pcount = 0; + register char *keyword; + + while (cont) + { + keyword = token(fp); + if (keyword == NULL) + /* Have reached an early and unexpected EOF. */ + /* Set flag and stop parsing */ + { + error = earlyEOF; + break; /* get out of loop */ + } + if (ccount > fi->numOfComps) + { + error = parseError; + break; /* get out of loop */ + } + if (!save) + /* get tokens until the end of the Composite Character info */ + /* section without saving any of the data */ + switch(recognize(keyword)) + { + case ENDCOMPOSITES: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + default: + break; + } /* switch */ + else + /* otherwise parse entire Composite Character info section, */ + /* saving the data */ + switch(recognize(keyword)) + { + case COMMENT: + keyword = linetoken(fp); + break; + case COMPCHAR: + if (ccount < fi->numOfComps) + { + keyword = token(fp); + if (pcount != fi->ccd[pos].numOfPieces) + error = parseError; + pcount = 0; + if (firstTime) firstTime = T1LIB_FALSE; + else pos++; + fi->ccd[pos].ccName = (char *) + malloc(strlen(keyword) + 1); + strcpy(fi->ccd[pos].ccName, keyword); + keyword = token(fp); + fi->ccd[pos].numOfPieces = atoi(keyword); + fi->ccd[pos].pieces = (Pcc *) + calloc(fi->ccd[pos].numOfPieces, sizeof(Pcc)); + j = 0; + ccount++; + } + else + { + error = parseError; + cont = T1LIB_FALSE; + } + break; + case COMPCHARPIECE: + if (pcount < fi->ccd[pos].numOfPieces) + { + keyword = token(fp); + fi->ccd[pos].pieces[j].pccName = (char *) + malloc(strlen(keyword) + 1); + strcpy(fi->ccd[pos].pieces[j].pccName, keyword); + keyword = token(fp); + fi->ccd[pos].pieces[j].deltax = atoi(keyword); + keyword = token(fp); + fi->ccd[pos].pieces[j++].deltay = atoi(keyword); + pcount++; + } + else + error = parseError; + break; + case ENDCOMPOSITES: + cont = T1LIB_FALSE; + break; + case ENDFONTMETRICS: + cont = T1LIB_FALSE; + error = normalEOF; + break; + case NOPE: + default: + error = parseError; + break; + } /* switch */ + } /* while */ + + if (error == ok && ccount != fi->numOfComps) + error = parseError; + + return(error); + +} /* parseCompCharData */ + + + + +/*************************** 'PUBLIC' FUNCTION ********************/ + + +/*************************** parseFile *****************************/ + +/* parseFile is the only 'public' procedure available. It is called + * from an application wishing to get information from an AFM file. + * The caller of this function is responsible for locating and opening + * an AFM file and handling all errors associated with that task. + * + * parseFile expects 3 parameters: a vaild file pointer, a pointer + * to a (FontInfo *) variable (for which storage will be allocated and + * the data requested filled in), and a mask specifying which + * data from the AFM File should be saved in the FontInfo structure. + * + * The file will be parsed and the requested data will be stored in + * a record of type FontInfo (refer to ParseAFM.h). + * + * parseFile returns an error code as defined in parseAFM.h. + * + * The position of the read/write pointer associated with the file + * pointer upon return of this function is undefined. + */ + +/* Note: function renamed to T1lib_parseFile in order to avoid name clushes + with other libraries that also use the Adobe parseAFM-package (RMz) */ +int T1lib_parseFile (fp, fi, flags) + FILE *fp; + FontInfo **fi; + FLAGS flags; +{ + + int code = ok; /* return code from each of the parsing routines */ + int error = ok; /* used as the return code from this function */ + + register char *keyword; /* used to store a token */ + + + /* storage data for the global variable ident */ + ident = (char *) calloc(MAX_NAME, sizeof(char)); + if (ident == NULL) {error = storageProblem; return(error);} + + (*fi) = (FontInfo *) calloc(1, sizeof(FontInfo)); + if ((*fi) == NULL) {error = storageProblem; return(error);} + + if (flags & P_G) + { + (*fi)->gfi = (GlobalFontInfo *) calloc(1, sizeof(GlobalFontInfo)); + if ((*fi)->gfi == NULL) {error = storageProblem; return(error);} + } + + /* The AFM File begins with Global Font Information. This section */ + /* will be parsed whether or not information should be saved. */ + code = parseGlobals(fp, (*fi)->gfi); + + if (code < 0) error = code; + + /* The Global Font Information is followed by the Character Metrics */ + /* section. Which procedure is used to parse this section depends on */ + /* how much information should be saved. If all of the metrics info */ + /* is wanted, parseCharMetrics is called. If only the character widths */ + /* is wanted, parseCharWidths is called. parseCharWidths will also */ + /* be called in the case that no character data is to be saved, just */ + /* to parse through the section. */ + + if ((code != normalEOF) && (code != earlyEOF)) + { + (*fi)->numOfChars = atoi(token(fp)); + if (flags & (P_M ^ P_W)) + { + (*fi)->cmi = (CharMetricInfo *) + calloc((*fi)->numOfChars, sizeof(CharMetricInfo)); + if ((*fi)->cmi == NULL) {error = storageProblem; return(error);} + code = parseCharMetrics(fp, *fi); + } + else + { + if (flags & P_W) + { + (*fi)->cwi = (int *) calloc(256, sizeof(int)); + if ((*fi)->cwi == NULL) + { + error = storageProblem; + return(error); + } + } + /* parse section regardless */ + code = parseCharWidths(fp, (*fi)->cwi); + } /* else */ + } /* if */ + + if ((error != earlyEOF) && (code < 0)) error = code; + + /* The remaining sections of the AFM are optional. This code will */ + /* look at the next keyword in the file to determine what section */ + /* is next, and then allocate the appropriate amount of storage */ + /* for the data (if the data is to be saved) and call the */ + /* appropriate parsing routine to parse the section. */ + + while ((code != normalEOF) && (code != earlyEOF)) { + keyword = token(fp); + if (keyword == NULL) + /* Have reached an early and unexpected EOF. */ + /* Set flag and stop parsing */ + { + code = earlyEOF; + break; /* get out of loop */ + } + switch(recognize(keyword)) + { + /* this case has been added for t1lib because otherwise comment line + between (i.e., outside) the main sections would lead to parse + errors. The Adobe spec does not seem to forbid comments at + such locations (2001-05-14, RMz) */ + case COMMENT: + keyword = linetoken(fp); + break; + case STARTKERNDATA: + break; + case ENDKERNDATA: + break; + case STARTTRACKKERN: + keyword = token(fp); + if (flags & P_T) + { + (*fi)->numOfTracks = atoi(keyword); + (*fi)->tkd = (TrackKernData *) + calloc((*fi)->numOfTracks, sizeof(TrackKernData)); + if ((*fi)->tkd == NULL) + { + error = storageProblem; + return(error); + } + } /* if */ + code = parseTrackKernData(fp, *fi); + break; + case STARTKERNPAIRS: + keyword = token(fp); + if (flags & P_P) + { + (*fi)->numOfPairs = atoi(keyword); + (*fi)->pkd = (PairKernData *) + calloc((*fi)->numOfPairs, sizeof(PairKernData)); + if ((*fi)->pkd == NULL) + { + error = storageProblem; + return(error); + } + } /* if */ + code = parsePairKernData(fp, *fi); + break; + case STARTCOMPOSITES: + keyword = token(fp); + if (flags & P_C) + { + (*fi)->numOfComps = atoi(keyword); + (*fi)->ccd = (CompCharData *) + calloc((*fi)->numOfComps, sizeof(CompCharData)); + if ((*fi)->ccd == NULL) + { + error = storageProblem; + return(error); + } + } /* if */ + code = parseCompCharData(fp, *fi); + break; + case ENDFONTMETRICS: + code = normalEOF; + break; + case NOPE: + default: + code = parseError; + break; + } /* switch */ + + if ((error != earlyEOF) && (code < 0)) error = code; + + } /* while */ + + if ((error != earlyEOF) && (code < 0)) error = code; + + if (ident != NULL) { free(ident); ident = NULL; } + + return(error); + +} /* parseFile */ diff -Naur xdvik-22.40l/libs/t1lib/parseAFM.h xdvik-22.40n/libs/t1lib/parseAFM.h --- xdvik-22.40l/libs/t1lib/parseAFM.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/parseAFM.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,354 @@ +/*-------------------------------------------------------------------------- + ----- File: parseAFM.h + ----- Author: Adobe Systems Inc., modifications by + Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It is the original + parseAFM.h modified at a few points. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +/* + * (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved. + * + * This file may be freely copied and redistributed as long as: + * 1) This entire notice continues to be included in the file, + * 2) If the file has been modified in any way, a notice of such + * modification is conspicuously indicated. + * + * PostScript, Display PostScript, and Adobe are registered trademarks of + * Adobe Systems Incorporated. + * + * ************************************************************************ + * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT + * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS + * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR + * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY + * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, + * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + * ************************************************************************ + */ + +/* ParseAFM.h + * + * This header file is used in conjuction with the parseAFM.c file. + * Together these files provide the functionality to parse Adobe Font + * Metrics files and store the information in predefined data structures. + * It is intended to work with an application program that needs font metric + * information. The program can be used as is by making a procedure call to + * parse an AFM file and have the data stored, or an application developer + * may wish to customize the code. + * + * This header file defines the data structures used as well as the key + * strings that are currently recognized by this version of the AFM parser. + * This program is based on the document "Adobe Font Metrics Files, + * Specification Version 2.0". + * + * AFM files are separated into distinct sections of different data. Because + * of this, the parseAFM program can parse a specified file to only save + * certain sections of information based on the application's needs. A record + * containing the requested information will be returned to the application. + * + * AFM files are divided into five sections of data: + * 1) The Global Font Information + * 2) The Character Metrics Information + * 3) The Track Kerning Data + * 4) The Pair-Wise Kerning Data + * 5) The Composite Character Data + * + * Basically, the application can request any of these sections independent + * of what other sections are requested. In addition, in recognizing that + * many applications will want ONLY the x-width of characters and not all + * of the other character metrics information, there is a way to receive + * only the width information so as not to pay the storage cost for the + * unwanted data. An application should never request both the + * "quick and dirty" char metrics (widths only) and the Character Metrics + * Information since the Character Metrics Information will contain all + * of the character widths as well. + * + * There is a procedure in parseAFM.c, called parseFile, that can be + * called from any application wishing to get information from the AFM File. + * This procedure expects 3 parameters: a vaild file descriptor, a pointer + * to a (FontInfo *) variable (for which space will be allocated and then + * will be filled in with the data requested), and a mask specifying + * which data from the AFM File should be saved in the FontInfo structure. + * + * The flags that can be used to set the appropriate mask are defined below. + * In addition, several commonly used masks have already been defined. + * + * History: + * original: DSM Thu Oct 20 17:39:59 PDT 1988 + * modified: DSM Mon Jul 3 14:17:50 PDT 1989 + * - added 'storageProblem' return code + * - fixed typos + */ + +#include + + + +/* your basic constants */ +#define T1LIB_TRUE 1 +#define T1LIB_FALSE 0 +#define EOL '\n' /* end-of-line indicator */ +#define MAX_NAME 4096 /* max length for identifiers */ +#define BOOL int +#define FLAGS int + + + +/* Flags that can be AND'ed together to specify exactly what + * information from the AFM file should be saved. + */ +#define P_G 0x01 /* 0000 0001 */ /* Global Font Info */ +#define P_W 0x02 /* 0000 0010 */ /* Character Widths ONLY */ +#define P_M 0x06 /* 0000 0110 */ /* All Char Metric Info */ +#define P_P 0x08 /* 0000 1000 */ /* Pair Kerning Info */ +#define P_T 0x10 /* 0001 0000 */ /* Track Kerning Info */ +#define P_C 0x20 /* 0010 0000 */ /* Composite Char Info */ + + +/* Commonly used flags + */ +#define P_GW (P_G | P_W) +#define P_GM (P_G | P_M) +#define P_GMP (P_G | P_M | P_P) +#define P_GMK (P_G | P_M | P_P | P_T) +#define P_ALL (P_G | P_M | P_P | P_T | P_C) + + + +/* Possible return codes from the parseFile procedure. + * + * ok means there were no problems parsing the file. + * + * parseError means that there was some kind of parsing error, but the + * parser went on. This could include problems like the count for any given + * section does not add up to how many entries there actually were, or + * there was a key that was not recognized. The return record may contain + * vaild data or it may not. + * + * earlyEOF means that an End of File was encountered before expected. This + * may mean that the AFM file had been truncated, or improperly formed. + * + * storageProblem means that there were problems allocating storage for + * the data structures that would have contained the AFM data. + */ +#define ok 0 +#define parseError -1 +#define earlyEOF -2 +#define storageProblem -3 + + + +/************************* TYPES *********************************/ +/* Below are all of the data structure definitions. These structures + * try to map as closely as possible to grouping and naming of data + * in the AFM Files. + */ + + +/* Bounding box definition. Used for the Font BBox as well as the + * Character BBox. + */ +typedef struct +{ + int llx; /* lower left x-position */ + int lly; /* lower left y-position */ + int urx; /* upper right x-position */ + int ury; /* upper right y-position */ +} BBox; + + +/* Global Font information. + * The key that each field is associated with is in comments. For an + * explanation about each key and its value please refer to the AFM + * documentation (full title & version given above). + */ +typedef struct +{ + char *afmVersion; /* key: StartFontMetrics */ + char *fontName; /* key: FontName */ + char *fullName; /* key: FullName */ + char *familyName; /* key: FamilyName */ + char *weight; /* key: Weight */ + float italicAngle; /* key: ItalicAngle */ + BOOL isFixedPitch; /* key: IsFixedPitch */ + BBox fontBBox; /* key: FontBBox */ + int underlinePosition; /* key: UnderlinePosition */ + int underlineThickness; /* key: UnderlineThickness */ + char *version; /* key: Version */ + char *notice; /* key: Notice */ + char *encodingScheme; /* key: EncodingScheme */ + int capHeight; /* key: CapHeight */ + int xHeight; /* key: XHeight */ + int ascender; /* key: Ascender */ + int descender; /* key: Descender */ +} GlobalFontInfo; + + +/* Ligature definition is a linked list since any character can have + * any number of ligatures. + */ +typedef struct _t_ligature +{ + char *succ, *lig; + struct _t_ligature *next; +} Ligature; + + +/* Character Metric Information. This structure is used only if ALL + * character metric information is requested. If only the character + * widths is requested, then only an array of the character x-widths + * is returned. + * + * The key that each field is associated with is in comments. For an + * explanation about each key and its value please refer to the + * Character Metrics section of the AFM documentation (full title + * & version given above). + */ +typedef struct +{ + int code, /* key: C */ + wx, /* key: WX */ + wy; /* together wx and wy are associated with key: W */ + char *name; /* key: N */ + BBox charBBox; /* key: B */ + Ligature *ligs; /* key: L (linked list; not a fixed number of Ls */ +} CharMetricInfo; + + +/* Track kerning data structure. + * The fields of this record are the five values associated with every + * TrackKern entry. + * + * For an explanation about each value please refer to the + * Track Kerning section of the AFM documentation (full title + * & version given above). + */ +typedef struct +{ + int degree; + float minPtSize, + minKernAmt, + maxPtSize, + maxKernAmt; +} TrackKernData; + + +/* Pair Kerning data structure. + * The fields of this record are the four values associated with every + * KP entry. For KPX entries, the yamt will be zero. + * + * For an explanation about each value please refer to the + * Pair Kerning section of the AFM documentation (full title + * & version given above). + */ +typedef struct +{ + char *name1; + char *name2; + int xamt, + yamt; +} PairKernData; + + +/* PCC is a piece of a composite character. This is a sub structure of a + * compCharData described below. + * These fields will be filled in with the values from the key PCC. + * + * For an explanation about each key and its value please refer to the + * Composite Character section of the AFM documentation (full title + * & version given above). + */ +typedef struct +{ + char *pccName; + int deltax, + deltay; +} Pcc; + + +/* Composite Character Information data structure. + * The fields ccName and numOfPieces are filled with the values associated + * with the key CC. The field pieces points to an array (size = numOfPieces) + * of information about each of the parts of the composite character. That + * array is filled in with the values from the key PCC. + * + * For an explanation about each key and its value please refer to the + * Composite Character section of the AFM documentation (full title + * & version given above). + + structure extended for use with t1lib. The fields "width" and bbox store + the composite characters escapement and its bounding box (2001-05-027, RMz) + */ +typedef struct +{ + int wx; /* these two will be filled by T1_LoadFont() */ + BBox charBBox; + char *ccName; + int numOfPieces; + Pcc *pieces; +} CompCharData; + + +/* FontInfo + * Record type containing pointers to all of the other data + * structures containing information about a font. + * A a record of this type is filled with data by the + * parseFile function. + */ +typedef struct +{ + GlobalFontInfo *gfi; /* ptr to a GlobalFontInfo record */ + int *cwi; /* ptr to 256 element array of just char widths */ + int numOfChars; /* number of entries in char metrics array */ + CharMetricInfo *cmi; /* ptr to char metrics array */ + int numOfTracks; /* number to entries in track kerning array */ + TrackKernData *tkd; /* ptr to track kerning array */ + int numOfPairs; /* number to entries in pair kerning array */ + PairKernData *pkd; /* ptr to pair kerning array */ + int numOfComps; /* number to entries in comp char array */ + CompCharData *ccd; /* ptr to comp char array */ +} FontInfo; + + + +/************************* PROCEDURES ****************************/ + +/* Call this procedure to do the grunt work of parsing an AFM file. + * + * "fp" should be a valid file pointer to an AFM file. + * + * "fi" is a pointer to a pointer to a FontInfo record sturcture + * (defined above). Storage for the FontInfo structure will be + * allocated in parseFile and the structure will be filled in + * with the requested data from the AFM File. + * + * "flags" is a mask with bits set representing what data should + * be saved. Defined above are valid flags that can be used to set + * the mask, as well as a few commonly used masks. + * + * The possible return codes from parseFile are defined above. + */ + +extern int T1lib_parseFile ( FILE *fp, FontInfo **fi, FLAGS flags ); diff -Naur xdvik-22.40l/libs/t1lib/parse_afm/CVS/Entries xdvik-22.40n/libs/t1lib/parse_afm/CVS/Entries --- xdvik-22.40l/libs/t1lib/parse_afm/CVS/Entries Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/parse_afm/CVS/Entries Thu Jan 1 00:00:00 1970 @@ -1,3 +0,0 @@ -/README.RMz/1.1.1.1/Wed Apr 18 14:24:14 2001//Txdvik_22_40_STABLE -/parseAFM.shar/1.1.1.1/Wed Apr 18 14:24:15 2001//Txdvik_22_40_STABLE -D diff -Naur xdvik-22.40l/libs/t1lib/parse_afm/CVS/Repository xdvik-22.40n/libs/t1lib/parse_afm/CVS/Repository --- xdvik-22.40l/libs/t1lib/parse_afm/CVS/Repository Sat Aug 31 22:50:43 2002 +++ xdvik-22.40n/libs/t1lib/parse_afm/CVS/Repository Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -xdvik/libs/t1lib/parse_afm diff -Naur xdvik-22.40l/libs/t1lib/parse_afm/CVS/Root xdvik-22.40n/libs/t1lib/parse_afm/CVS/Root --- xdvik-22.40l/libs/t1lib/parse_afm/CVS/Root Sat Aug 31 22:50:43 2002 +++ xdvik-22.40n/libs/t1lib/parse_afm/CVS/Root Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/t1lib/parse_afm/CVS/Tag xdvik-22.40n/libs/t1lib/parse_afm/CVS/Tag --- xdvik-22.40l/libs/t1lib/parse_afm/CVS/Tag Sat Aug 31 23:06:36 2002 +++ xdvik-22.40n/libs/t1lib/parse_afm/CVS/Tag Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/t1lib/parse_afm/README.RMz xdvik-22.40n/libs/t1lib/parse_afm/README.RMz --- xdvik-22.40l/libs/t1lib/parse_afm/README.RMz Wed Apr 18 14:24:14 2001 +++ xdvik-22.40n/libs/t1lib/parse_afm/README.RMz Thu Jan 1 00:00:00 1970 @@ -1,9 +0,0 @@ -Dear Folks, - -this directory contains the shell-archive with the parseAFM-package by -Adobe Systems Inc. The shell archive is only located here for -completeness. The files used by the t1-library (parseAFM.c, -parseAFM.h) have been extracted and copied to the t1lib-subdirectory. -Thus, no make is done in this directory. - - (08/11/1996, RMz) diff -Naur xdvik-22.40l/libs/t1lib/parse_afm/parseAFM.shar xdvik-22.40n/libs/t1lib/parse_afm/parseAFM.shar --- xdvik-22.40l/libs/t1lib/parse_afm/parseAFM.shar Wed Apr 18 14:24:15 2001 +++ xdvik-22.40n/libs/t1lib/parse_afm/parseAFM.shar Thu Jan 1 00:00:00 1970 @@ -1,2059 +0,0 @@ -#!/bin/sh -# This is a shell archive (produced by GNU sharutils 4.1.6). -# To extract the files from this archive, save it to some FILE, remove -# everything before the `!/bin/sh' line above, then type `sh FILE'. -# -# Made on 1996-10-25 16:19 EDT by . -# Source directory was `/usr/home/rainer/src/T1/parse_afm'. -# -# Existing files will *not* be overwritten unless `-c' is specified. -# -# This shar contains: -# length mode name -# ------ ---------- ------------------------------------------ -# 280 -rw-r--r-- makefile -# 43280 -rw-r--r-- parseAFM.c -# 11502 -rw-r--r-- parseAFM.h -# 12210 -rw-r--r-- parseAFMclient.c -# -save_IFS=${IFS} -IFS="${IFS}:" -gettext_dir=FAILED -locale_dir=FAILED -for dir in $PATH -do - if test "$gettext_dir" = "FAILED" && test -f $dir/gettext \ - && ($dir/gettext --version >/dev/null 2>&1) - then - set `$dir/gettext --version 2>&1` - if test "$3" = "GNU" - then - gettext_dir=$dir - fi - fi - if test "$locale_dir" = "FAILED" && test -f $dir/shar \ - && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) - then - locale_dir=`$dir/shar --print-text-domain-dir` - fi -done -IFS=$save_IFS -if test "$locale_dir" = "FAILED" || test "$gettext_dir" = "FAILED" -then - echo=echo -else - TEXTDOMAINDIR=$locale_dir - export TEXTDOMAINDIR - TEXTDOMAIN=sharutils - export TEXTDOMAIN - echo="$gettext_dir/gettext --shell-script" -fi -touch -am 1231235999 $$.touch >/dev/null 2>&1 -if test ! -f 1231235999 && test -f $$.touch; then - shar_touch=touch -else - shar_touch=: - echo - $echo 'WARNING: not restoring timestamps. Consider getting and' - $echo "installing GNU \`touch', distributed in GNU File Utilities..." - echo -fi -rm -f 1231235999 $$.touch -# -if mkdir _sh00599; then - $echo 'x -' 'creating lock directory' -else - $echo 'failed to create lock directory' - exit 1 -fi -# ============= makefile ============== -if test -f 'makefile' && test X"$1" != X"-c"; then - $echo 'x -' SKIPPING 'makefile' '(file already exists)' -else - $echo 'x -' extracting 'makefile' '(text)' - sed 's/^X//' << 'SHAR_EOF' > 'makefile' && -X -parseAFM: parseAFM.o parseAFMclient.o makefile -X cc -g -o parseAFM parseAFM.o parseAFMclient.o -lm;\ -X shar makefile parseAFM.c parseAFM.h parseAFMclient.c > parseAFM.shar -X -parseAFMclient.o: parseAFMclient.c -X cc -g -c parseAFMclient.c -X -parseAFM.o: parseAFM.c -X cc -g -c parseAFM.c -X -SHAR_EOF - $shar_touch -am 1018085596 'makefile' && - chmod 0644 'makefile' || - $echo 'restore of' 'makefile' 'failed' - shar_count="`wc -c < 'makefile'`" - test 280 -eq "$shar_count" || - $echo 'makefile:' 'original size' '280,' 'current size' "$shar_count" -fi -# ============= parseAFM.c ============== -if test -f 'parseAFM.c' && test X"$1" != X"-c"; then - $echo 'x -' SKIPPING 'parseAFM.c' '(file already exists)' -else - $echo 'x -' extracting 'parseAFM.c' '(text)' - sed 's/^X//' << 'SHAR_EOF' > 'parseAFM.c' && -/* -X * (C) 1988, 1989, 1990 by Adobe Systems Incorporated. All rights reserved. -X * -X * This file may be freely copied and redistributed as long as: -X * 1) This entire notice continues to be included in the file, -X * 2) If the file has been modified in any way, a notice of such -X * modification is conspicuously indicated. -X * -X * PostScript, Display PostScript, and Adobe are registered trademarks of -X * Adobe Systems Incorporated. -X * -X * ************************************************************************ -X * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT -X * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS -X * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR -X * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY -X * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, -X * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, -X * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. -X * ************************************************************************ -X */ -X -/* parseAFM.c -X * -X * This file is used in conjuction with the parseAFM.h header file. -X * This file contains several procedures that are used to parse AFM -X * files. It is intended to work with an application program that needs -X * font metric information. The program can be used as is by making a -X * procedure call to "parseFile" (passing in the expected parameters) -X * and having it fill in a data structure with the data from the -X * AFM file, or an application developer may wish to customize this -X * code. -X * -X * There is also a file, parseAFMclient.c, that is a sample application -X * showing how to call the "parseFile" procedure and how to use the data -X * after "parseFile" has returned. -X * -X * Please read the comments in parseAFM.h and parseAFMclient.c. -X * -X * History: -X * original: DSM Thu Oct 20 17:39:59 PDT 1988 -X * modified: DSM Mon Jul 3 14:17:50 PDT 1989 -X * - added 'storageProblem' return code -X * - fixed bug of not allocating extra byte for string duplication -X * - fixed typos -X * modified: DSM Tue Apr 3 11:18:34 PDT 1990 -X * - added free(ident) at end of parseFile routine -X * modified: DSM Tue Jun 19 10:16:29 PDT 1990 -X * - changed (width == 250) to (width = 250) in initializeArray -X */ -X -#include -#include -#include -#include -#include "parseAFM.h" -X -#define lineterm EOL /* line terminating character */ -#define normalEOF 1 /* return code from parsing routines used only */ -X /* in this module */ -#define Space "space" /* used in string comparison to look for the width */ -X /* of the space character to init the widths array */ -#define False "false" /* used in string comparison to check the value of */ -X /* boolean keys (e.g. IsFixedPitch) */ -X -#define MATCH(A,B) (strncmp((A),(B), MAX_NAME) == 0) -X -X -X -/*************************** GLOBALS ***********************/ -X -static char *ident = NULL; /* storage buffer for keywords */ -X -X -/* "shorts" for fast case statement -X * The values of each of these enumerated items correspond to an entry in the -X * table of strings defined below. Therefore, if you add a new string as -X * new keyword into the keyStrings table, you must also add a corresponding -X * parseKey AND it MUST be in the same position! -X * -X * IMPORTANT: since the sorting algorithm is a binary search, the strings of -X * keywords must be placed in lexicographical order, below. [Therefore, the -X * enumerated items are not necessarily in lexicographical order, depending -X * on the name chosen. BUT, they must be placed in the same position as the -X * corresponding key string.] The NOPE shall remain in the last position, -X * since it does not correspond to any key string, and it is used in the -X * "recognize" procedure to calculate how many possible keys there are. -X */ -X -static enum parseKey { -X ASCENDER, CHARBBOX, CODE, COMPCHAR, CAPHEIGHT, COMMENT, -X DESCENDER, ENCODINGSCHEME, ENDCHARMETRICS, ENDCOMPOSITES, -X ENDFONTMETRICS, ENDKERNDATA, ENDKERNPAIRS, ENDTRACKKERN, -X FAMILYNAME, FONTBBOX, FONTNAME, FULLNAME, ISFIXEDPITCH, -X ITALICANGLE, KERNPAIR, KERNPAIRXAMT, LIGATURE, CHARNAME, -X NOTICE, COMPCHARPIECE, STARTCHARMETRICS, STARTCOMPOSITES, -X STARTFONTMETRICS, STARTKERNDATA, STARTKERNPAIRS, -X STARTTRACKKERN, TRACKKERN, UNDERLINEPOSITION, -X UNDERLINETHICKNESS, VERSION, XYWIDTH, XWIDTH, WEIGHT, XHEIGHT, -X NOPE }; -X -/* keywords for the system: -X * This a table of all of the current strings that are vaild AFM keys. -X * Each entry can be referenced by the appropriate parseKey value (an -X * enumerated data type defined above). If you add a new keyword here, -X * a corresponding parseKey MUST be added to the enumerated data type -X * defined above, AND it MUST be added in the same position as the -X * string is in this table. -X * -X * IMPORTANT: since the sorting algorithm is a binary search, the keywords -X * must be placed in lexicographical order. And, NULL should remain at the -X * end. -X */ -X -static char *keyStrings[] = { -X "Ascender", "B", "C", "CC", "CapHeight", "Comment", -X "Descender", "EncodingScheme", "EndCharMetrics", "EndComposites", -X "EndFontMetrics", "EndKernData", "EndKernPairs", "EndTrackKern", -X "FamilyName", "FontBBox", "FontName", "FullName", "IsFixedPitch", -X "ItalicAngle", "KP", "KPX", "L", "N", -X "Notice", "PCC", "StartCharMetrics", "StartComposites", -X "StartFontMetrics", "StartKernData", "StartKernPairs", -X "StartTrackKern", "TrackKern", "UnderlinePosition", -X "UnderlineThickness", "Version", "W", "WX", "Weight", "XHeight", -X NULL }; -X -/*************************** PARSING ROUTINES **************/ -X -/*************************** token *************************/ -X -/* A "AFM File Conventions" tokenizer. That means that it will -X * return the next token delimited by white space. See also -X * the `linetoken' routine, which does a similar thing but -X * reads all tokens until the next end-of-line. -X */ -X -static char *token(stream) -X FILE *stream; -{ -X int ch, idx; -X -X /* skip over white space */ -X while ((ch = fgetc(stream)) == ' ' || ch == lineterm || -X ch == ',' || ch == '\t' || ch == ';'); -X -X idx = 0; -X while (ch != EOF && ch != ' ' && ch != lineterm -X && ch != '\t' && ch != ':' && ch != ';') -X { -X ident[idx++] = ch; -X ch = fgetc(stream); -X } /* while */ -X -X if (ch == EOF && idx < 1) return ((char *)NULL); -X if (idx >= 1 && ch != ':' ) ungetc(ch, stream); -X if (idx < 1 ) ident[idx++] = ch; /* single-character token */ -X ident[idx] = 0; -X -X return(ident); /* returns pointer to the token */ -X -} /* token */ -X -X -/*************************** linetoken *************************/ -X -/* "linetoken" will get read all tokens until the EOL character from -X * the given stream. This is used to get any arguments that can be -X * more than one word (like Comment lines and FullName). -X */ -X -static char *linetoken(stream) -X FILE *stream; -{ -X int ch, idx; -X -X while ((ch = fgetc(stream)) == ' ' || ch == '\t' ); -X -X idx = 0; -X while (ch != EOF && ch != lineterm) -X { -X ident[idx++] = ch; -X ch = fgetc(stream); -X } /* while */ -X -X ungetc(ch, stream); -X ident[idx] = 0; -X -X return(ident); /* returns pointer to the token */ -X -} /* linetoken */ -X -X -/*************************** recognize *************************/ -X -/* This function tries to match a string to a known list of -X * valid AFM entries (check the keyStrings array above). -X * "ident" contains everything from white space through the -X * next space, tab, or ":" character. -X * -X * The algorithm is a standard Knuth binary search. -X */ -X -static enum parseKey recognize(ident) -X register char *ident; -{ -X int lower = 0, upper = (int) NOPE, midpoint, cmpvalue; -X BOOL found = FALSE; -X -X while ((upper >= lower) && !found) -X { -X midpoint = (lower + upper)/2; -X if (keyStrings[midpoint] == NULL) break; -X cmpvalue = strncmp(ident, keyStrings[midpoint], MAX_NAME); -X if (cmpvalue == 0) found = TRUE; -X else if (cmpvalue < 0) upper = midpoint - 1; -X else lower = midpoint + 1; -X } /* while */ -X -X if (found) return (enum parseKey) midpoint; -X else return NOPE; -X -} /* recognize */ -X -X -/************************* parseGlobals *****************************/ -X -/* This function is called by "parseFile". It will parse the AFM File -X * up to the "StartCharMetrics" keyword, which essentially marks the -X * end of the Global Font Information and the beginning of the character -X * metrics information. -X * -X * If the caller of "parseFile" specified that it wanted the Global -X * Font Information (as defined by the "AFM File Specification" -X * document), then that information will be stored in the returned -X * data structure. -X * -X * Any Global Font Information entries that are not found in a -X * given file, will have the usual default initialization value -X * for its type (i.e. entries of type int will be 0, etc). -X * -X * This function returns an error code specifying whether there was -X * a premature EOF or a parsing error. This return value is used by -X * parseFile to determine if there is more file to parse. -X */ -X -static BOOL parseGlobals(fp, gfi) -X FILE *fp; -X register GlobalFontInfo *gfi; -{ -X BOOL cont = TRUE, save = (gfi != NULL); -X int error = ok; -X register char *keyword; -X -X while (cont) -X { -X keyword = token(fp); -X -X if (keyword == NULL) -X /* Have reached an early and unexpected EOF. */ -X /* Set flag and stop parsing */ -X { -X error = earlyEOF; -X break; /* get out of loop */ -X } -X if (!save) -X /* get tokens until the end of the Global Font info section */ -X /* without saving any of the data */ -X switch (recognize(keyword)) -X { -X case STARTCHARMETRICS: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X default: -X break; -X } /* switch */ -X else -X /* otherwise parse entire global font info section, */ -X /* saving the data */ -X switch(recognize(keyword)) -X { -X case STARTFONTMETRICS: -X keyword = token(fp); -X gfi->afmVersion = (char *) malloc(strlen(keyword) + 1); -X strcpy(gfi->afmVersion, keyword); -X break; -X case COMMENT: -X keyword = linetoken(fp); -X break; -X case FONTNAME: -X keyword = token(fp); -X gfi->fontName = (char *) malloc(strlen(keyword) + 1); -X strcpy(gfi->fontName, keyword); -X break; -X case ENCODINGSCHEME: -X keyword = token(fp); -X gfi->encodingScheme = (char *) -X malloc(strlen(keyword) + 1); -X strcpy(gfi->encodingScheme, keyword); -X break; -X case FULLNAME: -X keyword = linetoken(fp); -X gfi->fullName = (char *) malloc(strlen(keyword) + 1); -X strcpy(gfi->fullName, keyword); -X break; -X case FAMILYNAME: -X keyword = linetoken(fp); -X gfi->familyName = (char *) malloc(strlen(keyword) + 1); -X strcpy(gfi->familyName, keyword); -X break; -X case WEIGHT: -X keyword = token(fp); -X gfi->weight = (char *) malloc(strlen(keyword) + 1); -X strcpy(gfi->weight, keyword); -X break; -X case ITALICANGLE: -X keyword = token(fp); -X gfi->italicAngle = atof(keyword); -X if (errno == ERANGE) error = parseError; -X break; -X case ISFIXEDPITCH: -X keyword = token(fp); -X if (MATCH(keyword, False)) -X gfi->isFixedPitch = 0; -X else -X gfi->isFixedPitch = 1; -X break; -X case UNDERLINEPOSITION: -X keyword = token(fp); -X gfi->underlinePosition = atoi(keyword); -X break; -X case UNDERLINETHICKNESS: -X keyword = token(fp); -X gfi->underlineThickness = atoi(keyword); -X break; -X case VERSION: -X keyword = token(fp); -X gfi->version = (char *) malloc(strlen(keyword) + 1); -X strcpy(gfi->version, keyword); -X break; -X case NOTICE: -X keyword = linetoken(fp); -X gfi->notice = (char *) malloc(strlen(keyword) + 1); -X strcpy(gfi->notice, keyword); -X break; -X case FONTBBOX: -X keyword = token(fp); -X gfi->fontBBox.llx = atoi(keyword); -X keyword = token(fp); -X gfi->fontBBox.lly = atoi(keyword); -X keyword = token(fp); -X gfi->fontBBox.urx = atoi(keyword); -X keyword = token(fp); -X gfi->fontBBox.ury = atoi(keyword); -X break; -X case CAPHEIGHT: -X keyword = token(fp); -X gfi->capHeight = atoi(keyword); -X break; -X case XHEIGHT: -X keyword = token(fp); -X gfi->xHeight = atoi(keyword); -X break; -X case DESCENDER: -X keyword = token(fp); -X gfi->descender = atoi(keyword); -X break; -X case ASCENDER: -X keyword = token(fp); -X gfi->ascender = atoi(keyword); -X break; -X case STARTCHARMETRICS: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X case NOPE: -X default: -X error = parseError; -X break; -X } /* switch */ -X } /* while */ -X -X return(error); -X -} /* parseGlobals */ -X -X -X -/************************* initializeArray ************************/ -X -/* Unmapped character codes are (at Adobe Systems) assigned the -X * width of the space character (if one exists) else they get the -X * value of 250 ems. This function initializes all entries in the -X * char widths array to have this value. Then any mapped character -X * codes will be replaced with the width of the appropriate character -X * when parsing the character metric section. -X -X * This function parses the Character Metrics Section looking -X * for a space character (by comparing character names). If found, -X * the width of the space character will be used to initialize the -X * values in the array of character widths. -X * -X * Before returning, the position of the read/write pointer of the -X * file is reset to be where it was upon entering this function. -X */ -X -static int initializeArray(fp, cwi) -X FILE *fp; -X register int *cwi; -{ -X BOOL cont = TRUE, found = FALSE; -X long opos = ftell(fp); -X int code = 0, width = 0, i = 0, error = 0; -X register char *keyword; -X -X while (cont) -X { -X keyword = token(fp); -X if (keyword == NULL) -X { -X error = earlyEOF; -X break; /* get out of loop */ -X } -X switch(recognize(keyword)) -X { -X case COMMENT: -X keyword = linetoken(fp); -X break; -X case CODE: -X code = atoi(token(fp)); -X break; -X case XWIDTH: -X width = atoi(token(fp)); -X break; -X case CHARNAME: -X keyword = token(fp); -X if (MATCH(keyword, Space)) -X { -X cont = FALSE; -X found = TRUE; -X } -X break; -X case ENDCHARMETRICS: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X case NOPE: -X default: -X error = parseError; -X break; -X } /* switch */ -X } /* while */ -X -X if (!found) -X width = 250; -X -X for (i = 0; i < 256; ++i) -X cwi[i] = width; -X -X fseek(fp, opos, 0); -X -X return(error); -X -} /* initializeArray */ -X -X -/************************* parseCharWidths **************************/ -X -/* This function is called by "parseFile". It will parse the AFM File -X * up to the "EndCharMetrics" keyword. It will save the character -X * width info (as opposed to all of the character metric information) -X * if requested by the caller of parseFile. Otherwise, it will just -X * parse through the section without saving any information. -X * -X * If data is to be saved, parseCharWidths is passed in a pointer -X * to an array of widths that has already been initialized by the -X * standard value for unmapped character codes. This function parses -X * the Character Metrics section only storing the width information -X * for the encoded characters into the array using the character code -X * as the index into that array. -X * -X * This function returns an error code specifying whether there was -X * a premature EOF or a parsing error. This return value is used by -X * parseFile to determine if there is more file to parse. -X */ -X -static parseCharWidths(fp, cwi) -X FILE *fp; -X register int *cwi; -{ -X BOOL cont = TRUE, save = (cwi != NULL); -X int pos = 0, error = ok; -X register char *keyword; -X -X while (cont) -X { -X keyword = token(fp); -X /* Have reached an early and unexpected EOF. */ -X /* Set flag and stop parsing */ -X if (keyword == NULL) -X { -X error = earlyEOF; -X break; /* get out of loop */ -X } -X if (!save) -X /* get tokens until the end of the Char Metrics section without */ -X /* saving any of the data*/ -X switch (recognize(keyword)) -X { -X case ENDCHARMETRICS: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X default: -X break; -X } /* switch */ -X else -X /* otherwise parse entire char metrics section, saving */ -X /* only the char x-width info */ -X switch(recognize(keyword)) -X { -X case COMMENT: -X keyword = linetoken(fp); -X break; -X case CODE: -X keyword = token(fp); -X pos = atoi(keyword); -X break; -X case XYWIDTH: -X /* PROBLEM: Should be no Y-WIDTH when doing "quick & dirty" */ -X keyword = token(fp); keyword = token(fp); /* eat values */ -X error = parseError; -X break; -X case XWIDTH: -X keyword = token(fp); -X if (pos >= 0) /* ignore unmapped chars */ -X cwi[pos] = atoi(keyword); -X break; -X case ENDCHARMETRICS: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X case CHARNAME: /* eat values (so doesn't cause parseError) */ -X keyword = token(fp); -X break; -X case CHARBBOX: -X keyword = token(fp); keyword = token(fp); -X keyword = token(fp); keyword = token(fp); -X break; -X case LIGATURE: -X keyword = token(fp); keyword = token(fp); -X break; -X case NOPE: -X default: -X error = parseError; -X break; -X } /* switch */ -X } /* while */ -X -X return(error); -X -} /* parseCharWidths */ -X -X -/************************* parseCharMetrics ************************/ -X -/* This function is called by parseFile if the caller of parseFile -X * requested that all character metric information be saved -X * (as opposed to only the character width information). -X * -X * parseCharMetrics is passed in a pointer to an array of records -X * to hold information on a per character basis. This function -X * parses the Character Metrics section storing all character -X * metric information for the ALL characters (mapped and unmapped) -X * into the array. -X * -X * This function returns an error code specifying whether there was -X * a premature EOF or a parsing error. This return value is used by -X * parseFile to determine if there is more file to parse. -X */ -X -static parseCharMetrics(fp, fi) -X FILE *fp; -X register FontInfo *fi; -{ -X BOOL cont = TRUE, firstTime = TRUE; -X int error = ok, count = 0; -X register CharMetricInfo *temp = fi->cmi; -X register char *keyword; -X -X while (cont) -X { -X keyword = token(fp); -X if (keyword == NULL) -X { -X error = earlyEOF; -X break; /* get out of loop */ -X } -X switch(recognize(keyword)) -X { -X case COMMENT: -X keyword = linetoken(fp); -X break; -X case CODE: -X if (count < fi->numOfChars) -X { -X if (firstTime) firstTime = FALSE; -X else temp++; -X temp->code = atoi(token(fp)); -X count++; -X } -X else -X { -X error = parseError; -X cont = FALSE; -X } -X break; -X case XYWIDTH: -X temp->wx = atoi(token(fp)); -X temp->wy = atoi(token(fp)); -X break; -X case XWIDTH: -X temp->wx = atoi(token(fp)); -X break; -X case CHARNAME: -X keyword = token(fp); -X temp->name = (char *) malloc(strlen(keyword) + 1); -X strcpy(temp->name, keyword); -X break; -X case CHARBBOX: -X temp->charBBox.llx = atoi(token(fp)); -X temp->charBBox.lly = atoi(token(fp)); -X temp->charBBox.urx = atoi(token(fp)); -X temp->charBBox.ury = atoi(token(fp)); -X break; -X case LIGATURE: { -X Ligature **tail = &(temp->ligs); -X Ligature *node = *tail; -X -X if (*tail != NULL) -X { -X while (node->next != NULL) -X node = node->next; -X tail = &(node->next); -X } -X -X *tail = (Ligature *) calloc(1, sizeof(Ligature)); -X keyword = token(fp); -X (*tail)->succ = (char *) malloc(strlen(keyword) + 1); -X strcpy((*tail)->succ, keyword); -X keyword = token(fp); -X (*tail)->lig = (char *) malloc(strlen(keyword) + 1); -X strcpy((*tail)->lig, keyword); -X break; } -X case ENDCHARMETRICS: -X cont = FALSE;; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X case NOPE: -X default: -X error = parseError; -X break; -X } /* switch */ -X } /* while */ -X -X if ((error == ok) && (count != fi->numOfChars)) -X error = parseError; -X -X return(error); -X -} /* parseCharMetrics */ -X -X -X -/************************* parseTrackKernData ***********************/ -X -/* This function is called by "parseFile". It will parse the AFM File -X * up to the "EndTrackKern" or "EndKernData" keywords. It will save the -X * track kerning data if requested by the caller of parseFile. -X * -X * parseTrackKernData is passed in a pointer to the FontInfo record. -X * If data is to be saved, the FontInfo record will already contain -X * a valid pointer to storage for the track kerning data. -X * -X * This function returns an error code specifying whether there was -X * a premature EOF or a parsing error. This return value is used by -X * parseFile to determine if there is more file to parse. -X */ -X -static parseTrackKernData(fp, fi) -X FILE *fp; -X register FontInfo *fi; -{ -X BOOL cont = TRUE, save = (fi->tkd != NULL); -X int pos = 0, error = ok, tcount = 0; -X register char *keyword; -X -X while (cont) -X { -X keyword = token(fp); -X -X if (keyword == NULL) -X { -X error = earlyEOF; -X break; /* get out of loop */ -X } -X if (!save) -X /* get tokens until the end of the Track Kerning Data */ -X /* section without saving any of the data */ -X switch(recognize(keyword)) -X { -X case ENDTRACKKERN: -X case ENDKERNDATA: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X default: -X break; -X } /* switch */ -X else -X /* otherwise parse entire Track Kerning Data section, */ -X /* saving the data */ -X switch(recognize(keyword)) -X { -X case COMMENT: -X keyword = linetoken(fp); -X break; -X case TRACKKERN: -X if (tcount < fi->numOfTracks) -X { -X keyword = token(fp); -X fi->tkd[pos].degree = atoi(keyword); -X keyword = token(fp); -X fi->tkd[pos].minPtSize = atof(keyword); -X if (errno == ERANGE) error = parseError; -X keyword = token(fp); -X fi->tkd[pos].minKernAmt = atof(keyword); -X if (errno == ERANGE) error = parseError; -X keyword = token(fp); -X fi->tkd[pos].maxPtSize = atof(keyword); -X if (errno == ERANGE) error = parseError; -X keyword = token(fp); -X fi->tkd[pos++].maxKernAmt = atof(keyword); -X if (errno == ERANGE) error = parseError; -X tcount++; -X } -X else -X { -X error = parseError; -X cont = FALSE; -X } -X break; -X case ENDTRACKKERN: -X case ENDKERNDATA: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X case NOPE: -X default: -X error = parseError; -X break; -X } /* switch */ -X } /* while */ -X -X if (error == ok && tcount != fi->numOfTracks) -X error = parseError; -X -X return(error); -X -} /* parseTrackKernData */ -X -X -/************************* parsePairKernData ************************/ -X -/* This function is called by "parseFile". It will parse the AFM File -X * up to the "EndKernPairs" or "EndKernData" keywords. It will save -X * the pair kerning data if requested by the caller of parseFile. -X * -X * parsePairKernData is passed in a pointer to the FontInfo record. -X * If data is to be saved, the FontInfo record will already contain -X * a valid pointer to storage for the pair kerning data. -X * -X * This function returns an error code specifying whether there was -X * a premature EOF or a parsing error. This return value is used by -X * parseFile to determine if there is more file to parse. -X */ -X -static parsePairKernData(fp, fi) -X FILE *fp; -X register FontInfo *fi; -{ -X BOOL cont = TRUE, save = (fi->pkd != NULL); -X int pos = 0, error = ok, pcount = 0; -X register char *keyword; -X -X while (cont) -X { -X keyword = token(fp); -X -X if (keyword == NULL) -X { -X error = earlyEOF; -X break; /* get out of loop */ -X } -X if (!save) -X /* get tokens until the end of the Pair Kerning Data */ -X /* section without saving any of the data */ -X switch(recognize(keyword)) -X { -X case ENDKERNPAIRS: -X case ENDKERNDATA: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X default: -X break; -X } /* switch */ -X else -X /* otherwise parse entire Pair Kerning Data section, */ -X /* saving the data */ -X switch(recognize(keyword)) -X { -X case COMMENT: -X keyword = linetoken(fp); -X break; -X case KERNPAIR: -X if (pcount < fi->numOfPairs) -X { -X keyword = token(fp); -X fi->pkd[pos].name1 = (char *) -X malloc(strlen(keyword) + 1); -X strcpy(fi->pkd[pos].name1, keyword); -X keyword = token(fp); -X fi->pkd[pos].name2 = (char *) -X malloc(strlen(keyword) + 1); -X strcpy(fi->pkd[pos].name2, keyword); -X keyword = token(fp); -X fi->pkd[pos].xamt = atoi(keyword); -X keyword = token(fp); -X fi->pkd[pos++].yamt = atoi(keyword); -X pcount++; -X } -X else -X { -X error = parseError; -X cont = FALSE; -X } -X break; -X case KERNPAIRXAMT: -X if (pcount < fi->numOfPairs) -X { -X keyword = token(fp); -X fi->pkd[pos].name1 = (char *) -X malloc(strlen(keyword) + 1); -X strcpy(fi->pkd[pos].name1, keyword); -X keyword = token(fp); -X fi->pkd[pos].name2 = (char *) -X malloc(strlen(keyword) + 1); -X strcpy(fi->pkd[pos].name2, keyword); -X keyword = token(fp); -X fi->pkd[pos++].xamt = atoi(keyword); -X pcount++; -X } -X else -X { -X error = parseError; -X cont = FALSE; -X } -X break; -X case ENDKERNPAIRS: -X case ENDKERNDATA: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X case NOPE: -X default: -X error = parseError; -X break; -X } /* switch */ -X } /* while */ -X -X if (error == ok && pcount != fi->numOfPairs) -X error = parseError; -X -X return(error); -X -} /* parsePairKernData */ -X -X -/************************* parseCompCharData **************************/ -X -/* This function is called by "parseFile". It will parse the AFM File -X * up to the "EndComposites" keyword. It will save the composite -X * character data if requested by the caller of parseFile. -X * -X * parseCompCharData is passed in a pointer to the FontInfo record, and -X * a boolean representing if the data should be saved. -X * -X * This function will create the appropriate amount of storage for -X * the composite character data and store a pointer to the storage -X * in the FontInfo record. -X * -X * This function returns an error code specifying whether there was -X * a premature EOF or a parsing error. This return value is used by -X * parseFile to determine if there is more file to parse. -X */ -X -static parseCompCharData(fp, fi) -X FILE *fp; -X register FontInfo *fi; -{ -X BOOL cont = TRUE, firstTime = TRUE, save = (fi->ccd != NULL); -X int pos = 0, j = 0, error = ok, ccount = 0, pcount = 0; -X register char *keyword; -X -X while (cont) -X { -X keyword = token(fp); -X if (keyword == NULL) -X /* Have reached an early and unexpected EOF. */ -X /* Set flag and stop parsing */ -X { -X error = earlyEOF; -X break; /* get out of loop */ -X } -X if (ccount > fi->numOfComps) -X { -X error = parseError; -X break; /* get out of loop */ -X } -X if (!save) -X /* get tokens until the end of the Composite Character info */ -X /* section without saving any of the data */ -X switch(recognize(keyword)) -X { -X case ENDCOMPOSITES: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X default: -X break; -X } /* switch */ -X else -X /* otherwise parse entire Composite Character info section, */ -X /* saving the data */ -X switch(recognize(keyword)) -X { -X case COMMENT: -X keyword = linetoken(fp); -X break; -X case COMPCHAR: -X if (ccount < fi->numOfComps) -X { -X keyword = token(fp); -X if (pcount != fi->ccd[pos].numOfPieces) -X error = parseError; -X pcount = 0; -X if (firstTime) firstTime = FALSE; -X else pos++; -X fi->ccd[pos].ccName = (char *) -X malloc(strlen(keyword) + 1); -X strcpy(fi->ccd[pos].ccName, keyword); -X keyword = token(fp); -X fi->ccd[pos].numOfPieces = atoi(keyword); -X fi->ccd[pos].pieces = (Pcc *) -X calloc(fi->ccd[pos].numOfPieces, sizeof(Pcc)); -X j = 0; -X ccount++; -X } -X else -X { -X error = parseError; -X cont = FALSE; -X } -X break; -X case COMPCHARPIECE: -X if (pcount < fi->ccd[pos].numOfPieces) -X { -X keyword = token(fp); -X fi->ccd[pos].pieces[j].pccName = (char *) -X malloc(strlen(keyword) + 1); -X strcpy(fi->ccd[pos].pieces[j].pccName, keyword); -X keyword = token(fp); -X fi->ccd[pos].pieces[j].deltax = atoi(keyword); -X keyword = token(fp); -X fi->ccd[pos].pieces[j++].deltay = atoi(keyword); -X pcount++; -X } -X else -X error = parseError; -X break; -X case ENDCOMPOSITES: -X cont = FALSE; -X break; -X case ENDFONTMETRICS: -X cont = FALSE; -X error = normalEOF; -X break; -X case NOPE: -X default: -X error = parseError; -X break; -X } /* switch */ -X } /* while */ -X -X if (error == ok && ccount != fi->numOfComps) -X error = parseError; -X -X return(error); -X -} /* parseCompCharData */ -X -X -X -X -/*************************** 'PUBLIC' FUNCTION ********************/ -X -X -/*************************** parseFile *****************************/ -X -/* parseFile is the only 'public' procedure available. It is called -X * from an application wishing to get information from an AFM file. -X * The caller of this function is responsible for locating and opening -X * an AFM file and handling all errors associated with that task. -X * -X * parseFile expects 3 parameters: a vaild file pointer, a pointer -X * to a (FontInfo *) variable (for which storage will be allocated and -X * the data requested filled in), and a mask specifying which -X * data from the AFM File should be saved in the FontInfo structure. -X * -X * The file will be parsed and the requested data will be stored in -X * a record of type FontInfo (refer to ParseAFM.h). -X * -X * parseFile returns an error code as defined in parseAFM.h. -X * -X * The position of the read/write pointer associated with the file -X * pointer upon return of this function is undefined. -X */ -X -extern int parseFile (fp, fi, flags) -X FILE *fp; -X FontInfo **fi; -X FLAGS flags; -{ -X -X int code = ok; /* return code from each of the parsing routines */ -X int error = ok; /* used as the return code from this function */ -X -X register char *keyword; /* used to store a token */ -X -X -X /* storage data for the global variable ident */ -X ident = (char *) calloc(MAX_NAME, sizeof(char)); -X if (ident == NULL) {error = storageProblem; return(error);} -X -X (*fi) = (FontInfo *) calloc(1, sizeof(FontInfo)); -X if ((*fi) == NULL) {error = storageProblem; return(error);} -X -X if (flags & P_G) -X { -X (*fi)->gfi = (GlobalFontInfo *) calloc(1, sizeof(GlobalFontInfo)); -X if ((*fi)->gfi == NULL) {error = storageProblem; return(error);} -X } -X -X /* The AFM File begins with Global Font Information. This section */ -X /* will be parsed whether or not information should be saved. */ -X code = parseGlobals(fp, (*fi)->gfi); -X -X if (code < 0) error = code; -X -X /* The Global Font Information is followed by the Character Metrics */ -X /* section. Which procedure is used to parse this section depends on */ -X /* how much information should be saved. If all of the metrics info */ -X /* is wanted, parseCharMetrics is called. If only the character widths */ -X /* is wanted, parseCharWidths is called. parseCharWidths will also */ -X /* be called in the case that no character data is to be saved, just */ -X /* to parse through the section. */ -X -X if ((code != normalEOF) && (code != earlyEOF)) -X { -X (*fi)->numOfChars = atoi(token(fp)); -X if (flags & (P_M ^ P_W)) -X { -X (*fi)->cmi = (CharMetricInfo *) -X calloc((*fi)->numOfChars, sizeof(CharMetricInfo)); -X if ((*fi)->cmi == NULL) {error = storageProblem; return(error);} -X code = parseCharMetrics(fp, *fi); -X } -X else -X { -X if (flags & P_W) -X { -X (*fi)->cwi = (int *) calloc(256, sizeof(int)); -X if ((*fi)->cwi == NULL) -X { -X error = storageProblem; -X return(error); -X } -X } -X /* parse section regardless */ -X code = parseCharWidths(fp, (*fi)->cwi); -X } /* else */ -X } /* if */ -X -X if ((error != earlyEOF) && (code < 0)) error = code; -X -X /* The remaining sections of the AFM are optional. This code will */ -X /* look at the next keyword in the file to determine what section */ -X /* is next, and then allocate the appropriate amount of storage */ -X /* for the data (if the data is to be saved) and call the */ -X /* appropriate parsing routine to parse the section. */ -X -X while ((code != normalEOF) && (code != earlyEOF)) -X { -X keyword = token(fp); -X if (keyword == NULL) -X /* Have reached an early and unexpected EOF. */ -X /* Set flag and stop parsing */ -X { -X code = earlyEOF; -X break; /* get out of loop */ -X } -X switch(recognize(keyword)) -X { -X case STARTKERNDATA: -X break; -X case ENDKERNDATA: -X break; -X case STARTTRACKKERN: -X keyword = token(fp); -X if (flags & P_T) -X { -X (*fi)->numOfTracks = atoi(keyword); -X (*fi)->tkd = (TrackKernData *) -X calloc((*fi)->numOfTracks, sizeof(TrackKernData)); -X if ((*fi)->tkd == NULL) -X { -X error = storageProblem; -X return(error); -X } -X } /* if */ -X code = parseTrackKernData(fp, *fi); -X break; -X case STARTKERNPAIRS: -X keyword = token(fp); -X if (flags & P_P) -X { -X (*fi)->numOfPairs = atoi(keyword); -X (*fi)->pkd = (PairKernData *) -X calloc((*fi)->numOfPairs, sizeof(PairKernData)); -X if ((*fi)->pkd == NULL) -X { -X error = storageProblem; -X return(error); -X } -X } /* if */ -X code = parsePairKernData(fp, *fi); -X break; -X case STARTCOMPOSITES: -X keyword = token(fp); -X if (flags & P_C) -X { -X (*fi)->numOfComps = atoi(keyword); -X (*fi)->ccd = (CompCharData *) -X calloc((*fi)->numOfComps, sizeof(CompCharData)); -X if ((*fi)->ccd == NULL) -X { -X error = storageProblem; -X return(error); -X } -X } /* if */ -X code = parseCompCharData(fp, *fi); -X break; -X case ENDFONTMETRICS: -X code = normalEOF; -X break; -X case NOPE: -X default: -X code = parseError; -X break; -X } /* switch */ -X -X if ((error != earlyEOF) && (code < 0)) error = code; -X -X } /* while */ -X -X if ((error != earlyEOF) && (code < 0)) error = code; -X -X if (ident != NULL) { free(ident); ident = NULL; } -X -X return(error); -X -} /* parseFile */ -SHAR_EOF - $shar_touch -am 1018085596 'parseAFM.c' && - chmod 0644 'parseAFM.c' || - $echo 'restore of' 'parseAFM.c' 'failed' - shar_count="`wc -c < 'parseAFM.c'`" - test 43280 -eq "$shar_count" || - $echo 'parseAFM.c:' 'original size' '43280,' 'current size' "$shar_count" -fi -# ============= parseAFM.h ============== -if test -f 'parseAFM.h' && test X"$1" != X"-c"; then - $echo 'x -' SKIPPING 'parseAFM.h' '(file already exists)' -else - $echo 'x -' extracting 'parseAFM.h' '(text)' - sed 's/^X//' << 'SHAR_EOF' > 'parseAFM.h' && -/* -X * (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved. -X * -X * This file may be freely copied and redistributed as long as: -X * 1) This entire notice continues to be included in the file, -X * 2) If the file has been modified in any way, a notice of such -X * modification is conspicuously indicated. -X * -X * PostScript, Display PostScript, and Adobe are registered trademarks of -X * Adobe Systems Incorporated. -X * -X * ************************************************************************ -X * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT -X * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS -X * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR -X * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY -X * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, -X * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, -X * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. -X * ************************************************************************ -X */ -X -/* ParseAFM.h -X * -X * This header file is used in conjuction with the parseAFM.c file. -X * Together these files provide the functionality to parse Adobe Font -X * Metrics files and store the information in predefined data structures. -X * It is intended to work with an application program that needs font metric -X * information. The program can be used as is by making a procedure call to -X * parse an AFM file and have the data stored, or an application developer -X * may wish to customize the code. -X * -X * This header file defines the data structures used as well as the key -X * strings that are currently recognized by this version of the AFM parser. -X * This program is based on the document "Adobe Font Metrics Files, -X * Specification Version 2.0". -X * -X * AFM files are separated into distinct sections of different data. Because -X * of this, the parseAFM program can parse a specified file to only save -X * certain sections of information based on the application's needs. A record -X * containing the requested information will be returned to the application. -X * -X * AFM files are divided into five sections of data: -X * 1) The Global Font Information -X * 2) The Character Metrics Information -X * 3) The Track Kerning Data -X * 4) The Pair-Wise Kerning Data -X * 5) The Composite Character Data -X * -X * Basically, the application can request any of these sections independent -X * of what other sections are requested. In addition, in recognizing that -X * many applications will want ONLY the x-width of characters and not all -X * of the other character metrics information, there is a way to receive -X * only the width information so as not to pay the storage cost for the -X * unwanted data. An application should never request both the -X * "quick and dirty" char metrics (widths only) and the Character Metrics -X * Information since the Character Metrics Information will contain all -X * of the character widths as well. -X * -X * There is a procedure in parseAFM.c, called parseFile, that can be -X * called from any application wishing to get information from the AFM File. -X * This procedure expects 3 parameters: a vaild file descriptor, a pointer -X * to a (FontInfo *) variable (for which space will be allocated and then -X * will be filled in with the data requested), and a mask specifying -X * which data from the AFM File should be saved in the FontInfo structure. -X * -X * The flags that can be used to set the appropriate mask are defined below. -X * In addition, several commonly used masks have already been defined. -X * -X * History: -X * original: DSM Thu Oct 20 17:39:59 PDT 1988 -X * modified: DSM Mon Jul 3 14:17:50 PDT 1989 -X * - added 'storageProblem' return code -X * - fixed typos -X */ -X -#include -X -X -X -/* your basic constants */ -#define TRUE 1 -#define FALSE 0 -#define EOL '\n' /* end-of-line indicator */ -#define MAX_NAME 4096 /* max length for identifiers */ -#define BOOL int -#define FLAGS int -X -X -X -/* Flags that can be AND'ed together to specify exactly what -X * information from the AFM file should be saved. -X */ -#define P_G 0x01 /* 0000 0001 */ /* Global Font Info */ -#define P_W 0x02 /* 0000 0010 */ /* Character Widths ONLY */ -#define P_M 0x06 /* 0000 0110 */ /* All Char Metric Info */ -#define P_P 0x08 /* 0000 1000 */ /* Pair Kerning Info */ -#define P_T 0x10 /* 0001 0000 */ /* Track Kerning Info */ -#define P_C 0x20 /* 0010 0000 */ /* Composite Char Info */ -X -X -/* Commonly used flags -X */ -#define P_GW (P_G | P_W) -#define P_GM (P_G | P_M) -#define P_GMP (P_G | P_M | P_P) -#define P_GMK (P_G | P_M | P_P | P_T) -#define P_ALL (P_G | P_M | P_P | P_T | P_C) -X -X -X -/* Possible return codes from the parseFile procedure. -X * -X * ok means there were no problems parsing the file. -X * -X * parseError means that there was some kind of parsing error, but the -X * parser went on. This could include problems like the count for any given -X * section does not add up to how many entries there actually were, or -X * there was a key that was not recognized. The return record may contain -X * vaild data or it may not. -X * -X * earlyEOF means that an End of File was encountered before expected. This -X * may mean that the AFM file had been truncated, or improperly formed. -X * -X * storageProblem means that there were problems allocating storage for -X * the data structures that would have contained the AFM data. -X */ -#define ok 0 -#define parseError -1 -#define earlyEOF -2 -#define storageProblem -3 -X -X -X -/************************* TYPES *********************************/ -/* Below are all of the data structure definitions. These structures -X * try to map as closely as possible to grouping and naming of data -X * in the AFM Files. -X */ -X -X -/* Bounding box definition. Used for the Font BBox as well as the -X * Character BBox. -X */ -typedef struct -{ -X int llx; /* lower left x-position */ -X int lly; /* lower left y-position */ -X int urx; /* upper right x-position */ -X int ury; /* upper right y-position */ -} BBox; -X -X -/* Global Font information. -X * The key that each field is associated with is in comments. For an -X * explanation about each key and its value please refer to the AFM -X * documentation (full title & version given above). -X */ -typedef struct -{ -X char *afmVersion; /* key: StartFontMetrics */ -X char *fontName; /* key: FontName */ -X char *fullName; /* key: FullName */ -X char *familyName; /* key: FamilyName */ -X char *weight; /* key: Weight */ -X float italicAngle; /* key: ItalicAngle */ -X BOOL isFixedPitch; /* key: IsFixedPitch */ -X BBox fontBBox; /* key: FontBBox */ -X int underlinePosition; /* key: UnderlinePosition */ -X int underlineThickness; /* key: UnderlineThickness */ -X char *version; /* key: Version */ -X char *notice; /* key: Notice */ -X char *encodingScheme; /* key: EncodingScheme */ -X int capHeight; /* key: CapHeight */ -X int xHeight; /* key: XHeight */ -X int ascender; /* key: Ascender */ -X int descender; /* key: Descender */ -} GlobalFontInfo; -X -X -/* Ligature definition is a linked list since any character can have -X * any number of ligatures. -X */ -typedef struct _t_ligature -{ -X char *succ, *lig; -X struct _t_ligature *next; -} Ligature; -X -X -/* Character Metric Information. This structure is used only if ALL -X * character metric information is requested. If only the character -X * widths is requested, then only an array of the character x-widths -X * is returned. -X * -X * The key that each field is associated with is in comments. For an -X * explanation about each key and its value please refer to the -X * Character Metrics section of the AFM documentation (full title -X * & version given above). -X */ -typedef struct -{ -X int code, /* key: C */ -X wx, /* key: WX */ -X wy; /* together wx and wy are associated with key: W */ -X char *name; /* key: N */ -X BBox charBBox; /* key: B */ -X Ligature *ligs; /* key: L (linked list; not a fixed number of Ls */ -} CharMetricInfo; -X -X -/* Track kerning data structure. -X * The fields of this record are the five values associated with every -X * TrackKern entry. -X * -X * For an explanation about each value please refer to the -X * Track Kerning section of the AFM documentation (full title -X * & version given above). -X */ -typedef struct -{ -X int degree; -X float minPtSize, -X minKernAmt, -X maxPtSize, -X maxKernAmt; -} TrackKernData; -X -X -/* Pair Kerning data structure. -X * The fields of this record are the four values associated with every -X * KP entry. For KPX entries, the yamt will be zero. -X * -X * For an explanation about each value please refer to the -X * Pair Kerning section of the AFM documentation (full title -X * & version given above). -X */ -typedef struct -{ -X char *name1; -X char *name2; -X int xamt, -X yamt; -} PairKernData; -X -X -/* PCC is a piece of a composite character. This is a sub structure of a -X * compCharData described below. -X * These fields will be filled in with the values from the key PCC. -X * -X * For an explanation about each key and its value please refer to the -X * Composite Character section of the AFM documentation (full title -X * & version given above). -X */ -typedef struct -{ -X char *pccName; -X int deltax, -X deltay; -} Pcc; -X -X -/* Composite Character Information data structure. -X * The fields ccName and numOfPieces are filled with the values associated -X * with the key CC. The field pieces points to an array (size = numOfPieces) -X * of information about each of the parts of the composite character. That -X * array is filled in with the values from the key PCC. -X * -X * For an explanation about each key and its value please refer to the -X * Composite Character section of the AFM documentation (full title -X * & version given above). -X */ -typedef struct -{ -X char *ccName; -X int numOfPieces; -X Pcc *pieces; -} CompCharData; -X -X -/* FontInfo -X * Record type containing pointers to all of the other data -X * structures containing information about a font. -X * A a record of this type is filled with data by the -X * parseFile function. -X */ -typedef struct -{ -X GlobalFontInfo *gfi; /* ptr to a GlobalFontInfo record */ -X int *cwi; /* ptr to 256 element array of just char widths */ -X int numOfChars; /* number of entries in char metrics array */ -X CharMetricInfo *cmi; /* ptr to char metrics array */ -X int numOfTracks; /* number to entries in track kerning array */ -X TrackKernData *tkd; /* ptr to track kerning array */ -X int numOfPairs; /* number to entries in pair kerning array */ -X PairKernData *pkd; /* ptr to pair kerning array */ -X int numOfComps; /* number to entries in comp char array */ -X CompCharData *ccd; /* ptr to comp char array */ -} FontInfo; -X -X -X -/************************* PROCEDURES ****************************/ -X -/* Call this procedure to do the grunt work of parsing an AFM file. -X * -X * "fp" should be a valid file pointer to an AFM file. -X * -X * "fi" is a pointer to a pointer to a FontInfo record sturcture -X * (defined above). Storage for the FontInfo structure will be -X * allocated in parseFile and the structure will be filled in -X * with the requested data from the AFM File. -X * -X * "flags" is a mask with bits set representing what data should -X * be saved. Defined above are valid flags that can be used to set -X * the mask, as well as a few commonly used masks. -X * -X * The possible return codes from parseFile are defined above. -X */ -X -extern int parseFile ( /* FILE *fp; FontInfo **fi; FLAGS flags; */ ); -SHAR_EOF - $shar_touch -am 1018085596 'parseAFM.h' && - chmod 0644 'parseAFM.h' || - $echo 'restore of' 'parseAFM.h' 'failed' - shar_count="`wc -c < 'parseAFM.h'`" - test 11502 -eq "$shar_count" || - $echo 'parseAFM.h:' 'original size' '11502,' 'current size' "$shar_count" -fi -# ============= parseAFMclient.c ============== -if test -f 'parseAFMclient.c' && test X"$1" != X"-c"; then - $echo 'x -' SKIPPING 'parseAFMclient.c' '(file already exists)' -else - $echo 'x -' extracting 'parseAFMclient.c' '(text)' - sed 's/^X//' << 'SHAR_EOF' > 'parseAFMclient.c' && -/* -X * (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved. -X * -X * This file may be freely copied and redistributed as long as: -X * 1) This entire notice continues to be included in the file, -X * 2) If the file has been modified in any way, a notice of such -X * modification is conspicuously indicated. -X * -X * PostScript, Display PostScript, and Adobe are registered trademarks of -X * Adobe Systems Incorporated. -X * -X * ************************************************************************ -X * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT -X * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS -X * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR -X * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY -X * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, -X * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, -X * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. -X * ************************************************************************ -X */ -X -/* parseAFMclient.c -X * -X * This file is an example of how an application might use the provided -X * AFM Parser (parseAFM.c). -X * -X * In a nutshell, the client of the parser (like this file) chooses -X * the AFM File that it wishes to have parsed, opens the file for -X * reading (and does any/all error handling associated with that task), -X * and passes the resulting file pointer to the procedure "parseFile" -X * (in parseAFM.c). In addition to the file pointer, the client also -X * needs to pass a pointer to a FontInfo record type (for which storage -X * will be allocated and data filled in), and a mask representing which -X * sections of the AFM should be saved in the FontInfo record. -X * -X * In the procedure "main", the mask is built from command line switches, -X * but your application, of course, can set that mask any way you prefer. -X * "main" then calls the "parseFile" procedure (of parseAFM.c) to do the -X * grunt work, and checks the error codes upon "parseFile"'s return. -X * -X * The rest of this sample application is a collection of print routines -X * that show how to reference each of the sections of data and a -X * "freeStorage" routine (that many unix programmers may feel they -X * don't need but is included for portability to other systems that do -X * need to manage storage). The print procedures are there just to -X * give meaning to this application, and hopefully your application -X * will use the data collected from the AFM file in a more useful way. -X * -X * History: -X * original: DSM Thu Oct 20 17:39:59 PDT 1988 -X * modified: DSM Mon Jul 3 14:17:50 PDT 1989 -X * - added 'storageProblem' check in main -X */ -X -#include -#include "parseAFM.h" -X -X -/*************************** GLOBALS ***************************/ -FontInfo *fi; -FLAGS myflags = 0; -X -X -/*************************** printGlobals **********************/ -X -printGlobals() -{ -X printf("\nThis AFM is of Version %s\n", fi->gfi->afmVersion); -X printf("The font name is %s\n", fi->gfi->fontName); -X printf("The full name is %s\n", fi->gfi->fullName); -X printf("The family name is %s\n", fi->gfi->familyName); -X printf("The weight is %s\n", fi->gfi->weight); -X printf("Italic Angle is %3.1f\n", fi->gfi->italicAngle); -X if (fi->gfi->isFixedPitch) -X printf("This font IS fixed-pitch\n"); -X else -X printf("This font is NOT fixed-pitch\n"); -X printf("Underline position is %d\n", fi->gfi->underlinePosition); -X printf("Underline thickness is %d\n", fi->gfi->underlineThickness); -X printf("Version is %s\n", fi->gfi->version); -X printf("FontBBox is [%d, %d, %d, %d]\n", -X fi->gfi->fontBBox.llx, fi->gfi->fontBBox.lly, -X fi->gfi->fontBBox.urx, fi->gfi->fontBBox.ury); -X printf("%s\n", fi->gfi->notice); -X printf("Encoding Scheme is %s\n", fi->gfi->encodingScheme); -X printf("CapHeight is %d\n", fi->gfi->capHeight); -X printf("XHeight is %d\n", fi->gfi->xHeight); -X printf("Descender is %d\n", fi->gfi->descender); -X printf("Ascender is %d\n\n", fi->gfi->ascender); -X -} /* printGlobals */ -X -X -/*************************** printCharWidths *********************/ -printCharWidths() -{ -X int i = 0; -X printf("Here come some character widths ...\n"); -X for (i = 0; i < 256; ++i) -X printf(" code: %3d width: %4d\n", i, fi->cwi[i]); -X printf("\n"); -X -} /* printCharWidths */ -X -X -/*************************** printAllCharMetrics *****************/ -printAllCharMetrics() -{ -X int i = 0; -X CharMetricInfo *temp = fi->cmi; -X Ligature *node = temp->ligs; -X -X printf("Here come some character metrics ...\n"); -X for (i = 0; i < fi->numOfChars; ++i) -X { -X printf( -X " code: %3d x-width: %4d y-width: %4d name: %-12s bbox: [%d, %d, %d, %d]\n", -X temp->code, temp->wx, temp->wy, temp->name, temp->charBBox.llx, -X temp->charBBox.lly, temp->charBBox.urx, temp->charBBox.ury); -X for (node = temp->ligs; node != NULL; node = node->next) -X { -X printf(" Ligatures: successor: %s ligature: %s\n", -X node->succ, node->lig); -X } -X temp++; -X } /* for */ -X printf("\n"); -X -} /* printAllCharMetrics */ -X -X -/*************************** printKernPairData ******************/ -printKernPairData() -{ -X int i = 0; -X PairKernData *pkd = fi->pkd; -X -X if (fi->numOfPairs != 0) -X { -X printf("Here comes the pair kerning data ...\n"); -X for (i = 0; i < fi->numOfPairs; ++i) -X printf( -X " char 1: %-12s char 2: %-12s x-amount: %d y-amount: %d\n", -X pkd[i].name1, pkd[i].name2, pkd[i].xamt, pkd[i].yamt); -X } -X else printf("There isn't any pair kerning data.\n"); -X printf("\n"); -X -} /* printKernPairData */ -X -X -/*************************** printKernTrackData *******************/ -printKernTrackData() -{ -X int i = 0; -X TrackKernData *tkd = fi->tkd; -X -X if (fi->numOfTracks != 0) -X { -X printf("Here comes the track kerning data ...\n"); -X for (i = 0; i < fi->numOfTracks; ++i) -X printf( -X " degree: %d min-pt: %5.2f min-kern: %5.2f max-pt: %5.2f max-kern: %5.2f\n", -X tkd[i].degree, tkd[i].minPtSize, tkd[i].minKernAmt, -X tkd[i].maxPtSize, tkd[i].maxKernAmt); -X } -X else printf("There isn't any track kerning data.\n"); -X printf("\n"); -X -} /* printKernTrackData */ -X -X -/*************************** printCompCharData ********************/ -printCompCharData() -{ -X int i = 0, j = 0; -X CompCharData *ccd = fi->ccd; -X -X if (fi->numOfComps != 0) -X { -X printf("Here comes the composite character data ...\n"); -X for (i = 0; i < fi->numOfComps; ++i) -X { -X printf(" comp char: %-12s pieces: %d\n", -X ccd[i].ccName, ccd[i].numOfPieces); -X for (j = 0; j < ccd[i].numOfPieces; ++j) -X printf( -X " Part # %d Name: %-12s Delta X: %d Delta Y: %d\n", -X (j + 1), ccd[i].pieces[j].pccName, -X ccd[i].pieces[j].deltax, ccd[i].pieces[j].deltay); -X } -X } -X else printf("There aren't any composites characters. \n"); -X printf("\n"); -X -} /* printCompCharData */ -X -X -X -/*************************** freeStorage ***********************/ -X -freeStorage() -{ -X if (fi != NULL) -X { -X if (fi->gfi != NULL) -X { -X free(fi->gfi->afmVersion); fi->gfi->afmVersion = NULL; -X free(fi->gfi->fontName); fi->gfi->fontName = NULL; -X free(fi->gfi->fullName); fi->gfi->fullName = NULL; -X free(fi->gfi->familyName); fi->gfi->familyName = NULL; -X free(fi->gfi->weight); fi->gfi->weight = NULL; -X free(fi->gfi->version); fi->gfi->version = NULL; -X free(fi->gfi->notice); fi->gfi->notice = NULL; -X free(fi->gfi->encodingScheme); fi->gfi->encodingScheme = NULL; -X free(fi->gfi); fi->gfi = NULL; -X } -X -X if (fi->cwi != NULL) -X { free(fi->cwi); fi->cwi = NULL; } -X -X if (fi->cmi != NULL) -X { -X int i = 0; -X CharMetricInfo *temp = fi->cmi; -X Ligature *node = temp->ligs; -X -X for (i = 0; i < fi->numOfChars; ++i) -X { -X for (node = temp->ligs; node != NULL; node = node->next) -X { -X free(node->succ); node->succ = NULL; -X free(node->lig); node->lig = NULL; -X } -X -X free(temp->name); temp->name = NULL; -X temp++; -X } -X -X free(fi->cmi); fi->cmi = NULL; -X } -X -X if (fi->tkd != NULL) -X { free(fi->tkd); fi->tkd = NULL; } -X -X if (fi->pkd != NULL) -X { -X free(fi->pkd->name1); fi->pkd->name1 = NULL; -X free(fi->pkd->name2); fi->pkd->name2 = NULL; -X free(fi->pkd); fi->pkd = NULL; -X } -X -X if (fi->ccd != NULL) -X { -X int i = 0, j = 0; -X CompCharData *ccd = fi->ccd; -X -X for (i = 0; i < fi->numOfComps; ++i) -X { -X for (j = 0; j < ccd[i].numOfPieces; ++j) -X { -X free(ccd[i].pieces[j].pccName); -X ccd[i].pieces[j].pccName = NULL; -X } -X -X free(ccd[i].ccName); ccd[i].ccName = NULL; -X } -X -X free(fi->ccd); fi->ccd = NULL; -X } -X -X free(fi); -X -X } /* if */ -X -} /* freeStorage */ -X -X -/*************************** printValues **************************/ -X -printValues() -{ -X if ((myflags & P_G) && (fi->gfi != NULL)) printGlobals(); -X if ((myflags & (P_M ^ P_W)) && (fi->cmi != NULL)) printAllCharMetrics(); -X else if ((myflags & P_W) && (fi->cwi != NULL)) printCharWidths(); -X if ((myflags & P_P) && (fi->pkd != NULL)) printKernPairData(); -X if ((myflags & P_T) && (fi->tkd != NULL)) printKernTrackData(); -X if ((myflags & P_C) && (fi->ccd != NULL)) printCompCharData(); -X -} /* printValues */ -X -X -X -/*************************** main *********************************/ -X -main (argc, argv) -X int argc; -X char **argv; -{ -X char *filename, *prog = *argv; -X FILE *fp; -X -X ++argv; --argc; -X while (argc > 0 && **argv == '-') -X { -X switch ((*argv)[1]) -X { -X case 'g': /* save Globals */ -X myflags |= P_G; -X break; -X case 'w': /* save Char Widths */ -X myflags |= P_W; -X break; -X case 'm': /* save All Char Metrics */ -X myflags |= P_M; -X break; -X case 'p': /* save Kern Pair Data */ -X myflags |= P_P; -X break; -X case 't': /* save Kern Track Data */ -X myflags |= P_T; -X break; -X case 'c': /* save Comp Char Data */ -X myflags |= P_C; -X break; -X default: -X printf(" usage: parseAFM [-g] [-w] [-p] [-t] [-c] [AFM File]\nOR: usage: parseAFM [-g] [-m] [-p] [-t] [-c] [AFM File]\n"); -X exit(0); -X } -X ++argv; --argc; -X } -X -X if (!argc) -X { -X printf(" usage: parseAFM [-g] [-w] [-p] [-t] [-c] [AFM File]\nOR: usage: parseAFM [-g] [-m] [-p] [-t] [-c] [AFM File]\n"); -X exit(0); -X } -X else -X filename = *argv; -X -X if (!filename[0]) -X { -X printf ("*** ERROR: can't open. filename is missing.\n", -X filename ); -X return 0; -X } -X -X fp = fopen(filename, "r" ); -X if (fp == NULL) -X { -X printf ("*** ERROR: can't find: %s\n", filename ); -X exit(1); -X } -X -X switch (parseFile(fp, &fi, myflags)) -X { -X case parseError: -X printf("*** ERROR: problem in parsing the AFM File.\n"); -X case ok: -X fclose(fp); -X printValues(); -X freeStorage(); -X break; -X case earlyEOF: -X printf("The AFM File ended prematurely.\n"); -X break; -X case storageProblem: -X printf("*** ERROR: problem allocating storage.\n"); -X break; -X default: -X break; -X } -X -} /* main */ -SHAR_EOF - $shar_touch -am 1018085596 'parseAFMclient.c' && - chmod 0644 'parseAFMclient.c' || - $echo 'restore of' 'parseAFMclient.c' 'failed' - shar_count="`wc -c < 'parseAFMclient.c'`" - test 12210 -eq "$shar_count" || - $echo 'parseAFMclient.c:' 'original size' '12210,' 'current size' "$shar_count" -fi -rm -fr _sh00599 -exit 0 diff -Naur xdvik-22.40l/libs/t1lib/sysconf.h.in xdvik-22.40n/libs/t1lib/sysconf.h.in --- xdvik-22.40l/libs/t1lib/sysconf.h.in Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/sysconf.h.in Sat Sep 14 00:24:47 2002 @@ -0,0 +1,40 @@ +/*-------------------------------------------------------------------------- + ----- File: sysconf.h.in + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. Some system + dependent definitions are stored here. sysconf.h + is generated from this file automatically by the + configure-script. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#undef __CHAR_UNSIGNED__ +#define SIZEOF_CHAR 0 +#define SIZEOF_SHORT 0 +#define SIZEOF_INT 0 +#define SIZEOF_LONG 0 +#define SIZEOF_LONG_LONG 0 +#define SIZEOF_FLOAT 0 +#define SIZEOF_DOUBLE 0 +#define SIZEOF_LONG_DOUBLE 0 +#define SIZEOF_VOID_P 0 diff -Naur xdvik-22.40l/libs/t1lib/t1aaset.c xdvik-22.40n/libs/t1lib/t1aaset.c --- xdvik-22.40l/libs/t1lib/t1aaset.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1aaset.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1676 @@ +/*-------------------------------------------------------------------------- + ----- File: t1aaset.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + Subsampling based on code by Raph Levien (raph@acm.org) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + functions for antialiased setting of characters + and strings of characters. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1AASET_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" + +#include "t1types.h" +#include "t1extern.h" +#include "t1aaset.h" +#include "t1set.h" +#include "t1load.h" +#include "t1finfo.h" +#include "t1misc.h" +#include "t1base.h" +#include "t1outline.h" + + +#define DEFAULTBPP 8 + + +/* As a fall back */ +#ifndef T1_AA_TYPE16 +#define T1_AA_TYPE16 short +#endif +#ifndef T1_AA_TYPE32 +#define T1_AA_TYPE32 int +#endif + + +/* In the following arrays take the gray values. Entry 0 is associated + with the white (background) value and the max entry is the + black (foreground) value. */ +static unsigned T1_AA_TYPE32 gv[5]={0,0,0,0,0}; +static unsigned T1_AA_TYPE32 gv_h[17]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; +static unsigned T1_AA_TYPE32 gv_n[2]={0,0}; + +static int T1aa_level=T1_AA_LOW; /* The default value */ +static T1_AA_TYPE32 T1aa_lut[625]; +static int T1aa_count[256]; +static T1_AA_TYPE32 T1aa_h_lut[289]; +static int T1aa_h_count[256]; +static T1_AA_TYPE32 T1aa_n_lut[64]; + +/* This global is for querying the current bg from other parts + of t1lib */ +unsigned T1_AA_TYPE32 T1aa_bg=0; + +/* The limit values for smart antialiasing */ +float T1aa_smartlimit1=T1_AA_SMARTLIMIT1; +float T1aa_smartlimit2=T1_AA_SMARTLIMIT2; +int T1aa_SmartOn=0; /* We do not enable smart AA by default */ + +/* T1_AAInit: This function must be called whenever the T1aa_gray_val + or T1aa_bpp variables change, or the level changes. */ +static int T1_AAInit ( int level ) +{ + int i; + int i0, i1, i2, i3; + int movelow=0, movehigh=0, indlow=0, indhigh=0; + + /* Note: movelow, movehigh, indlow and indhigh take care for proper + byte swapping in dependence of endianess for level=4 */ + if (level==T1_AA_NONE){ + if (T1aa_bpp==8){ + if (pFontBase->endian){ + movelow=3; + movehigh=2; + } + else{ + movelow=0; + movehigh=1; + } + } + else if (T1aa_bpp==16){ + if (pFontBase->endian){ + movelow=1; + movehigh=0; + } + else{ + movelow=0; + movehigh=1; + } + } + } + + if (level==T1_AA_HIGH){ + + if (T1aa_bpp==8){ + if (pFontBase->endian){ + indlow=17; + indhigh=1; + movelow=3; + movehigh=2; + } + else{ + indlow=1; + indhigh=17; + movelow=0; + movehigh=1; + } + } + else if (T1aa_bpp==16){ + if (pFontBase->endian){ + indlow=17; + indhigh=1; + movelow=1; + movehigh=0; + } + else{ + indlow=1; + indhigh=17; + movelow=0; + movehigh=1; + } + } + else if (T1aa_bpp==32){ + indlow=1; + indhigh=17; + } + for (i = 0; i < 256; i++) { + T1aa_h_count[i] = 0; + if (i & 0x80) T1aa_h_count[i] += indhigh; + if (i & 0x40) T1aa_h_count[i] += indhigh; + if (i & 0x20) T1aa_h_count[i] += indhigh; + if (i & 0x10) T1aa_h_count[i] += indhigh; + if (i & 0x08) T1aa_h_count[i] += indlow; + if (i & 0x04) T1aa_h_count[i] += indlow; + if (i & 0x02) T1aa_h_count[i] += indlow; + if (i & 0x01) T1aa_h_count[i] += indlow; + } + } + + if (level == 2 && T1aa_bpp == 8) { + for (i0 = 0; i0 < 5; i0++) + for (i1 = 0; i1 < 5; i1++) + for (i2 = 0; i2 < 5; i2++) + for (i3 = 0; i3 < 5; i3++) { + ((char *)T1aa_lut)[(((i0 * 5 + i1) * 5 + i2) * 5 + i3) * 4] = gv[i3]; + ((char *)T1aa_lut)[(((i0 * 5 + i1) * 5 + i2) * 5 + i3) * 4 + 1] = gv[i2]; + ((char *)T1aa_lut)[(((i0 * 5 + i1) * 5 + i2) * 5 + i3) * 4 + 2] = gv[i1]; + ((char *)T1aa_lut)[(((i0 * 5 + i1) * 5 + i2) * 5 + i3) * 4 + 3] = gv[i0]; + } + for (i = 0; i < 256; i++) { + T1aa_count[i] = 0; + if (i & 0x80) T1aa_count[i] += 125; + if (i & 0x40) T1aa_count[i] += 125; + if (i & 0x20) T1aa_count[i] += 25; + if (i & 0x10) T1aa_count[i] += 25; + if (i & 0x08) T1aa_count[i] += 5; + if (i & 0x04) T1aa_count[i] += 5; + if (i & 0x02) T1aa_count[i] += 1; + if (i & 0x01) T1aa_count[i] += 1; + } + return(0); + } else if (level == 2 && T1aa_bpp == 16) { + for (i0 = 0; i0 < 5; i0++) + for (i1 = 0; i1 < 5; i1++) { + ((T1_AA_TYPE16 *)T1aa_lut)[(i0 * 5 + i1) * 2] = gv[i1]; + ((T1_AA_TYPE16 *)T1aa_lut)[(i0 * 5 + i1) * 2 + 1] = gv[i0]; + } + for (i = 0; i < 256; i++) { + T1aa_count[i] = 0; + if (i & 0x80) T1aa_count[i] += 160; + if (i & 0x40) T1aa_count[i] += 160; + if (i & 0x20) T1aa_count[i] += 32; + if (i & 0x10) T1aa_count[i] += 32; + if (i & 0x08) T1aa_count[i] += 5; + if (i & 0x04) T1aa_count[i] += 5; + if (i & 0x02) T1aa_count[i] += 1; + if (i & 0x01) T1aa_count[i] += 1; + } + return(0); + } else if (level == 2 && T1aa_bpp == 32) { + for (i0 = 0; i0 < 5; i0++) + ((T1_AA_TYPE32 *)T1aa_lut)[i0] = gv[i0]; + for (i = 0; i < 256; i++) { + T1aa_count[i] = 0; + if (i & 0x80) T1aa_count[i] += 512; + if (i & 0x40) T1aa_count[i] += 512; + if (i & 0x20) T1aa_count[i] += 64; + if (i & 0x10) T1aa_count[i] += 64; + if (i & 0x08) T1aa_count[i] += 8; + if (i & 0x04) T1aa_count[i] += 8; + if (i & 0x02) T1aa_count[i] += 1; + if (i & 0x01) T1aa_count[i] += 1; + } + return(0); + } + else if (level == 4 && T1aa_bpp == 8) { + for (i0 = 0; i0 < 17; i0++){ /* i0 indexes higher nibble */ + for (i1 = 0; i1 < 17; i1++){ /* i1 indixes lower nibble */ + ((char *)T1aa_h_lut)[(i0 * 17 + i1) * 4 + movelow] = gv_h[i1]; + ((char *)T1aa_h_lut)[(i0 * 17 + i1) * 4 + movehigh] = gv_h[i0]; + } + } + return(0); + } + else if (level == 4 && T1aa_bpp == 16) { + for (i0 = 0; i0 < 17; i0++){ /* i0 indexes higher nibble */ + for (i1 = 0; i1 < 17; i1++){ /* i1 indixes lower nibble */ + ((T1_AA_TYPE16 *)T1aa_h_lut)[(i0 * 17 + i1) * 2 + movelow] = gv_h[i1]; + ((T1_AA_TYPE16 *)T1aa_h_lut)[(i0 * 17 + i1) * 2 + movehigh] = gv_h[i0]; + } + } + return(0); + } + else if (level == 4 && T1aa_bpp == 32) { + for (i0 = 0; i0 < 17; i0++){ /* i0 indexes higher nibble */ + for (i1 = 0; i1 < 17; i1++){ /* i1 indixes lower nibble */ + ((T1_AA_TYPE32 *)T1aa_h_lut)[(i0 * 17 + i1)] = gv_h[i1]; + } + } + return(0); + } + else if (level == 1 && T1aa_bpp == 8) { + for (i0=0; i0<16; i0++) { + ((char *)T1aa_n_lut)[i0*4+movelow]=gv_n[i0 & 0x01]; + ((char *)T1aa_n_lut)[i0*4+movelow+1]=gv_n[(i0>>1) & 0x01]; + ((char *)T1aa_n_lut)[i0*4+movelow+2]=gv_n[(i0>>2) & 0x01]; + ((char *)T1aa_n_lut)[i0*4+movelow+3]=gv_n[(i0>>3) & 0x01]; + } + return(0); + } + else if (level == 1 && T1aa_bpp == 16) { + for (i0=0; i0<4; i0++) { + ((T1_AA_TYPE16 *)T1aa_n_lut)[i0*2]=gv_n[i0 & 0x01]; + ((T1_AA_TYPE16 *)T1aa_n_lut)[i0*2+1]=gv_n[(i0>>1) & 0x01]; + } + return(0); + } + else if (level == 1 && T1aa_bpp == 32) { + for ( i0=0; i0<2; i0++) { + ((T1_AA_TYPE32 *)T1aa_n_lut)[i0]=gv_n[i0]; + } + return(0); + } + else { + /* unsupported combination of level and bpp -> we set T1_errno and + put an entry into the logfile! */ + T1_errno=T1ERR_INVALID_PARAMETER; + sprintf( err_warn_msg_buf, + "Unsupported AA specification: level=%d, bpp=%d", + level, T1aa_bpp); + T1_PrintLog( "T1_AAInit()", err_warn_msg_buf, T1LOG_WARNING); + } + return(1); +} + + +/* T1_AADoLine: Create a single scanline of antialiased output. The + (x, y) arguments refer to the number of pixels in the input image + to convert down. The width argument is the number of bytes + separating scanlines in the input. The quantity hcorr describes the + number of subpixels. It is the shift of the oversampled bitmap to + the right */ +static void T1_AADoLine ( int level, int x, int y, int width, + char *c_in_ptr, char *target_ptr, int hcorr ) +{ + int i=0; + int size; + int count=0; + int mod; + + unsigned char bcarry1=0, bcarry2=0, bcarry3=0, bcarry4=0; + + static char *align_buf = NULL; + static int align_buf_size = 0; + unsigned char *in_ptr; + + int new_size=55; + register char *optr; + + + + /* We convert the input pointer to unsigned since we use it as index! */ + in_ptr=(unsigned char*)c_in_ptr; + + + if ((long)target_ptr & 3){ + /* calculate new_size (size in bytes of output buffer */ + if (level == T1_AA_LOW){ + new_size=((x + hcorr + 1) >> 1) * (T1aa_bpp >> 3); + } + else{ /* T1_AA_HIGH */ + new_size = ((x + hcorr + 3) >> 2) * (T1aa_bpp >> 3); + } + if (new_size > align_buf_size) + { + if (align_buf) + free (align_buf); + /* Note: we allocate 12 more than necessary to have tolerance + at the end of line */ + align_buf = (char *)malloc(new_size+12); + align_buf_size = new_size; + } + optr = align_buf; + } + else + optr = target_ptr; + + + /* size: The number of valid byte in the input string, i.e., the number of bytes + partially filled with pixels before shifting with hcorr. + mod: Is 1 if after shifting with hcorr the last byte in the input line has an + overflow. + */ + + if (level == T1_AA_LOW) { + size=(x+7)>>3; + mod=(x+hcorr)>(size*8) ? 1 : 0; + + if (T1aa_bpp == 8) { + if (y == 2){ + for (i = 0; i < size; i++) { + ((T1_AA_TYPE32 *)optr)[i] = + T1aa_lut[(T1aa_count[(unsigned char)((in_ptr[i]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<> 5]; + bcarry1=in_ptr[i]>>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<> 5]; + bcarry1=in_ptr[i]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<> 5]; + } + } + else if (T1aa_bpp == 32) { + if (y == 2){ + for (i = 0; i < size; i++) { + count = T1aa_count[(unsigned char)((in_ptr[i]<> 3) & 7]; + ((T1_AA_TYPE32 *)optr)[i * 4 + 2] = T1aa_lut[(count >> 6) & 7]; + ((T1_AA_TYPE32 *)optr)[i * 4 + 3] = T1aa_lut[(count >> 9) & 7]; + bcarry1=in_ptr[i]>>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<> 3) & 7]; + ((T1_AA_TYPE32 *)optr)[i * 4 + 2] = T1aa_lut[(count >> 6) & 7]; + ((T1_AA_TYPE32 *)optr)[i * 4 + 3] = T1aa_lut[(count >> 9) & 7]; + bcarry1=in_ptr[i]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<> 3) & 7]; + ((T1_AA_TYPE32 *)optr)[i * 4 + 2] = T1aa_lut[(count >> 6) & 7]; + ((T1_AA_TYPE32 *)optr)[i * 4 + 3] = T1aa_lut[(count >> 9) & 7]; + } + } + } + else if (level==T1_AA_HIGH){ + size=(x+7)>>3; + mod=(x+hcorr)>(size*8) ? 1 : 0; + + if (T1aa_bpp == 8) { + if (y == 4){ + for (i = 0; i < size; i++) { + ((T1_AA_TYPE16 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + bcarry3=in_ptr[i+2*width]>>(8-hcorr); + bcarry4=in_ptr[i+3*width]>>(8-hcorr); + } + } + else if (y == 3){ + for (i = 0; i < size; i++) { + ((T1_AA_TYPE16 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + bcarry3=in_ptr[i+2*width]>>(8-hcorr); + } + } + else if (y == 2){ + for (i = 0; i < size; i++) { + ((T1_AA_TYPE16 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + } + } + else if (y == 1){ + for (i = 0; i < size; i++) { + ((T1_AA_TYPE16 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); + } + } + if (mod) { + if (y == 4) + ((T1_AA_TYPE16 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[bcarry1] + + T1aa_h_count[bcarry2] + + T1aa_h_count[bcarry3] + + T1aa_h_count[bcarry4])]; + else if (y == 3) + ((T1_AA_TYPE16 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[bcarry1] + + T1aa_h_count[bcarry2] + + T1aa_h_count[bcarry3])]; + else if (y == 2) + ((T1_AA_TYPE16 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[bcarry1] + + T1aa_h_count[bcarry2])]; + else if (y == 1) + ((T1_AA_TYPE16 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[bcarry1])]; + } + } else if (T1aa_bpp == 16) { + if (y == 4){ + for (i = 0; i < size; i++) { + ((T1_AA_TYPE32 *)optr)[i] = + T1aa_h_lut[(T1aa_h_count[(unsigned char)((in_ptr[i]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + bcarry3=in_ptr[i+2*width]>>(8-hcorr); + bcarry4=in_ptr[i+3*width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>(8-hcorr); + bcarry2=in_ptr[i+2*width]>>(8-hcorr); + bcarry3=in_ptr[i+3*width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + bcarry3=in_ptr[i+2*width]>>(8-hcorr); + bcarry4=in_ptr[i+3*width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + bcarry3=in_ptr[i+2*width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>(8-hcorr); + bcarry2=in_ptr[i+width]>>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>(8-hcorr); + } + if (size==0){ + bcarry1=in_ptr[0]<>j%8)&0x0F]; + } + } + else if (T1aa_bpp==16) { + starget_ptr=(T1_AA_TYPE16 *)target_ptr; + for ( j=0; j>j%8)&0x03]; + } + } + else if (T1aa_bpp==32) { + ltarget_ptr=(T1_AA_TYPE32 *)target_ptr; + for ( j=0; j>j%8)&0x01]; + } + return; +} + + + +/* T1_AASetChar(...): Generate the anti-aliased bitmap for a character */ +GLYPH *T1_AASetChar( int FontID, char charcode, float size, + T1_TMATRIX *transform) +{ + + GLYPH *glyph; /* pointer to bitmap glyph */ + static GLYPH aaglyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */ + long asc, dsc, ht, wd; + long i; + long n_horz, n_horz_pad, n_vert, n_asc, n_dsc; + long v_start, v_end; + char *target_ptr; + long offset; + char *ptr; + int y; + long lsb, aalsb, aahstart; + int memsize; + LONG paddedW; + int savelevel; + FONTSIZEDEPS *font_ptr=NULL; + unsigned char ucharcode; + + + /* Reset character glyph, if necessary */ + if (aaglyph.bits!=NULL){ + free(aaglyph.bits); + aaglyph.bits=NULL; + } + aaglyph.metrics.leftSideBearing=0; + aaglyph.metrics.rightSideBearing=0; + aaglyph.metrics.advanceX=0; + aaglyph.metrics.advanceY=0; + aaglyph.metrics.ascent=0; + aaglyph.metrics.descent=0; + aaglyph.pFontCacheInfo=NULL; + aaglyph.bpp=T1aa_bpp; + + + ucharcode=charcode; + + /* Check for smart antialiasing */ + savelevel=T1aa_level; + if (T1aa_SmartOn){ + if (size>=T1aa_smartlimit2) { + T1aa_level=T1_AA_NONE; + } + else if (size>=T1aa_smartlimit1) { + T1aa_level=T1_AA_LOW; + } + else { + T1aa_level=T1_AA_HIGH; + } + } + + + /* The following code is only exectued if caching of antialiased + chracters is enabled. */ + /* Check if char is in cache */ + if ((pFontBase->t1lib_flags & T1_AA_CACHING)) { + if (transform==NULL){ + /* if size/aa is not existent we create it */ + if ((font_ptr=QueryFontSize( FontID, size, T1aa_level))==NULL){ + /* We create the required size struct and leave the rest + for T1_SetChar() */ + font_ptr=CreateNewFontSize( FontID, size, T1aa_level); + if (font_ptr==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + T1aa_level=savelevel; + return(NULL); + } + } + else {/* size is already existent in cache */ + if (font_ptr->pFontCache[ucharcode].bits != NULL){ + /* Character is already in Chache -> create a copy of cache + and return a pointer to the result: */ + memcpy( &aaglyph, &(font_ptr->pFontCache[ucharcode]), sizeof(GLYPH)); + memsize = (aaglyph.metrics.ascent-aaglyph.metrics.descent) * + PAD((aaglyph.metrics.rightSideBearing-aaglyph.metrics.leftSideBearing) * + T1aa_bpp,pFontBase->bitmap_pad)/8; + aaglyph.bits = (char *)malloc(memsize*sizeof( char)); + if (aaglyph.bits == NULL){ + T1_errno=T1ERR_ALLOC_MEM; + T1aa_level=savelevel; + return(NULL); + } + memcpy( aaglyph.bits, font_ptr->pFontCache[ucharcode].bits, memsize); + return(&(aaglyph)); + } + } + } /* (transform==NULL) */ + } /* T1_AA_CACHING */ + + + /* First, call routine to rasterize character, all error checking is + done in this function: */ + if ((glyph=T1_SetChar( FontID, charcode, T1aa_level*size, transform))==NULL){ + /* restore level */ + T1aa_level=savelevel; + return(NULL); /* An error occured */ + } + + /* In case there are no black pixels, we simply set the dimensions and + then return */ + if ( glyph->bits == NULL) { + aaglyph.bits=NULL; + aaglyph.metrics.leftSideBearing=0; + aaglyph.metrics.rightSideBearing=0; + aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); + aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); + aaglyph.metrics.ascent=0; + aaglyph.metrics.descent=0; + aaglyph.pFontCacheInfo=NULL; + /* restore level and return */ + T1aa_level=savelevel; + return(&aaglyph); + } + + /* Get dimensions of bitmap: */ + asc=glyph->metrics.ascent; + dsc=glyph->metrics.descent; + lsb=glyph->metrics.leftSideBearing; + ht=asc-dsc; + wd=glyph->metrics.rightSideBearing-lsb; + + + + if (T1aa_level==T1_AA_NONE){ + /* we only convert bitmap to bytemap */ + aaglyph=*glyph; + aaglyph.bpp=T1aa_bpp; + /* Compute scanline length and such */ + n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3; + /* Allocate memory for glyph */ + memsize = n_horz_pad*ht*8; + /* aaglyph.bits = (char *)malloc(memsize*sizeof( char)); */ + aaglyph.bits = (char *)malloc(memsize*sizeof( char)); + if (aaglyph.bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + /* restore level */ + T1aa_level=savelevel; + return(NULL); + } + paddedW=PAD(wd,pFontBase->bitmap_pad)>>3; + ptr=glyph->bits; + target_ptr=aaglyph.bits; + for (i = 0; i < ht; i++) { + T1_DoLine ( wd, paddedW, ptr, target_ptr ); + ptr += paddedW; + target_ptr += n_horz_pad; + } + /* restore level */ + T1aa_level=savelevel; + return(&aaglyph); + } + + + /* Set some looping parameters for subsampling */ + if (lsb<0){ + aalsb=lsb/T1aa_level-1; + aahstart=T1aa_level+(lsb%T1aa_level); + } + else{ + aalsb=lsb/T1aa_level; + aahstart=lsb%T1aa_level; + } + + /* The horizontal number of steps: */ + n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level; + /* And the padded value */ + n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3; + + /* vertical number of steps: */ + if (asc % T1aa_level){ /* not aligned */ + if ( asc > 0){ + n_asc=asc/T1aa_level+1; + v_start=asc % T1aa_level; + } + else{ + n_asc=asc/T1aa_level; + v_start=T1aa_level + (asc % T1aa_level); + } + } + else{ + n_asc=asc/T1aa_level; + v_start=T1aa_level; + } + if (dsc % T1aa_level){ /* not aligned */ + if ( dsc < 0){ + n_dsc=dsc/T1aa_level-1; + v_end=-(dsc % T1aa_level); + } + else{ + n_dsc=dsc/T1aa_level; + v_end=T1aa_level - (dsc % T1aa_level); + } + } + else{ + n_dsc=dsc/T1aa_level; + v_end=T1aa_level; + } + /* the total number of lines: */ + n_vert=n_asc-n_dsc; + + /* Allocate memory for glyph */ + memsize = n_horz_pad*n_vert; + + /* Note: we allocate 12 bytes more than necessary */ + aaglyph.bits = (char *)malloc(memsize*sizeof( char) +12); + if (aaglyph.bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + /* restore level */ + T1aa_level=savelevel; + return(NULL); + } + + + paddedW=PAD(wd,pFontBase->bitmap_pad)/8; + offset=0; + target_ptr=aaglyph.bits; + + /* We must check for n_vert==1 because the computation above is not + valid in this case */ + if (n_vert==1) + v_start=v_start < v_end ? v_start : v_end; + + ptr = glyph->bits; + for (i = 0; i < n_vert; i++) { + if (i==0) + y=v_start; + else if (i==n_vert-1) + y=v_end; + else + y=T1aa_level; + T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart ); + ptr += y * paddedW; + target_ptr += n_horz_pad; + } + + /* .. and set them in aaglyph */ + aaglyph.metrics.leftSideBearing=aalsb; + aaglyph.metrics.rightSideBearing=aalsb + n_horz; + aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); + aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); + aaglyph.metrics.ascent=n_asc; + aaglyph.metrics.descent=n_dsc; + aaglyph.pFontCacheInfo=NULL; + + + if ((pFontBase->t1lib_flags & T1_AA_CACHING) && (transform==NULL)) { + /* Put char into cache area */ + memcpy( &(font_ptr->pFontCache[ucharcode]), &aaglyph, sizeof(GLYPH)); + font_ptr->pFontCache[ucharcode].bits = (char *)malloc(memsize*sizeof( char)); + if (font_ptr->pFontCache[ucharcode].bits == NULL){ + T1_errno=T1ERR_ALLOC_MEM; + T1aa_level=savelevel; + return(NULL); + } + memcpy( font_ptr->pFontCache[ucharcode].bits, aaglyph.bits, memsize); + } + + /* restore level */ + T1aa_level=savelevel; + + return(&aaglyph); +} + + + +/* T1_AASetString(...): Generate the antialiased bitmap for a + string of characters */ +GLYPH *T1_AASetString( int FontID, char *string, int len, + long spaceoff, int modflag, float size, + T1_TMATRIX *transform) +{ + GLYPH *glyph; /* pointer to bitmap glyph */ + static GLYPH aastring_glyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */ + long asc, dsc, ht, wd; + long i; + long n_horz, n_horz_pad, n_vert, n_asc, n_dsc; + long v_start, v_end; + char *target_ptr; + long offset; + char *ptr; + int y; + long lsb, aalsb, aahstart; + int memsize; + LONG paddedW; + int savelevel; + + + /* Reset character glyph, if necessary */ + if (aastring_glyph.bits!=NULL){ + free(aastring_glyph.bits); + aastring_glyph.bits=NULL; + } + aastring_glyph.metrics.leftSideBearing=0; + aastring_glyph.metrics.rightSideBearing=0; + aastring_glyph.metrics.advanceX=0; + aastring_glyph.metrics.advanceY=0; + aastring_glyph.metrics.ascent=0; + aastring_glyph.metrics.descent=0; + aastring_glyph.pFontCacheInfo=NULL; + aastring_glyph.bpp=T1aa_bpp; + + + /* Check for smart antialiasing */ + savelevel=T1aa_level; + if (T1aa_SmartOn){ + if (size>=T1aa_smartlimit2) { + T1aa_level=T1_AA_NONE; + } + else if (size>=T1aa_smartlimit1) { + T1aa_level=T1_AA_LOW; + } + else { + T1aa_level=T1_AA_HIGH; + } + } + + /* First, call routine to rasterize character, all error checking is + done in this function: */ + if ((glyph=T1_SetString( FontID, string, len, spaceoff, + modflag, T1aa_level*size, transform))==NULL){ + /* restore level */ + T1aa_level=savelevel; + return(NULL); /* An error occured */ + } + + /* In case there are no black pixels, we simply set the dimensions and + then return */ + if ( glyph->bits == NULL) { + aastring_glyph.bits=NULL; + aastring_glyph.metrics.leftSideBearing=0; + aastring_glyph.metrics.rightSideBearing=0; + aastring_glyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); + aastring_glyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); + aastring_glyph.metrics.ascent=0; + aastring_glyph.metrics.descent=0; + aastring_glyph.pFontCacheInfo=NULL; + /* restore level and return */ + T1aa_level=savelevel; + return(&aastring_glyph); + } + + + /* Get dimensions of bitmap: */ + asc=glyph->metrics.ascent; + dsc=glyph->metrics.descent; + lsb=glyph->metrics.leftSideBearing; + ht=asc-dsc; + wd=glyph->metrics.rightSideBearing-lsb; + + if (T1aa_level==T1_AA_NONE){ + /* we only convert bitmap to bytemap */ + aastring_glyph=*glyph; + aastring_glyph.bpp=T1aa_bpp; + /* Compute scanline length and such */ + n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3; + /* Allocate memory for glyph */ + memsize = n_horz_pad*ht*8; + aastring_glyph.bits = (char *)malloc(memsize*sizeof( char)); + if (aastring_glyph.bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + /* restore level */ + T1aa_level=savelevel; + return(NULL); + } + paddedW=PAD(wd,pFontBase->bitmap_pad)>>3; + ptr=glyph->bits; + target_ptr=aastring_glyph.bits; + for (i = 0; i < ht; i++) { + T1_DoLine ( wd, paddedW, ptr, target_ptr ); + ptr += paddedW; + target_ptr += n_horz_pad; + } + /* restore level */ + T1aa_level=savelevel; + return(&aastring_glyph); + } + + + /* Set some looping parameters for subsampling */ + if (lsb<0){ + aalsb=lsb/T1aa_level-1; + aahstart=T1aa_level+(lsb%T1aa_level); + } + else{ + aalsb=lsb/T1aa_level; + aahstart=lsb%T1aa_level; + } + + /* The horizontal number of steps: */ + n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level; + /* And the padded value */ + n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3; + + /* vertical number of steps: */ + if (asc % T1aa_level){ /* not aligned */ + if ( asc > 0){ + n_asc=asc/T1aa_level+1; + v_start=asc % T1aa_level; + } + else{ + n_asc=asc/T1aa_level; + v_start=T1aa_level + (asc % T1aa_level); + } + } + else{ + n_asc=asc/T1aa_level; + v_start=T1aa_level; + } + if (dsc % T1aa_level){ /* not aligned */ + if ( dsc < 0){ + n_dsc=dsc/T1aa_level-1; + v_end=-(dsc % T1aa_level); + } + else{ + n_dsc=dsc/T1aa_level; + v_end=T1aa_level - (dsc % T1aa_level); + } + } + else{ + n_dsc=dsc/T1aa_level; + v_end=T1aa_level; + } + /* the total number of lines: */ + n_vert=n_asc-n_dsc; + + /* Allocate memory for glyph */ + memsize = n_horz_pad*n_vert; + + /* Note: we allocate 12 bytes more than necessary */ + aastring_glyph.bits = (char *)malloc(memsize*sizeof( char) +12); + if (aastring_glyph.bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + paddedW=PAD(wd,pFontBase->bitmap_pad)/8; + offset=0; + target_ptr=aastring_glyph.bits; + + /* We must check for n_vert==1 because the computation above is not + valid in this case */ + if (n_vert==1) + v_start=v_start < v_end ? v_start : v_end; + + ptr = glyph->bits; + for (i = 0; i < n_vert; i++) { + if (i==0) + y=v_start; + else if (i==n_vert-1) + y=v_end; + else + y=T1aa_level; + T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart ); + ptr += y * paddedW; + target_ptr += n_horz_pad; + } + + /* .. and set them in aastring_glyph */ + aastring_glyph.metrics.leftSideBearing=aalsb; + aastring_glyph.metrics.rightSideBearing=aalsb + n_horz; + aastring_glyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); + aastring_glyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); + aastring_glyph.metrics.ascent=n_asc; + aastring_glyph.metrics.descent=n_dsc; + aastring_glyph.pFontCacheInfo=NULL; + + /* restore level */ + T1aa_level=savelevel; + + return(&aastring_glyph); +} + + + +/* T1_AASetGrayValues(): Sets the byte values that are put into the + pixel position for the respective entries: + Returns 0 if successfull. + */ +int T1_AASetGrayValues(unsigned long white, + unsigned long gray75, + unsigned long gray50, + unsigned long gray25, + unsigned long black) +{ + + if (CheckForInit()){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + gv[4]=(unsigned T1_AA_TYPE32)black; /* black value */ + gv[3]=(unsigned T1_AA_TYPE32)gray25; /* gray 25% value */ + gv[2]=(unsigned T1_AA_TYPE32)gray50; /* gray 50% value */ + gv[1]=(unsigned T1_AA_TYPE32)gray75; /* gray 75% value */ + gv[0]=(unsigned T1_AA_TYPE32)white; /* white value */ + + T1aa_bg=white; + + if ((T1_AAInit( T1_AA_LOW))) + return(-1); + return(0); + +} + + + +/* T1_AAHSetGrayValues(): Sets the byte values that are put into the + pixel position for the respective entries (for 17 gray levels): + Returns 0 if successfull. + */ +int T1_AAHSetGrayValues( unsigned long *grayvals) +{ + int i; + + if (CheckForInit()){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + /* 0==white(background) ... 16==black(foreground) */ + for (i=0; i<17; i++){ + gv_h[i]=(unsigned T1_AA_TYPE32)grayvals[i]; + } + + + T1aa_bg=grayvals[0]; + + if ((T1_AAInit( T1_AA_HIGH))) + return(-1); + return(0); + +} + + + +/* T1_AANSetGrayValues(): Sets the byte values that are put into the + pixel position for the respective entries (for 2 gray levels): + Returns 0 if successfull. This is for the case the non-antialiased + "bytemaps" should be generated. + */ +int T1_AANSetGrayValues( unsigned long bg, unsigned long fg) +{ + + if (CheckForInit()){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + gv_n[0]=bg; + gv_n[1]=fg; + + T1aa_bg=bg; + + if ((T1_AAInit( T1_AA_NONE))) + return(-1); + return(0); + +} + + + +/* Get the current setting of graylevels for 2x antialiasing. The 5 + values are stored at address pgrayvals in order from background to + foreground */ +int T1_AAGetGrayValues( long *pgrayvals) +{ + int i; + + if (CheckForInit()) { + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + if (pgrayvals==NULL) { + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + } + + for ( i=0; i<5; i++) { /* bg (i=0) to fg (i=4) */ + pgrayvals[i]=gv[i]; + } + return( 0); + +} + + + +/* Get the current setting of graylevels for 2x antialiasing. The 17 + values are stored at address pgrayvals in order from background to + foreground */ +int T1_AAHGetGrayValues( long *pgrayvals) +{ + int i; + + if (CheckForInit()) { + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + if (pgrayvals==NULL) { + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + } + + for ( i=0; i<17; i++) { /* bg (i=0) to fg (i=16) */ + pgrayvals[i]=gv[i]; + } + return( 0); +} + + + +/* Get the current setting of graylevels for 2x antialiasing. The 2 + values are stored at address pgrayvals in order from background to + foreground */ +int T1_AANGetGrayValues( long *pgrayvals) +{ + + if (CheckForInit()) { + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + if (pgrayvals==NULL) { + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + } + pgrayvals[0]=gv[0]; /* background */ + pgrayvals[1]=gv[1]; /* foreground */ + return( 0); +} + + +/* T1_AASetBitsPerPixel(): Sets the depths of the antialiased glyph + pixel. Returns 0 if bpp is valid and -1 otherwise. If 24 is + specified, meaning to be the depth rather than the bpp-value, + automatically 32 bpp is chosen. */ +int T1_AASetBitsPerPixel( int bpp) +{ + + if (CheckForInit()){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + + /* T1aa_level = 0; */ + + if (bpp==8){ + T1aa_bpp=8; + return(0); + } + if (bpp==16){ + T1aa_bpp=16; + return(0); + } + if ((bpp==32)|(bpp==24)){ + T1aa_bpp=32; + return(0); + } + + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); +} + + +/* T1_AAGetBitsPerPixel(): Return the number of bits per pixel set in + t1lib. +*/ +int T1_AAGetBitsPerPixel( void) +{ + return( T1aa_bpp); + +} + + +/* Set the Subsampling level for subsequent operations: */ +int T1_AASetLevel( int level) +{ + + if (CheckForInit()){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + if (level==T1_AA_LOW){ + T1aa_level=T1_AA_LOW; + return(0); + } + else if (level==T1_AA_HIGH){ + T1aa_level=T1_AA_HIGH; + return(0); + } + else if (level==T1_AA_NONE){ + T1aa_level=T1_AA_NONE; + return(0); + } + + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + +} + + +/* Get the current subsampling level */ +int T1_AAGetLevel( void) +{ + return( T1aa_level); +} + + +/* T1_AAFillOutline(): Create a filled glyph from an outline description */ +GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag) +{ + + GLYPH *glyph; /* pointer to bitmap glyph */ + static GLYPH aaglyph={NULL,{0,0,0,0,0,0},NULL,DEFAULTBPP};/* The anti-aliased glyph */ + long asc, dsc, ht, wd; + long i; + long n_horz, n_horz_pad, n_vert, n_asc, n_dsc; + long v_start, v_end; + char *target_ptr; + long offset; + char *ptr; + int y; + long lsb, aalsb, aahstart; + int memsize; + LONG paddedW; + + + /* Reset character glyph, if necessary */ + if (aaglyph.bits!=NULL){ + free(aaglyph.bits); + aaglyph.bits=NULL; + } + aaglyph.metrics.leftSideBearing=0; + aaglyph.metrics.rightSideBearing=0; + aaglyph.metrics.advanceX=0; + aaglyph.metrics.advanceY=0; + aaglyph.metrics.ascent=0; + aaglyph.metrics.descent=0; + aaglyph.pFontCacheInfo=NULL; + aaglyph.bpp=T1aa_bpp; + + + /* First, scale outline appropriately: */ + path=T1_ScaleOutline( path, T1aa_level); + + /* Second, call routine to fill outline, all error checking is + done in this function: */ + if ((glyph=T1_FillOutline( path, modflag))==NULL) + return(NULL); /* An error occured */ + + /* In case there are no black pixels, we simply set the dimensions and + then return */ + if ( glyph->bits == NULL) { + aaglyph.bits=NULL; + aaglyph.metrics.leftSideBearing=0; + aaglyph.metrics.rightSideBearing=0; + aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); + aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); + aaglyph.metrics.ascent=0; + aaglyph.metrics.descent=0; + aaglyph.pFontCacheInfo=NULL; + return(&aaglyph); + } + + /* Get dimensions of bitmap: */ + asc=glyph->metrics.ascent; + dsc=glyph->metrics.descent; + lsb=glyph->metrics.leftSideBearing; + ht=asc-dsc; + wd=glyph->metrics.rightSideBearing-lsb; + + + if (T1aa_level==T1_AA_NONE){ + /* we only convert bitmap to bytemap */ + aaglyph=*glyph; + aaglyph.bpp=T1aa_bpp; + /* Compute scanline length and such */ + n_horz_pad=PAD( wd*T1aa_bpp, pFontBase->bitmap_pad )>>3; + /* Allocate memory for glyph, we alloc 12 bytes more to simplify + subsampling! */ + memsize = n_horz_pad*ht*8; + aaglyph.bits = (char *)malloc(memsize*sizeof( char) +12); + if (aaglyph.bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + paddedW=PAD(wd,pFontBase->bitmap_pad)>>3; + ptr=glyph->bits; + target_ptr=aaglyph.bits; + for (i = 0; i < ht; i++) { + T1_DoLine ( wd, paddedW, ptr, target_ptr ); + ptr += paddedW; + target_ptr += n_horz_pad; + } + return(&aaglyph); + } + + + /* Set some looping parameters for subsampling */ + if (lsb<0){ + aalsb=lsb/T1aa_level-1; + aahstart=T1aa_level+(lsb%T1aa_level); + } + else{ + aalsb=lsb/T1aa_level; + aahstart=lsb%T1aa_level; + } + + /* The horizontal number of steps: */ + n_horz=(wd+aahstart+T1aa_level-1)/T1aa_level; + /* And the padded value */ + n_horz_pad=PAD( n_horz*T1aa_bpp, pFontBase->bitmap_pad )>>3; + + /* vertical number of steps: */ + if (asc % T1aa_level){ /* not aligned */ + if ( asc > 0){ + n_asc=asc/T1aa_level+1; + v_start=asc % T1aa_level; + } + else{ + n_asc=asc/T1aa_level; + v_start=T1aa_level + (asc % T1aa_level); + } + } + else{ + n_asc=asc/T1aa_level; + v_start=T1aa_level; + } + if (dsc % T1aa_level){ /* not aligned */ + if ( dsc < 0){ + n_dsc=dsc/T1aa_level-1; + v_end=-(dsc % T1aa_level); + } + else{ + n_dsc=dsc/T1aa_level; + v_end=T1aa_level - (dsc % T1aa_level); + } + } + else{ + n_dsc=dsc/T1aa_level; + v_end=T1aa_level; + } + /* the total number of lines: */ + n_vert=n_asc-n_dsc; + + /* Allocate memory for glyph */ + memsize = n_horz_pad*n_vert; + + aaglyph.bits = (char *)malloc(memsize*sizeof( char)+12); + if (aaglyph.bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + paddedW=PAD(wd,pFontBase->bitmap_pad)/8; + offset=0; + target_ptr=aaglyph.bits; + + /* We must check for n_vert==1 because the computation above is not + valid in this case */ + if (n_vert==1) + v_start=v_start < v_end ? v_start : v_end; + + ptr = glyph->bits; + for (i = 0; i < n_vert; i++) { + if (i==0) + y=v_start; + else if (i==n_vert-1) + y=v_end; + else + y=T1aa_level; + T1_AADoLine ( T1aa_level, wd, y, paddedW, ptr, target_ptr, aahstart ); + ptr += y * paddedW; + target_ptr += n_horz_pad; + } + + /* .. and set them in aaglyph */ + aaglyph.metrics.leftSideBearing=aalsb; + aaglyph.metrics.rightSideBearing=aalsb + n_horz; + aaglyph.metrics.advanceX=(int) floor(glyph->metrics.advanceX/(float)T1aa_level+0.5); + aaglyph.metrics.advanceY=(int) floor(glyph->metrics.advanceY/(float)T1aa_level+0.5); + aaglyph.metrics.ascent=n_asc; + aaglyph.metrics.descent=n_dsc; + aaglyph.pFontCacheInfo=NULL; + + return(&aaglyph); +} + + + +/* T1_AASetSmartLimits(): Set the limit-values for smart + antialiasing. Returns 0 if OK, and -1 else. */ +int T1_AASetSmartLimits( float limit1, float limit2) +{ + + if (limit1 > 0.0 && limit2 > 0.0 && limit2 >= limit2) { + T1aa_smartlimit1=limit1; + T1aa_smartlimit2=limit2; + return( 0); + } + else{ + T1_errno=T1ERR_INVALID_PARAMETER; + return( -1); + } +} + + + +/* T1_AASetSmartMode(): Enable or disable smart anialiasing */ +int T1_AASetSmartMode( int smart) +{ + + if (smart==T1_YES) { + T1aa_SmartOn=1; + } + else if (smart==T1_NO) { + T1aa_SmartOn=0; + } + else { + T1_errno=T1ERR_INVALID_PARAMETER; + return( -1); + } + return( 0); +} + + diff -Naur xdvik-22.40l/libs/t1lib/t1aaset.h xdvik-22.40n/libs/t1lib/t1aaset.h --- xdvik-22.40l/libs/t1lib/t1aaset.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1aaset.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,79 @@ +/*-------------------------------------------------------------------------- + ----- File: t1aaset.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + definitions and declarations for t1set.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#ifdef T1AASET_C + +GLYPH *T1_AASetChar( int FontID, char charcode, + float size, T1_TMATRIX *transform); +GLYPH *T1_AASetString( int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +int T1_AASetGrayValues( unsigned long white, + unsigned long gray75, + unsigned long gray50, + unsigned long gray25, + unsigned long black); +int T1_AAHSetGrayValues( unsigned long *grayvals); +int T1_AANSetGrayValues( unsigned long fg, unsigned long bg); +int T1_AAGetGrayValues( long *pgrayvals); +int T1_AAHGetGrayValues( long *pgrayvals); +int T1_AANGetGrayValues( long *pgrayvals); +int T1_AASetBitsPerPixel( int bpp); +int T1_AAGetBitsPerPixel( void); +int T1_AASetLevel( int level); +int T1_AAGetLevel( void); +GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag); +int T1_AASetSmartLimits( float limit1, float limit2); +int T1_AASetSmartMode( int smart); + +#else + +extern GLYPH *T1_AASetChar( int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_AASetString( int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern int T1_AASetGrayValues( unsigned long white, + unsigned long gray75, + unsigned long gray50, + unsigned long gray25, + unsigned long black); +extern int T1_AAHSetGrayValues( unsigned long *grayvals); +extern int T1_AANSetGrayValues( unsigned long bg, unsigned long fg); +extern int T1_AAGetGrayValues( long *pgrayvals); +extern int T1_AAHGetGrayValues( long *pgrayvals); +extern int T1_AANGetGrayValues( long *pgrayvals); +extern int T1_AASetBitsPerPixel( int bpp); +extern int T1_AAGetBitsPerPixel( void); +extern int T1_AASetLevel( int level); +extern int T1_AAGetLevel( void); +extern GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag); +extern int T1_AASetSmartLimits( float limit1, float limit2); +extern int T1_AASetSmartMode( int smart); + +#endif + diff -Naur xdvik-22.40l/libs/t1lib/t1afmtool.c xdvik-22.40n/libs/t1lib/t1afmtool.c --- xdvik-22.40l/libs/t1lib/t1afmtool.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1afmtool.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,548 @@ +/*-------------------------------------------------------------------------- + ----- File: t1afmtool.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + functions for generating a fallback set of afm data + from type 1 font files. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1AFMTOOL_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" +#include "../type1/blues.h" + + +#include "t1types.h" +#include "t1extern.h" +#include "t1finfo.h" +#include "t1base.h" +#include "t1misc.h" +#include "t1set.h" +#include "t1load.h" +#include "t1afmtool.h" + + +#define DELTA_MAX 30 +#define ENCODINGSIZE (int) 256 +#ifndef T1LIB_IDENT +#define T1LIB_IDENT "???.???" +#endif + + +extern char *t1_get_abort_message( int number); + + +/* T1_GenerateAFMFallbackInfo(): Generate fallback information from + Type 1 font file by rasterizing every character at 1000 bp. Returns + a pointer to a generated FontInfo struct or NULL in case of an error. + */ +FontInfo *T1_GenerateAFMFallbackInfo( int FontID) +{ + int i, j; + struct region *area; + struct XYspace *S; + int mode=0; + char **charnames; + int nochars=0; + FontInfo *pAFMData; + + + /* We return to this if something goes wrong deep in the rasterizer */ + if ((i=setjmp( stck_state))!=0) { + T1_errno=T1ERR_TYPE1_ABORT; + sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", + t1_get_abort_message( i)); + T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, + T1LOG_ERROR); + return( NULL); + } + + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + sprintf( err_warn_msg_buf, + "Can't generate AFM Info from Font %d (invalid ID)\n", FontID); + T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + /* Setup apropriate charspace matrix */ + S=(struct XYspace *)IDENTITY; + /* Make this permanent so that scaling it in fontfcnB_ByName will + make a duplicate of it, and this duplicate can thus be safely + destroyed. Fixes the somewhat smaller memory leak */ + S=(struct XYspace *)Permanent + (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0], + pFontBase->pFontArray[FontID].FontTransform[1], + pFontBase->pFontArray[FontID].FontTransform[2], + pFontBase->pFontArray[FontID].FontTransform[3])); + + /* Alloc memory for FontInfo: */ + if ((pAFMData=(FontInfo *)malloc( sizeof(FontInfo)))==NULL){ + sprintf( err_warn_msg_buf, + "Failed to allocate memory for FontInfo in Font %d!", FontID); + T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_ALLOC_MEM; + /* make sure to free S */ + if (S) { + KillSpace (S); + } + return( NULL); + } + /* Initialize pointers */ + pAFMData->gfi=NULL; + pAFMData->cwi=NULL; + pAFMData->numOfChars=0; + pAFMData->cmi=NULL; + pAFMData->numOfTracks=0; + pAFMData->tkd=NULL; + pAFMData->numOfPairs=0; + pAFMData->pkd=NULL; + pAFMData->numOfComps=0; + pAFMData->ccd=NULL; + + /* Get list of character name */ + charnames=T1_GetAllCharNames( FontID); + /* and count number of characters */ + nochars=0; + + while (charnames[nochars]!=NULL) + nochars++; + pAFMData->numOfChars=nochars; + /* Allocate memory for CharMetricInfo area */ + if ((pAFMData->cmi=(CharMetricInfo *) + malloc( nochars * sizeof( CharMetricInfo)))==NULL){ + sprintf( err_warn_msg_buf, + "Failed to allocate memory for CharMetricsInfo area in Font %d!", + FontID); + T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, + T1LOG_WARNING); + free( pAFMData); + T1_errno=T1ERR_ALLOC_MEM; + /* make sure to free S */ + if (S) { + KillSpace (S); + } + return( NULL); + } + /* Get metrics values */ + for (i=0; ipFontArray[FontID].pType1Data, DO_RASTER); + + if (area==NULL){ + sprintf( err_warn_msg_buf, + "Could not get charspace representation of character %d (%s) Font %d!", + i, charnames[i], FontID); + T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, + T1LOG_WARNING); + /* Return since we don't know how to fill the values */ + for (j=i-1; j>=0; j--) + free( pAFMData->cmi[j].name); + if (pAFMData->cmi!=NULL) + free( pAFMData->cmi); + if (pAFMData!=NULL) + free( pAFMData); + T1_errno=mode; + /* make sure to free S */ + if (S) { + KillSpace (S); + } + return( NULL); + } + else if ((pAFMData->cmi[i].name=(char *) + malloc( (size_t)(strlen( charnames[i])+1)))==NULL){ + sprintf( err_warn_msg_buf, + "Failed to allocate memory for CharName %d (%s) Font %d!", + i, charnames[i], FontID); + T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, + T1LOG_WARNING); + /* NULL-ptr in charnames is prone to SIGSEGV-errors, thus, + we have to return: */ + for (j=i; j>=0; j--) + free( pAFMData->cmi[j].name); + free( pAFMData->cmi); + free( pAFMData); + T1_errno=T1ERR_ALLOC_MEM; + /* make sure to free S */ + if (S) { + KillSpace (S); + } + return( NULL); + } + else{ + strcpy( pAFMData->cmi[i].name, charnames[i]); + pAFMData->cmi[i].code=T1_GetEncodingIndex( FontID, charnames[i]); + pAFMData->cmi[i].wx=NEARESTPEL(area->ending.x); + pAFMData->cmi[i].wy=NEARESTPEL(area->ending.y); + /* We check for a valid BBox and set it to zero otherwise */ + if ((int)area->xmax > (int)area->xmin){ + pAFMData->cmi[i].charBBox.llx =(int)area->xmin; + pAFMData->cmi[i].charBBox.urx =(int)area->xmax; + pAFMData->cmi[i].charBBox.lly =(int)area->ymin; + pAFMData->cmi[i].charBBox.ury =(int)area->ymax; + } + else{ + pAFMData->cmi[i].charBBox.llx =0; + pAFMData->cmi[i].charBBox.urx =0; + pAFMData->cmi[i].charBBox.lly =0; + pAFMData->cmi[i].charBBox.ury =0; + } + pAFMData->cmi[i].ligs=NULL; + /* We are done with area, so get rid of it. Solves the REALLY + HUGE memory leak */ + KillRegion (area); + } + } + sprintf( err_warn_msg_buf, + "Generated metric information for %d characters of font %d!", + nochars, FontID); + T1_PrintLog( "T1_GenerateAFMFallbackInfo()", err_warn_msg_buf, + T1LOG_STATISTIC); + + /* make sure to free S */ + if (S) { + KillSpace (S); + } + return( pAFMData); +} + + +/* T1_WriteAFMFallbackFile(): Write a fallback AFM-file from AFM data + genarated for font FontID. returns + 0 if successful + -1 if afm-data was loaded from existent AFM-file + -2 if font is not loaded (invalid FontID) + -3 if for some reason the fonts' AFM-data has not been generated + -4 if the file could not be openend + -5 if an error occurred during write + -6 other error. + */ +int T1_WriteAFMFallbackFile( int FontID) +{ + + int i, j, k, l; + + int nochars; + int capheight, ascender, xheight, descender; + int min=0, delta; + time_t s_clock, *tp; + + char *afmfilename; + FILE *afmfile; + CharMetricInfo **cmi; + + + /* Check for valid font */ + if (CheckForFontID(FontID)!=1){ + sprintf( err_warn_msg_buf, + "Warning: Invalid FontID, font %d not loaded!", + FontID); + T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_INVALID_FONTID; + return(-2); + } + + /* Check for AFM-data to be existent */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL){ + sprintf( err_warn_msg_buf, + "Warning: No AFM-Data available for font %d", + FontID); + T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, + T1LOG_WARNING); + return(-3); + } + + /* Check if AFM data has been generated from existent afm file --> + no need to generate a new one. */ + if ((pFontBase->pFontArray[FontID].info_flags & AFM_SUCCESS) + || (pFontBase->pFontArray[FontID].info_flags & AFM_SLOPPY_SUCCESS)){ + sprintf( err_warn_msg_buf, + "Alert: Available AFM-Data for font %d is generated from existent AFM-file!", + FontID); + T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, + T1LOG_STATISTIC); + return(-1); + } + + /* Construct AFM-filename */ + i=strlen(pFontBase->pFontArray[FontID].pFontFileName); + if ((afmfilename=(char *)malloc((size_t)(i + 1) ))==NULL){ + sprintf( err_warn_msg_buf, + "Memory allocation error (fontID = %d)", + FontID); + T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_ALLOC_MEM; + return(-6); + } + strcpy( afmfilename, pFontBase->pFontArray[FontID].pFontFileName); + while (afmfilename[i]!='.') + i--; + afmfilename[i+1]='a'; + afmfilename[i+2]='f'; + afmfilename[i+3]='m'; + + if ((afmfile=fopen( afmfilename, "w"))==NULL){ + sprintf( err_warn_msg_buf, + "Could not open %s, (FontID = %d)", + afmfilename, FontID); + T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, + T1LOG_WARNING); + free( afmfilename); + T1_errno=T1ERR_FILE_OPEN_ERR; + return(-4); + } + + /* Set the creation time of afm file */ + tp=&s_clock; + s_clock=time( tp); + + /* Allocate a pointer-array to the metrics information, + of the size 256 + number of characters. */ + nochars=pFontBase->pFontArray[FontID].pAFMData->numOfChars; + if ((cmi=(CharMetricInfo **)calloc( nochars+ENCODINGSIZE, + sizeof(CharMetricInfo *)))==NULL){ + sprintf( err_warn_msg_buf, + "Memory allocation error (fontID = %d)", + FontID); + T1_PrintLog( "T1_WriteAFMFallbackFile()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_ALLOC_MEM; + return(-6); + } + /* Reset area */ + for ( i=0; i<(nochars+ENCODINGSIZE); i++) + cmi[i]=NULL; + /* First half of array is dedicated to encoded characters, the + second half for unencoded characters */ + k=ENCODINGSIZE; + for ( i=0; ipFontArray[FontID].pAFMData->cmi[i].name); + if (j>=0) + cmi[j]=&(pFontBase->pFontArray[FontID].pAFMData->cmi[i]); + else + cmi[k++]=&(pFontBase->pFontArray[FontID].pAFMData->cmi[i]); + } + + fprintf(afmfile, "StartFontMetrics 4.0\n"); + fprintf(afmfile, "Comment This is %s created from %s by t1lib V. %s.\n", + afmfilename, pFontBase->pFontArray[FontID].pFontFileName, + T1LIB_IDENT); + fprintf(afmfile, "Comment File creation date: %s", ctime(&s_clock)); + fprintf(afmfile, "Comment t1lib is copyright (c) Rainer Menzner, 1996-2001.\n"); + fprintf(afmfile, "Comment t1lib is distributed under the GNU General Public Library License (LGPL)\n"); + fprintf(afmfile, "FontName %s\n", T1_GetFontName( FontID)); + fprintf(afmfile, "FullName %s\n", T1_GetFullName( FontID)); + fprintf(afmfile, "FamilyName %s\n", T1_GetFamilyName( FontID)); + fprintf(afmfile, "Weight %s\n", T1_GetWeight( FontID)); + fprintf(afmfile, "ItalicAngle %d\n", (int)T1_GetItalicAngle( FontID)); + fprintf(afmfile, "IsFixedPitch %s\n", T1_GetIsFixedPitch( FontID) ? "true" : "false" ); + fprintf(afmfile, "FontBBox %d %d %d %d\n", + T1_GetFontBBox( FontID).llx, + T1_GetFontBBox( FontID).lly, + T1_GetFontBBox( FontID).urx, + T1_GetFontBBox( FontID).ury); + fprintf(afmfile, "UnderlinePosition %d\n", + (int)T1_GetUnderlinePosition( FontID)); + fprintf(afmfile, "UnderlineThickness %d\n", + (int)T1_GetUnderlineThickness( FontID)); + + fprintf(afmfile, "Version %s\n", T1_GetVersion( FontID)); + fprintf(afmfile, "Notice %s\n", T1_GetNotice( FontID)); + /* Encoding */ + if (pFontBase->pFontArray[FontID].pFontEnc==NULL){ + if (pFontBase->pFontArray[FontID].info_flags & USES_STANDARD_ENCODING){ + fprintf( afmfile, "EncodingScheme AdobeStandardEncoding\n"); + } + else{ + fprintf( afmfile, "EncodingScheme FontSpecific\n"); + } + } + else + fprintf( afmfile, "EncodingScheme FontSpecific\n"); + /* Values like capheight ascender xheight and descender */ + /* We start with the overshoot positions */ + i=pFontBase->pFontArray[FontID].pType1Data->BluesP->numBlueValues; + if (i>0){ + /* Capheight */ + if ((k=T1_GetEncodingIndex( FontID, "H"))!=-1){ + l=T1_GetCharBBox( FontID, (char) k).ury; + delta=10000; + for (j=0; j abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l)){ + min=j; + delta=abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l); + } + } + if (min % 2) /* index is odd */ + min--; + /* Check for plausibility */ + if (abs( pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min] - l) + > DELTA_MAX) /* We probably did not found the right position */ + capheight=0; + else + capheight=pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min]; + } + else + capheight=0; + /* XHeight */ + if ((k=T1_GetEncodingIndex( FontID, "x"))!=-1){ + l=T1_GetCharBBox( FontID, (char) k).ury; + delta=10000; + for (j=0; j abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l)){ + min=j; + delta=abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l); + } + } + if (min % 2) /* index is odd */ + min--; + /* Check for plausibility */ + if (abs( pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min] - l) + > DELTA_MAX) /* We probably did not found the right position */ + xheight=0; + else + xheight=pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min]; + } + else{ + xheight=0; + } + /* Ascender */ + if ((k=T1_GetEncodingIndex( FontID, "d"))!=-1){ + l=T1_GetCharBBox( FontID, (char) k).ury; + delta=10000; + for (j=0; j abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l)){ + min=j; + delta=abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[j] - l); + } + } + if (min % 2) /* index is odd */ + min--; + /* Check for plausibility */ + if (abs( pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min] - l) + > DELTA_MAX) /* We probably did not found the right position */ + ascender=0; + else + ascender=pFontBase->pFontArray[FontID].pType1Data->BluesP->BlueValues[min]; + } + else{ + ascender=0; + } + } + else{ + capheight=0; + xheight=0; + ascender=0; + } + /* And now comes under shoot alignment position */ + i=pFontBase->pFontArray[FontID].pType1Data->BluesP->numOtherBlues; + if (i>0){ + /* Descender */ + if ((k=T1_GetEncodingIndex( FontID, "p"))!=-1){ + l=T1_GetCharBBox( FontID, (char) k).lly; + delta=10000; + for (j=0; j abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->OtherBlues[j] - l)){ + min=j; + delta=abs(pFontBase->pFontArray[FontID].pType1Data->BluesP->OtherBlues[j] - l); + } + } + if ((min % 2)==0) /* index is even */ + min++; + /* Check for plausibility */ + if (abs( pFontBase->pFontArray[FontID].pType1Data->BluesP->OtherBlues[min] - l) + > DELTA_MAX) /* We probably did not found the right position */ + descender=0; + else + descender=pFontBase->pFontArray[FontID].pType1Data->BluesP->OtherBlues[min]; + } + else{ + descender=0; + } + } + else{ + descender=0; + } + if (capheight != 0) + fprintf( afmfile, "CapHeight %d\n", capheight); + if (xheight != 0) + fprintf( afmfile, "XHeight %d\n", xheight); + if (ascender != 0) + fprintf( afmfile, "Ascender %d\n", ascender); + if (descender != 0) + fprintf( afmfile, "Descender %d\n", descender); + if (pFontBase->pFontArray[FontID].pType1Data->BluesP->StdHW != 0.0) + fprintf( afmfile, "StdHW %d\n", + (int) pFontBase->pFontArray[FontID].pType1Data->BluesP->StdHW); + if (pFontBase->pFontArray[FontID].pType1Data->BluesP->StdVW != 0.0) + fprintf( afmfile, "StdVW %d\n", + (int) pFontBase->pFontArray[FontID].pType1Data->BluesP->StdVW); + + /* Now fill in the values (we omit the .notdef) */ + fprintf(afmfile, "StartCharMetrics %d\n", nochars-1); + for ( i=0; i<(nochars+ENCODINGSIZE); i++){ + if (cmi[i]!=NULL && strcmp(cmi[i]->name,".notdef")) + fprintf( afmfile, "C %3d ; WX %4d ; N %-20s ; B %5d %5d %5d %5d ;\n", + cmi[i]->code, cmi[i]->wx, cmi[i]->name, + cmi[i]->charBBox.llx, cmi[i]->charBBox.lly, + cmi[i]->charBBox.urx, cmi[i]->charBBox.ury); + } + fprintf(afmfile, "EndCharMetrics\nEndFontMetrics\n"); + + free(cmi); + fclose( afmfile); + return(0); +} + + diff -Naur xdvik-22.40l/libs/t1lib/t1afmtool.h xdvik-22.40n/libs/t1lib/t1afmtool.h --- xdvik-22.40l/libs/t1lib/t1afmtool.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1afmtool.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,43 @@ +/*-------------------------------------------------------------------------- + ----- File: t1afmtool.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + declarations and definitions for t1afmtool.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#ifdef T1AFMTOOL_C + +FontInfo *T1_GenerateAFMFallbackInfo( int FontID); +int T1_WriteAFMFallbackFile( int FontID); +extern struct region *fontfcnB_ByName( int FontID, int modflag, + struct XYspace *S, + char *charname, + int *mode, psfont *Font_Ptr, + int do_raster); + +#else + +extern FontInfo *T1_GenerateAFMFallbackInfo( int FontID); +extern int T1_WriteAFMFallbackFile( int FontID); + +#endif diff -Naur xdvik-22.40l/libs/t1lib/t1base.c xdvik-22.40n/libs/t1lib/t1base.c --- xdvik-22.40l/libs/t1lib/t1base.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1base.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1267 @@ +/*-------------------------------------------------------------------------- + ----- File: t1base.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-10-03 + ----- Description: This file is part of the t1-library. It contains basic + routines to initialize the data structures used + by the t1-library. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independ from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#define T1BASE_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" + + +#include "sysconf.h" +#include "t1base.h" +#include "t1types.h" +#include "t1global.h" +#include "t1env.h" +#include "t1delete.h" + + +static int T1_pad=0; + + +/* This function is to be called by the user to initialize + the font mechanism */ +void *T1_InitLib( int log) +{ + int result; + int i; + + char *usershome=NULL; + char *logfilepath=NULL; + char *envlogreq=NULL; + int usrforcelog=0; + + + + /* Reset T1_errno */ + T1_errno=0; + + /* Assign pointer to global struct and set entry padding: */ + pFontBase=&FontBase; + if (T1_pad) + pFontBase->bitmap_pad=T1_pad; + else + pFontBase->bitmap_pad=T1GLYPH_PAD; + + pFontBase->pFontArray = NULL; + pFontBase->t1lib_flags=0; + /* Check for AA-caching */ + if ((log & T1_AA_CACHING)){ + pFontBase->t1lib_flags |= T1_AA_CACHING; + } + /* Check for AFM disable */ + if ((log & T1_NO_AFM)) { + pFontBase->t1lib_flags |= T1_NO_AFM; + } + + /* Check environment variable ENV_LOG_STRING. By this means, a user may + generate a log file even if at compile time log file creation has + been suppressed. Of course, if the loglevel is reduced after + initialization by the programmer, this environment variable takes + no effect! */ + if ((envlogreq=getenv(ENV_LOG_STRING))!=NULL) { + if (strcmp( envlogreq, "logDebug")==0) + T1_SetLogLevel( T1LOG_DEBUG); + else if (strcmp( envlogreq, "logStatistic")==0) + T1_SetLogLevel( T1LOG_STATISTIC); + else if (strcmp( envlogreq, "logWarning")==0) + T1_SetLogLevel( T1LOG_WARNING); + else if (strcmp( envlogreq, "logError")==0) + T1_SetLogLevel( T1LOG_ERROR); + usrforcelog=1; + } + + /* Open log-file: */ + t1lib_log_file=NULL; + if ((log & LOGFILE) || (usrforcelog!=0)) { + pFontBase->t1lib_flags |= LOGFILE; + /* Try first opening in current directory: */ + if ((t1lib_log_file=fopen( T1_LOG_FILE, "w"))==NULL) { + if ((usershome=getenv("HOME"))!=NULL) { + logfilepath=(char *)malloc((strlen(usershome) + + strlen(T1_LOG_FILE) + 2 + ) * sizeof(char)); + strcpy( logfilepath, usershome); + strcat( logfilepath, DIRECTORY_SEP); + strcat( logfilepath, T1_LOG_FILE); + if ((t1lib_log_file=fopen( logfilepath, "w"))==NULL){ + t1lib_log_file=stderr; + } + free( logfilepath); + } + else { + t1lib_log_file=stderr; + } + } + if (t1lib_log_file==stderr) { + T1_PrintLog( "T1_InitLib()", "Unable to open a logfile, using stderr", + T1LOG_ERROR); + } + } + + T1_PrintLog( "T1_InitLib()", "Initialization started", + T1LOG_STATISTIC); + /* Check for representation of data in memory: */ + if ((pFontBase->endian=T1_CheckEndian())){ + T1_PrintLog( "T1_InitLib()", "Using Big Endian data presentation (MSBFirst)", + T1LOG_DEBUG); + pFontBase->endian=1; + } + else{ + T1_PrintLog( "T1_InitLib()", "Using Little Endian data presentation (LSBFirst)", + T1LOG_DEBUG); + pFontBase->endian=0; + } + + /* Save version identifier */ + sprintf( err_warn_msg_buf, "Version Identifier: %s", T1LIB_IDENT); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, + T1LOG_DEBUG); + /* Save how t1lib is initialized */ + sprintf( err_warn_msg_buf, "Initialization flags: 0x%X", log); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, + T1LOG_DEBUG); + /* Save padding value in log file */ + sprintf( err_warn_msg_buf, "Glyphs are padded to %d bits", + pFontBase->bitmap_pad); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, + T1LOG_DEBUG); +#ifdef __CHAR_UNSIGNED__ + T1_PrintLog( "T1_InitLib()", "System-Info: char is unsigned", + T1LOG_DEBUG); +#else + T1_PrintLog( "T1_InitLib()", "System-Info: char is signed", + T1LOG_DEBUG); +#endif + sprintf( err_warn_msg_buf, "System-Info: sizeof(char): %d", + SIZEOF_CHAR); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "System-Info: sizeof(short): %d", + SIZEOF_SHORT); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "System-Info: sizeof(int): %d", + SIZEOF_INT); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "System-Info: sizeof(long): %d", + SIZEOF_LONG); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "System-Info: sizeof(long long): %d", + SIZEOF_LONG_LONG); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "System-Info: sizeof(float): %d", + SIZEOF_FLOAT); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "System-Info: sizeof(double): %d", + SIZEOF_DOUBLE); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "System-Info: sizeof(long double): %d", + SIZEOF_LONG_DOUBLE); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "System-Info: sizeof(void *): %d", + SIZEOF_VOID_P); + T1_PrintLog( "T1_InitLib()", err_warn_msg_buf, T1LOG_DEBUG); + + intT1_SetupDefaultSearchPaths(); + if (log & IGNORE_CONFIGFILE) { + pFontBase->t1lib_flags |= IGNORE_CONFIGFILE; + T1_PrintLog( "T1_InitLib()", "Skipping configuration file search!", + T1LOG_STATISTIC); + } + else { + if ((result=intT1_ScanConfigFile())==0) + T1_PrintLog( "T1_InitLib()", "Warning t1lib configuration file not found!", + T1LOG_WARNING); + } + + + /* Set the default encoding to the fonts' internal encoding */ + pFontBase->default_enc=NULL; + + /* Initialize the no_fonts... values */ + pFontBase->no_fonts=0; + pFontBase->no_fonts_ini=pFontBase->no_fonts; + pFontBase->no_fonts_limit=pFontBase->no_fonts; + + + /* Check whether to read font database */ + if ((log & IGNORE_FONTDATABASE)){ + pFontBase->t1lib_flags |= IGNORE_FONTDATABASE; + + T1_Up=1; /* System has been initialized ! */ + T1_PrintLog( "T1_InitLib()", "Initialization successfully finished (Database empty)", + T1LOG_STATISTIC); + + return((void *) pFontBase); + } + + result=0; + /* Read fontdatabase(s) */ + i=0; + while (T1_FDB_ptr[i]!=NULL) { + if ((result=intT1_scanFontDBase(T1_FDB_ptr[i]))==-1){ + T1_PrintLog( "T1_InitLib()", "Fatal error scanning Font Database File %s", + T1LOG_WARNING, T1_FDB_ptr[i]); + } + if (result>-1) + pFontBase->no_fonts+=result; + i++; + + } + if (result == 0){ + T1_PrintLog( "T1_InitLib()", "No fonts from Font Database File(s) found (T1_errno=%d)", + T1LOG_ERROR, T1_errno); + return(NULL); + } + + /* Initialize the no_fonts... values */ + pFontBase->no_fonts_ini=pFontBase->no_fonts; + pFontBase->no_fonts_limit=pFontBase->no_fonts; + + T1_Up=1; /* System has been initialized ! */ + T1_PrintLog( "T1_InitLib()", "Initialization successfully finished", + T1LOG_STATISTIC); + + return((void *) pFontBase); +} + + + +/* intT1_scanFontDBase(): + - opens the file with the font definitions, + - reads the number of fonts defined and saves this in FontBase, + - allocates memory for all the filenames of the Type1 files + - tests for .pfa und .pfb files and saves the name found + - initializes an array that allows to acces these names by an + index number, the font_ID + - returns -1 on fatal error and the number of fonts located + successfullly + */ +int intT1_scanFontDBase( char *filename) +{ + int fd; + int filesize, i, j, k, m; + int found=0, located=0; + char *filebuffer; + int nofonts=0; + FONTPRIVATE* fontarrayP=NULL; + + + if ((fd=open( filename, O_RDONLY))<3){ + T1_PrintLog( "intT1_scanFontDBase()", "Font Database File %s not found!", + T1LOG_WARNING, filename); + T1_errno=T1ERR_FILE_OPEN_ERR; + return(-1); + } + + /* Get the file size */ + filesize=lseek( fd, 0, 2); + /* Reset fileposition to start */ + lseek (fd, 0, 0); + + if ((filebuffer=(char *)malloc(filesize*sizeof(char) + )) == NULL){ + T1_PrintLog( "intT1_scanFontDBase()", + "Couldn't allocate memory for loading font database file %s", + T1LOG_ERROR, filename); + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + + i=read( fd, filebuffer, filesize); + close(fd); /* Close font database file */ + + i=j=m=0; + + while (inofonts) /* to ignore especially white space at end */ + break; + i++; /* Step further in file position */ + } + /* Return the memory for file reading */ + free(filebuffer); + + return( found); +} + + +/* T1_CloseLib(): Close the library and free all associated memory */ +int T1_CloseLib( void) +{ + + int i, j, error=0; + + if (T1_Up){ + for (i=pFontBase->no_fonts; i; i--){ + /* Free filename only if not NULL and if the font is physical! + Do it before removing the font since the physical information + is no more available afterwards. If necessary, an explicitly + specified AFM filename is also freed. + */ + if ((pFontBase->pFontArray[i-1].pFontFileName!=NULL) + && (pFontBase->pFontArray[i-1].physical==1)){ + free( pFontBase->pFontArray[i-1].pFontFileName); + pFontBase->pFontArray[i-1].pFontFileName=NULL; + if (pFontBase->pFontArray[i-1].pAfmFileName!=NULL){ + free( pFontBase->pFontArray[i-1].pAfmFileName); + pFontBase->pFontArray[i-1].pAfmFileName=NULL; + } + } + + /* Now, remove font: */ + if ((j=T1_DeleteFont( i-1))){ + error=1; + sprintf( err_warn_msg_buf, "T1_DeleteFont() returned %d for Font %d", + j, i-1); + T1_PrintLog( "T1_CloseLib()", err_warn_msg_buf, T1LOG_ERROR); + } + } + /* Free the FONTPRIVATE area */ + if (pFontBase->pFontArray) + free( pFontBase->pFontArray); + else + error=1; + + /* Free search paths */ + intT1_FreeSearchPaths(); + + /* Reset the flags */ + pFontBase->t1lib_flags=0; + + /* Indicate Library is no longer initialized */ + pFontBase=NULL; + T1_Up=0; + T1_PrintLog( "T1_CloseLib()", "Library closed", T1LOG_STATISTIC); + if ((t1lib_log_file!=NULL) && (t1lib_log_file!=stderr)) + fclose(t1lib_log_file); + t1lib_log_file=NULL; + } + + return( error); +} + + +/* T1_AddFont(): Add a new fontfile to the fontdatabase. + Return values: >0: Assigned FontID + -1: Fontfile not found + -2: Error allocating memory for FONTPRIVATE-area + -3: No memory for saving font filename + */ +int T1_AddFont( char *fontfilename) +{ + + char *FullName; + FONTPRIVATE *save_ptr; + int i; + int new_ID; + + + if (fontfilename==NULL){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + } + + /* Check for existence of fontfile */ + if ((FullName=intT1_Env_GetCompletePath(fontfilename,T1_PFAB_ptr))==NULL) { + T1_errno=T1ERR_FILE_OPEN_ERR; + return(-1); + } + free(FullName); + + /* Check if free space for a new FONTPRIVATE is available; if not, + realloc memory some amount larger */ + save_ptr=pFontBase->pFontArray; + if (pFontBase->no_fonts==pFontBase->no_fonts_limit){ + if (pFontBase->pFontArray == NULL) { + /* In case this is the first font */ + pFontBase->pFontArray=(FONTPRIVATE *)calloc(pFontBase->no_fonts_limit + + ADVANCE_FONTPRIVATE, + sizeof(FONTPRIVATE)); + } + else { + /* We already have some fonts */ + pFontBase->pFontArray=(FONTPRIVATE *)realloc(pFontBase->pFontArray, + (pFontBase->no_fonts_limit + + ADVANCE_FONTPRIVATE) + * sizeof(FONTPRIVATE)); + if (pFontBase->pFontArray==NULL){ + /* Restore pointer */ + pFontBase->pFontArray=save_ptr; + T1_errno=T1ERR_ALLOC_MEM; + return(-2); /* No memory available */ + } + } + pFontBase->no_fonts_limit += ADVANCE_FONTPRIVATE; + /* First, initialize newly allocated to be not used */ + for ( i=pFontBase->no_fonts; + ino_fonts+ADVANCE_FONTPRIVATE; i++){ + pFontBase->pFontArray[i].pFontFileName=NULL; + pFontBase->pFontArray[i].pAfmFileName=NULL; + pFontBase->pFontArray[i].pAFMData=NULL; + pFontBase->pFontArray[i].pType1Data=NULL; + pFontBase->pFontArray[i].pEncMap=NULL; + pFontBase->pFontArray[i].pKernMap=NULL; + pFontBase->pFontArray[i].pFontEnc=NULL; + pFontBase->pFontArray[i].pFontSizeDeps=NULL; + pFontBase->pFontArray[i].vm_base=NULL; + pFontBase->pFontArray[i].FontMatrix[0]=0.0; + pFontBase->pFontArray[i].FontMatrix[1]=0.0; + pFontBase->pFontArray[i].FontMatrix[2]=0.0; + pFontBase->pFontArray[i].FontMatrix[3]=0.0; + pFontBase->pFontArray[i].FontTransform[0]=0.0; + pFontBase->pFontArray[i].FontTransform[1]=0.0; + pFontBase->pFontArray[i].FontTransform[2]=0.0; + pFontBase->pFontArray[i].FontTransform[3]=0.0; + pFontBase->pFontArray[i].slant=0.0; + pFontBase->pFontArray[i].extend=0.0; + pFontBase->pFontArray[i].physical=0; + pFontBase->pFontArray[i].refcount=0; + pFontBase->pFontArray[i].space_position=0; + pFontBase->pFontArray[i].info_flags=0; + } + } + /* no_fonts-1 was the largest allowed font ID */ + new_ID=pFontBase->no_fonts; + pFontBase->no_fonts++; + + if ((FontBase.pFontArray[new_ID].pFontFileName=(char *) + calloc( strlen( fontfilename)+1, sizeof(char))) == NULL){ + T1_PrintLog( "T1_AddFont()", + "Failed to allocate memory for Filename %s (FontID=%d)", + T1LOG_ERROR, fontfilename, new_ID); + T1_errno=T1ERR_ALLOC_MEM; + return(-3); + } + strcpy( FontBase.pFontArray[new_ID].pFontFileName, fontfilename); + + /* Generate logfile entry */ + sprintf( err_warn_msg_buf, "Assigned FontID %d to fontfile %s", + new_ID, FontBase.pFontArray[new_ID].pFontFileName); + T1_PrintLog( "T1_AddFont()", err_warn_msg_buf, + T1LOG_STATISTIC); + /* Return FontID of newly declared font */ + return( new_ID); + +} + + +/* T1_PrintLog() generates entries in the log file. msg_txt is subject to scan + conversion and ... signifies a accordingly lrge variable list. */ +void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...) +{ + va_list vararg; + static char levelid[4]={ 'E', 'W', 'S', 'D'}; + time_t s_clock, *tp; + + if (t1lib_log_file==NULL) + return; + if ((level>t1lib_log_level) || (level<1)){ + return; + } + else{ + /* initialize argument list */ + va_start( vararg, level); + + tp=&s_clock; + s_clock=time( tp); + /* + fprintf( t1lib_log_file, "(%c) (%.24s) %s: ", + levelid[level-1], ctime(&s_clock), func_ident); + */ + /* Don't print the time stamp */ + fprintf( t1lib_log_file, "(%c) %s: ", levelid[level-1], func_ident ); + vfprintf( t1lib_log_file, msg_txt, vararg ); + fprintf( t1lib_log_file, "\n"); + fflush( t1lib_log_file); + + /* cleanup variable list */ + va_end( vararg); + + return; + } +} + + +/* T1_SetLogLevel(): Set the level which a message must have so + that it is printed into the logfile. This function may be called + before T1_InitLib(). */ +void T1_SetLogLevel( int level) +{ + if ((level>0) && (level<5)) + t1lib_log_level=level; + return; +} + + + +/* CheckForInit(): If no initialization of font mechanism has been + done, return -1, indicating an error. */ +int CheckForInit(void) +{ + if(T1_Up) + return(0); + else + return(-1); + +} + + + +/* CheckForFontID(): Checks the font mechanism concerning the specified + ID. It returns: + 0 if font belonging to FontID has not yet been loaded + 1 if font belonging to FontID has already been loaded + -1 if FontID is an invalid specification or t1lib not + initialized + */ +int CheckForFontID( int FontID) +{ + + /* FontID is invalid */ + if ((FontID<0)||(FontID>(pFontBase->no_fonts - 1))||(T1_Up==0)) + return(-1); + + if (pFontBase->pFontArray[FontID].pType1Data==NULL) + return(0); /* has not yet been loaded */ + else + return(1); /* has already been loaded */ +} + + + + +/* test_for_t1_file returns 0 if a file "name.pfa" or "name.pfb" + was found. Else, -1 is returned. If successful, buffer contains the + found filename string */ +int test_for_t1_file( char *buffer ) +{ + int i=0; + char *FullName; + + /* First case: A PostScript Font ASCII File without extension + (according to some UNIX-conventions) */ + if ((FullName=intT1_Env_GetCompletePath(buffer,T1_PFAB_ptr))!=NULL) { + free(FullName); + return(0); + } + + while (buffer[i]!=0){ + i++; + } + buffer[i]='.'; + buffer[i+1]='p'; + buffer[i+2]='f'; + buffer[i+4]=0; + + + /* Second case: A PostScript Font ASCII File */ + buffer[i+3]='a'; + if ((FullName=intT1_Env_GetCompletePath(buffer,T1_PFAB_ptr))!=NULL) { + free(FullName); + return(0); + } + /* Third case: A PostScript Font Binary File */ + buffer[i+3]='b'; + if ((FullName=intT1_Env_GetCompletePath(buffer,T1_PFAB_ptr))!=NULL) { + free(FullName); + return(0); + } + + /* If we get here no file was found => Set buffer + to an empty string and return -1 */ + + buffer[0]=0; + return(-1); +} + + +/* T1_GetFontFileName() returns a pointer to the filename of the font, + associated with FontID. This filename does not contain a full path. + */ +char *T1_GetFontFileName( int FontID) +{ + + static char filename[MAXPATHLEN+1]; + + if (CheckForInit())return(NULL); + + /* Check first for valid FontID */ + if ((FontID<0) || (FontID>FontBase.no_fonts)){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + strcpy( filename, pFontBase->pFontArray[FontID].pFontFileName); + + return( filename); + +} + + + +/* As suggested by Nicolai Langfeldt, we make it possible to specify + a completely independent path for the afm filename. This should + make t1lib usable in context with using the kpathsearch-library. + We allow setting those path´s after initialization, but before a + font is loaded. + returns 0: OK + -1: Operation could not be performed +*/ +int T1_SetAfmFileName( int FontID, char *afm_name) +{ + + if (CheckForFontID(FontID)!=0){ + /* Operation may not be applied because FontID is invalid + or font is loaded */ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + if (afm_name==NULL) { + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + } + if (pFontBase->pFontArray[FontID].pAfmFileName!=NULL){ + /* we first free the current name */ + free( pFontBase->pFontArray[FontID].pAfmFileName); + pFontBase->pFontArray[FontID].pAfmFileName=NULL; + } + + if ((pFontBase->pFontArray[FontID].pAfmFileName= + (char *)malloc( (strlen(afm_name)+1)*sizeof( char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return( -1); + } + strcpy( pFontBase->pFontArray[FontID].pAfmFileName, afm_name); + + return(0); + +} + + + +/* We have a function for querying the name. Returns a pointer + to the string or NULL if name was not explicitly set .*/ +char *T1_GetAfmFileName( int FontID) +{ + + static char filename[MAXPATHLEN+1]; + + if (CheckForInit())return(NULL); + + /* Check first for valid FontID */ + if ((FontID<0) || (FontID>FontBase.no_fonts)){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + if (pFontBase->pFontArray[FontID].pAfmFileName==NULL) { + return( NULL); + } + + strcpy( filename, pFontBase->pFontArray[FontID].pAfmFileName); + return( filename); + +} + + + +/* T1_Get_no_fonts(): Return the number of declared fonts */ +int T1_Get_no_fonts(void) +{ + if (CheckForInit())return(-1); + return(FontBase.no_fonts); +} + + + +/* T1_SetDeviceResolutions( x_res, y_res): Set the device's physical + resolution in horizontal and vertical direction, mesured in DPI + (Dots Per Inch). This should be done before the first font is + loaded! */ +int T1_SetDeviceResolutions( float x_res, float y_res) +{ + + int i; + + if (CheckForInit()) + ; /* Not initialized -> no size dependent data -> OK */ + else + /* Check if size-dependent data is existent */ + for ( i=T1_Get_no_fonts(); i; i--) + if (pFontBase->pFontArray[i-1].pFontSizeDeps!=NULL){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); /* There's is size dependent data for a font */ + } + + /* Save resolutions and calculate horizontal and vertical + scale factors to map desired bp to device pixel */ + DeviceSpecifics.x_resolution=(float) x_res; + DeviceSpecifics.y_resolution=(float) y_res; + DeviceSpecifics.scale_x=(float)(((float)x_res)/BIGPOINTSPERINCH); + DeviceSpecifics.scale_y=(float)(((float)y_res)/BIGPOINTSPERINCH); + return(0); +} + + +/* T1_QueryX11Support(): Check at runtime to see if t1lib was compiled + with X11 interface: */ +int T1_QueryX11Support( void) +{ +#ifndef T1LIB_NO_X11_SUPPORT + return(1); +#else + return(0); +#endif +} + + + + +/* int T1_CopyFont(): Copies the font associated with FontID to another + location. The pointers to type1- , afm- and encoding data as well as + the matrices remain completely untouched. However, size dependent data + is not copied. The produced font is marked as a "logical" font. + If no memory is available in the FONTPRIVATE-array, there's realloc'ed + some more memory. The FontID which is assigned to the newly generated + font is given as the return value, or < 0 if an error occurs. Also, + the refcount entry of the source font is incremented by one. + + Return value -1: invalid FontID specified + -2: source font is not a "physical" font + -3: no memory for reallocation of FONTPRIVATEs + -4: no memory for one of the mapping tables + */ +int T1_CopyFont( int FontID) +{ + FONTPRIVATE *save_ptr; + int k; + int new_ID; + + + /* Check for a valid source font */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + + /* Check if the font in question is a "physical" font, otherwise it may + not be copied */ + if (pFontBase->pFontArray[FontID].physical==0){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-2); + } + + + /* Check if free space for a new FONTPRIVATE is available; if not, + realloc memory some amount larger */ + save_ptr=pFontBase->pFontArray; + if (pFontBase->no_fonts==pFontBase->no_fonts_limit){ + pFontBase->pFontArray=(FONTPRIVATE *)realloc(pFontBase->pFontArray, + (pFontBase->no_fonts_limit + + ADVANCE_FONTPRIVATE) + * sizeof(FONTPRIVATE)); + if (pFontBase->pFontArray==NULL){ + /* Restore pointer */ + pFontBase->pFontArray=save_ptr; + T1_errno=T1ERR_ALLOC_MEM; + return(-3); + } + /* We zero the newly allocated memory */ + if (pFontBase->pFontArray != NULL) { + memset( pFontBase->pFontArray + pFontBase->no_fonts_limit, 0, + ADVANCE_FONTPRIVATE * sizeof(FONTPRIVATE)); + } + pFontBase->no_fonts_limit += ADVANCE_FONTPRIVATE; + } + /* no_fonts-1 was the largest allowed font ID */ + new_ID=pFontBase->no_fonts; + /* Copy FONTPRIVATE-structure: */ + pFontBase->pFontArray[new_ID]=pFontBase->pFontArray[FontID]; + /* (Re)Set some values explicitly, others remain untouched: */ + pFontBase->pFontArray[new_ID].pFontSizeDeps=NULL; + pFontBase->pFontArray[new_ID].physical=0; + /* AFM-mapping tables are to be setup for logical fonts separately + (if AFM data is there) */ + /* first, kerning map */ + if (pFontBase->pFontArray[new_ID].pAFMData) { + k=pFontBase->pFontArray[new_ID].pAFMData->numOfPairs; + if (k>0){ /* kern map exists only if kerning pairs exist! */ + if ((pFontBase->pFontArray[new_ID].pKernMap= + (METRICS_ENTRY *)malloc( k*sizeof( METRICS_ENTRY)))==NULL){ + sprintf( err_warn_msg_buf, "Error allocating memory for kerning map (new_ID=%d)", + new_ID); + T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_ALLOC_MEM; + return(-4); + } + memcpy( pFontBase->pFontArray[new_ID].pKernMap, + pFontBase->pFontArray[FontID].pKernMap, + k*sizeof( METRICS_ENTRY)); + } + else { /* no kerning pairs, bu AFM data present */ + pFontBase->pFontArray[new_ID].pKernMap=NULL; + } + } + else { /* AFM data not present at all */ + pFontBase->pFontArray[new_ID].pKernMap=NULL; + } + + /* second, encoding map */ + if (pFontBase->pFontArray[FontID].pEncMap!=NULL) { + if ((pFontBase->pFontArray[new_ID].pEncMap= + (int *)calloc(256,sizeof(int)))==NULL){ + sprintf( err_warn_msg_buf, + "Error allocating memory for encoding map (new_ID=%d)", + new_ID); + T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_ALLOC_MEM; + return(-4); + } + memcpy( pFontBase->pFontArray[new_ID].pEncMap, + pFontBase->pFontArray[FontID].pEncMap, + 256*sizeof( int)); + } + + /* New font is logical --> indicate to which physical font it + refers by setting refcount: */ + pFontBase->pFontArray[new_ID].refcount=FontID; + + /* Now the struct is setup; increment no_fonts by 1 because + new_ID is a valid font specification from now on. */ + pFontBase->no_fonts++; + /* Increment refcount in source font */ + pFontBase->pFontArray[FontID].refcount++; + + /* Generate logfile entry */ + sprintf( err_warn_msg_buf, "Assigned FontID %d to fontfile %s", + new_ID, FontBase.pFontArray[new_ID].pFontFileName); + T1_PrintLog( "T1_CopyFont()", err_warn_msg_buf, + T1LOG_STATISTIC); + return(new_ID); +} + + + +/* T1_SetBitmapPad(): Set the value to which bitmap-scanlines are padded. + This has to be done before initialization because it is a very + rudimentary operation. + */ +int T1_SetBitmapPad( int pad) +{ + if (T1_Up){ + /* Library is initialized --> return error */ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + else{ + switch (pad){ + case 8: + T1_pad=8; + return(0); + case 16: + T1_pad=16; + return(0); +#ifdef T1_AA_TYPE64 + case 32: + T1_pad=32; + return(0); +#endif + default: + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + } + } +} + + + +/* T1_GetBitmapPad(): Read the value to which scanlines of bitmap are + padded. This can be done before or after initialization. */ +int T1_GetBitmapPad( void) +{ + if (pFontBase) /* T1lib initialized --> return value from struct */ + return( pFontBase->bitmap_pad); + else{ + if (T1_pad) + return(T1_pad); /* pad is explicitly set --> return that value */ + else + return( T1GLYPH_PAD); /* not expl. set --> return compilation default */ + } +} + + + +/* bin_dump(): Print a binary dump of a byte, short and + long variable (used for debug purposes only): */ +void bin_dump_c(unsigned char value, char space_flag) +{ + int i,j; + + for (i=0;i<=7;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + if (space_flag) + printf(" "); + +} + +void bin_dump_s(unsigned short value, char space_flag) +{ + int i,j; + + if (T1_CheckEndian()){ + for (i=8;i<=15;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + for (i=0;i<=7;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + } + else{ + for (i=0;i<=15;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + } + if (space_flag) + printf(" "); + +} + +void bin_dump_l(unsigned long value, char space_flag) +{ + int i,j; + + if (T1_CheckEndian()){ + for (i=24;i<=31;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + for (i=16;i<=23;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + for (i=8;i<=15;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + for (i=0;i<=7;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + } + else{ + for (i=0;i<=31;i++){ + if ((j=((value)>>i)&0x01)) + printf("X"); + else + printf("."); + } + } + if (space_flag) + printf(" "); + +} + + + +/* CheckEndian(): Checks whether the current machine is of little or big + endian architecture. This is important for concatenating bitmaps. + Function returns 0 if LittleEndian and 1 if BigEndian representation + is used on the current hardware. + */ +int T1_CheckEndian() +{ + unsigned char *charptr; + + /* Generate test value */ + unsigned short test=0x0001; + + /* Read out memory as unsigned char */ + charptr=(unsigned char *)(&test)+1; + + /* Return value will be 1 if Big- and 0 if Little Endian */ + return((int) *charptr); + +} + + + +/* T1_GetLibIdent(): Return the identifier string for the current version + of t1lib */ +char *T1_GetLibIdent( void) +{ + static char buf[15]; + + sprintf( buf, "%s", T1LIB_IDENT); + + return( (char *)buf); +} + + + +/* T1_SetRasterFlags(): Enable/Disable certain features in + the rasterizer */ +extern void T1_SetRasterFlags( int flags) +{ + + T1_Type1OperatorFlags=flags; + return; + +} + + + +/* T1_GetFontFileName(): returns a pointer to the complete path filename + of the font, associated with FontID as it is in use by t1lib. + */ +char *T1_GetFontFilePath( int FontID) +{ + + static char filepath[MAXPATHLEN+1]; + char *FileNamePath=NULL; + + /* is initialzed? */ + if (CheckForInit()) { + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + /* Check first for valid FontID */ + if ((FontID<0) || (FontID>FontBase.no_fonts)){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + /* lib is initialized and FontID is valid -> + we can really expect a name */ + if ((FileNamePath=intT1_Env_GetCompletePath( pFontBase->pFontArray[FontID].pFontFileName, + T1_PFAB_ptr))==NULL) { + T1_PrintLog( "T1_GetFontFilePath()", "Couldn't locate font file for font %d in %s", + T1LOG_WARNING, FontID, T1_GetFileSearchPath(T1_PFAB_PATH)); + T1_errno=T1ERR_FILE_OPEN_ERR; + return(NULL); + } + + strcpy( filepath, FileNamePath); + free( FileNamePath); + + return( filepath); + +} + + + +/* We have a function for querying the name. Returns a pointer + to the string or NULL if name was not explicitly set .*/ +char *T1_GetAfmFilePath( int FontID) +{ + + static char filepath[MAXPATHLEN+1]; + char *FontFileName; + char *AFMFilePath; + int i, j; + + /* is initialized? */ + if ((CheckForInit())) { + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + /* Check first for valid FontID */ + if ((FontID<0) || (FontID>FontBase.no_fonts)){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + /* Check wether AFM-file loading was suppressed on user's request */ + if ((pFontBase->t1lib_flags & T1_NO_AFM)!=0) { + /* this is no error condition, we simply return (NULL) */ + return( NULL); + } + + /* Check for explicitly associated metrics filename (via + "T1_SetAfmFileName()"). If it exists, we return it! */ + if (pFontBase->pFontArray[FontID].pAfmFileName!=NULL) { + strcpy( filepath, pFontBase->pFontArray[FontID].pAfmFileName); + sprintf( err_warn_msg_buf, "Returning explicitly specified path %s for Font %d", + filepath, FontID); + T1_PrintLog( "T1_GetAfmFilePath()", err_warn_msg_buf, T1LOG_DEBUG); + return( filepath); + } + + /* we have the usual case that the name of the metrics file has to be + deduced from the font file name */ + FontFileName=T1_GetFontFileName( FontID); + i=strlen(FontFileName); + j=i; + strcpy( filepath, FontFileName); + while ( filepath[i] != '.'){ + if (i==0) break; + else i--; + } + if (i==0){ + /* We have a filename without extension -> append extension */ + filepath[j]='.'; + filepath[j+1]='a'; + filepath[j+2]='f'; + filepath[j+3]='m'; + filepath[j+4]='\0'; + } + else{ + /* we found a '.' -> replace extension */ + filepath[i+1]='a'; + filepath[i+2]='f'; + filepath[i+3]='m'; + filepath[i+4]='\0'; + } + /* Get full path of the afm file (The case of a full path name + name specification is valid */ + AFMFilePath=intT1_Env_GetCompletePath( filepath, T1_AFM_ptr); + strcpy( filepath, AFMFilePath); + free( AFMFilePath); + + return( filepath); + +} diff -Naur xdvik-22.40l/libs/t1lib/t1base.h xdvik-22.40n/libs/t1lib/t1base.h --- xdvik-22.40l/libs/t1lib/t1base.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1base.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,88 @@ +/*-------------------------------------------------------------------------- + ----- File: t1base.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-10-03 + ----- Description: This file is part of the t1-library. It contains + declarations and definitions for t1base.c + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independ from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#ifdef T1BASE_C + +void *T1_InitLib( int log); +int intT1_scanFontDBase( char *filename); +int T1_CloseLib( void); +int T1_AddFont( char *fontfilename); +void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...); +void T1_SetLogLevel( int level); +int CheckForInit(void); +int CheckForFontID( int FontID); +int test_for_t1_file( char *buffer ); +char *T1_GetFontFileName( int FontID); +int T1_Get_no_fonts(void); +int T1_SetDeviceResolutions( float x_res, float y_res); +int T1_CopyFont( int FontID); +int T1_QueryX11Support( void); +void bin_dump_c(unsigned char value, char space_flag); +void bin_dump_s(unsigned short value, char space_flag); +void bin_dump_l(unsigned long value, char space_flag); +int T1_CheckEndian(void); +int T1_SetBitmapPad( int pad); +int T1_GetBitmapPad( void); +char *T1_GetLibIdent( void); +void T1_SetRasterFlags( int flags); +char *T1_GetAfmFileName( int FontID); +int T1_SetAfmFileName( int FontId, char *afm_name); +char *T1_GetFontFilePath( int FontID); +char *T1_GetAfmFilePath( int FontID); + +extern int T1_Type1OperatorFlags; + +#else + +extern void *T1_InitLib( int log); +extern int intT1_scanFontDBase( char *filename); +extern int T1_CloseLib( void); +extern int T1_AddFont( char *fontfilename); +extern void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...); +extern void T1_SetLogLevel( int level); +extern int CheckForInit(void); +extern int CheckForFontID( int FontID); +extern int test_for_t1_file( char *buffer ); +extern char *T1_GetFontFileName( int FontID); +extern int T1_Get_no_fonts(void); +extern int T1_SetDeviceResolutions( float x_res, float y_res); +extern int T1_QueryX11Support( void); +extern int T1_CopyFont( int FontID); +extern void bin_dump_c(unsigned char value, char space_flag); +extern void bin_dump_s(unsigned short value, char space_flag); +extern void bin_dump_l(unsigned long value, char space_flag); +extern int T1_CheckEndian(void); +extern int T1_SetBitmapPad( int pad); +extern int T1_GetBitmapPad( void); +extern char *T1_GetLibIdent( void); +extern void T1_SetRasterFlags( int flags); +extern char *T1_GetAfmFileName( int FontID); +extern int T1_SetAfmFileName( int FontId, char *afm_name); +extern char *T1_GetFontFilePath( int FontID); +extern char *T1_GetAfmFilePath( int FontID); + +#endif diff -Naur xdvik-22.40l/libs/t1lib/t1delete.c xdvik-22.40n/libs/t1lib/t1delete.c --- xdvik-22.40l/libs/t1lib/t1delete.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1delete.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,362 @@ +/*-------------------------------------------------------------------------- + ----- File: t1delete.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-06-03 + ----- Description: This file is part of the t1-library. It contains + functions for giving free previously allocated + memory areas and similar things. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1DELETE_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include + + +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" + +#include "t1types.h" +#include "t1extern.h" +#include "t1delete.h" +#include "t1load.h" +#include "t1finfo.h" +#include "t1base.h" + + + +/* T1_DeleteSize(): Gives back all the memory allocated for size to the + system. If size is somewhere in the middle of a linked list of sizes, + it further takes care that the remaining list is linked in a proper + way. Function returns 0 if successful and otherwise -1*/ +int T1_DeleteSize( int FontID, float size) +{ + int i, j; + FONTSIZEDEPS *ptr, *next_ptr, *prev_ptr; + int jobs=0; + int antialias; + int level[4]={0,T1_AA_NONE,T1_AA_LOW,T1_AA_HIGH}; + + + for ( j=0; j<4; j++){ + antialias=level[j]; + /* Check if size exists; if not, return 1 */ + if ((ptr=QueryFontSize( FontID, size, antialias))!=NULL){ + /* We have to remove a size-> */ + jobs++; + /* Get pointers to structure which is before/after the structure + to be deleted in the linked list and properly relink + structures */ + next_ptr=((FONTSIZEDEPS *)ptr)->pNextFontSizeDeps; + prev_ptr=((FONTSIZEDEPS *)ptr)->pPrevFontSizeDeps; + + if ((prev_ptr==NULL)&&(next_ptr==NULL)){ + /* There's only one single size, no relink is necessary + => reset the initial pointer to indicate that no size + dependent data is available */ + pFontBase->pFontArray[FontID].pFontSizeDeps=NULL; + } + else{ + if (prev_ptr!=NULL) + /* We are at the first size of the linked list and + there are still some sizes left after removing the + current */ + prev_ptr->pNextFontSizeDeps=next_ptr; + else + pFontBase->pFontArray[FontID].pFontSizeDeps=next_ptr; + if (next_ptr!=NULL) + /* We are at the end of an list of at least two sizes: */ + next_ptr->pPrevFontSizeDeps=prev_ptr; + } + + /* Now, that the list is properly linked, free the memory used by size: */ + /* Free the bitmaps memory: */ + for (i=0; i<256; i++) + if (ptr->pFontCache[i].bits) + free(ptr->pFontCache[i].bits); + + /* Free memory for glyphs: */ + free(ptr->pFontCache); + /* Free the structure itself: */ + free(ptr); + /* Print log: */ + sprintf( err_warn_msg_buf, "Size %f deleted for FontID %d (antialias=%d)", + size, FontID, antialias); + T1_PrintLog( "T1_DeleteSize()", err_warn_msg_buf, T1LOG_STATISTIC); + } + } + + /* Return the appropriate value */ + if (jobs==0) + return(-1); + else + return(0); + +} + + +/* T1_DeleteAllSizes(): Gives back all the memory allocated for all sizes + to the system. Function returns the number of removed sizes or -1 if an + error ocurred. */ +int T1_DeleteAllSizes( int FontID) +{ + int sizecount; + float currsize; + + FONTSIZEDEPS *ptr; + + if (CheckForFontID(FontID)!=1) + return(-1); + + /* Start deleting at the end of the linked list: */ + sizecount=0; + if ((ptr=GetLastFontSize( FontID))==NULL){ + /* There has not been any size dependent data: */ + return(0); + } + + while (((ptr=GetLastFontSize(FontID)) != NULL)){ + currsize=ptr->size; + T1_DeleteSize( FontID, currsize); + sizecount++; + + } + + return(sizecount); +} + + +/* T1_FreeGlyph(): Gives the memory used by a glyph back to the system. */ +int T1_FreeGlyph( GLYPH *glyph) +{ + if (glyph!=NULL) { + if (glyph->bits!=NULL) { + free(glyph->bits); + } + free(glyph); + } + return(0); +} + + +/* T1_FreeCompCharData(): Return emory used by a composite character + data information structure to the system */ +int T1_FreeCompCharData( T1_COMP_CHAR_INFO *cci) +{ + + if (cci!=NULL) { + if (cci->pieces!=NULL) { + free( cci->pieces); + } + free( cci); + } + return( 0); +} + + +/* T1_DeleteFont(): Gives all memory used by a font back to the system. + If the font is successfully deinstalled 0 is returned. A positive value + indicates an error. */ +int T1_DeleteFont( int FontID) +{ + + int result; + + + if (CheckForFontID(FontID)==-1){ /* Invalid ID */ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + if (CheckForFontID(FontID)==0) /* Font is not loaded */ + return(0); + + /* Memory freeing must be done hierachical, start with size dependent + data: */ + result=T1_DeleteAllSizes(FontID); + + /* Next we delete the AFM-mapping tables */ + if (pFontBase->pFontArray[FontID].pEncMap!=NULL) + free( pFontBase->pFontArray[FontID].pEncMap); + if (pFontBase->pFontArray[FontID].pKernMap!=NULL) + free( pFontBase->pFontArray[FontID].pKernMap); + + /* We do not touch the file name because this is only to be done by + T1_CloseLib(): */ + + /* The Type-1 area and tyhe AFM-area may only be free'ed, if the + font is a "physical" font and if its reference counter is 1, or + if it is a logical font. Otherwise, other logical font use this + physical one and it may not be free'ed. In this case, return the + number of logical fonts which refer to this physical font. */ + if ((pFontBase->pFontArray[FontID].physical==1)&& + (pFontBase->pFontArray[FontID].refcount==1)){ + /* Now handle the type 1 data: */ + if (pFontBase->pFontArray[FontID].pType1Data!=NULL){ + /* First: VM, which includes CharStrings, Private, .... */ + free(pFontBase->pFontArray[FontID].vm_base); + /* .. then the struct itself: */ + free(pFontBase->pFontArray[FontID].pType1Data); + pFontBase->pFontArray[FontID].pType1Data=NULL; + } + + /* afm-data is yet there -> */ + if (pFontBase->pFontArray[FontID].pAFMData!=NULL){ + result=FreeAFMData(pFontBase->pFontArray[FontID].pAFMData); + pFontBase->pFontArray[FontID].pAFMData=NULL; + } + } + else{ + if (pFontBase->pFontArray[FontID].physical==1){ + /* font is physical and is referred to by other fonts -> + Do nothing further and return number of references: */ + + return(pFontBase->pFontArray[FontID].refcount - 1); + } + } + + /* If we get here and the font is logical, we have to + decrement the refcount of the referred physical font */ + if (pFontBase->pFontArray[FontID].physical==0){ + pFontBase->pFontArray[pFontBase->pFontArray[FontID].refcount].refcount--; + } + + + /* Set remaining area explicitly to 0 (all but pFontFileName and + pAfmFileName!) */ + pFontBase->pFontArray[FontID].pAFMData=NULL; + pFontBase->pFontArray[FontID].pType1Data=NULL; + pFontBase->pFontArray[FontID].pEncMap=NULL; + pFontBase->pFontArray[FontID].pKernMap=NULL; + pFontBase->pFontArray[FontID].pFontEnc=NULL; + pFontBase->pFontArray[FontID].pFontSizeDeps=NULL; + pFontBase->pFontArray[FontID].vm_base=NULL; + pFontBase->pFontArray[FontID].FontMatrix[0]=0.0; + pFontBase->pFontArray[FontID].FontMatrix[1]=0.0; + pFontBase->pFontArray[FontID].FontMatrix[2]=0.0; + pFontBase->pFontArray[FontID].FontMatrix[3]=0.0; + pFontBase->pFontArray[FontID].FontTransform[0]=0.0; + pFontBase->pFontArray[FontID].FontTransform[1]=0.0; + pFontBase->pFontArray[FontID].FontTransform[2]=0.0; + pFontBase->pFontArray[FontID].FontTransform[3]=0.0; + pFontBase->pFontArray[FontID].slant=0.0; + pFontBase->pFontArray[FontID].extend=0.0; + pFontBase->pFontArray[FontID].UndrLnPos=0.0; + pFontBase->pFontArray[FontID].UndrLnThick=0.0; + pFontBase->pFontArray[FontID].OvrLnPos=0.0; + pFontBase->pFontArray[FontID].OvrLnThick=0.0; + pFontBase->pFontArray[FontID].OvrStrkPos=0.0; + pFontBase->pFontArray[FontID].OvrStrkThick=0.0; + pFontBase->pFontArray[FontID].physical=0; + pFontBase->pFontArray[FontID].refcount=0; + pFontBase->pFontArray[FontID].space_position=0; + pFontBase->pFontArray[FontID].info_flags=0; + + return(0); + +} + + + +/* FreeAFMData(): Give all memory used by afm-Information back to the + system. */ +int FreeAFMData( FontInfo *pAFMData) +{ + if (pAFMData != NULL){ + if (pAFMData->gfi != NULL){ + free(pAFMData->gfi->afmVersion); pAFMData->gfi->afmVersion = NULL; + free(pAFMData->gfi->fontName); pAFMData->gfi->fontName = NULL; + free(pAFMData->gfi->fullName); pAFMData->gfi->fullName = NULL; + free(pAFMData->gfi->familyName); pAFMData->gfi->familyName = NULL; + free(pAFMData->gfi->weight); pAFMData->gfi->weight = NULL; + free(pAFMData->gfi->version); pAFMData->gfi->version = NULL; + free(pAFMData->gfi->notice); pAFMData->gfi->notice = NULL; + free(pAFMData->gfi->encodingScheme); pAFMData->gfi->encodingScheme = NULL; + free(pAFMData->gfi); pAFMData->gfi = NULL; + } + + if (pAFMData->cwi != NULL){ + free(pAFMData->cwi); pAFMData->cwi = NULL; + } + + if (pAFMData->cmi != NULL){ + int i = 0; + CharMetricInfo *temp = pAFMData->cmi; + Ligature *node = temp->ligs; + for (i = 0; i < pAFMData->numOfChars; ++i){ + for (node = temp->ligs; node != NULL; node = node->next){ + free(node->succ); node->succ = NULL; + free(node->lig); node->lig = NULL; + } + free(temp->name); temp->name = NULL; + temp++; + } + free(pAFMData->cmi); pAFMData->cmi = NULL; + } + + if (pAFMData->tkd != NULL){ + free(pAFMData->tkd); pAFMData->tkd = NULL; + } + + if (pAFMData->pkd != NULL){ + int i = 0; + for (i = 0; i < pAFMData->numOfPairs; ++i){ + free(pAFMData->pkd[i].name1); pAFMData->pkd[i].name1 = NULL; + free(pAFMData->pkd[i].name2); pAFMData->pkd[i].name2 = NULL; + } + free(pAFMData->pkd); pAFMData->pkd = NULL; + } + + if (pAFMData->ccd != NULL){ + int i = 0, j = 0; + CompCharData *ccd = pAFMData->ccd; + for (i = 0; i < pAFMData->numOfComps; ++i){ + for (j = 0; j < ccd[i].numOfPieces; ++j){ + free(ccd[i].pieces[j].pccName); + ccd[i].pieces[j].pccName = NULL; + } + free(ccd[i].ccName); ccd[i].ccName = NULL; + } + free(pAFMData->ccd); pAFMData->ccd = NULL; + } + free(pAFMData); + } + return(0); + +} + diff -Naur xdvik-22.40l/libs/t1lib/t1delete.h xdvik-22.40n/libs/t1lib/t1delete.h --- xdvik-22.40l/libs/t1lib/t1delete.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1delete.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,49 @@ +/*-------------------------------------------------------------------------- + ----- File: t1delete.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-06-03 + ----- Description: This file is part of the t1-library. It contains + functions for setting characters and strings of + characters. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#ifdef T1DELETE_C + +int T1_DeleteSize( int FontID, float size); +int T1_DeleteAllSizes( int FontID); +int T1_FreeGlyph( GLYPH *glyph); +int T1_FreeCompCharData( T1_COMP_CHAR_INFO *cci); +int T1_DeleteFont( int FontID); +int FreeAFMData( FontInfo *pAFMData); + +#else + +extern int T1_DeleteSize( int FontID, float size); +extern int T1_DeleteAllSizes( int FontID); +extern int T1_FreeGlyph( GLYPH *glyph); +extern int T1_FreeCompCharData( T1_COMP_CHAR_INFO *cci); +extern int T1_DeleteFont( int FontID); +extern int FreeAFMData( FontInfo *pAFMData); + +#endif + + diff -Naur xdvik-22.40l/libs/t1lib/t1enc.c xdvik-22.40n/libs/t1lib/t1enc.c --- xdvik-22.40l/libs/t1lib/t1enc.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1enc.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,807 @@ +/*-------------------------------------------------------------------------- + ----- File: t1enc.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-10-18 + ----- Description: This file is part of the t1-library. It contains + functions encoding handling at runtime. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independ from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1ENC_C + + +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include + + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" + + +#include "t1types.h" +#include "t1extern.h" +#include "t1enc.h" +#include "t1env.h" +#include "t1base.h" +#include "t1finfo.h" + + +static char defaultencodingname[]="Unspecified"; + +/* This struct is retunred by the tokenizer. It contains indices + in linebuf for the first and the last character in a token */ +typedef struct +{ + int first; + int last; +} CNTOKEN; + + + +/* ScanForWord(): Tokenizer for ScanEncodingFile. + + - and return the first and last index in linebuf of the token + + - skips whitespace and comments + + - the vector marks [ and ] are considered token-delimiters + and also treated as independent tokens + + - the literal escape char "/" is also considered as a token + delimiter but is not returned as a token. + + This function leaves linebuf unmodified so that in case of a + failure, TryT1LibEncoding() will receive a clean buffer! */ +static CNTOKEN *ScanForWord( char *lb, int size) +{ + static int i=-1; + int j; + int comment; + + static CNTOKEN currtoken={-1,-1}; + + /* Reset tokenizer */ + if (lb==NULL) { + i=-1; + currtoken.first=-1; + currtoken.last=-1; + return NULL; + } + + comment=0; + j=-1; + + while (++i word */ + if (j==-1) { + j=i; + currtoken.first=j; + continue; + } + } + + /* We're at the end of the buffer. Do we have a word? */ + if (j!=-1) { + currtoken.last=i-1; + return &currtoken; + } + + /* We have nothing */ + return NULL; +} + + +/* tokcpy(): Copy a token from linebuf and append \0 */ +static char *tokcpy( char *dest, const char *src, + int first, int last) +{ + /* we do not do any range or error checking in this function */ + memcpy( dest, &(src[first]), last-first+1); + dest[last-first+1]='\0'; + return dest; +} + + +/* TryDVIPSEncoding(): Try to read an encoding file conforming to the + dvips specification. The file's contents is expected in a buffer + "linebuf" of size "filesize". Function returns the actual size of the + charnames memory or -1. */ +static int TryDVIPSEncoding( char *linebuf, int filesize, char *charnames) +{ + + char token[256]; + char *encname; + int charname_count=0; + int k=0; + CNTOKEN *currtokenP; + + + /* Initialize tokenizer */ + currtokenP=ScanForWord( NULL, filesize); + + + currtokenP=ScanForWord(linebuf,filesize); + if ( (currtokenP!=NULL) && + (linebuf[currtokenP->first]=='/')) { + /* / indicates start of postscript string literal, so this + could be a postscript .enc file */ + if ((encname=(char *)malloc( (currtokenP->last - currtokenP->first + 1 + 1) * + sizeof( char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return -1; + } + else { + /* store encoding name */ + if (currtokenP->first==currtokenP->last) { + /* PostScript encoding requires an identifier + so this does not seem to be a valid encoding file */ + free( encname); + return( -1); + } + tokcpy( encname, linebuf, currtokenP->first+1, currtokenP->last); + + } + + + /* Next, the PostScript "mark" character is expected */ + if ( ((currtokenP=ScanForWord(linebuf,filesize))!=NULL) && + (currtokenP->first==currtokenP->last) && + (linebuf[currtokenP->first]!='[') ) { + /* Since we got up to here, there is a certain probability that + we have a PostScript encoding definition, but with invalid + syntax. So put log message. */ + sprintf( err_warn_msg_buf, + "Expected encoding definition after %s, but did not find \"[\"-character", + encname); + T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); + if (encname!=NULL) + free( encname); + return( -1); + } + + /* now, try to read 256 literal character names. We do not check + for charname count because this would bypass error checking. */ + while((currtokenP=ScanForWord(linebuf,filesize))!=NULL) { + + /* End of vector operator? */ + if ( (currtokenP->first==currtokenP->last) && /* one character? */ + (linebuf[currtokenP->first]==']')) { + break; + } + /* We drop the escape character if it is present. However, + non-literal name specifications are not allowed in + encoding vectors. */ + if (linebuf[currtokenP->first]!='/') { + sprintf( err_warn_msg_buf, + "Found non-literal name (c=%c (first=%d, last=%d)) at slot %d while scanning encoding vector %s.", + linebuf[currtokenP->first], + currtokenP->first, currtokenP->last, + charname_count, encname); + T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); + if (encname!=NULL) + free( encname); + return( -1); + } + else { + /* OK, first char in token is "/". Does there follow a name? */ + if ( currtokenP->first==currtokenP->last) { + sprintf( err_warn_msg_buf, + "Empty literal name at slot %d while scanning encoding vector %s.", + charname_count, encname); + T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); + if (encname!=NULL) + free( encname); + return( -1); + } + } + + /* We seem to have a valid name -> copy name to *charnames-array */ + tokcpy( &(charnames[k]), linebuf, + currtokenP->first+1, currtokenP->last); + k+=currtokenP->last-currtokenP->first+1; /* note: we have omitted "/"! */ + /* Increment character counter */ + charname_count++; + /* set index to start of next word/line */ + } /* end of loop scanning character names */ + + if (currtokenP==NULL) { + /* In this case loop has been stopped because buffer end has been + reached. Since we did not alreay read the ]-character, this is + an error condition. */ + sprintf( err_warn_msg_buf, + "Premature end of encoding definition encountered." ); + T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); + free(encname); + return( -1); + } + /* Since the above loop has not been finished due to a NULL-ptr, + the token ] must have been encountered. Thus, read ahead and look + for def: */ + if ((currtokenP=ScanForWord(linebuf,filesize))==NULL) { + sprintf( err_warn_msg_buf, + "Premature end of encoding definition encountered."); + T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); + free(encname); + return( -1); + } + + if (strcmp(tokcpy( &(charnames[k]), linebuf, + currtokenP->first, currtokenP->last), "def")!=0) { + /* we store the current token in charnames only temporarily, so we + do not increment k! */ + sprintf( err_warn_msg_buf, + "Closing token \"def\" expected but found \"%s\".", + &(charnames[k])); + T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); + free(encname); + return( -1); + } + /* Encoding definition is complete. we do not allow any further tokens + except comments. */ + if ((currtokenP=ScanForWord(linebuf,filesize))!=NULL) { + tokcpy( token, linebuf, currtokenP->first, currtokenP->last); + sprintf( err_warn_msg_buf, + "Token \"%s\" after closing \"def\" in successfully scanned encoding file makes encoding definition file invalid", token); + T1_PrintLog( "TryDVIPSEncoding()", err_warn_msg_buf, T1LOG_WARNING); + free(encname); + return( -1); + } + + /* we allow less than 256 character names. The missing ones are filled + now with .notdef */ + for ( ; charname_count<256; charname_count++) { + tokcpy( &(charnames[k]), ".notdef", 0, 6); + k+=8; + } + + /* Append the string for the encoding's name */ + strcpy( &(charnames[k]), encname); + k +=strlen(encname)+1; + + free(encname); + + return( k); + + } /* file does not start with / -> no dvips-encoding file */ + + return( -1); + +} + + + +/* TryT1LibEncoding(): Try to read an encoding file conforming to the + t1lib specification. The file's contents is expected in a buffer + "linebuf" of size "filesize". Function returns the actual size of the + charnames memory or -1. */ +static int TryT1LibEncoding( char *linebuf, int filesize, char *charnames) +{ + int i=0, j=0, k=0, l=0; + + char save_char; + int charname_count=0; + + while(i no encoding read */ + } + + + /* enc_fp points now to a (hopefully) valid encoding file */ + /* Get the file size */ + fseek( enc_fp, 0, SEEK_END); + filesize=ftell(enc_fp); + /* Reset fileposition to start */ + fseek( enc_fp, 0, SEEK_SET); + + if ((linebuf=(char *)calloc( filesize, + sizeof(char)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + /* Allocate space for character names, assume the worst case and realloc + later. The DVIPS-parser requires one more char in order to work properly */ + if ((charnames=(char *)calloc( filesize + strlen(defaultencodingname+1), + sizeof(char)))==NULL){ + free( linebuf); + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + fread((char *)linebuf, sizeof(char), filesize, enc_fp); + fclose(enc_fp); + + + /* file is read. Operate now on the buffer. */ + + + /* try dvips encoding file */ + cnsize=TryDVIPSEncoding( linebuf, filesize, charnames); + if ( cnsize>-1) { + /* a debug message to log file */ + sprintf( err_warn_msg_buf, + "Scanned file %s (%d bytes) as dvips-encoding file.", + FileName, filesize); + T1_PrintLog( "ScanEncodingFile()", err_warn_msg_buf, T1LOG_DEBUG); + } + else { + /* try t1lib encoding file */ + cnsize=TryT1LibEncoding( linebuf, filesize, charnames); + if ( cnsize>-1) { + /* write a debug message to log file */ + sprintf( err_warn_msg_buf, + "Scanned file %s (%d bytes) as t1lib-encoding file.", + FileName, filesize); + T1_PrintLog( "ScanEncodingFile()", err_warn_msg_buf, T1LOG_DEBUG); + } + else { + /* write a warning message because loading encoding + entirely failed */ + sprintf( err_warn_msg_buf, + "Scanning file %s (%d bytes) as encoding file failed.", + FileName, filesize); + T1_PrintLog( "ScanEncodingFile()", err_warn_msg_buf, T1LOG_WARNING); + } + } + + if ( cnsize<0) { + /* T1_errno is already set from the respective function */ + if ( charnames!=NULL) { + free(charnames); + } + free(linebuf); + return( NULL); + } + + + /* cnsize contains the size of the charnames' memory, so let's + now realloc charnames */ + charnames=(char *)realloc( charnames, cnsize*sizeof(char)); + /* Now initialize the array with the start-addresses of the character + name strings */ + /* We alloc 257 to save the encoding's name at the 257th entry */ + if ((encoding=(char **)malloc(257*sizeof(char *)))==NULL) { + if ( charnames!=NULL) { + free(charnames); + } + free(linebuf); + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + while (i<257) { + encoding[i]=&charnames[j]; + while (charnames[j]) + j++; + j++; + i++; + } + + free( linebuf); + return(encoding); + +} + + + +/* T1_LoadEncoding(): Load an encoding file to have a new encoding + available. If successful, the pointer to the encoding array is + returned. In case of an error, the return value is NULL. + */ +char **T1_LoadEncoding( char *FileName) +{ + char **Encoding; + char *EncFileName; + + if( FileName==NULL){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + if ((EncFileName=intT1_Env_GetCompletePath( FileName, T1_ENC_ptr))==NULL){ + T1_errno=T1ERR_FILE_OPEN_ERR; + return(NULL); + } + Encoding=ScanEncodingFile(EncFileName); + free(EncFileName); + + return(Encoding); +} + + + +/* T1_DeleteEncoding() free a previously loaded encoding */ +int T1_DeleteEncoding( char **encoding) +{ + if (encoding){ + /* First free character names memory */ + free( encoding[0]); + /* then, free pointer array */ + free( encoding); + } + return(0); + +} + + + +/* T1_ReencodeFont(): Assign a new encoding to an existent font. This is + only allowed if no size dependent data exists for the font in question. + Moreover, the font must be loaded already since must get the position + of the space-character. Function returns 0 if successful, and -1 otherwise. + */ +int T1_ReencodeFont( int FontID, char **Encoding) +{ + int i, j, k, l, m; + char *charname; + PairKernData *pkd; + METRICS_ENTRY *kern_tbl; + int char1, char2; + + + /* First, check for valid font ID residing in memory: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + /* Second, check whether size-dependent data exists: */ + if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + pFontBase->pFontArray[FontID].pFontEnc=Encoding; + + + /* We have to update the space_position-entry in the FONTPRIVATE. + If space is not found (not encoded), set it to -1: */ + pFontBase->pFontArray[FontID].space_position=-1; + i=0; + if (Encoding){ /* external encoding */ + while (i<256){ + if (strcmp( (char *)pFontBase->pFontArray[FontID].pFontEnc[i], + "space")==0){ + /* space found at position i: */ + pFontBase->pFontArray[FontID].space_position=i; + break; + } + i++; + } + } + else{ /* reencoding to internal encoding */ + while (i<256){ + if (strcmp( (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[i].data.arrayP, + "space")==0){ + /* space found at position i: */ + pFontBase->pFontArray[FontID].space_position=i; + break; + } + i++; + } + } + + /* Now update afm index mapping: */ + if (pFontBase->pFontArray[FontID].pAFMData != NULL){ + for (i=0; i<256; i++) { + charname=T1_GetCharName( FontID, i); + /* in a first loop check for ordinary characters */ + for ( j=0; jpFontArray[FontID].pAFMData->numOfChars; j++) { + if (strcmp( charname, + pFontBase->pFontArray[FontID].pAFMData->cmi[j].name)==0) { + pFontBase->pFontArray[FontID].pEncMap[i]=j+1; /* index 0 is reserved! */ + continue; + } + } + /* if nothing has been found, check for composite characters */ + for ( j=0; jpFontArray[FontID].pAFMData->numOfComps; j++) { + if (strcmp( charname, + pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName)==0) { + pFontBase->pFontArray[FontID].pEncMap[i]=-(j+1); /* index 0 is reserved! */ + /* Note: Metrics of composite characters already exist so that there is + no need to recalculate them! */ + continue; + } + } + } + /* Update kerning table */ + k=pFontBase->pFontArray[FontID].pAFMData->numOfPairs; + if (k>0){ /* i.e., there are any pairs */ + /* OK, it does not suffice to alloc numOfPairs METRICS_ENTRYs, because + a given character might be encoded at several locations and kerning + should still work. As a worst case estimation, we allocate 256^2 + and realloc later. */ + if ((pFontBase->pFontArray[FontID].pKernMap= + (METRICS_ENTRY *)malloc( (256*256) *sizeof( METRICS_ENTRY)))==NULL){ + sprintf( err_warn_msg_buf, "Error allocating memory for metrics map (FontID=%d)", + FontID); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + kern_tbl=pFontBase->pFontArray[FontID].pKernMap; + pkd=pFontBase->pFontArray[FontID].pAFMData->pkd; + j=0; + for ( i=0; i + Put char1 in higher byte and char2 in LSB: */ + kern_tbl[j].chars=(char1 << 8) | char2; + /* We only make use of horizontal kerning */ + kern_tbl[j].hkern=pkd[i].xamt; + j++; + } /* while (char2) */ + } /* while (char1) */ + } /* for */ + /* We are done, realloc memory: */ + kern_tbl=(METRICS_ENTRY*) realloc( kern_tbl, j*sizeof(METRICS_ENTRY)); + /* We now sort the kerning array with respect to char indices */ + qsort( kern_tbl, (size_t) j, sizeof(METRICS_ENTRY), + &cmp_METRICS_ENTRY ); + /* Finally write back pointer for the case that realloc changed the + pointer */ + pFontBase->pFontArray[FontID].pKernMap=kern_tbl; + pFontBase->pFontArray[FontID].KernMapSize=j; + } + else { + pFontBase->pFontArray[FontID].pKernMap=NULL; + } + } + return(0); +} + + + +/* T1_SetDefaultEncoding(): Set the default encoding vector that's + used when fonts are loaded. + */ +int T1_SetDefaultEncoding( char **encoding) +{ + + if (CheckForInit()){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + pFontBase->default_enc=encoding; + return(0); +} + + +/* T1_GetEncodingScheme(): Get the name associated with the current + encoding vector of font FontID */ +char *T1_GetEncodingScheme( int FontID) +{ + + static char enc_scheme[256]; + + /* First, check for valid font ID residing in memory: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + if (pFontBase->pFontArray[FontID].pFontEnc==NULL){ + if (pFontBase->pFontArray[FontID].info_flags & USES_STANDARD_ENCODING){ + strcpy( enc_scheme, "StandardEncoding"); + } + else { + strcpy( enc_scheme, "FontSpecific"); + } + } + else + strcpy( enc_scheme, pFontBase->pFontArray[FontID].pFontEnc[256]); + + return(enc_scheme); + +} + + +/* A function for comparing METRICS_ENTRY structs */ +static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2) +{ + if (((METRICS_ENTRY *)entry1)->chars < + ((METRICS_ENTRY *)entry2)->chars) + return(-1); + if (((METRICS_ENTRY *)entry1)->chars > + ((METRICS_ENTRY *)entry2)->chars) + return(1); + return(0); /* This should not happen */ +} + diff -Naur xdvik-22.40l/libs/t1lib/t1enc.h xdvik-22.40n/libs/t1lib/t1enc.h --- xdvik-22.40l/libs/t1lib/t1enc.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1enc.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,47 @@ +/*-------------------------------------------------------------------------- + ----- File: t1enc.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-06-16 + ----- Description: This file is part of the t1-library. It contains + declarations and definitions for t11enc.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independ from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#ifdef T1ENC_C + +static char **ScanEncodingFile( char *FileName); +char **T1_LoadEncoding( char *FileName); +int T1_DeleteEncoding( char **encoding); +int T1_ReencodeFont( int FontID, char **Encoding); +int T1_SetDefaultEncoding( char **encoding); +char *T1_GetEncodingScheme( int FontID); +static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2); + +#else + +extern char **T1_LoadEncoding( char *FileName); +extern int T1_DeleteEncoding( char **encoding); +extern int T1_ReencodeFont( int FontID, char **Encoding); +extern int T1_SetDefaultEncoding( char **encoding); +extern char *T1_GetEncodingScheme( int FontID); + +#endif + diff -Naur xdvik-22.40l/libs/t1lib/t1env.c xdvik-22.40n/libs/t1lib/t1env.c --- xdvik-22.40l/libs/t1lib/t1env.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1env.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1040 @@ +/*-------------------------------------------------------------------------- + ----- File: t1env.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-11-12 + ----- Description: This file is part of the t1-library. It implements + the reading of a configuration file and path-searching + of type1-, afm- and encoding files. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independ from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#define T1ENV_C + + +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include + + +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/fontmisc.h" + +#include "sysconf.h" +#include "t1types.h" +#include "t1extern.h" +#include "t1env.h" +#include "t1misc.h" +#include "t1base.h" + + +/* The following static variables are used to store information on the distinct + file search paths: + + -1 t1lib has not yet been initialized! + 0 t1lib has been initialized and default paths have been setup + n (>0) there are n path elements for current search path type, either built + from a FontDataBase file or from explicit fucntion calls. +*/ + +static int pfab_no=-1; +static int afm_no=-1; +static int enc_no=-1; +static int fdb_no=-1; + +static char path_sep_char='\0'; +static char path_sep_string[2]; + +static char pathbuf[2048]; + +/* Define some default search paths */ +#ifndef VMS +static char T1_pfab[]="."; +static char T1_afm[]="."; +static char T1_enc[]="."; +#else +static char T1_pfab[]="sys$disk:[]"; +static char T1_afm[]="sys$disk:[]"; +static char T1_enc[]="sys$disk:[]"; +#endif +char T1_fdb[]="FontDataBase"; + + +/* keywords recognized in config file */ +static const char enc_key[]="ENCODING"; +static const char pfab_key[]="TYPE1"; +static const char afm_key[]="AFM"; +static const char fdb_key[]="FONTDATABASE"; + + +/* qstrncpy(): Copy bytes from srcP to to destP. srcP is count bytes long + and destP is the number of quoted characters shorter. That is, count + refers to the number of characters including the escapement chars in + srcP! */ +static void qstrncpy( char *destP, const char *srcP, long nochars) +{ + long i; + long j; + + i=0; /* dest-index */ + j=0; /* src-index */ + + while (j omit escape char. */ + } + } + else { /* normal character */ + destP[i++]=srcP[j++]; + } + } +} + + + + +/* Setup the default paths for searching the distinct file types. If + paths have been setup explicitly, skip the step of setting up a default path. */ +void intT1_SetupDefaultSearchPaths( void) +{ + + path_sep_char=PATH_SEP_CHAR; + sprintf( path_sep_string, "%c", path_sep_char); + + /* We set the number of stored path elements 0 so that we can distiguish + between explicitly setup paths and default paths in intT1_ScanConfigFile(). */ + if (pfab_no==-1) { + T1_PFAB_ptr=(char**) calloc( 2, sizeof(char*)); + T1_PFAB_ptr[0]=(char*)malloc(strlen(T1_pfab)+1); + strcpy(T1_PFAB_ptr[0],T1_pfab); + pfab_no=0; + } + + if (afm_no==-1) { + T1_AFM_ptr=(char**) calloc( 2, sizeof(char*)); + T1_AFM_ptr[0]=(char*)malloc(strlen(T1_afm)+1); + strcpy(T1_AFM_ptr[0],T1_afm); + afm_no=0; + } + + if (enc_no==-1) { + T1_ENC_ptr=(char**) calloc( 2, sizeof(char*)); + T1_ENC_ptr[0]=(char*)malloc(strlen(T1_enc)+1); + strcpy(T1_ENC_ptr[0],T1_enc); + enc_no=0; + } + + if (fdb_no==-1) { + T1_FDB_ptr=(char**) calloc( 2, sizeof(char*)); + T1_FDB_ptr[0]=(char*)malloc(strlen(T1_fdb)+1); + strcpy(T1_FDB_ptr[0],T1_fdb); + fdb_no=0; + } +} + + +/* This function is called from T1_CloseLib(). We have to indicate the state + of a non-initialzed t1lib! */ +void intT1_FreeSearchPaths( void) +{ + int i; + + i=0; + if (T1_PFAB_ptr!=NULL) { + while (T1_PFAB_ptr[i]!=NULL) { + free(T1_PFAB_ptr[i]); + T1_PFAB_ptr[i]=NULL; + } + free( T1_PFAB_ptr); + } + i=0; + if (T1_AFM_ptr!=NULL) { + while (T1_AFM_ptr[i]!=NULL) { + free(T1_AFM_ptr[i]); + T1_AFM_ptr[i]=NULL; + } + free( T1_AFM_ptr); + } + i=0; + if (T1_ENC_ptr!=NULL) { + while (T1_ENC_ptr[i]!=NULL) { + free(T1_ENC_ptr[i]); + T1_ENC_ptr[i]=NULL; + } + free( T1_ENC_ptr); + } + i=0; + if (T1_FDB_ptr!=NULL) { + while (T1_FDB_ptr[i]!=NULL) { + free(T1_FDB_ptr[i]); + T1_FDB_ptr[i]=NULL; + } + free( T1_FDB_ptr); + } + /* indicate t1lib non-initialized */ + pfab_no=-1; + afm_no=-1; + enc_no=-1; + fdb_no=-1; + + return; +} + + +/* ScanConfigFile(): Read a configuration file and scan and save the + environment strings used for searching pfa/pfb-, afm- and encoding + files as well as the name of the font database file. */ +int intT1_ScanConfigFile( void) +{ + + char *env_str; + char *linebuf; + char *usershome; + char *cnffilepath; + char *globalcnffilepath; + static int linecnt; + char local_path_sep_char; + int quoted=0; + int quotecnt=0; + FILE *cfg_fp; + int filesize, i, j, k; + int ignoreline=0; + + char*** destP=NULL; + int *idestP=NULL; + char* curr_key=NULL; + + /* First, get the string stored in the environment variable: */ + env_str=getenv(ENV_CONF_STRING); + linecnt=1; + + if (env_str==NULL) { + /* environment variable not set, try to open default file + in user's home directory and afterwards global config file */ + if ((usershome=getenv("HOME"))!=NULL) { + cnffilepath=(char *)malloc((strlen(usershome) + + strlen(T1_CONFIGFILENAME) + 2 + ) * sizeof(char)); + if (cnffilepath==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + strcpy( cnffilepath, usershome); + } + else { + cnffilepath=(char *)malloc((strlen(T1_CONFIGFILENAME) + 2 + ) * sizeof(char)); + } + strcat( cnffilepath, DIRECTORY_SEP); + strcat( cnffilepath, T1_CONFIGFILENAME); + + globalcnffilepath=(char*)malloc((strlen(GLOBAL_CONFIG_DIR) + + strlen(GLOBAL_CONFIG_FILE) + 2 + ) * sizeof(char)); + if (globalcnffilepath==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + strcpy( globalcnffilepath, GLOBAL_CONFIG_DIR); + strcat( globalcnffilepath, DIRECTORY_SEP); + strcat( globalcnffilepath, GLOBAL_CONFIG_FILE); + + if ((cfg_fp=fopen( cnffilepath, "r"))==NULL){ + sprintf( err_warn_msg_buf, "Could not open configfile %s", + cnffilepath); + T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_STATISTIC); + /* Try global config file */ + if ((cfg_fp=fopen( globalcnffilepath, "r"))==NULL){ + sprintf( err_warn_msg_buf, "Could not open global configfile %s", + globalcnffilepath); + T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_WARNING); + } + else{ + sprintf( err_warn_msg_buf, "Using %s as Configfile (global)", + cnffilepath); + T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_STATISTIC); + } + } + else{ + sprintf( err_warn_msg_buf, "Using %s as Configfile (user's)", + cnffilepath); + T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_STATISTIC); + } + free( cnffilepath); + free( globalcnffilepath); + if (cfg_fp==NULL){ + T1_PrintLog( "ScanConfigFile()", + "Neither user's nor global Configfile has been found", + T1LOG_WARNING); + return(0); + } + } + else { + /* open specified file for reading the configuration */ + if ((cfg_fp=fopen(env_str,"r"))==NULL){ + T1_PrintLog( "ScanConfigFile()", + "Configfile as specified by Environment has not been found", + T1LOG_WARNING); + return(0); /* specified file could not be openend + => no config paths read */ + } + else { + sprintf( err_warn_msg_buf, "Using %s as Configfile (environment)", + env_str); + T1_PrintLog( "ScanConfigFile()", err_warn_msg_buf, T1LOG_STATISTIC); + } + } + + + /* cfg_fp points now to a valid config file */ + /* Get the file size */ + fseek( cfg_fp, 0, SEEK_END); + filesize=ftell(cfg_fp); + /* Reset fileposition to start */ + fseek( cfg_fp, 0, SEEK_SET); + + if ((linebuf=(char *)calloc( filesize+1, + sizeof(char)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + + fread((char *)linebuf, sizeof(char), filesize, cfg_fp); + fclose(cfg_fp); + + i=0; + + /* this might be overwritten on a per file basis */ + local_path_sep_char=path_sep_char; + + while(i end of path specification */ + else + quotecnt++; + } /* some other char */ + if (linebuf[i]=='\n') { /* a newline in a quoted string? Perhabs, quotes do not match! */ + T1_PrintLog( "ScanConfigFile()", + "Newline in quoted %s-string in line %d, column %d, of config file! Closing quote missing?", + T1LOG_WARNING, curr_key, linecnt, i-j+1); + j=i+1; /* resynchronize linecount */ + linecnt++; + } + if (i1) && (FileName[0]=='.') && + (FileName[1]==DIRECTORY_SEP_CHAR)) + || + ((fnamelen>2) && (FileName[0]=='.') && + (FileName[1]=='.') && (FileName[2]==DIRECTORY_SEP_CHAR)) +#if defined(MSDOS) | defined(_WIN32) | defined (__EMX__) + || + ((isalpha(FileName[0])) && (FileName[1]==':')) +#endif +#ifdef VMS + || (strchr(FileName,':') != NULL) +#endif + ) + { + /* Check for existence of the path: */ + if (!stat( FileName, &filestats)) { + if (t1lib_log_file!=NULL) { + sprintf( err_warn_msg_buf, "stat()'ing complete path %s successful", + FileName); + T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, + T1LOG_DEBUG); + } + /* Return a copy of the string */ + if ((FullPathName=(char *)malloc( fnamelen + 1))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + strcpy( FullPathName, FileName); + return(FullPathName); + } + if (t1lib_log_file!=NULL){ + sprintf( err_warn_msg_buf, "stat()'ing complete path %s failed", + FileName); + T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, + T1LOG_DEBUG); + } + /* Trying to locate absolute path spec. failed. We try to recover + by removing the path component and searching in the remaining search + path entries. This depends on the OS. */ + i=fnamelen-1; + StrippedName=&(FileName[i]); + while ( FileName[i]!=DIRECTORY_SEP_CHAR +#if defined(VMS) + /* What exactly to do for VMS? */ +#elif defined(MSDOS) | defined(_WIN32) | defined (__EMX__) | defined(_MSC_VER) + /* We take a drive specification into account. This means we + step back until the directory separator or a drive specifier + appears! */ + && FileName[i]!=':' +#endif + ) { + i--; + } + i++; + StrippedName=&FileName[i]; + if (t1lib_log_file!=NULL){ + sprintf( err_warn_msg_buf, "path %s stripped to %s", + FileName, StrippedName); + T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, + T1LOG_DEBUG); + } + } + else{ /* We have a relative path name */ + StrippedName=&FileName[0]; + } + + i=0; + while (env_ptr[i]!=NULL) { + /* Copy current path element: */ + strcpy( pathbuf, env_ptr[i]); + /* cut a trailing directory separator */ + j=strlen(pathbuf); + if (pathbuf[j-1]==DIRECTORY_SEP_CHAR) + pathbuf[j--]='\0'; + /* Add the directory separator: */ +#ifdef VMS + { char *p= strrchr(pathbuf, DIRECTORY_SEP_CHAR); + if (p && *(p+1) == '\0') + *p = '\0'; + } +#endif + strcat( pathbuf, DIRECTORY_SEP); + /* And finally the filename: */ + strcat( pathbuf, StrippedName); + + /* Check for existence of the path: */ + if (!stat( pathbuf, &filestats)) { + if ((FullPathName=(char*)malloc( (j+fnamelen+2)*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + strcpy( FullPathName, pathbuf); + if (t1lib_log_file!=NULL){ + sprintf( err_warn_msg_buf, "stat()'ing %s successful", + FullPathName); + T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, + T1LOG_DEBUG); + } + return(FullPathName); + } + if (t1lib_log_file!=NULL){ + sprintf( err_warn_msg_buf, "stat()'ing %s failed", + pathbuf); + T1_PrintLog( "intT1_Env_GetCompletePath()", err_warn_msg_buf, + T1LOG_DEBUG); + } + /* We didn't find the file --> try next path entry */ + i++; + } + /* If we get here, no file was found at all, so return a NULL-pointer */ + return(NULL); +} + + + +/* T1_SetFileSearchPath(): Set the search path to find files of the + specified type and return 0 if successful and -1 otherwise. An existing + path is overwritten rigorously, unless the database already contains fonts. + In the latter case the function returns with an error status. + Multiple path types may be specified as a bitmask! +*/ +int T1_SetFileSearchPath( int type, char *pathname) +{ + + int i; + int pathlen; + + + if (pathname==NULL){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + } + + /* We do not allow to change the searchpath if the database already + contains one or more entries. */ + if (T1_Get_no_fonts()>0){ + sprintf( err_warn_msg_buf, "Path %s not set, database is not empty", + pathname); + T1_PrintLog( "T1_SetFileSearchPath()", err_warn_msg_buf, + T1LOG_STATISTIC); + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + pathlen=strlen(pathname)+1; + /* Throw away a possibly existing path */ + if (type & T1_PFAB_PATH){ + if (pfab_no==-1) { + T1_PFAB_ptr=NULL; /* realloc() will do a malloc() */ + } + else { + /* throw away current paths */ + i=0; + while (T1_PFAB_ptr[i]!=NULL) { + free (T1_PFAB_ptr[i++]); + } + } + if ((T1_PFAB_ptr=(char**)realloc( T1_PFAB_ptr, 2*sizeof(char*)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + if ((T1_PFAB_ptr[0]=(char*)malloc(pathlen*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + strcpy( T1_PFAB_ptr[0], pathname); + T1_PFAB_ptr[1]=NULL; + pfab_no=1; + } + if (type & T1_AFM_PATH){ + if (afm_no==-1) { + T1_AFM_ptr=NULL; /* realloc() will do a malloc() */ + } + else { + /* throw away current paths */ + i=0; + while (T1_AFM_ptr[i]!=NULL) { + free (T1_AFM_ptr[i++]); + } + } + if ((T1_AFM_ptr=(char**)realloc( T1_AFM_ptr, 2*sizeof(char*)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + if ((T1_AFM_ptr[0]=(char*)malloc(pathlen*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + strcpy( T1_AFM_ptr[0], pathname); + T1_AFM_ptr[1]=NULL; + afm_no=1; + } + if (type & T1_ENC_PATH){ + if (enc_no==-1) { + T1_ENC_ptr=NULL; /* realloc() will do a malloc() */ + } + else { + /* throw away current paths */ + i=0; + while (T1_ENC_ptr[i]!=NULL) { + free (T1_ENC_ptr[i++]); + } + } + if ((T1_ENC_ptr=(char**)realloc( T1_ENC_ptr, 2*sizeof(char*)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + if ((T1_ENC_ptr[0]=(char*)malloc(pathlen*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + strcpy( T1_ENC_ptr[0], pathname); + T1_ENC_ptr[1]=NULL; + enc_no=1; + } + + return(0); + +} + + + +/* T1_GetFileSearchPath(): Return the specified file search path + or NULL if an error occurred. Note: We do only one path at a + time, so that if a bitmask is specified, the first match wins. + The returned path is formatted using the actual PATH_SEP_CHAR. */ +char *T1_GetFileSearchPath( int type) +{ + static char *out_ptr; + int i; + int pathlen; + char **src_ptr=NULL; + + + if (out_ptr!=NULL) + free( out_ptr); + out_ptr=NULL; + + if (type & T1_PFAB_PATH) { + src_ptr=T1_PFAB_ptr; + } + else if (type & T1_AFM_PATH) { + src_ptr=T1_AFM_ptr; + } + else if (type & T1_ENC_PATH) { + src_ptr=T1_ENC_ptr; + } + else if (type & T1_FDB_PATH) { + src_ptr=T1_FDB_ptr; + } + + + i=0; + pathlen=0; + while (src_ptr[i]!=NULL) { + pathlen +=strlen( src_ptr[i++]); + pathlen+=1; /* path separator */ + } + if ((out_ptr=(char *)malloc(pathlen+1))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + strcpy( out_ptr, src_ptr[0]); + i=1; + while (src_ptr[i]!=NULL) { + strcat( out_ptr, path_sep_string); + strcat( out_ptr, src_ptr[i++]); + } + + return( out_ptr); + +} + + +/* T1_AddToFileSearchPath(): Add the specified path element to + the specified search path. If the existing path is the default path, + it will not be replaced by the new path element. Since this function might + be called before initialization, we have to be aware that even the default + path could be missing. Multiple path types may be specified as a bitmask! + Return value is 0 if successful and -1 otherwise */ +int T1_AddToFileSearchPath( int pathtype, int mode, char *pathname) +{ + int i; + int pathlen; + char* newpath; + int nofonts; + + + + if (pathname==NULL) + return(-1); + + nofonts=T1_Get_no_fonts(); + + pathlen=strlen(pathname); + + if (pathtype & T1_PFAB_PATH){ + /* Allocate meory for string */ + if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + /* Check for and handle the existing path configuration */ + if (pfab_no==0) { /* do not free the default path but establish it + as a regularly setup path, if database not empty! */ + if (nofonts>0) { + pfab_no++; + } + else { + free( T1_AFM_ptr[0]); + } + } + if (pfab_no==-1) { /* not initialized! */ + pfab_no=0; + T1_PFAB_ptr=NULL; /* realloc() will do the malloc()! */ + } + if ((T1_PFAB_ptr=(char**)realloc( T1_PFAB_ptr, (++pfab_no+1)*sizeof(char*)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + /* Insert the new path element: */ + if (mode & T1_PREPEND_PATH){ /* prepend */ + i=pfab_no-2; + while (i>=0) { + T1_PFAB_ptr[i+1]=T1_PFAB_ptr[i]; + i--; + } + T1_PFAB_ptr[0]=newpath; + } + else{ /* append */ + T1_PFAB_ptr[pfab_no-1]=newpath; + } + T1_PFAB_ptr[pfab_no]=NULL; + } + if (pathtype & T1_AFM_PATH){ + /* Allocate meory for string */ + if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + /* Check for and handle the existing path configuration */ + if (afm_no==0) { /* do not free the default path but establish it + as a regularly setup path, if database not empty! */ + if (nofonts>0) { + afm_no++; + } + else { + free( T1_AFM_ptr[0]); + } + } + if (afm_no==-1) { /* not initialized! */ + afm_no=0; + T1_AFM_ptr=NULL; /* realloc() will do the malloc()! */ + } + if ((T1_AFM_ptr=(char**)realloc( T1_AFM_ptr, (++afm_no+1)*sizeof(char*)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + /* Insert the new path element */ + if (mode & T1_PREPEND_PATH){ /* prepend */ + i=afm_no-2; + while (i>=0) { + T1_AFM_ptr[i+1]=T1_AFM_ptr[i]; + i--; + } + T1_AFM_ptr[0]=newpath; + } + else{ /* append */ + T1_AFM_ptr[afm_no-1]=newpath; + } + T1_AFM_ptr[afm_no]=NULL; + } + if (pathtype & T1_ENC_PATH){ + /* Allocate meory for string */ + if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + /* Check for and handle the existing path configuration */ + if (enc_no==0) { /* do not free the default path but establish it + as a regularly setup path, if database not empty! */ + if (nofonts>0) { + enc_no++; + } + else { + free( T1_ENC_ptr[0]); + } + } + if (enc_no==-1) { /* not initialized! */ + enc_no=0; + T1_ENC_ptr=NULL; /* realloc() will do the malloc()! */ + } + if ((T1_ENC_ptr=(char**)realloc( T1_ENC_ptr, (++enc_no+1)*sizeof(char*)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + /* Insert the new path element: */ + if (mode & T1_PREPEND_PATH){ /* prepend */ + i=enc_no-2; + while (i>=0) { + T1_ENC_ptr[i+1]=T1_ENC_ptr[i]; + i--; + } + T1_ENC_ptr[0]=newpath; + } + else{ /* append */ + T1_ENC_ptr[enc_no-1]=newpath; + } + T1_ENC_ptr[enc_no]=NULL; + } + return(0); + +} + + + +/* T1_SetFontDataBase(): Set a new name for the font database. It replaces the default + name and any names specified previously with this function. + Return value: 0 if OK, and -1 if filename not valid or an allocation + error occurred */ +int T1_SetFontDataBase( char *filename) +{ + int pathlen; + int i; + int result=0; + + + /* chekc filename */ + if (filename==NULL) { + T1_errno=T1ERR_INVALID_PARAMETER; + return -1; + } + + /* this function must be called before any font is in the database, that is, usually, + before initialization! */ + if ( pFontBase!=NULL && pFontBase->no_fonts>0) { + T1_errno=T1ERR_OP_NOT_PERMITTED; + return -1; + } + + + pathlen=strlen(filename)+1; + /* Throw away a possibly existing font database-statement */ + if (fdb_no==-1) { + T1_FDB_ptr=NULL; /* realloc() will do a malloc() */ + } + else { + /* throw away current paths */ + i=0; + while (T1_FDB_ptr[i]!=NULL) { + free (T1_FDB_ptr[i++]); + } + } + + if ((T1_FDB_ptr=(char**)realloc( T1_FDB_ptr, 2*sizeof(char*)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return -1; + } + + if ((T1_FDB_ptr[0]=(char*)malloc(pathlen*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return -1; + } + strcpy( T1_FDB_ptr[0], filename); + T1_FDB_ptr[1]=NULL; + fdb_no=1; + + /* Load database immediately if t1lib already is initailzed */ + if (CheckForInit()==0) { + if ((result=intT1_scanFontDBase(T1_FDB_ptr[0]))==-1) { + T1_PrintLog( "T1_AddFontDataBase()", "Fatal error scanning Font Database File %s (T1_errno=%d)", + T1LOG_WARNING, T1_FDB_ptr[0], T1_errno); + } + if (result>-1) + pFontBase->no_fonts+=result; + result=pFontBase->no_fonts; + } + return result; + +} + + +/* T1_AddFontDataBase(): Add a new font database file to the list. If the + lib is already initialzed, then the new database is immediately loaded. + Otherwise it is simply appended to the list and loaded at the time of + initialization. + Returns: -1 an error occured + 0 successfully inserted but not loaded because lib not initilized + n>0 the highest defined FontID +*/ +int T1_AddFontDataBase( int mode, char *filename) +{ + int i; + int pathlen; + int result=0; + char* newpath; + + + if (filename==NULL) { + T1_errno=T1ERR_INVALID_PARAMETER; + return(-1); + } + + pathlen=strlen(filename); + + /* Allocate memory for string */ + if ((newpath=(char*)malloc( (pathlen+1)*sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + strcpy( newpath, filename); + /* Check for and handle the existing path configuration */ + if (fdb_no==0) { /* defauls setup, free the path */ + free( T1_FDB_ptr[0]); + } + if (fdb_no==-1) { /* not initialized! */ + fdb_no=0; + T1_FDB_ptr=NULL; /* realloc() will do the malloc()! */ + } + + if ((T1_FDB_ptr=(char**)realloc( T1_FDB_ptr, (++fdb_no+1)*sizeof(char*)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + /* Insert the new database. If t1lib is already initialzed, the database can only + be appended. Otherwise. prepending is also possible.*/ + if ((mode & T1_PREPEND_PATH) && (CheckForInit()!=0) ) { /* prepend */ + i=fdb_no-2; + while (i>=0) { + T1_FDB_ptr[i+1]=T1_FDB_ptr[i]; + i--; + } + T1_FDB_ptr[0]=newpath; + result=0; + } + else { /* append */ + T1_FDB_ptr[fdb_no-1]=newpath; + if (CheckForInit()==0) { + if ((result=intT1_scanFontDBase(T1_FDB_ptr[fdb_no-1]))==-1) { + T1_PrintLog( "T1_AddFontDataBase()", "Fatal error scanning Font Database File %s (T1_errno=%d)", + T1LOG_WARNING, T1_FDB_ptr[fdb_no-1], T1_errno); + } + if (result>-1) + pFontBase->no_fonts+=result; + result=pFontBase->no_fonts; + } + } + T1_FDB_ptr[fdb_no]=NULL; + return result; + +} + + diff -Naur xdvik-22.40l/libs/t1lib/t1env.h xdvik-22.40n/libs/t1lib/t1env.h --- xdvik-22.40l/libs/t1lib/t1env.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1env.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,54 @@ +/*-------------------------------------------------------------------------- + ----- File: t1env.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-09-26 + ----- Description: This file is part of the t1-library. It contains + declarations and definitions for t1env.c + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independ from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#ifdef T1ENV_C + +void intT1_FreeSearchPaths( void); +void intT1_SetupDefaultSearchPaths( void); +int intT1_ScanConfigFile( void); +char *intT1_Env_GetCompletePath( char *FileName, char **env_ptr ); +int T1_SetFileSearchPath( int type, char *pathname); +int T1_AddToFileSearchPath( int pathtype, int mode, char *pathname); +char *T1_GetFileSearchPath( int type); +int T1_SetFontDataBase( char *filename); +int T1_AddFontDataBase( int mode, char *filename); + +#else + +extern void intT1_FreeSearchPaths( void); +extern void intT1_SetupDefaultSearchPaths( void); +extern int intT1_ScanConfigFile( void); +extern char *intT1_Env_GetCompletePath( char *FileName, char **env_ptr ); +extern int T1_SetFileSearchPath( int type, char *pathname); +extern int T1_AddToFileSearchPath( int pathtype, int mode, char *pathname); +extern char *T1_GetFileSearchPath( int type); +extern int T1_SetFontDataBase( char *filename); +extern int T1_AddFontDataBase( int mode, char *filename); + +#endif + diff -Naur xdvik-22.40l/libs/t1lib/t1extern.h xdvik-22.40n/libs/t1lib/t1extern.h --- xdvik-22.40l/libs/t1lib/t1extern.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1extern.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,105 @@ +/*-------------------------------------------------------------------------- + ----- File: t1extern.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-10-03 + ----- Description: This file is part of the t1-library. It contains + external declarations used by the t1-library. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#include "t1misc.h" + + +/* Following struct will allow all accesses to font data! */ +extern struct FONTBASE +{ + int t1lib_flags; /* Global library flags */ + int no_fonts_ini; /* The number of fonts initially declared in + Font database file. */ + int no_fonts; /* The number of currently allocated fonts including + logical fonts produced by T1_CopyFont() */ + int no_fonts_limit; /* The maximum number of font for which is memory + currently available. */ + int bitmap_pad; /* The value to which bitmap-scanlines are padded */ + int endian; /* 1 if little endian representation and 0 otherwise */ + char **default_enc; /* The default encoding vector */ + FONTPRIVATE *pFontArray; /* Points to first element of font pointer array */ +} FontBase; +extern struct FONTBASE *pFontBase; + + +/* Further we need a struct where to save device dependent data such as + resolution. The values in this struct may be altered using + T1_SetDeviceRes(x_res,y_res). Generally, the fontsize is to be specified + in BigPoints ("bp")---this is the default PostScript unit. It is + 1in=72bp. + */ +extern struct +{ + float x_resolution; /* Value must be specified in DPI */ + float y_resolution; /* Value must be specified in DPI */ + float scale_x; /* horizontal scale-value to get a + matrix scaled to 1b */ + float scale_y; /* vertical scale-value to get a + matrix scaled to 1b */ +} DeviceSpecifics; + + +extern struct stat filestats; /* A structure where fileinfo is stored */ +extern char linebuf[BUF_SIZE]; /* A buffer for reading files line + by line */ +extern int T1_Up; /* This one is for initialization-checking */ + +/* The width of AA-pixels */ +extern int T1aa_bpp; + +/* The follwoing variable allows the primary rastering functions + to check for the caller */ +extern int SetFuncRequestID; + +/* The following variable allows to suppress rastering at 1000 bp + for getting a correct bounding box for slanted characters --> + should only internally be used */ +extern int ForceAFMBBox; + +extern struct XYspace *IDENTITY; + +extern int errornumber; /* for debugging purposes */ + +extern char **T1_PFAB_ptr; +extern char **T1_AFM_ptr; +extern char **T1_ENC_ptr; +extern char **T1_FDB_ptr; + +/* We use a uchar buffer for error and warning messages: */ +extern char err_warn_msg_buf[1024]; + +/* file pointer for log-file */ +extern FILE *t1lib_log_file; +extern int t1lib_log_level; + +/* The errno for t1lib */ +extern int T1_errno; + +/* A variable for saving stack info */ +extern jmp_buf stck_state; + diff -Naur xdvik-22.40l/libs/t1lib/t1finfo.c xdvik-22.40n/libs/t1lib/t1finfo.c --- xdvik-22.40l/libs/t1lib/t1finfo.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1finfo.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1341 @@ +/*-------------------------------------------------------------------------- + ----- File: t1finfo.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-06-10 + ----- Description: This file is part of the t1-library. It contains + functions for accessing afm-data and some other + fontinformation data. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1FINFO_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" + + +#include "t1types.h" +#include "t1extern.h" +#include "t1finfo.h" +#include "t1base.h" +#include "t1misc.h" +#include "t1set.h" +#include "t1load.h" + + +/* The following variable controls the computation of the bbox internal + to T1_GetMetricsInfo(). Its influence may be overridden by the + global variable ForceAFMBBox: */ +static int ForceAFMBBoxInternal=0; + + +extern int ForceAFMBBox; +extern char *t1_get_abort_message( int number); + + +/* int T1_GetKerning(): This function returns the amount of kerning that + is specified in the afm-file for the supplied character-pair. If an + an extension has been applied to the font in question, this is taken + into account. + If for whatever reason there's no afm information available (that's not + deadly), simply 0 is returned, indicating that no kerning should be used. + The value returned is meant to be in character space coordinates. Thus, + it must be transformed to be applicable in device space. + */ +int T1_GetKerning( int FontID, char char1, char char2) +{ + METRICS_ENTRY entry; + METRICS_ENTRY *target_pair=NULL; + + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0); + } + + /* If no AFM info is present, we return an error */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( 0); + } + + /* if there's no kerning info, return immediately */ + if (pFontBase->pFontArray[FontID].KernMapSize==0) + return( 0); + + entry.chars=(char1<<8) | char2; + if ((target_pair=(METRICS_ENTRY *) + bsearch( &entry, pFontBase->pFontArray[FontID].pKernMap, + (size_t) pFontBase->pFontArray[FontID].KernMapSize, + sizeof(METRICS_ENTRY), + &cmp_METRICS_ENTRY))==NULL) + return(0); + else + return( target_pair->hkern * pFontBase->pFontArray[FontID].extend); + +} + + + +/* int T1_GetCharWidth(): This function returns the characterwidth + specified in the .afm-file. If no .afm-file is loaded for that font, + 0 is returned. Note that if one tries to raster strings, afm data + must always be available. The returned character width is corrected + using a possibly applied font extension! + */ +int T1_GetCharWidth( int FontID, char char1) +{ + unsigned char uchar1; + + uchar1=(unsigned char) char1; + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0); + } + + /* If no AFM info is present, we return an error */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( 0); + } + + /* return appriate value */ + if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]>0) { /* ordinary character */ + return((int) ((pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]-1].wx) * pFontBase->pFontArray[FontID].extend)); + } + else if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]<0) { /* composite character */ + return((int) ((pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1)].wx) * pFontBase->pFontArray[FontID].extend)); + } + else { /* undefined or .notdef */ + return(0); + } + +} + + + +/* T1_GetCharBBox(): Get the BoundingBox of specified character. If an + extension factor has been applied to the font in question, this + is taken into account. However, a slant factor which has been applied + to the font, also affects the bounding box of a character. The + only way to determine its influence on the character bounding box + is to compute the exact shape of that slanted character. There's no + simple way to extract the new bounding box from the former bounding + box. Thus, if a font has been slanted, the characters outline itself + is examined. Since this must be done at 1000 bp it takes considerably + longer than reading afm data. */ +BBox T1_GetCharBBox( int FontID, char char1) +{ + + struct region *area; + struct XYspace *S; + int mode=0; + int i; + + BBox NullBBox= { 0, 0, 0, 0}; /* A bounding box containing all 0's. */ + BBox ResultBox= { 0, 0, 0, 0}; /* The Box returned if char is found */ + + unsigned char uchar1; + + + /* We return to this if something goes wrong deep in the rasterizer */ + if ((i=setjmp( stck_state))!=0) { + T1_errno=T1ERR_TYPE1_ABORT; + sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", + t1_get_abort_message( i)); + T1_PrintLog( "T1_GetCharBBox()", err_warn_msg_buf, + T1LOG_ERROR); + return( NullBBox); + } + + + uchar1=(unsigned char) char1; + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NullBBox); + } + + /* If no AFM info is present, we return an error */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( NullBBox); + } + + + /* Check for a font slant */ + if ((pFontBase->pFontArray[FontID].slant!=0.0) + &&(ForceAFMBBox==0) + &&(ForceAFMBBoxInternal==0)){ + /* We have a font slant -> character outline must be examined in order + to determine bounding box */ + /* Set up an identity charspace matrix + and take a slant and an extension into account */ + /* And make it permanent, to plug a memory leak */ + S=(struct XYspace *)IDENTITY; + S=(struct XYspace *)Permanent + (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0], + pFontBase->pFontArray[FontID].FontTransform[1], + pFontBase->pFontArray[FontID].FontTransform[2], + pFontBase->pFontArray[FontID].FontTransform[3])); + /* Genrate an edgelist for the current character at size 1000bp + using current transformation and encoding: */ + area=fontfcnB( FontID, 0, S, + pFontBase->pFontArray[FontID].pFontEnc, + (int) uchar1, &mode, + pFontBase->pFontArray[FontID].pType1Data, + DO_RASTER); + /* Read out bounding box */ + ResultBox.llx =area->xmin; + ResultBox.urx =area->xmax; + ResultBox.lly =area->ymin; + ResultBox.ury =area->ymax; + + /* Reset AFM-switch and return BBox */ + ForceAFMBBoxInternal=0; + /* make sure to destroy 'area' before leaving! */ + KillRegion (area); + /* make sure to free S */ + if (S) { + KillSpace (S); + } + return(ResultBox); + } + else{ + /* Assign bounding box for the different cases: */ + /* Check if character is */ + if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]>0) { /* ordinary char */ + ResultBox=(pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]-1].charBBox); + } + else if (pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]<0) { /* composite char */ + ResultBox=(pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1)].charBBox); + } + else { /* undefined char */ + return(NullBBox); + } + + /* .. and apply transformations: */ + ResultBox.llx *=pFontBase->pFontArray[FontID].extend; + ResultBox.urx *=pFontBase->pFontArray[FontID].extend; + + return(ResultBox); + } +} + + + +/* int T1_GetUnderlinePosition(): Return underline position of specified + font in charspace units. If 0 is returned, it indicated that the font + is not yet loaded into memory. or an invalid ID has been specified. */ +float T1_GetUnderlinePosition( int FontID) +{ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0.0); + } + + return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINEPOSITION].value.data.real)); +} + + + +/* int T1_GetUnderlineThickness(): Return underline thickness of specified + font in charspace units. If 0 is returned, it indicated that the font + is not yet loaded into memory. or an invalid ID has been specified. */ +float T1_GetUnderlineThickness( int FontID) +{ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0.0); + } + + return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINETHICKNESS].value.data.real)); +} + + +/* int T1_ItalicAngle(): Return underline position of specified + font in charspace units. If 0.0 is returned, it indicated that the font + is not yet loaded into memory. or an invalid ID has been specified. */ +float T1_GetItalicAngle( int FontID) +{ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0.0); + } + + return((float)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ITALICANGLE].value.data.real)); +} + + + +/* int T1_GetUnderlinePosition(): Return underline position of specified + font in charspace units. If 0 is returned, it indicated that the font + is not yet loaded into memory. or an invalid ID has been specified. */ +int T1_GetIsFixedPitch( int FontID) +{ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0.0); + } + + return((int)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ISFIXEDPITCH].value.data.boolean)); +} + + + +/* char *T1_GetFontName( FontID): Get the PostScript FontName of + the font dictionary associated with the specified font, or NULL if + an error occurs. */ +char *T1_GetFontName( int FontID) +{ + static char fontname[MAXPSNAMELEN]; + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + strncpy(fontname, + (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.data.nameP), + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.len); + fontname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTNAME].value.len]=0; + + return(fontname); + +} + + +/* char *T1_GetFullName( FontID): Get the Full Name from + the font dictionary associated with the specified font, or NULL if + an error occurs. */ +char *T1_GetFullName( int FontID) +{ + static char fullname[MAXPSNAMELEN]; + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + strncpy(fullname, + (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.data.nameP), + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.len); + fullname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FULLNAME].value.len]=0; + + return(fullname); + +} + + +/* char *T1_GetFamilyName( FontID): Get the Family Name of + the font dictionary associated with the specified font, or NULL if + an error occurs. */ +char *T1_GetFamilyName( int FontID) +{ + static char familyname[MAXPSNAMELEN]; + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + strncpy(familyname, + (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.data.nameP), + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.len); + familyname[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FAMILYNAME].value.len]=0; + + return(familyname); + +} + + +/* char *T1_GetWeight( FontID): Get the Weight entry from + the font dictionary associated with the specified font, or NULL if + an error occurs. */ +char *T1_GetWeight( int FontID) +{ + static char weight[128]; + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + strncpy(weight, + (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.data.nameP), + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.len); + weight[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[WEIGHT].value.len]=0; + + return(weight); + +} + + +/* char *T1_GetFontName( FontID): Get the Version entry from + the font dictionary associated with the specified font, or NULL if + an error occurs. */ +char *T1_GetVersion( int FontID) +{ + static char version[2048]; + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + strncpy(version, + (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.data.nameP), + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.len); + version[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[VERSION].value.len]=0; + + return(version); + +} + + +/* char *T1_GetNotice( FontID): Get the Notice entry from + the font dictionary associated with the specified font, or NULL if + an error occurs. */ +char *T1_GetNotice( int FontID) +{ + static char notice[2048]; + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + strncpy(notice, + (char *)(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.data.nameP), + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.len); + notice[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[NOTICE].value.len]=0; + + return(notice); + +} + + + + +/* char *T1_GetCharName(): Get the PostScript character name of + the character indexed by char1. */ +char *T1_GetCharName( int FontID, char char1) +{ + static char cc_name1[256]; + char *c1; + + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + if (pFontBase->pFontArray[FontID].pFontEnc==NULL){ + /* We have to get the names from the fonts internal encoding */ + c1= (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP; + strncpy(cc_name1, + (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP, + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len); + cc_name1[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len]=0; + } + else{ + /* Take names from explicitly loaded and assigned encoding */ + c1=pFontBase->pFontArray[FontID].pFontEnc[(unsigned char)char1]; + strcpy(cc_name1,c1); + } + + /* Return address of charname */ + return(cc_name1); + +} + + + +/* T1_QueryLigs(): Get the number of ligatures defined in the font FontID for + the character which is located at position char1 in the current encoding + vector! + Function returns the number of defined ligs (including 0) or -1 if an + error occured. + */ +int T1_QueryLigs( int FontID, char char1, char **successors, + char **ligatures) +{ + + FontInfo *afm_ptr; + CharMetricInfo *m_ptr; + char *c_name; + char cc_name[128]; + static char succ[MAX_LIGS]; + int succ_index; + static char lig[MAX_LIGS]; + int lig_index; + + Ligature *ligs; + int i,j; + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + /* If no AFM info is present, we return an error */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( -1); + } + + /* All OK, ... */ + afm_ptr=pFontBase->pFontArray[FontID].pAFMData; + m_ptr=afm_ptr->cmi; + + /* Get the name of the character: */ + if (pFontBase->pFontArray[FontID].pFontEnc==NULL){ + /* We have to get the name from the fonts internal encoding */ + c_name=(char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP; + strncpy(cc_name, + (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].data.arrayP, + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len); + cc_name[pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[(unsigned char)char1].len]=0; + } + else{ + /* Take name from explicitly loaded and assigned encoding */ + c_name=pFontBase->pFontArray[FontID].pFontEnc[(unsigned char)char1]; + strcpy(cc_name,c_name); + } + + for (i=0; inumOfChars; i++){ + if (strcmp(m_ptr[i].name,cc_name)==0) + break; + } + + + if (i==afm_ptr->numOfChars) /* we didn't find the characters name */ + return(-1); + + ligs=m_ptr[i].ligs; + + j=0; + if (ligs==NULL) + return(0); + + while (ligs!=NULL) { + /* Get indices of the two characters: */ + if ((succ_index=T1_GetEncodingIndex( FontID, (char*) ligs->succ))==-1) { + /* successor is not current encoding */ + ligs=ligs->next; + continue; + } + if ((lig_index=T1_GetEncodingIndex( FontID, (char*) ligs->lig))==-1) { + /* Specified ligature is not in current encoding */ + ligs=ligs->next; + continue; + } + succ[j]=(char)succ_index; + lig[j]=(char)lig_index; + j++; + ligs=ligs->next; + } + + *successors=succ; + *ligatures=lig; + + return(j); +} + + + +/* T1_GetEncodingIndex(): Return the Index of char1 in the current + encoding vector of font FontID */ +int T1_GetEncodingIndex( int FontID, char *char1) +{ + int i; + int len1; + int result_index; + char **extern_enc; + psobj *objptr; + + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + extern_enc=pFontBase->pFontArray[FontID].pFontEnc; + + len1=strlen( char1); + + /* The default return-value if character is not found: */ + result_index=-1; + + if (extern_enc==NULL) { + objptr=&(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[0]); + /* We have to search the fonts internal encoding */ + for (i=0;i<256;i++){ + if (len1==objptr[i].len){ + if (strncmp((char *)objptr[i].data.arrayP, + char1, objptr[i].len)==0){ + result_index=i; + break; + } + } + } + + } + else { + /* Take name from explicitly loaded and assigned encoding */ + for (i=0;i<256;i++){ + if (strcmp(extern_enc[i], char1)==0){ + result_index=i; + break; + } + } + } + + return(result_index); +} + + +/* T1_GetEncodingIndices(): Return all indices of char1 in the current + encoding vector of font FontID. */ +int *T1_GetEncodingIndices( int FontID, char *char1) +{ + int i; + int endmark=0; + int len1; + char **extern_enc; + psobj *objptr; + /* the following array suffices for the extreme unlikely case of a font + where one single fillsthe whole encoding vector */ + static int indices[257]; + + + if (CheckForFontID(FontID)!=1) { + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + extern_enc=pFontBase->pFontArray[FontID].pFontEnc; + + len1=strlen( char1); + + if (extern_enc==NULL) { + objptr=&(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[0]); + /* We have to search the fonts internal encoding */ + for (i=0;i<256;i++){ + if (len1==objptr[i].len){ + if (strncmp((char *)objptr[i].data.arrayP, + char1, objptr[i].len)==0){ + indices[endmark++]=i; + } + } + } + } + else { + /* Take name from explicitly loaded and assigned encoding */ + for (i=0;i<256;i++){ + if (strcmp(extern_enc[i], char1)==0){ + indices[endmark++]=i; + } + } + } + + indices[endmark]=-1; + return((int *)indices); +} + + +/* int T1_GetStringWidth(): This function returns the width of string + in .afm-file units. If no .afm-file is loaded for font FontID, + 0 is returned. Note that if one tries to raster strings, afm data + should always be available. The returned character width is corrected + using a possibly applied font extension! + */ +int T1_GetStringWidth( int FontID, char *string, + int len, long spaceoff, int kerning) +{ + + int no_chars; /* Number of chars in string */ + int i; + int *kern_pairs; + int *charwidths; + int spacewidth; + int stringwidth; + + unsigned char *ustring; + + ustring=(unsigned char *) string; + + /* First, check for a correct ID */ + i=CheckForFontID(FontID); + if (i!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0); + } + + /* If no AFM info is present, we return an error */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( 0); + } + + /* Get length of string: */ + if (len<0 || ustring == NULL){ /* invalid length or NULL-pointer */ + T1_errno=T1ERR_INVALID_PARAMETER; + return(0); + } + if (len==0) /* should be computed assuming "normal" 0-terminated string */ + no_chars=strlen(string); + else /* use value given on command line */ + no_chars=len; + + /* Allocate room for temporary arrays of kerning and width arrays: */ + kern_pairs=(int *)calloc(no_chars -1, sizeof(int)); + if (kern_pairs==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(0); + } + charwidths=(int *)calloc(no_chars, sizeof(int)); + if (charwidths==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(0); + } + + /* If kerning is requested, get kerning amounts and fill the array: */ + if (kerning){ + for (i=0; ipFontArray[FontID].space_position)+spaceoff; + + /* Fill the width-array: */ + for (i=0; ipFontArray[FontID].space_position) + charwidths[i]=(int)spacewidth; + else + charwidths[i]=T1_GetCharWidth(FontID,ustring[i]); + } + + /* Accumulate width: */ + stringwidth=0; + for (i=0; ipFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( NullBBox); + } + + /* Get length of string: */ + if (len<0 || string==NULL) { /* invalid length or NULL-pointer */ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NullBBox); + } + if (len==0) /* should be computed assuming "normal" 0-terminated string */ + no_chars=strlen(string); + else /* use value given on command line */ + no_chars=len; + + spacewidth= + T1_GetCharWidth(FontID,pFontBase->pFontArray[FontID].space_position)+spaceoff; + + /* Accumulate metrics: */ + for (i=0; ipFontArray[FontID].space_position) + curr_width +=spacewidth; + else{ + tmp_BBox=T1_GetCharBBox( FontID, string[i]); + if (curr_width+tmp_BBox.llx < lsb_min) + lsb_min=curr_width+tmp_BBox.llx; + if (curr_width+tmp_BBox.urx > rsb_max) + rsb_max=curr_width+tmp_BBox.urx; + if (tmp_BBox.lly < overalldescent) + overalldescent=tmp_BBox.lly; + if (tmp_BBox.ury > overallascent) + overallascent=tmp_BBox.ury; + curr_width +=T1_GetCharWidth( FontID, string[i]); + if ((ipFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( metrics); + } + + /* Get length of string: */ + if (len<0 || ustring==NULL ) { /* invalid length or NULL_pointer */ + T1_errno=T1ERR_INVALID_PARAMETER; + return(metrics); + } + + if (len==0) /* should be computed assuming "normal" 0-terminated string */ + no_chars=strlen(string); + else /* use value given on command line */ + no_chars=len; + + /* Compute the correct spacewidth value (in charspace units): */ + spacewidth=T1_GetCharWidth(FontID,pFontBase->pFontArray[FontID].space_position)+spaceoff; + + /* Allocate memory for character positions array: */ + metrics.charpos=(int *)calloc(no_chars, sizeof(int)); + + metrics.numchars=no_chars; + + /* Accumulate metrics: */ + for (i=0; ipFontArray[FontID].space_position) + curr_width +=spacewidth; + else{ + tmp_BBox=T1_GetCharBBox( FontID, string[i]); + if (curr_width+tmp_BBox.llx < lsb_min) + lsb_min=curr_width+tmp_BBox.llx; + if (curr_width+tmp_BBox.urx > rsb_max) + rsb_max=curr_width+tmp_BBox.urx; + if (tmp_BBox.lly < overalldescent) + overalldescent=tmp_BBox.lly; + if (tmp_BBox.ury > overallascent) + overallascent=tmp_BBox.ury; + curr_width +=T1_GetCharWidth( FontID, string[i]); + if ((ipFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[0]); + outbox.llx = + objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ? + (int) ceil(obj->data.real) : (int) floor(obj->data.real); + obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[1]); + outbox.lly = + objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ? + (int) ceil(obj->data.real) : (int) floor(obj->data.real); + obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[2]); + outbox.urx = + objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ? + (int) ceil(obj->data.real) : (int) floor(obj->data.real); + obj = &(pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTBBOX].value.data.arrayP[3]); + outbox.ury = + objPIsInteger(obj) ? obj->data.integer : obj->data.real > 0 ? + (int) ceil(obj->data.real) : (int) floor(obj->data.real); + + return( outbox); +} + + + +/* T1_GetAllCharNames(): Get a list of all defined character names in + in the font FontID: */ +char **T1_GetAllCharNames( int FontID) +{ + static char **bufmem=NULL; + register char *namedest; + psdict *pCharStrings; + int len, i, j; + long nameoffset; + + int bufmemsize=0; + + /* return NULL if font not loaded */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return( NULL); + } + + pCharStrings=pFontBase->pFontArray[FontID].pType1Data->CharStringsP; + + /* First, get number of charstrings: */ + len=pCharStrings[0].key.len; + + /* We must be careful here: size of the charstrings dict might be larger + than the actual number of charstrings. We correct for this by reducing + the value of len appropriately */ + for ( i=1; i<=len; i++){ + /* calculate room for each characters name plus the prepending \0 */ + if ((j=pCharStrings[i].key.len)){ + bufmemsize += j + 1; + } + else{ /* we skip this (the remaining) entries */ + len--; + i--; + } + } + /* Now we reserve memory for the pointers (including final NULL) */ + nameoffset=(len+1)*sizeof( char *); + bufmemsize += nameoffset; + + /* Now allocate memory, copy strings and initialize pointers */ + if (bufmem!=NULL) + free(bufmem); + if ((bufmem=(char **)malloc( bufmemsize))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + namedest=(char *)((long)bufmem + nameoffset); + j=0; + for ( i=0; ipFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( -1); + } + + return( pFontBase->pFontArray[FontID].pAFMData->numOfPairs); + +} + + + +/* A function for comparing METRICS_ENTRY structs */ +static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2) +{ + if (((METRICS_ENTRY *)entry1)->chars < + ((METRICS_ENTRY *)entry2)->chars) + return(-1); + if (((METRICS_ENTRY *)entry1)->chars > + ((METRICS_ENTRY *)entry2)->chars) + return(1); + return(0); /* This should not happen */ +} + + + +/* A few functions for accessing composite character data: */ +/* T1_GetNoCompositeChars(): Return the number of characters for + for which composite character information is available + for font FontID */ +int T1_GetNoCompositeChars( int FontID) +{ + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return( -1); + } + + /* If no AFM info is present, we return an error */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( -1); + } + + return( pFontBase->pFontArray[FontID].pAFMData->numOfComps); + +} + + + +/* T1_QueryCompositeChar(): Query whether char1 from font FontID + is a composite character. If so, the index of the composite + character data within the afm array is returned. The index can + be used to retrieve the retrieve the composite character data. + + retval>=0: index into AFM-array where the corresponding + composite char data is located + retval=-1: No composite character, but result is valid, + retval=-2: No composite character, but result is invalid. + T1_errno indicated the reason. +*/ +int T1_QueryCompositeChar( int FontID, char char1) +{ + unsigned char uchar1; + + uchar1=char1; + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return( -2); + } + + /* If no AFM info is present, we return -2 */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( -2); + } + + if (pFontBase->pFontArray[FontID].pEncMap[ uchar1]<0) { /* composite char */ + return( -(pFontBase->pFontArray[FontID].pEncMap[(int) uchar1]+1)); + } + + return(-1); + +} + + + +/* T1_GetCompCharData(): Retrieve data to construct composite + character char1 from font FontID. In case of an error NULL is returned + and T1_errno is set appropriately. */ +T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1) +{ + T1_COMP_CHAR_INFO *cci=NULL; + CompCharData *ccd=NULL; + int afmind=-1; + int i; + unsigned char uchar1; + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return( cci); + } + + /* If no AFM info is present, we return -2 */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( cci); + } + + if ((cci=(T1_COMP_CHAR_INFO*)malloc( sizeof(T1_COMP_CHAR_INFO)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return( cci); + } + + uchar1=(unsigned char)char1; + + /* set default values */ + cci->compchar=uchar1; + cci->numPieces=1; + cci->pieces=NULL; + + /* check char1 */ + if ((afmind=pFontBase->pFontArray[FontID].pEncMap[uchar1]) >= 0) { + /* char is no composite char */ + return(cci); + } + + /* character is a composite char-> retrieve index and pointer into + AFM data */ + afmind=-(afmind+1); + ccd=&(pFontBase->pFontArray[FontID].pAFMData->ccd[afmind]); + + /* cci->compchar is already setup correctly because char1 is a + composite character */ + cci->numPieces=ccd->numOfPieces; + /* we expect numPieces to be >1 */ + if ((cci->pieces=(T1_COMP_PIECE *)malloc( sizeof(T1_COMP_PIECE)* + cci->numPieces))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + free( cci); + return( NULL); + } + /* Copy information */ + for (i=0; inumPieces; i++) { + cci->pieces[i].piece=T1_GetEncodingIndex( FontID, ccd->pieces[i].pccName); + cci->pieces[i].deltax=ccd->pieces[i].deltax; + cci->pieces[i].deltay=ccd->pieces[i].deltay; + } + return( cci); + +} + + + +/* T1_GetCompCharDataByIndex(): Retrieve data to construct composite + characters form font FontID. The data is addressed by index which + may, for example, have been obtained by a call to + T1_QueryCompositeChar(). + In case of error NULL is returned and T1_errno is set appropriately. +*/ +T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index) +{ + T1_COMP_CHAR_INFO *cci=NULL; + CompCharData *ccd=NULL; + int i; + + /* Check whether font is loaded: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return( cci); + } + + /* If no AFM info is present, we return -2 */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return( cci); + } + + /* range check for index */ + if ((index < 0) || + (index >= pFontBase->pFontArray[FontID].pAFMData->numOfComps)) { + T1_errno=T1ERR_INVALID_PARAMETER; + return( cci); + } + + /* Alloc mem */ + if ((cci=(T1_COMP_CHAR_INFO*)malloc( sizeof(T1_COMP_CHAR_INFO)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return( cci); + } + + /* set source pointer */ + ccd=&(pFontBase->pFontArray[FontID].pAFMData->ccd[index]); + /* and copy information */ + cci->compchar=T1_GetEncodingIndex( FontID, ccd->ccName); + cci->numPieces=ccd->numOfPieces; + /* we expect numPieces to be >1 */ + if ((cci->pieces=(T1_COMP_PIECE *)malloc( sizeof(T1_COMP_PIECE)* + cci->numPieces))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + free( cci); + return( NULL); + } + /* Copy information */ + for (i=0; inumPieces; i++) { + cci->pieces[i].piece=T1_GetEncodingIndex( FontID, ccd->pieces[i].pccName); + cci->pieces[i].deltax=ccd->pieces[i].deltax; + cci->pieces[i].deltay=ccd->pieces[i].deltay; + } + return( cci); + +} + + + +/* T1_IsInternalChar(): Query whether the character in encoding slot + char1 of font FontID has an internal definition (CharString) or + whether it is constructed by t1lib from elementary units */ +int T1_IsInternalChar( int FontID, char char1) +{ + unsigned char uchar1; + char *charname; + psdict *pCharStrings; + int len, i, j; + + /* return NULL if font not loaded */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return( -1); + } + + pCharStrings=pFontBase->pFontArray[FontID].pType1Data->CharStringsP; + uchar1=(unsigned char)char1; + + charname=T1_GetCharName( FontID, uchar1); + + /* First, get the maximum number of charstrings: */ + len=pCharStrings[0].key.len; + + /* Check all CharString definitions */ + for ( i=1; i<=len; i++) { + /* if len=0, then the CharStrings dict is larger that required which + is valid and allowed by the spec.*/ + if ((j=pCharStrings[i].key.len)!=0) { + if ( (j==strlen(charname)) && + (strncmp( charname, pCharStrings[i].key.data.nameP, j)==0) ) { + /* we have found an internal definition */ + return( 1); + } + } + } + return( 0); +} diff -Naur xdvik-22.40l/libs/t1lib/t1finfo.h xdvik-22.40n/libs/t1lib/t1finfo.h --- xdvik-22.40l/libs/t1lib/t1finfo.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1finfo.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,104 @@ +/*-------------------------------------------------------------------------- + ----- File: t1finfo.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-06-03 + ----- Description: This file is part of the t1-library. It contains + declarations and definitions for t1finfo.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#ifdef T1FINFO_C + + +int T1_GetKerning( int FontID, char char1, char char2); +int T1_GetCharWidth( int FontID, char char1); +BBox T1_GetCharBBox( int FontID, char char1); +float T1_GetUnderlinePosition( int FontID); +float T1_GetUnderlineThickness( int FontID); +float T1_GetItalicAngle( int FontID); +int T1_GetIsFixedPitch( int FontID); +char *T1_GetFontName( int FontID); +char *T1_GetFullName( int FontID); +char *T1_GetFamilyName( int FontID); +char *T1_GetWeight( int FontID); +char *T1_GetVersion( int FontID); +char *T1_GetNotice( int FontID); +char *T1_GetCharName( int FontID, char char1); +int T1_QueryLigs( int FontID, char char1, char **successors, char **ligatures); +int T1_GetEncodingIndex( int FontID, char *char1); +int *T1_GetEncodingIndices( int FontID, char *char1); +int T1_GetStringWidth( int FontID, char *string, + int len, long spaceoff,int kerning); +BBox T1_GetStringBBox( int FontID, char *string, + int len, long spaceoff, int kerning); +METRICSINFO T1_GetMetricsInfo( int FontID, char *string, + int len, long spaceoff, int kerning); +BBox T1_GetFontBBox( int FontID); +char **T1_GetAllCharNames( int FontID); +int T1_GetNoKernPairs( int FontID); +static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2); +int T1_GetNoCompositeChars( int FontID); +int T1_QueryCompositeChar( int FontID, char char1); +T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1); +T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index); +int T1_IsInternalChar( int FontID, char char1); + + +#else + + +extern int T1_GetKerning( int FontID, char char1, + char char2); +extern int T1_GetCharWidth( int FontID, char char1); +extern BBox T1_GetCharBBox( int FontID, char char1); +extern float T1_GetUnderlinePosition( int FontID); +extern float T1_GetUnderlineThickness( int FontID); +extern float T1_GetItalicAngle( int FontID); +extern int T1_GetIsFixedPitch( int FontID); +extern char *T1_GetFontName( int FontID); +extern char *T1_GetFullName( int FontID); +extern char *T1_GetFamilyName( int FontID); +extern char *T1_GetWeight( int FontID); +extern char *T1_GetVersion( int FontID); +extern char *T1_GetNotice( int FontID); +extern char *T1_GetCharName( int FontID, char char1); +extern int T1_QueryLigs( int FontID, char char1, char **successors, char **ligatures); +extern int T1_GetEncodingIndex( int FontID, char *char1); +extern int *T1_GetEncodingIndices( int FontID, char *char1); +extern int T1_GetStringWidth( int FontID, char *string, + int len, long spaceoff,int kerning); +extern BBox T1_GetStringBBox( int FontID, char *string, + int len, long spaceoff, int kerning); +extern METRICSINFO T1_GetMetricsInfo( int FontID, char *string, + int len, long spaceoff, int kerning); +extern BBox T1_GetFontBBox( int FontID); +extern int T1_GetNoKernPairs( int FontID); +extern char **T1_GetAllCharNames( int FontID); +extern int T1_GetNoCompositeChars( int FontID); +extern int T1_QueryCompositeChar( int FontID, char char1); +extern T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1); +extern T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index); +extern int T1_IsInternalChar( int FontID, char char1); + + +#endif + diff -Naur xdvik-22.40l/libs/t1lib/t1global.h xdvik-22.40n/libs/t1lib/t1global.h --- xdvik-22.40l/libs/t1lib/t1global.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1global.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,115 @@ +/*-------------------------------------------------------------------------- + ----- File: t1global.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + global declarations used by the t1-library. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#include "t1misc.h" + + +/* Following struct will allow all accesses to font data! */ +struct FONTBASE +{ + int t1lib_flags; /* Global library flags */ + int no_fonts_ini; /* The number of fonts initially declared in + Font database file. */ + int no_fonts; /* The number of currently allocated fonts including + logical fonts produced by T1_CopyFont() */ + int no_fonts_limit; /* The maximum number of font for which is memory + currently available. */ + int bitmap_pad; /* The value to which bitmap-scanlines are padded */ + int endian; /* 1 if little endian representation and 0 otherwise */ + char **default_enc; /* The default encoding vector */ + FONTPRIVATE *pFontArray; /* Points to first element of font pointer array */ +} FontBase; +struct FONTBASE *pFontBase=NULL; + + + +/* Further we need a struct where to save device dependent data such as + resolution. The values in this struct may be altered using + T1_SetDeviceRes(x_res,y_res). Generally, the fontsize is to be specified + in BigPoints ("bp")---this is the default PostScript unit. It is + 1in=72bp. + */ +typedef struct +{ + float x_resolution; /* Value must be specified in DPI */ + float y_resolution; /* Value must be specified in DPI */ + float scale_x; /* horizontal scale-value to get a + matrix scaled to 1b */ + float scale_y; /* vertical scale-value to get a + matrix scaled to 1b */ +} DEVICESPECIFICS; + +DEVICESPECIFICS DeviceSpecifics = { DEFAULT_RES, + DEFAULT_RES, + DEFAULT_RES/BIGPOINTSPERINCH, + DEFAULT_RES/BIGPOINTSPERINCH +}; + + + +struct stat filestats; /* A structure where fileinfo is stored */ +char linebuf[BUF_SIZE]; /* A buffer for reading files line + by line */ +int T1_Up=0; /* This one is for initialization-checking */ + +/* The width of AA-pixels */ +int T1aa_bpp; + +/* The follwoing variable allows the primary rastering functions + to check for the caller */ +int SetFuncRequestID=0; + +/* The following variable allows to suppress rastering at 1000 bp + for getting a correct bounding box for slanted characters --> + should only internally be used */ +int ForceAFMBBox=0; + +extern struct XYspace *IDENTITY; + +int errornumber; /* for debugging purposes */ + +/* The following pointers should be set to path-strings--used for locating + type1, afm and encoding files */ +char** T1_PFAB_ptr=NULL; +char** T1_AFM_ptr=NULL; +char** T1_ENC_ptr=NULL; +char** T1_FDB_ptr=NULL; + +/* We use a uchar buffer for error and warning messages: */ +char err_warn_msg_buf[1024]; + +/* file pointer for log-file */ +FILE *t1lib_log_file=NULL; +int t1lib_log_level=2; + +/* The errno for t1lib */ +int T1_errno=0; + +/* A variable for saving stack info */ +jmp_buf stck_state; + diff -Naur xdvik-22.40l/libs/t1lib/t1lib.ac xdvik-22.40n/libs/t1lib/t1lib.ac --- xdvik-22.40l/libs/t1lib/t1lib.ac Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1lib.ac Sat Sep 14 00:24:47 2002 @@ -0,0 +1,95 @@ +if test "$needs_libt1" = no; then + LIBT1CPPFLAGS= + LDLIBT1= + LIBT1DEP= +else + EXTRA_LIBT1_INCLUDE= + EXTRA_LIBT1_LIBDIR= + + if test "$with_system_t1lib" = yes; then + if test "x$with_t1lib_libdir" != x; then + EXTRA_LIBT1_LIBDIR="-L$with_t1lib_libdir" + fi + if test "x$with_t1lib_include" != x; then + EXTRA_LIBT1_INCLUDE="-I$with_t1lib_include" + fi + fi + + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR" + CPP="$CPP $EXTRA_LIBT1_INCLUDE" + + if test "$with_system_t1lib" = yes; then + AC_CHECK_LIB(t1, T1_AddFont, + t1lib=-lt1, + AC_MSG_WARN(Standard T1 library not found. Compiling my own.) + with_system_t1lib=no, + -lz -lm) + fi + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR -lt1 -lm" + if test "$with_system_t1lib" = yes; then + AC_MSG_CHECKING(whether installed T1 lib is >= v 1.3.1 ) + AC_TRY_RUN([ +#include +#include "t1lib.h" +#define BUFLEN 128 +int main() { + char *t1libId = T1_GetLibIdent(); + char testbuf[BUFLEN]; + char *p = testbuf; + int i; + int version_num; + /* T1_GetLibIdent() might return something like '0.8-beta2'; + convert the leading numbers to a single digit: */ + for (i = 0; i < BUFLEN; i++) { + if (t1libId[i] >= '0' && t1libId[i] <= '9') + *p++ = t1libId[i]; + else if (t1libId[i] != '.' && t1libId[i] != '_' && t1libId[i] != '-') + break; + } + version_num = strtoul(testbuf, (char **)NULL, 10); + /* xdvik needs >= 1.2.0 for parsing dvips map files. + Try to deal with version strings with 1 or more digits. */ + if (version_num >= 120 + || (version_num < 100 && version_num >= 12) + || (version_num < 10 && version_num >= 2)) + exit(0); + exit(1); +} + ], + ac_compile_t1lib=0, + ac_compile_t1lib=1, + ac_compile_t1lib=1 + ]) + if test $ac_compile_t1lib = 0; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT([no, will compile my own version]) + with_system_t1lib=no + fi + fi + + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + LIBS=$OLD_LIBS + + if test "$with_system_t1lib" != yes; then + LIBT1CPPFLAGS='-I$(LIBT1DIR) -I$(LIBT1SRCDIR) -I$(LIBT1DIR)/../type1 -I$(LIBT1SRCDIR)/../type1' + LDLIBT1='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + LIBT1DEP='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + using_system_t1lib=no + else + LIBT1CPPFLAGS="$EXTRA_LIBT1_INCLUDE" + LDLIBT1="$EXTRA_LIBT1_LIBDIR -lt1" + LIBT1DEP= + using_system_t1lib=yes + fi +fi + +AC_SUBST(LIBT1CPPFLAGS) +AC_SUBST(LDLIBT1) +AC_SUBST(LIBT1DEP) diff -Naur xdvik-22.40l/libs/t1lib/t1lib.h xdvik-22.40n/libs/t1lib/t1lib.h --- xdvik-22.40l/libs/t1lib/t1lib.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1lib.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,452 @@ +/*-------------------------------------------------------------------------- + ----- File: t1lib.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-10-03 + ----- Description: This file is part of the t1-library. It must be + included by the user of the t1lib. It contains + function declarations and some basic data types, the + user must deal with. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#ifndef T1LIB_H_INCLUDED + +#define T1LIB_H_INCLUDED + +/* type definitions, needed by the user: */ + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + + +/* the data structure which contains the character bitmap description */ +typedef struct +{ + char *bits; /* A pointer to the characters local bitmap */ + struct /* A struct containing diverse metric information */ + { + int ascent; + int descent; + int leftSideBearing; + int rightSideBearing; + int advanceX; + int advanceY; + } metrics; + void *pFontCacheInfo; + unsigned long bpp; +} GLYPH; + + +/* A structure representing a matrix */ +typedef struct +{ + double cxx; + double cyx; + double cxy; + double cyy; +} T1_TMATRIX; + + +/* the bounding box data structure: */ +typedef struct +{ + int llx; /* lower left x-position */ + int lly; /* lower left y-position */ + int urx; /* upper right x-position */ + int ury; /* upper right y-position */ +} BBox; + + +/* A data that makes most important information available to user. */ +typedef struct +{ + int width; /* The glyph's width */ + BBox bbox; /* The glyph's bounding box */ + int numchars; /* The number of characters in the glyph (string) */ + int *charpos; /* A pointer to an integer array were the horizontal + positions in (afm units) of the individual + characters in the string are stored */ +} METRICSINFO; + + +#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad)) + + +/* def's for T1_InitLib() */ +#define NO_LOGFILE 0x0 +#define LOGFILE 0x1 +#define IGNORE_FONTDATABASE 0x2 /* Default is to read database */ +#define IGNORE_CONFIGFILE 0x4 /* Default is to read config file */ +#define T1_AA_CACHING 0x8 /* Cache aa-bytes */ +#define T1_NO_AFM 0x10 /* Do not load or generate AFM data */ + + + +/* common 'yes'/'no' */ +#define T1_YES 0x1 +#define T1_NO 0x0 + + +/* logfile levels: */ +#define T1LOG_ERROR 1 +#define T1LOG_WARNING 2 +#define T1LOG_STATISTIC 3 +#define T1LOG_DEBUG 4 + + +/* #define's for manipulating searchpaths */ +#define T1_PFAB_PATH 0x01 +#define T1_AFM_PATH 0x02 +#define T1_ENC_PATH 0x04 +#define T1_FDB_PATH 0x08 +#define T1_APPEND_PATH 0x00 +#define T1_PREPEND_PATH 0x01 + + +/* #define's for character/string properties (not all implemented) */ +#define T1_DEFAULT 0x0000 +#define T1_UNDERLINE 0x0001 +#define T1_OVERLINE 0x0002 +#define T1_OVERSTRIKE 0x0004 +#define T1_DOUBLEOVERSTRIKE 0x0008 +#define T1_RIGHT_TO_LEFT 0x0010 +#define T1_SUBSCRIPT 0x0100 +#define T1_SUPERSCRIPT 0x0200 +#define T1_STROKED 0x1000 +#define T1_KERNING 0x2000 + + +/* Setting the subsampling value */ +#define T1_AA_NONE 1 +#define T1_AA_LOW 2 +#define T1_AA_HIGH 4 + + +/* Error handling: */ +extern int T1_errno; + +/* These are from scanning a font file */ +#define T1ERR_SCAN_FONT_FORMAT -5 +#define T1ERR_SCAN_FILE_OPEN_ERR -4 +#define T1ERR_SCAN_OUT_OF_MEMORY -3 +#define T1ERR_SCAN_ERROR -2 +#define T1ERR_SCAN_FILE_EOF -1 +/* These are from generating paths */ +#define T1ERR_PATH_ERROR 1 +#define T1ERR_PARSE_ERROR 2 +#define T1ERR_TYPE1_ABORT 3 +/* These are from t1lib */ +#define T1ERR_INVALID_FONTID 10 +#define T1ERR_INVALID_PARAMETER 11 +#define T1ERR_OP_NOT_PERMITTED 12 +#define T1ERR_ALLOC_MEM 13 +#define T1ERR_FILE_OPEN_ERR 14 +#define T1ERR_UNSPECIFIED 15 +#define T1ERR_NO_AFM_DATA 16 +#define T1ERR_X11 17 +#define T1ERR_COMPOSITE_CHAR 18 + + +/* Flags to control the rasterizer */ +#define T1_IGNORE_FORCEBOLD 0x0001 +#define T1_IGNORE_FAMILYALIGNMENT 0x0002 +#define T1_IGNORE_HINTING 0x0004 + +#define T1_DEBUG_LINE 0x0100 +#define T1_DEBUG_REGION 0x0200 +#define T1_DEBUG_PATH 0x0400 +#define T1_DEBUG_FONT 0x0800 +#define T1_DEBUG_HINT 0x1000 + + +/* definitions for outline handling */ +#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ +/* From/to conversion of pels/fractpels */ +#define T1_TOPATHPOINT(p) (((long)p)<>FRACTBITS) + +/* A fractional point */ +typedef struct { + long x; + long y; +} T1_PATHPOINT; + + +/* A straight outline segment, stroked or not stroked */ +typedef struct pathsegment { + char type; /* type of segment (line or move) */ + unsigned char flag; /* type1 rasterizer internal stuff */ + short references; /* type1 rasterizer internal stuff */ + unsigned char size; /* size of the structure */ + unsigned char context; /* index to device context */ + struct pathsegment *link; /* pointer to next structure in linked list */ + struct pathsegment *last; /* pointer to last structure in list */ + T1_PATHPOINT dest; /* relative ending location of path segment */ +} T1_PATHSEGMENT; + +/* A third order bezier segment */ +typedef struct bezierpathsegment { + char type; /* type of segment (bezier) */ + unsigned char flag; /* type1 rasterizer internal stuff */ + short references; /* type1 rasterizer internal stuff */ + unsigned char size; /* as with any 'segment' type */ + unsigned char context; /* as with any 'segment' type */ + T1_PATHSEGMENT *link; /* as with any 'segment' type */ + T1_PATHSEGMENT *last; /* as with any 'segment' type */ + T1_PATHPOINT dest; /* ending point (D) */ + T1_PATHPOINT B; /* control point B */ + T1_PATHPOINT C; /* control point C */ +} T1_BEZIERSEGMENT; + +typedef T1_PATHSEGMENT T1_OUTLINE; + +#define T1_PATHTYPE_LINE 0x10 +#define T1_PATHTYPE_BEZIER 0x12 +#define T1_PATHTYPE_MOVE 0x15 + + +/* Definitions for font subsetting */ +#define T1_SUBSET_DEFAULT 0x00 +#define T1_SUBSET_FORCE_REENCODE 0x01 +#define T1_SUBSET_SKIP_REENCODE 0x02 +#define T1_SUBSET_ENCRYPT_BINARY 0x04 +/* This is only for debugging, it does not produce valid font-files! + This flag is not in the documented API!. */ +#define T1_SUBSET_ENCRYPT_NONE 0x08 + + +/* Two structures for handling composite character data */ +/* One structure for each symbol of the composite character */ +typedef struct +{ + int piece; /* the index of the current symbol */ + int deltax; /* horizontal displacement of current symbol in CS */ + int deltay; /* vertical displacement of current symbol in CS */ +} T1_COMP_PIECE; + +/* This one defines the composite character, the number of pieces and how to + access their data. */ +typedef struct +{ + int compchar; /* the base character in the current encoding */ + int numPieces; /* the number of defined pieces including the base char */ + T1_COMP_PIECE *pieces; /* a pointer to the pieces' information */ +} T1_COMP_CHAR_INFO; + + + +/* function declarations: */ + +/* from t1base.c */ +extern void *T1_InitLib( int log); +extern int T1_CloseLib( void); +extern int T1_AddFont( char *fontfilename); +extern void T1_PrintLog( char *func_ident, char *msg_txt, int level, ...); +extern void T1_SetLogLevel( int level); +extern int CheckForInit(void); +extern int CheckForFontID( int FontID); +extern int test_for_t1_file( char *buffer ); +extern char *T1_GetFontFileName( int FontID); +extern int T1_Get_no_fonts(void); +extern int T1_SetDeviceResolutions( float x_res, float y_res); +extern int T1_CopyFont( int FontID); +extern int T1_QueryX11Support( void); +extern void bin_dump_c(unsigned char value); +extern void bin_dump_s(unsigned short value); +extern void bin_dump_l(unsigned long value); +extern int T1_CheckEndian(void); +extern int T1_SetBitmapPad( int pad); +extern int T1_GetBitmapPad( void); +extern char *T1_GetLibIdent( void); +extern void T1_SetRasterFlags( int flags); +extern char *T1_GetAfmFileName( int FontID); +extern int T1_SetAfmFileName( int FontId, char *afm_name); +extern char *T1_GetFontFilePath( int FontID); +extern char *T1_GetAfmFilePath( int FontID); + +/* from t1delete.c */ +extern int T1_DeleteSize( int FontID, float size); +extern int T1_DeleteAllSizes( int FontID); +extern int T1_FreeGlyph( GLYPH *glyph); +extern int T1_FreeCompCharData( T1_COMP_CHAR_INFO *cci); +extern int T1_DeleteFont( int FontID); + +/* from t1enc.c */ +extern char **T1_LoadEncoding( char *FileName); +extern int T1_DeleteEncoding( char **encoding); +extern int T1_ReencodeFont( int FontID, char **Encoding); +extern int T1_SetDefaultEncoding( char **encoding); +extern char *T1_GetEncodingScheme( int FontID); + +/* from t1env.c */ +extern int T1_SetFileSearchPath( int type, char *pathname); +extern int T1_AddToFileSearchPath( int pathtype, int mode, char *pathname); +extern char *T1_GetFileSearchPath( int type); +extern int T1_SetFontDataBase( char *filename); +extern int T1_AddFontDataBase( int mode, char *filename); + +/* from t1finfo.c */ +extern int T1_GetKerning( int FontID, char char1, + char char2); +extern int T1_GetCharWidth( int FontID, char char1); +extern BBox T1_GetCharBBox( int FontID, char char1); +extern float T1_GetUnderlinePosition( int FontID); +extern float T1_GetUnderlineThickness( int FontID); +extern float T1_GetItalicAngle( int FontID); +extern int T1_GetIsFixedPitch( int FontID); +extern char *T1_GetFontName( int FontID); +extern char *T1_GetFullName( int FontID); +extern char *T1_GetFamilyName( int FontID); +extern char *T1_GetWeight( int FontID); +extern char *T1_GetVersion( int FontID); +extern char *T1_GetNotice( int FontID); +extern char *T1_GetCharName( int FontID, char char1); +extern int T1_QueryLigs( int FontID, + char char1, + char **successors, + char **ligatures); +extern int T1_GetEncodingIndex( int FontID, char *char1); +extern int *T1_GetEncodingIndices( int FontID, char *char1); +extern int T1_GetStringWidth( int FontID, char *string, + int len, long spaceoff, int kerning); +extern BBox T1_GetStringBBox( int FontID, char *string, + int len, long spaceoff, int kerning); +extern METRICSINFO T1_GetMetricsInfo( int FontID, char *string, + int len, long spaceoff, int kerning); +extern BBox T1_GetFontBBox( int FontID); +extern char **T1_GetAllCharNames( int FontID); +extern int T1_GetNoKernPairs( int FontID); +extern int T1_GetNoCompositeChars( int FontID); +extern int T1_QueryCompositeChar( int FontID, char char1); +extern T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1); +extern T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index); +extern int T1_IsInternalChar( int FontID, char char1); + +/* from t1load.c */ +extern int T1_LoadFont( int FontID); +extern int openFontMetricsFile( int FontID); +extern void *CreateNewFontSize( int FontID, float size, int aa); +extern void *GetLastFontSize( int FontID); +extern void *QueryFontSize( int FontID, float size, int aa); + +/* from t1set.c */ +extern GLYPH *T1_SetChar( int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_SetString( int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_CopyGlyph(GLYPH *glyph); +extern void T1_DumpGlyph( GLYPH *glyph); +extern GLYPH *T1_ConcatGlyphs( GLYPH *glyph1, GLYPH *glyph2, + int x_off, int y_off, int modflag); +extern void T1_DumpPixmap( GLYPH *glyph); +extern GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag); + +/* from t1trans.c */ +extern int T1_ExtendFont( int FontID, double extend); +extern int T1_SlantFont( int FontID, double slant); +extern int T1_TransformFont( int FontID, T1_TMATRIX *matrix); +extern double T1_GetExtend( int FontID); +extern double T1_GetSlant( int FontID); +extern T1_TMATRIX T1_GetTransform( int FontID); +extern int T1_SetLinePosition( int FontID, int linetype, float value); +extern int T1_SetLineThickness( int FontID, int linetype, float value); +extern float T1_GetLinePosition( int FontID, int linetype); +extern float T1_GetLineThickness( int FontID, int linetype); +extern T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, double angle); +extern T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix); +extern T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix); +extern T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, double shear); +extern T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, double shear); +extern T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, double extent); +extern T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, double extent); +extern T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, + double cxx, double cyx, + double cxy, double cyy); + + +/* from t1aaset.c */ +extern GLYPH *T1_AASetChar( int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_AASetString( int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern int T1_AASetGrayValues(unsigned long white, + unsigned long gray75, + unsigned long gray50, + unsigned long gray25, + unsigned long black); +extern int T1_AAHSetGrayValues( unsigned long *grayvals); +extern int T1_AANSetGrayValues( unsigned long bg, unsigned long fg); +extern int T1_AAGetGrayValues( long *pgrayvals); +extern int T1_AAHGetGrayValues( long *pgrayvals); +extern int T1_AANGetGrayValues( long *pgrayvals); +extern int T1_AASetBitsPerPixel( int bpp); +extern int T1_AAGetBitsPerPixel( void); +extern int T1_AASetLevel( int level); +extern int T1_AAGetLevel( void); +extern GLYPH *T1_AAFillOutline( T1_OUTLINE *path, int modflag); +extern int T1_AASetSmartLimits( float limit1, float limit2); +extern int T1_AASetSmartMode( int smart); + + +/* from t1afmtool.c */ +extern int T1_WriteAFMFallbackFile( int FontID); + +/* from t1outline.c */ +extern T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1, + T1_OUTLINE *path2); +extern T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale); +extern T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag, + float size, T1_TMATRIX *transform); +extern void T1_DumpPath( T1_OUTLINE *path); +extern void T1_AbsolutePath( T1_OUTLINE *rpath); +extern void T1_RelativePath( T1_OUTLINE *apath); +extern void T1_ManipulatePath( T1_OUTLINE *path, + void (*manipulate)(long *x,long *y,int type)); +extern T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path); +extern void T1_FreeOutline( T1_OUTLINE *path); + + +/* from t1subset.c */ +extern char *T1_SubsetFont( int FontID, + char *mask, + unsigned int flags, + int linewidth, + unsigned long maxblocksize, + unsigned long *bufsize); +extern char *T1_GetCharString( int FontID, char *charname, int *len); +extern int T1_GetlenIV( int FontID); + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* T1LIB_H_INCLUDED */ diff -Naur xdvik-22.40l/libs/t1lib/t1libx.h xdvik-22.40n/libs/t1lib/t1libx.h --- xdvik-22.40l/libs/t1lib/t1libx.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1libx.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,85 @@ +/*-------------------------------------------------------------------------- + ----- File: t1libx.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-10-30 + ----- Description: This file is part of the t1-library. It must be + included by the user of the t1lib. It contains + function declarations for the X11 wrapper. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#ifndef T1LIBX_H_INCLUDED + +#define T1LIBX_H_INCLUDED + + +#ifndef _XLIB_H_ +#include +#endif + + +#define T1LIB_X11_SUPPORT + +/* For paint mode of X-rastering functions */ +#define T1_OPAQUE 0x1 +#define T1_TRANSPARENT 0x0 + + +/* type definitions, needed by the user: */ + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + + +/* from t1x11.c */ +extern int T1_SetX11Params( Display *display, + Visual *visual, + unsigned int depth, + Colormap colormap); +extern GLYPH *T1_SetCharX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_SetStringX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_AASetCharX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_AASetStringX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern int T1_ComputeAAColorsX( unsigned long fg, + unsigned long bg, + int nolevels); +extern int T1_GetDepthOfDrawable( Drawable drawable); +extern void T1_LogicalPositionX( int pos_switch); +extern XImage *T1_XImageFromGlyph( GLYPH *pglyph); + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* T1LIBX_H_INCLUDED */ diff -Naur xdvik-22.40l/libs/t1lib/t1load.c xdvik-22.40n/libs/t1lib/t1load.c --- xdvik-22.40l/libs/t1lib/t1load.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1load.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1007 @@ +/*-------------------------------------------------------------------------- + ----- File: t1load.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-10-03 + ----- Description: This file is part of the t1-library. It contains + functions for loading fonts and for managing size + dependent data. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1LOAD_C + +#define ANSI_REALLOC_VM + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/blues.h" +#include "../type1/regions.h" + + +#include "t1types.h" +#include "t1extern.h" +#include "t1load.h" +#include "t1env.h" +#include "t1set.h" +#include "t1base.h" +#include "t1finfo.h" +#include "t1afmtool.h" + + + +extern psobj *StdEncArrayP; /* For checking of a fonts encoding */ +extern char not_def[]; /* for checking the ".notdef"-string */ + + + +/* T1_LoadFont(FontID): Loads a Type1 font into memory and allocates all + memory, necessary for this. */ + +int T1_LoadFont( int FontID) +{ + int i, j, k, l, m; + char *FileName, *FileNamePath; + int mode; /* This is used by the type1-library for error reporting */ + char *charname; + + /* The following vars are used for reallocation of VM */ + long tmp_size; + float ascender; +#ifdef ANSI_REALLOC_VM + unsigned long shift; + unsigned long ldummy; + char *tmp_ptr; +#endif + + struct region *area; + struct XYspace *S; + + /* These are for constructing the kerning lookup table: */ + PairKernData *pkd; + METRICS_ENTRY *kern_tbl; + int char1, char2; + + + if (CheckForInit()){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + + i=CheckForFontID(FontID); + if (i==1) + return(0); /* Font already loaded */ + if (i==-1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); /* illegal FontID */ + } + + /* Allocate memory for ps_font structure: */ + if ((pFontBase->pFontArray[FontID].pType1Data=(psfont *)malloc(sizeof(psfont)))==NULL){ + T1_PrintLog( "T1_LoadFont()", "Failed to allocate memory for psfont-struct (FontID=%d)", + T1LOG_ERROR, FontID); + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + + /* Check for valid filename */ + if ((FileName=T1_GetFontFileName(FontID))==NULL){ + T1_PrintLog( "T1_LoadFont()", "No font file name for font %d", T1LOG_ERROR, FontID); + return(-1); + } + + /* Fetch the full path of type1 font file */ + if ((FileNamePath=intT1_Env_GetCompletePath( FileName, + T1_PFAB_ptr))==NULL){ + T1_PrintLog( "T1_LoadFont()", "Couldn't locate font file for font %d in %s", + T1LOG_ERROR, FontID, T1_GetFileSearchPath(T1_PFAB_PATH)); + T1_errno=T1ERR_FILE_OPEN_ERR; + return(-1); + } + + /* And load all PostScript information into memory */ + if (fontfcnA( FileNamePath, &mode, + pFontBase->pFontArray[FontID].pType1Data) == FALSE){ + T1_PrintLog( "T1_LoadFont()", "Loading font with ID = %d failed! (mode = %d)", + T1LOG_ERROR, FontID, mode); + free(FileNamePath); + pFontBase->pFontArray[FontID].pType1Data=NULL; + T1_errno=mode; + return(-1); + } + free(FileNamePath); + + + /* Store the base address of virtual memory and realloc in order not + to waste too much memory: */ + pFontBase->pFontArray[FontID].vm_base=vm_base; +#ifdef ANSI_REALLOC_VM + /* We first get the size of pointers on the current system */ + /* Get size of VM, ... */ + tmp_size=((unsigned long)vm_used - (unsigned long)vm_base); + /* ... realloc to that size ... */ + tmp_ptr=(char *)realloc(vm_base, tmp_size); + /* ... and shift all pointers refering to that area */ + if (tmp_ptr > vm_base){ + shift= (unsigned long)tmp_ptr - (unsigned long)vm_base; + sprintf( err_warn_msg_buf, + "Old VM at 0x%lX, new VM at 0x%lX, shifting up by %lu", + (unsigned long)vm_base, (unsigned long)tmp_ptr, tmp_size); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + + /* We start by shifting the topmost pointers: */ + pFontBase->pFontArray[FontID].vm_base=tmp_ptr; + + ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->vm_start); + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->vm_start=(char *)ldummy; + + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->CharStringsP=(psdict *)ldummy; + + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->Private=(psdict *)ldummy; + + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP=(psdict *)ldummy; + + ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->BluesP); + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->BluesP=(struct blues_struct *)ldummy; + + /* We now have to care for correcting all pointers which are in the VM + and refer to some place in the VM! Note: Instead of selecting the + appropriate pointer-elements of the union we simply shift the + unspecified pointer "valueP". + Note: The filename entry does not need to be modified since it does not + need to be shifted since it points to memory managed by t1lib. + */ + /* FontInfo-dictionary: All name-pointers and the pointers to all array + types have to be shifted: */ + i=pFontBase->pFontArray[FontID].pType1Data->fontInfoP[0].key.len; + for (j=1; j<=i; j++){ + if ((pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ARRAY) || + (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_STRING) || + (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_NAME) || + (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_FILE)){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy; + } + /* The encoding needs special treatment: */ + if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ENCODING){ + /* If a builtin encoding is used, it is sufficient to shift the pointer + to the Encoding since the character-namestrings of builtin encodings + are static and thus located on the heap. + For font-specific encoding, character-namestrings reside in VM and + thus each entry has to be shifted. + Caution: We still have to shift the builtin encoding-pointer, since + they also point to are located in VM: */ + ldummy=(long)StdEncArrayP; + ldummy +=shift; + StdEncArrayP=(psobj *)ldummy; + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy; + if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP + == StdEncArrayP){ /* Font uses builtin standard encoding */ + ; + } + else{ /* Font-specific encoding */ + for (k=0; k<256; k++){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP; + /* The ".notdef" is also static and may not be shifted (Thanks, Derek ;) */ + if (ldummy != (unsigned long)not_def) { + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP=(struct ps_obj *)ldummy; + } + } + } + } /* end of encoding-handling */ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP=(char *)ldummy; + } /* fontinfo-dict done */ + + /* Private-dictionary: All name-pointers and the pointers to all array + types have to be shifted: */ + i=pFontBase->pFontArray[FontID].pType1Data->Private[0].key.len; + for (j=1; j<=i; j++){ + if ((pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_ARRAY) || + (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_STRING) || + (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_NAME) || + (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_FILE)){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP=(char *)ldummy; + } + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP=(char *)ldummy; + } + + /* BluesP: The entry "next" is the only pointer in blues_struct. Although it is + not used anywhere we should shift it for correctness reasons (in case its not + NULL)! */ + if (pFontBase->pFontArray[FontID].pType1Data->BluesP->next != NULL){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->BluesP->next; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->BluesP->next=(struct blues_struct *)ldummy; + } + + /* The CharStrings-dictionary: Every namepointer and its corresponding + charstring has to be shifted: */ + i=pFontBase->pFontArray[FontID].pType1Data->CharStringsP[0].key.len; + for (j=1; j<=i; j++){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP=(char *)ldummy; + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP=(char *)ldummy; + } + + /* The Subroutines have also to be reorganized: */ + i=pFontBase->pFontArray[FontID].pType1Data->Subrs.len; + /* First, shift pointer to array-start and after that the pointers to + each command string: */ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP=(struct ps_obj *)ldummy; + for (j=0; jpFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP; + ldummy +=shift; + pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP=(char *)ldummy; + } + } /* end of if( tmp_ptr > vm_base ) */ + else if ( vm_base > tmp_ptr){ + shift= (unsigned long)vm_base - (unsigned long)tmp_ptr; + sprintf( err_warn_msg_buf, + "Old VM at 0x%lX, new VM at 0x%lX, shifting down by %lu", + (unsigned long)vm_base, (unsigned long)tmp_ptr, tmp_size); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + + /* We start by shifting the topmost pointers: */ + pFontBase->pFontArray[FontID].vm_base=tmp_ptr; + + ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->vm_start); + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->vm_start=(char *)ldummy; + + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->CharStringsP=(psdict *)ldummy; + + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->Private=(psdict *)ldummy; + + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP=(psdict *)ldummy; + + ldummy=(long)(pFontBase->pFontArray[FontID].pType1Data->BluesP); + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->BluesP=(struct blues_struct *)ldummy; + + /* We now have to care for correcting all pointers which are in the VM + and refer to some place in the VM! Note: Instead of selecting the + appropriate pointer-elements of the union we simply shift the + unspecified pointer "valueP". + Note: The filename entry does not need to be modified since it does not + need to be shifted since it points to memory managed by t1lib. + */ + /* FontInfo-dictionary: All name-pointers and the pointers to all array + types have to be shifted: */ + i=pFontBase->pFontArray[FontID].pType1Data->fontInfoP[0].key.len; + for (j=1; j<=i; j++){ + if ((pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ARRAY) || + (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_STRING) || + (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_NAME) || + (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_FILE)){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy; + } + /* The encoding needs special treatment: */ + if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.type==OBJ_ENCODING){ + /* If a builtin encoding is used, it is sufficient to shift the pointer + to the Encoding since the character-namestrings of builtin encodings + are static and thus located on the heap. + For font-specific encoding, character-namestrings reside in VM and + thus each entry has to be shifted. + Caution: We still have to shift the builtin encoding-pointer, since + they also point to are located in VM: */ + ldummy=(long)StdEncArrayP; + ldummy -=shift; + StdEncArrayP=(psobj *)ldummy; + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.valueP=(char *)ldummy; + if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP + == StdEncArrayP){ /* Font uses builtin encoding */ + ; + } + else{ /* Font-specific encoding */ + for (k=0; k<256; k++){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP; + /* The ".notdef" is also static and may not be shifted (Thanks, Derek ;) */ + if (ldummy != (unsigned long)not_def) { + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].value.data.arrayP[k].data.arrayP=(struct ps_obj *)ldummy; + } + } + } + } /* end of encoding-handling */ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[j].key.data.valueP=(char *)ldummy; + } /* fontinfo-dict done */ + + /* Private-dictionary: All name-pointers and the pointers to all array + types have to be shifted: */ + i=pFontBase->pFontArray[FontID].pType1Data->Private[0].key.len; + for (j=1; j<=i; j++){ + if ((pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_ARRAY) || + (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_STRING) || + (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_NAME) || + (pFontBase->pFontArray[FontID].pType1Data->Private[j].value.type==OBJ_FILE)){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->Private[j].value.data.valueP=(char *)ldummy; + } + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->Private[j].key.data.valueP=(char *)ldummy; + } + + /* BluesP: The entry "next" is the only pointer in blues_struct. Although it is + not used anywhere we should shift it for correctness reasons (in case its not + NULL)! */ + if (pFontBase->pFontArray[FontID].pType1Data->BluesP->next != NULL){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->BluesP->next; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->BluesP->next=(struct blues_struct *)ldummy; + } + + /* The CharStrings-dictionary: Every namepointer and its corresponding + charstring has to be shifted: */ + i=pFontBase->pFontArray[FontID].pType1Data->CharStringsP[0].key.len; + for (j=1; j<=i; j++){ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].value.data.valueP=(char *)ldummy; + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->CharStringsP[j].key.data.valueP=(char *)ldummy; + } + + /* The Subroutines have also to be reorganized: */ + i=pFontBase->pFontArray[FontID].pType1Data->Subrs.len; + /* First, shift pointer to array-start and after that the pointers to + each command string: */ + ldummy=(long)pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP=(struct ps_obj *)ldummy; + for (j=0; jpFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP; + ldummy -=shift; + pFontBase->pFontArray[FontID].pType1Data->Subrs.data.arrayP[j].data.valueP=(char *)ldummy; + } + } /* end of if( vm_base > tmp_ptr ) */ + else{ /* VM addess has not changed during reallocation */ + sprintf( err_warn_msg_buf, + "Old VM and new VM at 0x%lX, no pointer-shifting", + (unsigned long)vm_base); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + } +#endif + + /* Generate a message how much VM the current font consumes */ + sprintf( err_warn_msg_buf, + "VM for Font %d: %d bytes", FontID, (int) tmp_size); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC); + + + /* Set the matrix for common transformations to "no transformations" */ + pFontBase->pFontArray[FontID].FontTransform[0]=1.0; + pFontBase->pFontArray[FontID].FontTransform[1]=0.0; + pFontBase->pFontArray[FontID].FontTransform[2]=0.0; + pFontBase->pFontArray[FontID].FontTransform[3]=1.0; + + /* Now, that the font has been loaded into memory, try to find the + FontMatrix in the font info dictionary. If it exists, load it into + our local fontmatrix, otherwise use a default matrix which scales to + 1/1000 (since font outlines are defined in a 1000 point space) + and does no further transformations. */ + if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP == NULL){ + pFontBase->pFontArray[FontID].FontMatrix[0]=0.001; + pFontBase->pFontArray[FontID].FontMatrix[1]=0.0; + pFontBase->pFontArray[FontID].FontMatrix[2]=0.0; + pFontBase->pFontArray[FontID].FontMatrix[3]=0.001; + } + else{ + pFontBase->pFontArray[FontID].FontMatrix[0]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[0].data.real; + pFontBase->pFontArray[FontID].FontMatrix[1]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[1].data.real; + pFontBase->pFontArray[FontID].FontMatrix[2]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[2].data.real; + pFontBase->pFontArray[FontID].FontMatrix[3]= (double)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[FONTMATRIX].value.data.arrayP[3].data.real; + } + + /* Set the default values for transformation: */ + pFontBase->pFontArray[FontID].slant=0.0; + pFontBase->pFontArray[FontID].extend=1.0; + + + /* Now try to load afm-structures from corresponding .afm-file (if + not suppressed by the user). */ + if ((pFontBase->t1lib_flags & T1_NO_AFM)!=0) { + pFontBase->pFontArray[FontID].pAFMData = NULL; + T1_PrintLog( "T1_LoadFont()", + "Suppressing AFM data handling on user request", + T1LOG_STATISTIC); + } + else { + if ((i=openFontMetricsFile( FontID, 0))){ + /* Try a fallback, opening sloppy: */ + if ((i=openFontMetricsFile( FontID, 1))) { + sprintf( err_warn_msg_buf, + "Alert: Error (%d) sloppy-processing afm-file for Font %d!", + i ,FontID); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC); + if ((pFontBase->pFontArray[FontID].pAFMData= + T1_GenerateAFMFallbackInfo(FontID))==NULL){ + sprintf( err_warn_msg_buf, + "Ultimately failed to generate metrics information Font %d!", + FontID); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_WARNING); + } + else { + pFontBase->pFontArray[FontID].info_flags |=AFM_SELFGEN_SUCCESS; + T1_PrintLog( "T1_LoadFont()", + "Generating AFM-information from fontfile successful!", + T1LOG_STATISTIC); + } + } + else { + pFontBase->pFontArray[FontID].info_flags |=AFM_SLOPPY_SUCCESS; + sprintf( err_warn_msg_buf, + "Alert: Limited afm-information for Font %d",FontID); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_STATISTIC); + } + } + else { + pFontBase->pFontArray[FontID].info_flags |=AFM_SUCCESS; + } + } + + + /* Now, set Encodingvector entry to default if the font's + internal encoding is "StandardEncoding". + */ + if (pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP + == StdEncArrayP) { + pFontBase->pFontArray[FontID].info_flags |=USES_STANDARD_ENCODING; + pFontBase->pFontArray[FontID].pFontEnc=pFontBase->default_enc; + sprintf( err_warn_msg_buf, + "Font %d reencoded to default",FontID); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + } + else { + sprintf( err_warn_msg_buf, + "Font %d not reencoded to default",FontID); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + pFontBase->pFontArray[FontID].pFontEnc = NULL; + } + + + /* If AFM-Info available we try to speed up some things: */ + if (pFontBase->pFontArray[FontID].pAFMData != NULL) { + /* We have to fill the array that maps the current encodings' indices to the + indices used in afm file. The interpretation has been changed in + in t1lib-1.2. We now use positive values for indexing into the charmetrics + array and negative values for indexing into the composite character array. + an index of zero indicates that no metrics are defined for this character. + This may happen because (a) not all AFM-files define metrics for the .notdef + character, and (b) because font and AFM-file do not match. */ + if ((pFontBase->pFontArray[FontID].pEncMap= + (int *)calloc(256,sizeof(int)))==NULL) { + sprintf( err_warn_msg_buf, "Error allocating memory for encoding map (FontID=%d)", + FontID); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + for (i=0; i<256; i++) { + charname=T1_GetCharName( FontID, i); + /* in a first loop check for ordinary characters */ + for ( j=0; jpFontArray[FontID].pAFMData->numOfChars; j++) { + if (strcmp( charname, + pFontBase->pFontArray[FontID].pAFMData->cmi[j].name)==0) { + pFontBase->pFontArray[FontID].pEncMap[i]=j+1; /* index 0 is reserved! */ + continue; + } + } + /* if nothing has been found, check for composite characters */ + for ( j=0; jpFontArray[FontID].pAFMData->numOfComps; j++) { + if (strcmp( charname, + pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName)==0) { + pFontBase->pFontArray[FontID].pEncMap[i]=-(j+1); /* index 0 is reserved! */ + continue; + } + } + } + + /* For composite characters, we still have to compute the width and bbox */ + for ( j=0; jpFontArray[FontID].pAFMData->numOfComps; j++) { + /*and bounding box by ourselves. First, set up an identity charspace + matrix and then generate an edgelist for the composite character at + size 1000bp using no transformation and current encoding. Note: This + action is only required when loading a font at first time, but not + when reencoding a font. */ + S=(struct XYspace *)IDENTITY; + S=(struct XYspace *)Permanent + (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0], + pFontBase->pFontArray[FontID].FontTransform[1], + pFontBase->pFontArray[FontID].FontTransform[2], + pFontBase->pFontArray[FontID].FontTransform[3])); + + area=fontfcnB_ByName( FontID, 0, S, + pFontBase->pFontArray[FontID].pAFMData->ccd[j].ccName, + &mode, pFontBase->pFontArray[FontID].pType1Data, + DO_RASTER); + /* Store bounding box ... */ + pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.llx=area->xmin; + pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.urx=area->xmax; + pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.lly=area->ymin; + pFontBase->pFontArray[FontID].pAFMData->ccd[j].charBBox.ury=area->ymax; + /* ... and character width. This should be the width of the base character + of the composite! */ + pFontBase->pFontArray[FontID].pAFMData->ccd[j].wx=NEARESTPEL(area->ending.x); + /* clean up. */ + KillRegion (area); + if (S!=NULL) { + KillSpace (S); + S=NULL; + } + } + /* We now create an encoding-specific kerning table which will speed up + looking for kerning pairs! */ + /* First, get number of defined kerning pairs: */ + k=pFontBase->pFontArray[FontID].pAFMData->numOfPairs; + if (k>0){ /* i.e., there are any pairs */ + /* OK, it does not suffice to alloc numOfPairs METRICS_ENTRYs, because + a given character might be encoded at several locations and kerning + should still work. As a worst case estimation, we allocate 256^2 + and realloc later. */ + if ((pFontBase->pFontArray[FontID].pKernMap= + (METRICS_ENTRY *)malloc( (256*256) *sizeof( METRICS_ENTRY)))==NULL){ + sprintf( err_warn_msg_buf, "Error allocating memory for metrics map (FontID=%d)", + FontID); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, + T1LOG_WARNING); + T1_errno=T1ERR_ALLOC_MEM; + return(-1); + } + kern_tbl=pFontBase->pFontArray[FontID].pKernMap; + pkd=pFontBase->pFontArray[FontID].pAFMData->pkd; + j=0; + for ( i=0; i + Put char1 in higher byte and char2 in LSB: */ + kern_tbl[j].chars=(char1 << 8) | char2; + /* We only make use of horizontal kerning */ + kern_tbl[j].hkern=pkd[i].xamt; + j++; + } /* while (char2) */ + } /* while (char1) */ + } /* for */ + /* We are done, realloc memory: */ + kern_tbl=(METRICS_ENTRY*) realloc( kern_tbl, j*sizeof(METRICS_ENTRY)); + /* We now sort the kerning array with respect to char indices */ + qsort( kern_tbl, (size_t) j, sizeof(METRICS_ENTRY), + &cmp_METRICS_ENTRY ); + /* Finally write back pointer for the case that realloc changed the + pointer */ + pFontBase->pFontArray[FontID].pKernMap=kern_tbl; + pFontBase->pFontArray[FontID].KernMapSize=j; + } + else + pFontBase->pFontArray[FontID].pKernMap=NULL; + } + else { /* no AFM data */ + pFontBase->pFontArray[FontID].pKernMap=NULL; + pFontBase->pFontArray[FontID].pEncMap=NULL; + } + /* End of "if (AFM-info ..)" */ + + + /* We have just loaded a physical font into memory, thus .... */ + pFontBase->pFontArray[FontID].physical=1; + + /* Set reference-counter to 1: */ + pFontBase->pFontArray[FontID].refcount=1; + + /* Get the index into encoding vector where the space character is + found. If not encoded, set space_position to -1. */ + pFontBase->pFontArray[FontID].space_position=-1; + i=0; + if (pFontBase->pFontArray[FontID].pFontEnc) { /* external default encoding */ + while (i<256) { + if (strcmp( (char *)pFontBase->pFontArray[FontID].pFontEnc[i], + "space")==0){ + /* space found at position i: */ + pFontBase->pFontArray[FontID].space_position=i; + break; + } + i++; + } + } + else { /* internal encoding */ + while (i<256) { + if (strcmp( (char *)pFontBase->pFontArray[FontID].pType1Data->fontInfoP[ENCODING].value.data.arrayP[i].data.arrayP, + "space")==0){ + /* space found at position i: */ + pFontBase->pFontArray[FontID].space_position=i; + break; + } + i++; + } + } + + + /* Set the lining rule parameters to default values */ + pFontBase->pFontArray[FontID].UndrLnPos= + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINEPOSITION].value.data.real; + pFontBase->pFontArray[FontID].UndrLnThick= + pFontBase->pFontArray[FontID].pType1Data->fontInfoP[UNDERLINETHICKNESS].value.data.real; + + /* We have to set the value for the typographic ascender. If possible, + we get it from the afm-File. But be aware this value might be undefined! + This value should in any acse explicitly be set later by the user! */ + if (pFontBase->pFontArray[FontID].pAFMData!=NULL && + pFontBase->pFontArray[FontID].pAFMData->gfi!=NULL) { + ascender=(float) pFontBase->pFontArray[FontID].pAFMData->gfi->ascender; + } + else { + ascender=(float) T1_GetCharBBox( FontID, T1_GetEncodingIndex( FontID, "d")).ury; + } + + pFontBase->pFontArray[FontID].OvrLnPos=ascender + + (float) abs( (double)pFontBase->pFontArray[FontID].UndrLnPos); + pFontBase->pFontArray[FontID].OvrStrkPos=ascender / 2.0; + pFontBase->pFontArray[FontID].OvrLnThick=pFontBase->pFontArray[FontID].UndrLnThick; + pFontBase->pFontArray[FontID].OvrStrkThick=pFontBase->pFontArray[FontID].UndrLnThick; + + + /* Finally, set the font size dependencies pointer to NULL since we can + assume, that at load time of a font, no size specific data of this + font is available. + */ + + pFontBase->pFontArray[FontID].pFontSizeDeps=NULL; + + /* If wanted, some debugging information is put into logfile */ + sprintf( err_warn_msg_buf, "Pointer vm_base: 0x%lX", + (long)pFontBase->pFontArray[FontID].vm_base); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "Pointer vm_start: 0x%lX", + (long)pFontBase->pFontArray[FontID].pType1Data->vm_start); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "Pointer CharStringsP: 0x%lX", + (long)pFontBase->pFontArray[FontID].pType1Data->CharStringsP); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "Pointer Private: 0x%lX", + (long)pFontBase->pFontArray[FontID].pType1Data->Private); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + sprintf( err_warn_msg_buf, "Pointer fontInfoP: 0x%lX", + (long)pFontBase->pFontArray[FontID].pType1Data->fontInfoP); + T1_PrintLog( "T1_LoadFont()", err_warn_msg_buf, T1LOG_DEBUG); + + return(0); +} + + +/* openFontMetricsFile( FontID, open_sloppy): Gets the fontfilename + corresponding to FontID, opens the corresponding afm-file and fills + the data structures. return-value is the value returned by the + T1lib_parseFile() function. If open_sloppy is set, the minimum + information needed is read from AFM file. This can be considered a + fallback for problematic AFM files. */ +static int openFontMetricsFile( int FontID, int open_sloppy) +{ + char *FontFileName; + char *AFMFileName; + char *afm_name; + char *AFMFileNamePath; + + int i, j; + FILE *metricsfile; + + + afm_name=T1_GetAfmFileName(FontID); + + if (afm_name!=NULL) { /* We have name explicitly specified */ + /* It needs to be freeable */ + if ((AFMFileName= + (char *)malloc( (strlen(afm_name)+1)*sizeof( char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return( -6); + } + strcpy( AFMFileName, afm_name); + } + else { + FontFileName=T1_GetFontFileName( FontID); + i=strlen(FontFileName); + j=i; + AFMFileName=(char *)malloc( i+5); + strcpy( AFMFileName, FontFileName); + while ( AFMFileName[i] != '.'){ + if (i==0) break; + else i--; + } + if (i==0){ + /* We have a filename without extension -> append extension */ + AFMFileName[j]='.'; + AFMFileName[j+1]='a'; + AFMFileName[j+2]='f'; + AFMFileName[j+3]='m'; + AFMFileName[j+4]='\0'; + } + else{ + /* we found a '.' -> replace extension */ + AFMFileName[i+1]='a'; + AFMFileName[i+2]='f'; + AFMFileName[i+3]='m'; + AFMFileName[i+4]='\0'; + } + } + + /* Get full path of the afm file (The case of a full path name + name specification is valid */ + AFMFileNamePath=intT1_Env_GetCompletePath( AFMFileName, T1_AFM_ptr); + free( AFMFileName); + + /* open afm-file: */ + if (AFMFileNamePath!=NULL){ + if ((metricsfile=fopen(AFMFileNamePath,"r"))==NULL){ + free(AFMFileNamePath); + return(-4); + } + else { + free(AFMFileNamePath); + } + } + else{ + return( -5); + } + + /* Call procedure to read afm-file and store the data formatted. + Flags used here: P_M All Metrics Information + P_P Pair Kerning Information + P_C Composite Character Data (since t1lib V.1.2) + The P_G flag to get global font information should not be used + if not absolutely needed. When parsing an unknown keyword, which + may be harmless, the T1lib_parseFile function returns the error code + -1 (parseError). On the other hand, all other really relevant + data may habe been parsed and stored correctly. In such a case, + There's no way to make a serious decision whether an error has + occured or not. + */ + if (open_sloppy!=0) + i=T1lib_parseFile( (FILE *) metricsfile, + (FontInfo **) &(FontBase.pFontArray[FontID].pAFMData), + P_M ); + else + i=T1lib_parseFile( (FILE *) metricsfile, + (FontInfo **) &(FontBase.pFontArray[FontID].pAFMData), + P_G | P_M | P_P | P_C ); + fclose(metricsfile); + return(i); +} + + + +/* CreateNewFontSize( FontID, size): Create a new size "size" of font + "FontID" and allocate all data necessary for this. The data + structure is connected to the linked list of FontSizeDeps for this + font. Returns a pointer to the newly created FontSizeDeps-struct + if all went correct and NULL otherwise. + Since of version 0.3 a member antialias has been added to the + FONTSIZEDEPS structure! This can be: + + 0: bitmaps are stored in this struct + 1: non-antialiased bytemaps are stored in this struct + 2: low-antialiased bytemaps are stored in this struct + 4: high-antialiased bytemaps are stored in this struct + */ +FONTSIZEDEPS *CreateNewFontSize( int FontID, float size, int aa) +{ + + FONTSIZEDEPS *pFontSizeDeps, *pPrev; + + + /* First, get to the last font size in the linked list for this font. + The following routine returns the address of the last struct in the + linked list of FONTSIZEDEPS or NULL if none exists. */ + pFontSizeDeps=GetLastFontSize( FontID); + pPrev=pFontSizeDeps; + + + if (pFontSizeDeps==NULL){ + /* Allocate memory for first FontSizeDeps-structure: */ + if ((pFontBase->pFontArray[FontID].pFontSizeDeps=(FONTSIZEDEPS *)malloc(sizeof(FONTSIZEDEPS)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + pFontSizeDeps=pFontBase->pFontArray[FontID].pFontSizeDeps; + } + else{ + /* A valid address of an existing structure was found */ + if ((pFontSizeDeps->pNextFontSizeDeps=(FONTSIZEDEPS *)malloc(sizeof(FONTSIZEDEPS)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + pFontSizeDeps=pFontSizeDeps->pNextFontSizeDeps; + } + + /* The pointer to the previous struct */ + pFontSizeDeps->pPrevFontSizeDeps=pPrev; + /* Put the size into this structure */ + pFontSizeDeps->size=size; + /* Set the antialias mark: */ + pFontSizeDeps->antialias=aa; + + /* Just the current becomes now the last item in the linked list: */ + pFontSizeDeps->pNextFontSizeDeps=NULL; + /* Setup CharSpaceMatrix for this font: */ + pFontSizeDeps->pCharSpaceLocal=(struct XYspace *) IDENTITY; + /* Apply transformation with font matrix: */ + pFontSizeDeps->pCharSpaceLocal=(struct XYspace *) + Transform(pFontSizeDeps->pCharSpaceLocal, + pFontBase->pFontArray[FontID].FontMatrix[0], + pFontBase->pFontArray[FontID].FontMatrix[1], + pFontBase->pFontArray[FontID].FontMatrix[2], + pFontBase->pFontArray[FontID].FontMatrix[3]); + /* Apply a further transformation (optionally): */ + pFontSizeDeps->pCharSpaceLocal=(struct XYspace *) + Transform(pFontSizeDeps->pCharSpaceLocal, + pFontBase->pFontArray[FontID].FontTransform[0], + pFontBase->pFontArray[FontID].FontTransform[1], + pFontBase->pFontArray[FontID].FontTransform[2], + pFontBase->pFontArray[FontID].FontTransform[3]); + /* Apply desired scaling factor, and make it Permanent */ + pFontSizeDeps->pCharSpaceLocal=(struct XYspace *) Permanent + (Scale(pFontSizeDeps->pCharSpaceLocal, size, size)); + + /* We should now allocate memory for the glyph area of the font + cache: */ + if ((pFontSizeDeps->pFontCache=(GLYPH *)calloc(256,sizeof(GLYPH))) + ==NULL) + return(NULL); + + sprintf( err_warn_msg_buf, "New Size %f created for FontID %d (antialias=%d)", + pFontSizeDeps->size, FontID, pFontSizeDeps->antialias); + T1_PrintLog( "CreateNewFontSize()", err_warn_msg_buf, T1LOG_STATISTIC); + /* We are done */ + return(pFontSizeDeps); + +} + + + + +/* QueryFontSize( FontID, size, aa): Search if a requested size of font + FontID is already existing. If so, it returns a pointer to the + respective FontSizeDeps-structure, otherwise NULL is returned: */ +FONTSIZEDEPS *QueryFontSize( int FontID, float size, int aa) +{ + + FONTSIZEDEPS *link_ptr; + + + /* There's not yet one size: */ + if (pFontBase->pFontArray[FontID].pFontSizeDeps == NULL) + return(pFontBase->pFontArray[FontID].pFontSizeDeps); + + + /* There's already existing one or more size */ + link_ptr=pFontBase->pFontArray[FontID].pFontSizeDeps; + + while (((link_ptr->size != size)||(link_ptr->antialias != aa)) + &&(link_ptr->pNextFontSizeDeps != NULL)) + link_ptr=link_ptr->pNextFontSizeDeps; + + if ((link_ptr->size != size)||(link_ptr->antialias != aa)) + return( NULL); /* requested size/aa-combination was not found */ + else + return(link_ptr); /* return pointer to requested struct */ + +} + +/* FONTSIZEDEPS *GetLastFontSize( FontID): Get the address of the + last struct in the linked list of FontSizeDeps or NULL if there is + no existing size dependent data. */ +FONTSIZEDEPS *GetLastFontSize( int FontID) +{ + FONTSIZEDEPS *link_ptr, *result_ptr; + + + /* There's not yet one size: */ + if (pFontBase->pFontArray[FontID].pFontSizeDeps == NULL) + return((FONTSIZEDEPS *) (pFontBase->pFontArray[FontID].pFontSizeDeps)); + + + /* There's already existing one or more size */ + link_ptr=pFontBase->pFontArray[FontID].pFontSizeDeps; + + while (link_ptr != NULL){ + result_ptr=link_ptr; + link_ptr=link_ptr->pNextFontSizeDeps; + } + + return((FONTSIZEDEPS *)(result_ptr)); +} + + +/* A function for comparing METRICS_ENTRY structs */ +static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2) +{ + if (((METRICS_ENTRY *)entry1)->chars < + ((METRICS_ENTRY *)entry2)->chars) + return(-1); + if (((METRICS_ENTRY *)entry1)->chars > + ((METRICS_ENTRY *)entry2)->chars) + return(1); + return(0); /* This should not happen */ +} + + diff -Naur xdvik-22.40l/libs/t1lib/t1load.h xdvik-22.40n/libs/t1lib/t1load.h --- xdvik-22.40l/libs/t1lib/t1load.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1load.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,48 @@ +/*-------------------------------------------------------------------------- + ----- File: t1load.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + declarations and definitions for t1load.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independ from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#ifdef T1LOAD_C + +int T1_LoadFont( int FontID); +static int openFontMetricsFile( int FontID, int open_sloppy); +FONTSIZEDEPS *CreateNewFontSize( int FontID, float size, int aa); +FONTSIZEDEPS *GetLastFontSize( int FontID); +FONTSIZEDEPS *QueryFontSize( int FontID, float size, int aa); +int fontfcnA( char *env, int *mode, psfont *Font_Ptr); +static int cmp_METRICS_ENTRY( const void *entry1, const void *entry2); +extern char *vm_base; /* from fontfcn.c in initfont()! */ +extern char *vm_used; /* from fontfcn.c in fontfcnA()! */ + +#else + +extern int T1_LoadFont( int FontID); +extern FONTSIZEDEPS *CreateNewFontSize( int FontID, float size, int aa); +extern FONTSIZEDEPS *GetLastFontSize( int FontID); +extern FONTSIZEDEPS *QueryFontSize( int FontID, float size, int aa); + +#endif diff -Naur xdvik-22.40l/libs/t1lib/t1misc.h xdvik-22.40n/libs/t1lib/t1misc.h --- xdvik-22.40l/libs/t1lib/t1misc.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1misc.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,212 @@ +/*-------------------------------------------------------------------------- + ----- File: t1misc.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-10-03 + ----- Description: This file is part of the t1-library. It contains + some miscellaneous definitions. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#include + +#define LINE_BUF 512 +#define BUF_SIZE 512 +#define NULLPTR (void *) 0 + + +/* t1lib-glyphs are padded to this value by default: */ +#define T1GLYPH_PAD 8 +#define T1GLYPH_BIT 0 +#define T1GLYPH_BYTE 0 +#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad)) + + +/* For debugging purposes: */ +#define SLEEP for(j=0; j<50; j++){for (k=0; k<65536; k++);} + + +#define KERN_FLAG 0x01 +#define LIGATURE_FLAG 0x02 + + +/* common 'yes'/'no' */ +#define T1_YES 0x1 +#define T1_NO 0x0 + + +/* The maximum length of a PostScript name of a font: */ +#define MAXPSNAMELEN 256 +#define MAXPATHLEN 1024 + +/* The default resolution used by the library */ +#define DEFAULT_RES 72.0 +#define BIGPOINTSPERINCH 72.0 + +/* Defaults for configuration file searching: */ +/* (Note: The directory where the global config will be located is + determined by configure at compile time) */ +#define T1_CONFIGFILENAME ".t1librc" +#define ENV_CONF_STRING "T1LIB_CONFIG" +#define GLOBAL_CONFIG_FILE "t1lib.config" +/* Directory separator is operating system dependent */ +#if defined(VMS) +# define DIRECTORY_SEP "]" +# define DIRECTORY_SEP_CHAR ']' +#elif defined(MSDOS) | defined(_WIN32) | defined(__EMX__) | defined(_MSC_VER) +# define DIRECTORY_SEP "\\" +# define DIRECTORY_SEP_CHAR '\\' +#else +# define DIRECTORY_SEP "/" +# define DIRECTORY_SEP_CHAR '/' +#endif +/* For EMX-, WIN32-, MSDOS-environment, we define the default path separator to + be ';' instead of ':' */ +#if defined(MSDOS) | defined(_WIN32) | defined(__EMX__) | defined(_MSC_VER) | defined(VMS) +#define PATH_SEP ";" +#define PATH_SEP_CHAR ';' +#else +#define PATH_SEP ":" +#define PATH_SEP_CHAR ':' +#endif +/* This non printable character is used internally */ +#define INTERNAL_PATH_SEP "\001" +#define INTERNAL_PATH_SEP_CHAR '\1' + + +/* Default name for t1lib-logfile: */ +#define ENV_LOG_STRING "T1LIB_LOGMODE" +#define T1_LOG_FILE "t1lib.log" +/* logfile levels: */ +#define T1LOG_ERROR 1 +#define T1LOG_WARNING 2 +#define T1LOG_STATISTIC 3 +#define T1LOG_DEBUG 4 + + +/* def's for T1_InitLib() */ +#define NO_LOGFILE 0x0 +#define LOGFILE 0x1 +#define IGNORE_FONTDATABASE 0x2 /* Default is to read database */ +#define IGNORE_CONFIGFILE 0x4 /* Default is to read config file */ +#define T1_AA_CACHING 0x8 /* Cache aa-bytes */ +#define T1_NO_AFM 0x10 /* Don't load AFM files or generate AFM data */ + + +/* How may ligatures a character may have at maximum: */ +#define MAX_LIGS 20 + + +/* The maximum number of gray-levels in antialiasing */ +#define AAMAXPLANES 17 +#define T1_AA_NONE 1 +#define T1_AA_LOW 2 +#define T1_AA_HIGH 4 + +/* The default limits for no/low/high AA */ +#define T1_AA_SMARTLIMIT1 20.0 +#define T1_AA_SMARTLIMIT2 60.0 + +/* How much to advance the number of FONTPRIVATE structures when + reallocating for new fonts? */ +#define ADVANCE_FONTPRIVATE 10 + +#define NO_ANTIALIAS 0 +#define ANTIALIAS 1 + + +/* #define's for manipulating searchpaths */ +#define T1_PFAB_PATH 0x01 +#define T1_AFM_PATH 0x02 +#define T1_ENC_PATH 0x04 +#define T1_FDB_PATH 0x08 +#define T1_APPEND_PATH 0x00 +#define T1_PREPEND_PATH 0x01 + + +/* #define's for character/string properties (not all implemented) */ +#define T1_DEFAULT 0x0000 +#define T1_UNDERLINE 0x0001 +#define T1_OVERLINE 0x0002 +#define T1_OVERSTRIKE 0x0004 +#define T1_DOUBLEOVERSTRIKE 0x0008 +#define T1_RIGHT_TO_LEFT 0x0010 +#define T1_SUBSCRIPT 0x0100 +#define T1_SUPERSCRIPT 0x0200 +#define T1_STROKED 0x1000 +#define T1_KERNING 0x2000 + + +/* Error handling: */ +/* These are from scanning a font file */ +#define T1ERR_SCAN_FONT_FORMAT -5 +#define T1ERR_SCAN_FILE_OPEN_ERR -4 +#define T1ERR_SCAN_OUT_OF_MEMORY -3 +#define T1ERR_SCAN_ERROR -2 +#define T1ERR_SCAN_FILE_EOF -1 +/* These are from generating paths */ +#define T1ERR_PATH_ERROR 1 +#define T1ERR_PARSE_ERROR 2 +#define T1ERR_TYPE1_ABORT 3 +/* These are from t1lib */ +#define T1ERR_INVALID_FONTID 10 +#define T1ERR_INVALID_PARAMETER 11 +#define T1ERR_OP_NOT_PERMITTED 12 +#define T1ERR_ALLOC_MEM 13 +#define T1ERR_FILE_OPEN_ERR 14 +#define T1ERR_UNSPECIFIED 15 +#define T1ERR_NO_AFM_DATA 16 +#define T1ERR_X11 17 +#define T1ERR_COMPOSITE_CHAR 18 + + +/* The info_flags meaning */ +#define AFM_SUCCESS (short)0x0001 +#define AFM_SLOPPY_SUCCESS (short)0x0002 +#define AFM_SELFGEN_SUCCESS (short)0x0004 +#define USES_STANDARD_ENCODING (short)0x0008 +#define FONT_NOCACHING (short)0x0100 + + +#ifndef PI +#define PI 3.1415927 +#endif + + +/* Flags to control the rasterizer */ +#define T1_IGNORE_FORCEBOLD 0x0001 +#define T1_IGNORE_FAMILYALIGNMENT 0x0002 +#define T1_IGNORE_HINTING 0x0004 + +#define T1_DEBUG_LINE 0x0100 +#define T1_DEBUG_REGION 0x0200 +#define T1_DEBUG_PATH 0x0400 +#define T1_DEBUG_FONT 0x0800 +#define T1_DEBUG_HINT 0x1000 + + +/* */ +#define DO_RASTER 0x1 +#define DO_NOT_RASTER 0x0 + + +/* this definition reports a character substitution from fontfcn */ +#define FF_NOTDEF_SUBST -1 diff -Naur xdvik-22.40l/libs/t1lib/t1outline.c xdvik-22.40n/libs/t1lib/t1outline.c --- xdvik-22.40l/libs/t1lib/t1outline.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1outline.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,766 @@ +/*-------------------------------------------------------------------------- + ----- File: t1outline.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-05-27 + ----- Description: This file is part of the t1-library. It contains + functions for getting glyph outline descriptions of + strings and characters. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1OUTLINE_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" +#include "../type1/paths.h" + + +#include "t1types.h" +#include "t1extern.h" +#include "t1set.h" +#include "t1load.h" +#include "t1finfo.h" +#include "t1misc.h" +#include "t1base.h" +#include "t1outline.h" + + +/* As a fall back */ +#ifndef T1_AA_TYPE16 +#define T1_AA_TYPE16 short +#endif +#ifndef T1_AA_TYPE32 +#define T1_AA_TYPE32 int +#endif + + +extern char *t1_get_abort_message( int number); +extern struct segment *Type1Line(psfont *env, struct XYspace *S, + float line_position, + float line_thickness, + float line_length); +extern struct segment *t1_Join( struct segment *path1, + struct segment *path2); +extern struct segment *CopyPath( struct segment *p); +extern void KillPath( struct segment *p); + + + + +/* T1_SetChar(...): Generate the bitmap for a character */ +T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode, float size, + T1_TMATRIX *transform) +{ + int i; + int mode; + T1_PATHSEGMENT *charpath; + struct XYspace *Current_S; + unsigned char ucharcode; + + + FONTSIZEDEPS *font_ptr; + FONTPRIVATE *fontarrayP; + + /* We don't implement underlining for characters, but the rasterer + implements it. Thus, we use a modflag of constant 0 */ + int modflag=0; + + + /* We return to this if something goes wrong deep in the rasterizer */ + if ((i=setjmp( stck_state))!=0) { + T1_errno=T1ERR_TYPE1_ABORT; + sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", + t1_get_abort_message( i)); + T1_PrintLog( "T1_GetCharOutline()", err_warn_msg_buf, + T1LOG_ERROR); + return( NULL); + } + + ucharcode=(unsigned char)charcode; + + + /* First, check for a correct ID */ + i=CheckForFontID(FontID); + if (i==-1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + /* if necessary load font into memory */ + if (i==0) + if (T1_LoadFont(FontID)) + return(NULL); + + /* Check for valid size */ + if (size<=0.0){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + fontarrayP=&(pFontBase->pFontArray[FontID]); + + /* font is now loaded into memory => + Check for size: */ + if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ + font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); + if (font_ptr==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + } + + /* Setup an appropriate charspace matrix. Note that the rasterizer + assumes vertical values with inverted sign! Transformation should + create a copy of the local charspace matrix which then still has + to be made permanent. */ + if (transform!=NULL) { + Current_S=(struct XYspace *) + Permanent(Scale(Transform (font_ptr->pCharSpaceLocal, + transform->cxx, - transform->cxy, + transform->cyx, - transform->cyy), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + else{ + Current_S=(struct XYspace *) + Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, + 1.0, 0.0, 0.0, -1.0), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + + + /* fnt_ptr now points to the correct FontSizeDeps-struct => + lets now raster the character */ + mode=0; + charpath=(T1_PATHSEGMENT *)fontfcnB( FontID, modflag, Current_S, + fontarrayP->pFontEnc, + ucharcode, &mode, + fontarrayP->pType1Data, + DO_NOT_RASTER); + KillSpace (Current_S); + + return((T1_OUTLINE *)charpath); +} + + + +/* T1_GetStringOutline(...): Generate the outline for a string of + characters */ +T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, + long spaceoff, int modflag, float size, + T1_TMATRIX *transform) +{ + int i; + int mode; + /* initialize this to NULL just to be on the safe side */ + T1_PATHSEGMENT *charpath = NULL; + struct XYspace *Current_S; + int *kern_pairs; /* use for accessing the kern pairs if kerning is + requested */ + int no_chars=0; /* The number of characters in the string */ + static int lastno_chars=0; + long spacewidth; /* This is given to fontfcnb_string() */ + + + FONTSIZEDEPS *font_ptr; + FONTPRIVATE *fontarrayP; + + static int *pixel_h_anchor_corr=NULL; + static int *flags=NULL; + + unsigned char *ustring; + + + /* We return to this if something goes wrong deep in the rasterizer */ + if ((i=setjmp( stck_state))!=0) { + T1_errno=T1ERR_TYPE1_ABORT; + sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", + t1_get_abort_message( i)); + T1_PrintLog( "T1_GetStringOutline()", err_warn_msg_buf, + T1LOG_ERROR); + return( NULL); + } + + /* force string elements into unsigned */ + ustring=(unsigned char*)string; + + /* First, check for a correct ID */ + i=CheckForFontID(FontID); + if (i==-1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + /* if necessary load font into memory */ + if (i==0) + if (T1_LoadFont(FontID)) + return(NULL); + + /* If no AFM info is present, we return an error */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return(NULL); + } + + /* Check for valid size */ + if (size<=0.0){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + fontarrayP=&(pFontBase->pFontArray[FontID]); + + /* font is now loaded into memory => + Check for size: */ + if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ + font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); + if (font_ptr==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + } + + /* Now comes string specific stuff: Get length of string and create an + array of integers where to store the bitmap positioning dimens: */ + if (len<0){ /* invalid length */ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + if (len==0) /* should be computed assuming "normal" 0-terminated string */ + no_chars=strlen(string); + else /* use value given on command line */ + no_chars=len; + + /* If necessary, allocate memory */ + if (no_chars>lastno_chars){ + if (pixel_h_anchor_corr!=NULL){ + free(pixel_h_anchor_corr); + } + if (flags!=NULL){ + free(flags); + } + + pixel_h_anchor_corr=(int *)calloc(no_chars, sizeof(int)); + flags=(int *)calloc(no_chars, sizeof(int)); + lastno_chars=no_chars; + } + else{ + /* Reset flags and position array */ + for (i=0; ipCharSpaceLocal, + transform->cxx, - transform->cxy, + transform->cyx, - transform->cyy), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + else{ + Current_S=(struct XYspace *) + Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, + 1.0, 0.0, 0.0, -1.0), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + + /* Compute the correct spacewidth value (in charspace units). The + value supplied by the user is interpreted as an offset in + char space units: + */ + spacewidth=T1_GetCharWidth(FontID,fontarrayP->space_position)+spaceoff; + + mode=0; + kern_pairs=(int *)calloc(no_chars, sizeof(int)); + if ((modflag & T1_KERNING)) + for (i=0; ipFontEnc, + (unsigned char *)string, + no_chars, &mode, + fontarrayP->pType1Data, + kern_pairs, spacewidth, + DO_NOT_RASTER); + KillSpace (Current_S); + + /* In all cases, free memory for kerning pairs */ + free(kern_pairs); + + /* fill the string_glyph-structure */ + if (mode != 0) { + sprintf( err_warn_msg_buf, "fontfcnB_string() set mode=%d", mode); + T1_PrintLog( "T1_GetStringOutline()", err_warn_msg_buf, T1LOG_WARNING); + T1_errno=mode; + /* make sure to get rid of path if it's there */ + if (charpath){ + KillRegion (charpath); + } + return(NULL); + } + if (charpath == NULL){ + T1_PrintLog( "T1_GetStringOutline()", "path=NULL returned by fontfcnB_string()", T1LOG_WARNING); + T1_errno=mode; + return(NULL); + } + + return( (T1_OUTLINE *)charpath); +} + + +/* T1_GetMoveOutline(...): Generate the "outline" for a movement + */ +T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag, + float size, T1_TMATRIX *transform) +{ + int i; + FONTSIZEDEPS *font_ptr; + struct segment *path, *tmppath; + struct XYspace *Current_S; + psfont *FontP; + float length; + + + /* We return to this if something goes wrong deep in the rasterizer */ + if ((i=setjmp( stck_state))!=0) { + T1_errno=T1ERR_TYPE1_ABORT; + sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", + t1_get_abort_message( i)); + T1_PrintLog( "T1_GetMoveOutline()", err_warn_msg_buf, + T1LOG_ERROR); + return( NULL); + } + + + /* First, check for a correct ID */ + i=CheckForFontID(FontID); + if (i==-1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + /* if necessary load font into memory */ + if (i==0) + if (T1_LoadFont(FontID)) + return(NULL); + + /* Check for valid size */ + if (size<=0.0){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + FontP=pFontBase->pFontArray[i].pType1Data; + + /* font is now loaded into memory => + Check for size: */ + if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ + font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); + if (font_ptr==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + } + + /* Setup an appropriate charspace matrix. Note that the rasterizer + assumes vertical values with inverted sign! Transformation should + create a copy of the local charspace matrix which then still has + to be made permanent. */ + if (transform!=NULL){ + Current_S=(struct XYspace *) + Permanent(Scale(Transform (font_ptr->pCharSpaceLocal, + transform->cxx, - transform->cxy, + transform->cyx, - transform->cyy), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + else{ + Current_S=(struct XYspace *) + Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, + 1.0, 0.0, 0.0, -1.0), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + + + path=(struct segment *)ILoc( Current_S, deltax, deltay); + + /* Take care for underlining and such */ + length=(float) deltax; + if (modflag & T1_UNDERLINE){ + tmppath=(struct segment *)Type1Line(FontP,Current_S, + pFontBase->pFontArray[FontID].UndrLnPos, + pFontBase->pFontArray[FontID].UndrLnThick, + length); + path=(struct segment *)Join(path,tmppath); + } + if (modflag & T1_OVERLINE){ + tmppath=(struct segment *)Type1Line(FontP,Current_S, + pFontBase->pFontArray[FontID].OvrLnPos, + pFontBase->pFontArray[FontID].OvrLnThick, + length); + path=(struct segment *)Join(path,tmppath); + } + if (modflag & T1_OVERSTRIKE){ + tmppath=(struct segment *)Type1Line(FontP,Current_S, + pFontBase->pFontArray[FontID].OvrStrkPos, + pFontBase->pFontArray[FontID].OvrStrkThick, + length); + path=(struct segment *)Join(path,tmppath); + } + + KillSpace( Current_S); + + return( (T1_OUTLINE *)path); + +} + + +/* T1_ConcatOutlines(): Concatenate two outline to one path */ +T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1, T1_OUTLINE *path2) +{ + + return( (T1_OUTLINE *) t1_Join( (struct segment *) path1, + (struct segment *) path2)); + +} + + +/* T1_ScaleOutline(): Scale an outline */ +T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale) +{ + struct segment *ipath; + + /* Step through the path list */ + ipath=(struct segment *)path; + + do { + if (ipath->type==LINETYPE){ + ipath->dest.x = (fractpel) (ipath->dest.x * scale); + ipath->dest.y = (fractpel) (ipath->dest.y * scale); + } + if (ipath->type==CONICTYPE){ + ((struct conicsegment *)ipath)->dest.x = + (fractpel) ((struct conicsegment *)ipath)->dest.x * scale; + ((struct conicsegment *)ipath)->dest.y = + (fractpel) ((struct conicsegment *)ipath)->dest.y * scale; + ((struct conicsegment *)ipath)->M.x = + (fractpel) ((struct conicsegment *)ipath)->M.x * scale; + ((struct conicsegment *)ipath)->M.y = + (fractpel) ((struct conicsegment *)ipath)->M.y * scale; + } + if (ipath->type==MOVETYPE){ + ipath->dest.x = (fractpel) (ipath->dest.x * scale); + ipath->dest.y = (fractpel) (ipath->dest.y * scale); + } + if (ipath->type==BEZIERTYPE){ + ((struct beziersegment *)ipath)->B.x = + (fractpel) (((struct beziersegment *)ipath)->B.x * scale); + ((struct beziersegment *)ipath)->B.y = + (fractpel) (((struct beziersegment *)ipath)->B.y * scale); + ((struct beziersegment *)ipath)->C.x = + (fractpel) (((struct beziersegment *)ipath)->C.x * scale); + ((struct beziersegment *)ipath)->C.y = + (fractpel) (((struct beziersegment *)ipath)->C.y * scale); + ((struct beziersegment *)ipath)->dest.x = + (fractpel) (((struct beziersegment *)ipath)->dest.x * scale); + ((struct beziersegment *)ipath)->dest.y = + (fractpel) (((struct beziersegment *)ipath)->dest.y * scale); + } + if (ipath->type==HINTTYPE){ + ((struct hintsegment *)ipath)->dest.x = + (fractpel) (((struct hintsegment *)ipath)->dest.x * scale); + ((struct hintsegment *)ipath)->dest.y = + (fractpel) (((struct hintsegment *)ipath)->dest.y * scale); + ((struct hintsegment *)ipath)->ref.x = + (fractpel) (((struct hintsegment *)ipath)->ref.x * scale); + ((struct hintsegment *)ipath)->ref.y = + (fractpel) (((struct hintsegment *)ipath)->ref.y * scale); + ((struct hintsegment *)ipath)->width.x = + (fractpel) (((struct hintsegment *)ipath)->width.x * scale); + ((struct hintsegment *)ipath)->width.y = + (fractpel) (((struct hintsegment *)ipath)->width.y * scale); + } + if (ipath->type==TEXTTYPE) + ; + ipath=ipath->link; + + } while (ipath!=NULL); + + return( path); + +} + + +/* dump a description of path elements to stdout */ +void T1_DumpPath( T1_OUTLINE *path) +{ + + struct segment *ipath; + + /* Step through the path list */ + ipath=(struct segment *)path; + + do { + if (ipath->type==LINETYPE){ + printf("Line-Segment: -> (%f,%f)\n", + (ipath->dest.x)/(double)(0xFFFF), + -(ipath->dest.y)/(double)(0xFFFF)); + } + if (ipath->type==MOVETYPE){ + printf("Move-Segment: -> (%f,%f)\n", + (ipath->dest.x)/(double)(0xFFFF), + -(ipath->dest.y)/(double)(0xFFFF)); + } + if (ipath->type==BEZIERTYPE){ + printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n", + (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF), + (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF), + (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF)); + } + ipath=ipath->link; + } while (ipath!=NULL); + +} + + +/* convert a relative path to an absolute path */ +void T1_AbsolutePath( T1_OUTLINE *rpath) +{ + + struct segment *ipath; + fractpel xcurr=0, ycurr=0; + + /* Step through the path list */ + ipath=(struct segment *)rpath; + + do { + if (ipath->type==LINETYPE){ + ipath->dest.x +=xcurr; + ipath->dest.y +=ycurr; +#ifdef PRINT_PATHS_TO_STDOUT + printf("Line-Segment: -> (%f,%f)\n", + (ipath->dest.x)/(double)(0xFFFF), + -(ipath->dest.y)/(double)(0xFFFF)); +#endif + xcurr=ipath->dest.x; + ycurr=ipath->dest.y; + } + if (ipath->type==MOVETYPE){ + ipath->dest.x +=xcurr; + ipath->dest.y +=ycurr; +#ifdef PRINT_PATHS_TO_STDOUT + printf("Move-Segment: -> (%f,%f)\n", + (ipath->dest.x)/(double)(0xFFFF), + -(ipath->dest.y)/(double)(0xFFFF)); +#endif + xcurr=ipath->dest.x; + ycurr=ipath->dest.y; + } + if (ipath->type==BEZIERTYPE){ + ((struct beziersegment *)ipath)->B.x +=xcurr; + ((struct beziersegment *)ipath)->B.y +=ycurr; + ((struct beziersegment *)ipath)->C.x +=xcurr; + ((struct beziersegment *)ipath)->C.y +=ycurr; + ipath->dest.x +=xcurr; + ipath->dest.y +=ycurr; +#ifdef PRINT_PATHS_TO_STDOUT + printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n", + (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF), + (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF), + (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF)); +#endif + xcurr=ipath->dest.x; + ycurr=ipath->dest.y; + } + ipath=ipath->link; + } while (ipath!=NULL); + +} + + + +/* convert path into a relative path as needed by the rasterizer */ +void T1_RelativePath( T1_OUTLINE *apath) +{ + + struct segment *ipath; + fractpel xcurr=0, ycurr=0; + + + /* Step through the path list */ + ipath=(struct segment *)apath; + + do { + if (ipath->type==LINETYPE){ + ipath->dest.x -=xcurr; + ipath->dest.y -=ycurr; + xcurr +=ipath->dest.x; + ycurr +=ipath->dest.y; +#ifdef PRINT_PATHS_TO_STDOUT + printf("Line-Segment: -> (%f,%f), curr=(%f,%f)\n", + (ipath->dest.x)/(double)(0xFFFF), + -(ipath->dest.y)/(double)(0xFFFF), + xcurr/(double)(0xFFFF), -ycurr/(double)(0xFFFF)); +#endif + } + if (ipath->type==MOVETYPE){ + ipath->dest.x -=xcurr; + ipath->dest.y -=ycurr; + xcurr +=ipath->dest.x; + ycurr +=ipath->dest.y; +#ifdef PRINT_PATHS_TO_STDOUT + printf("Move-Segment: -> (%f,%f), curr=(%f,%f)\n", + (ipath->dest.x)/(double)(0xFFFF), + -(ipath->dest.y)/(double)(0xFFFF), + xcurr/(double)(0xFFFF), -ycurr/(double)(0xFFFF)); +#endif + } + if (ipath->type==BEZIERTYPE){ + ipath->dest.x -=xcurr; + ipath->dest.y -=ycurr; + ((struct beziersegment *)ipath)->C.x -=xcurr; + ((struct beziersegment *)ipath)->C.y -=ycurr; + ((struct beziersegment *)ipath)->B.x -=xcurr; + ((struct beziersegment *)ipath)->B.y -=ycurr; + xcurr +=ipath->dest.x; + ycurr +=ipath->dest.y; +#ifdef PRINT_PATHS_TO_STDOUT + printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n", + (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF), + (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF), + (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF)); +#endif + } + ipath=ipath->link; + } while (ipath!=NULL); + +} + + +/* maniuplate the coordinata points of a path */ +void T1_ManipulatePath( T1_OUTLINE *path, + void (*manipulate)(fractpel *x,fractpel *y,int type)) +{ + + struct segment *ipath; + + + /* Step through the path list */ + ipath=(struct segment *)path; + + do { + if (ipath->type==LINETYPE){ + manipulate( &(ipath->dest.x), &ipath->dest.y, LINETYPE); +#ifdef PRINT_PATHS_TO_STDOUT + printf("Line-Segment: -> (%f,%f)\n", + (ipath->dest.x)/(double)(0xFFFF), + -(ipath->dest.y)/(double)(0xFFFF)); +#endif + } + if (ipath->type==MOVETYPE){ + manipulate( &(ipath->dest.x), &ipath->dest.y, MOVETYPE); +#ifdef PRINT_PATHS_TO_STDOUT + printf("Move-Segment: -> (%f,%f)\n", + (ipath->dest.x)/(double)(0xFFFF), + -(ipath->dest.y)/(double)(0xFFFF)); +#endif + } + if (ipath->type==BEZIERTYPE){ + manipulate( &((struct beziersegment *)ipath)->B.x, + &((struct beziersegment *)ipath)->B.y, + BEZIERTYPE); + manipulate( &((struct beziersegment *)ipath)->C.x, + &((struct beziersegment *)ipath)->C.y, + BEZIERTYPE); + manipulate( &((struct beziersegment *)ipath)->dest.x, + &((struct beziersegment *)ipath)->dest.y, + BEZIERTYPE); +#ifdef PRINT_PATHS_TO_STDOUT + printf("Bezier-Segment: ... (%f,%f) ... (%f,%f) -> (%f,%f)\n", + (((struct beziersegment *)ipath)->B.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->B.y)/(double)(0xFFFF), + (((struct beziersegment *)ipath)->C.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->C.y)/(double)(0xFFFF), + (((struct beziersegment *)ipath)->dest.x)/(double)(0xFFFF), + -(((struct beziersegment *)ipath)->dest.y)/(double)(0xFFFF)); +#endif + } + ipath=ipath->link; + } while (ipath!=NULL); + +} + + + +/* T1_CopyOutline(): Copy an outline physically. + Returns a pointer to the path or NULL */ +T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path) +{ + + return( (T1_OUTLINE *) CopyPath( (struct segment *)path)); + +} + + + +/* T1_FreeOutline(): Free an outline. */ +void T1_FreeOutline( T1_OUTLINE *path) +{ + + KillPath( (struct segment *)path); + return; + +} + diff -Naur xdvik-22.40l/libs/t1lib/t1outline.h xdvik-22.40n/libs/t1lib/t1outline.h --- xdvik-22.40l/libs/t1lib/t1outline.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1outline.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,88 @@ +/*-------------------------------------------------------------------------- + ----- File: t1outline.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-05-27 + ----- Description: This file is part of the t1-library. It contains + definitions and declarations for t1outline.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#ifdef T1OUTLINE_C + +T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode, float size, + T1_TMATRIX *transform); +T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, + long spaceoff, int modflag, float size, + T1_TMATRIX *transform); +T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1, T1_OUTLINE *path2); +T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale); +T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag, + float size, T1_TMATRIX *transform); +void T1_DumpPath( T1_OUTLINE *path); +void T1_AbsolutePath( T1_OUTLINE *rpath); +void T1_RelativePath( T1_OUTLINE *apath); +void T1_ManipulatePath( T1_OUTLINE *path, + void (*manipulate)(fractpel *x,fractpel *y,int type)); +T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path); +void T1_FreeOutline( T1_OUTLINE *path); + + +#else + +extern T1_OUTLINE *T1_GetCharOutline( int FontID, char charcode, float size, + T1_TMATRIX *transform); +extern T1_OUTLINE *T1_GetStringOutline( int FontID, char *string, int len, + long spaceoff, int modflag, float size, + T1_TMATRIX *transform); +extern T1_OUTLINE *T1_ConcatOutlines( T1_OUTLINE *path1, + T1_OUTLINE *path2); +extern T1_OUTLINE *T1_ScaleOutline( T1_OUTLINE *path, float scale); +extern T1_OUTLINE *T1_GetMoveOutline( int FontID, int deltax, int deltay, int modflag, + float size, T1_TMATRIX *transform); +extern void T1_DumpPath( T1_OUTLINE *path); +extern void T1_AbsolutePath( T1_OUTLINE *rpath); +extern void T1_RelativePath( T1_OUTLINE *apath); +extern void T1_ManipulatePath( T1_OUTLINE *path, + void (*manipulate)(fractpel *x,fractpel *y,int type)); +extern T1_OUTLINE *T1_CopyOutline( T1_OUTLINE *path); +extern void T1_FreeOutline( T1_OUTLINE *path); + +#endif + + +extern struct region *fontfcnB(int FontID, int modflag, + struct XYspace *S, char **ev, + unsigned char index, int *mode, + psfont *Font_Ptr, + int do_raster); +extern struct region *fontfcnB_string( int FontID, int modflag, + struct XYspace *S, char **ev, + unsigned char *string, int no_chars, + int *mode, psfont *Font_Ptr, + int *kern_pairs, long spacewidth, + int do_raster); +extern struct region *fontfcnB_ByName( int FontID, int modflag, + struct XYspace *S, + char *charname, + int *mode, psfont *Font_Ptr, + int do_raster); + + diff -Naur xdvik-22.40l/libs/t1lib/t1set.c xdvik-22.40n/libs/t1lib/t1set.c --- xdvik-22.40l/libs/t1lib/t1set.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1set.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1904 @@ +/*-------------------------------------------------------------------------- + ----- File: t1set.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-05-27 + ----- Description: This file is part of the t1-library. It contains + functions for setting characters and strings of + characters. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1SET_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" + + +#include "t1types.h" +#include "t1extern.h" +#include "t1set.h" +#include "t1load.h" +#include "t1finfo.h" +#include "t1misc.h" +#include "t1base.h" + + +/* As a fall back */ +#ifndef T1_AA_TYPE16 +#define T1_AA_TYPE16 short +#endif +#ifndef T1_AA_TYPE32 +#define T1_AA_TYPE32 int +#endif + + +extern char *t1_get_abort_message( int number); +extern struct region *Interior(struct segment *path, int fillrule); +extern unsigned T1_AA_TYPE32 T1aa_bg; /* white value */ + + + +static int T1_bit=T1GLYPH_BIT; +static int T1_byte; +static int T1_pad; +static int T1_wordsize; + +static int c_shift=8; +static int s_shift=16; +static int l_shift=32; + + + +/* T1_SetChar(...): Generate the bitmap for a character */ +GLYPH *T1_SetChar( int FontID, char charcode, float size, + T1_TMATRIX *transform) +{ + int i; + int mode; + struct region *area; + struct XYspace *Current_S; + int cache_flag=1; + int rot_flag=0; + unsigned char ucharcode; + + + FONTSIZEDEPS *font_ptr; + FONTPRIVATE *fontarrayP; + + volatile int memsize=0; + LONG h,w; + LONG paddedW; + + /* We don't implement underlining for characters, but the rasterer + implements it. Thus, we use a modflag of constant 0 */ + int modflag=0; + + static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1}; + + + /* We return to this if something goes wrong deep in the rasterizer */ + if ((i=setjmp( stck_state))!=0) { + T1_errno=T1ERR_TYPE1_ABORT; + sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", + t1_get_abort_message( i)); + T1_PrintLog( "T1_SetChar()", err_warn_msg_buf, + T1LOG_ERROR); + return( NULL); + } + + ucharcode=(unsigned char)charcode; + + + /* Reset character glyph, if necessary */ + if (glyph.bits!=NULL){ + free(glyph.bits); + glyph.bits=NULL; + } + glyph.metrics.leftSideBearing=0; + glyph.metrics.rightSideBearing=0; + glyph.metrics.advanceX=0; + glyph.metrics.advanceY=0; + glyph.metrics.ascent=0; + glyph.metrics.descent=0; + glyph.pFontCacheInfo=NULL; + glyph.bpp=1; + + /* First, check for a correct ID */ + i=CheckForFontID(FontID); + if (i==-1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + /* if necessary load font into memory */ + if (i==0) + if (T1_LoadFont(FontID)) + return(NULL); + + /* Check for valid size */ + if (size<=0.0){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + /* Assign padding value */ + T1_pad=pFontBase->bitmap_pad; + if (pFontBase->endian) + T1_byte=1; + else + T1_byte=0; + T1_wordsize=T1_pad; + + fontarrayP=&(pFontBase->pFontArray[FontID]); + + /* Check if rotation is requested */ + if (transform!=NULL){ + /* there's rotation requested => do not cache the resulting bitmap */ + rot_flag=1; + cache_flag=0; + } + else { + rot_flag=0; + cache_flag=1; + } + /* font is now loaded into memory => + Check for size: */ + if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ + font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); + if (font_ptr==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + } + else {/* size is already existent in cache */ + /* If no rotation, try to get character from cache */ + if (rot_flag==0){ + /* we don't use the .bits entry to check because in newer releases + also white glyphs (bits=NULL) are allowed. Rather, we check + whether bpp > 0! */ + if (font_ptr->pFontCache[ucharcode].bpp > 0){ + /* Character is already in Chache -> create a copy of cache + and return a pointer to the result: */ + memcpy( &glyph, &(font_ptr->pFontCache[ucharcode]), sizeof(GLYPH)); + paddedW = PAD((glyph.metrics.rightSideBearing-glyph.metrics.leftSideBearing), + T1_pad); + if (font_ptr->pFontCache[ucharcode].bits!=NULL) { + memsize = (glyph.metrics.ascent-glyph.metrics.descent)*paddedW / 8; + glyph.bits = (char *)malloc(memsize*sizeof( char)); + if (glyph.bits == NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + memcpy( glyph.bits, font_ptr->pFontCache[ucharcode].bits, memsize); + } + return(&(glyph)); + } + } + } + /* Setup an appropriate charspace matrix. Note that the rasterizer + assumes vertical values with inverted sign! Transformation should + create a copy of the local charspace matrix which then still has + to be made permanent. */ + if (rot_flag){ + Current_S=(struct XYspace *) + Permanent(Scale(Transform (font_ptr->pCharSpaceLocal, + transform->cxx, - transform->cxy, + transform->cyx, - transform->cyy), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + else{ + Current_S=(struct XYspace *) + Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, + 1.0, 0.0, 0.0, -1.0), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + + /* fnt_ptr now points to the correct FontSizeDeps-struct => + lets now raster the character */ + mode=0; + area=fontfcnB( FontID, modflag, Current_S, + fontarrayP->pFontEnc, + ucharcode, &mode, + fontarrayP->pType1Data, + DO_RASTER); + KillSpace (Current_S); + + /* fill the glyph-structure */ + if (mode > 0) { + sprintf( err_warn_msg_buf, "fontfcnB() set mode=%d", mode); + T1_PrintLog( "T1_SetChar()", err_warn_msg_buf, T1LOG_WARNING); + T1_errno=mode; + return(NULL); + } + if (area == NULL){ + T1_PrintLog( "T1_SetChar()", "area=NULL returned by fontfcnB()", T1LOG_WARNING); + T1_errno=mode; + return(NULL); + } + h = area->ymax - area->ymin; + w = area->xmax - area->xmin; + + if (mode == FF_NOTDEF_SUBST) { + sprintf( err_warn_msg_buf, + "\".notdef\" substituted for character %d from font %d", + ucharcode, FontID); + T1_PrintLog( "T1_SetChar()", err_warn_msg_buf, T1LOG_WARNING); + mode=0; + } + + paddedW = PAD(w, T1_pad); + + if (h > 0 && w > 0) { + memsize = h * paddedW / 8 + 1; + /* This is for the users copy of the character, for security-reasons + the original pointer to the cache area is not used. The entry glyph.bits + is free'ed every time this function is called: */ + glyph.bits = (char *)malloc(memsize*sizeof( char)); + if (glyph.bits == NULL){ + T1_errno=T1ERR_ALLOC_MEM; + /* make sure to get rid of 'area' before leaving! */ + KillRegion (area); + return(NULL); + } + } + else { + h = w = 0; + area->xmin = area->xmax = 0; + area->ymin = area->ymax = 0; + } + + /* Assign metrics */ + glyph.metrics.leftSideBearing = area->xmin; + glyph.metrics.advanceX = NEARESTPEL(area->ending.x - area->origin.x); + glyph.metrics.advanceY = - NEARESTPEL(area->ending.y - area->origin.y); + glyph.metrics.rightSideBearing = area->xmax; + glyph.metrics.descent = - area->ymax; + glyph.metrics.ascent = - area->ymin; + + + if (h > 0 && w > 0) { + (void) memset(glyph.bits, 0, memsize); + fill(glyph.bits, h, paddedW, area, T1_byte, T1_bit, T1_wordsize ); + } + + /* make sure to get rid of 'area' before leaving! */ + KillRegion (area); + + /* Cache glyph if requested, also if it contains only white space */ + if (cache_flag){ + /* Copy glyph to cache but be careful not to modify the pixmap + entry */ + font_ptr->pFontCache[ucharcode].metrics.leftSideBearing=glyph.metrics.leftSideBearing; + font_ptr->pFontCache[ucharcode].metrics.rightSideBearing=glyph.metrics.rightSideBearing; + font_ptr->pFontCache[ucharcode].metrics.advanceX=glyph.metrics.advanceX; + font_ptr->pFontCache[ucharcode].metrics.advanceY=glyph.metrics.advanceY; + font_ptr->pFontCache[ucharcode].metrics.ascent=glyph.metrics.ascent; + font_ptr->pFontCache[ucharcode].metrics.descent=glyph.metrics.descent; + font_ptr->pFontCache[ucharcode].pFontCacheInfo=glyph.pFontCacheInfo; + font_ptr->pFontCache[ucharcode].bpp=glyph.bpp; + if (glyph.bits==NULL) { + font_ptr->pFontCache[ucharcode].bits=NULL; + } + else { + font_ptr->pFontCache[ucharcode].bits = (char *)malloc(memsize*sizeof( char)); + if (font_ptr->pFontCache[ucharcode].bits == NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + /* ... and copy bitmap to cache area: */ + memcpy( font_ptr->pFontCache[ucharcode].bits, glyph.bits, memsize); + } + + } + + + return(&glyph); +} + + + +/* T1_SetString(...): Generate the bitmap for a string of characters */ +GLYPH *T1_SetString( int FontID, char *string, volatile int len, + long spaceoff, int modflag, float size, + T1_TMATRIX *transform) +{ + volatile int i, j=0, k; + int mode; + /* initialize this to NULL just to be on the safe side */ + struct region *area = NULL; + struct XYspace *Current_S, *S; + int cache_flag=1; + volatile int rot_flag=0; + int *kern_pairs; /* use for accessing the kern pairs if kerning is + requested */ + int no_chars=0; /* The number of characters in the string */ + static int lastno_chars=0; + float factor; + long spacewidth; /* This is given to fontfcnb_string() */ + + + FONTSIZEDEPS *font_ptr; + FONTPRIVATE *fontarrayP; + + + volatile int memsize=0; + + long h,w; + long paddedW, char_paddedW; + int h_anchor, v_anchor; + static int *pixel_h_anchor_corr=NULL; + static int *flags=NULL; + int lsb_min, rsb_max; + long overallwidth=0; + long overallascent=0; + long overalldescent=0; + + int underline_startx, underline_starty, underline_endx, underline_endy; + int overline_startx, overline_starty, overline_endx, overline_endy; + int overstrike_startx, overstrike_starty, overstrike_endx, overstrike_endy; + int start, middle; + int afm_ind; + + char startmask, endmask; + static unsigned char *r2lstring; + static int r2l_len=0; + + static GLYPH string_glyph={NULL,{0,0,0,0,0,0},NULL,1}; + GLYPH *currchar; + + + + /* The following are for bitmap blitting */ + long BitShift; + long ByteOffset; + /* pad=8 */ + unsigned T1_AA_TYPE16 BitBuf_c; + unsigned char *p_c; + unsigned char *Target_c; + /* pad=16 */ + unsigned T1_AA_TYPE32 BitBuf_s; + unsigned T1_AA_TYPE16 *p_s; + unsigned T1_AA_TYPE16 *Target_s; +#ifdef T1_AA_TYPE64 + /* pad=32 */ + unsigned T1_AA_TYPE64 BitBuf_l; + unsigned T1_AA_TYPE32 *p_l; + unsigned T1_AA_TYPE32 *Target_l; +#endif + unsigned char *ustring; + + + /* We return to this if something goes wrong deep in the rasterizer */ + if ((i=setjmp( stck_state))!=0) { + T1_errno=T1ERR_TYPE1_ABORT; + sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", + t1_get_abort_message( i)); + T1_PrintLog( "T1_SetString()", err_warn_msg_buf, + T1LOG_ERROR); + return( NULL); + } + + /* force string elements into unsigned */ + ustring=(unsigned char*)string; + + + /* Check for valid string */ + if (string==NULL){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + /* Reorganize if required */ + if (modflag & T1_RIGHT_TO_LEFT){ + if (len) + i=len; + else + i=j=strlen( string); + if (i+1>r2l_len){ + if (r2lstring!=NULL) + free( r2lstring); + r2lstring=(unsigned char *)malloc( (i+1)*sizeof(char)); + r2l_len=i+1; + } + j--; + while ( i--) { + r2lstring[j-i]=ustring[i]; + } + ustring=r2lstring; + len=j+1; + } + + + /* Reset string glyph, if necessary */ + if (string_glyph.bits!=NULL){ + free(string_glyph.bits); + string_glyph.bits=NULL; + } + string_glyph.metrics.leftSideBearing=0; + string_glyph.metrics.rightSideBearing=0; + string_glyph.metrics.advanceX=0; + string_glyph.metrics.advanceY=0; + string_glyph.metrics.ascent=0; + string_glyph.metrics.descent=0; + string_glyph.pFontCacheInfo=NULL; + string_glyph.bpp=1; + + /* We don't want to cache the resulting bitmap: */ + cache_flag=0; + + /* First, check for a correct ID */ + i=CheckForFontID(FontID); + if (i==-1){ + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + /* if necessary load font into memory */ + if (i==0) + if (T1_LoadFont(FontID)) + return(NULL); + + /* If no AFM info is present, we return an error */ + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + T1_errno=T1ERR_NO_AFM_DATA; + return(NULL); + } + + /* Check for valid size */ + if (size<=0.0){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + /* Assign padding value */ + T1_pad=pFontBase->bitmap_pad; + if (pFontBase->endian) + T1_byte=1; + else + T1_byte=0; + T1_wordsize=T1_pad; + + fontarrayP=&(pFontBase->pFontArray[FontID]); + + /* Check if rotation is requested */ + if (transform!=NULL){ + /* there's rotation requested => do not cache the resulting bitmap */ + rot_flag=1; + cache_flag=0; + } + + /* font is now loaded into memory => + Check for size: */ + if ((font_ptr=QueryFontSize( FontID, size, NO_ANTIALIAS))==NULL){ + font_ptr=CreateNewFontSize( FontID, size, NO_ANTIALIAS); + if (font_ptr==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + } + + /* Now comes string specific stuff: Get length of string and create an + array of integers where to store the bitmap positioning dimens: */ + if (len<0){ /* invalid length */ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + if (len==0) /* should be computed assuming "normal" 0-terminated string, + or R2L-part has already been computed! */ + no_chars=strlen(string); + else /* use value given on command line */ + no_chars=len; + + /* If necessary, allocate memory */ + if (no_chars>lastno_chars){ + if (pixel_h_anchor_corr!=NULL){ + free(pixel_h_anchor_corr); + } + if (flags!=NULL){ + free(flags); + } + pixel_h_anchor_corr=(int *)calloc(no_chars, sizeof(int)); + flags=(int *)calloc(no_chars, sizeof(int)); + lastno_chars=no_chars; + } + else{ + /* Reset flags and position array */ + for (i=0; ipCharSpaceLocal, + transform->cxx, - transform->cxy, + transform->cyx, - transform->cyy), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + else{ + Current_S=(struct XYspace *) + Permanent(Scale(Transform(font_ptr->pCharSpaceLocal, + 1.0, 0.0, 0.0, -1.0), + DeviceSpecifics.scale_x, DeviceSpecifics.scale_y)); + } + + /* Compute the correct spacewidth value (in charspace units). The + value supplied by the user is interpreted as an offset in + char space units: + */ + spacewidth=T1_GetCharWidth(FontID,fontarrayP->space_position)+spaceoff; + + + /* The following if (rot_flag==0){ ... } contains the whole code + to execute when the string is oriented horizontal. Then, there's + the possibility of concatenating most probably existent bitmaps + from the Cache, which should be much faster than every time raster + all the characters. + */ + /* First, ensure that all needed characters are in the Cache; if not, + generate them */ + if ((rot_flag==0)){ + overallwidth=0; + for (i=0; ipFontCache[ustring[i]]); + if (currchar->bpp<1) { + flags[i]=0; + mode=0; + /* Don't try to generate space-character: */ + if (ustring[i]!=fontarrayP->space_position){ + /* Note: Never underline etc. cached chars --> modflag=0 */ + area=fontfcnB( FontID, 0, Current_S, + fontarrayP->pFontEnc, + ustring[i], &mode, + fontarrayP->pType1Data, + DO_RASTER); + + /* fill the glyph-structure */ + if (mode > 0) { + sprintf( err_warn_msg_buf, "fontfcnB() set mode=%d", mode); + T1_PrintLog( "T1_SetString()", err_warn_msg_buf, T1LOG_WARNING); + T1_errno=mode; + /* Make sure to free the region if it's non-NULL */ + if (area){ + KillRegion (area); + } + return(NULL); + } + if (area == NULL){ + T1_PrintLog( "T1_SetString()", "area=NULL returned by fontfcnB()", T1LOG_WARNING); + T1_errno=mode; + return(NULL); + } + + if (mode == FF_NOTDEF_SUBST) { + sprintf( err_warn_msg_buf, + "\".notdef\" substituted in string[%d] (=character %d) from font %d", + i, ustring[i], FontID); + T1_PrintLog( "T1_SetString()", err_warn_msg_buf, T1LOG_WARNING); + mode=0; + flags[i]=1; /* indicates that .notdef has been substituted */ + } + + h = area->ymax - area->ymin; + w = area->xmax - area->xmin; + + if (h > 0 && w > 0) { /* bitmap contains pixels */ + paddedW = PAD(w, T1_pad); + memsize = h * paddedW / 8 + 1; + currchar->bits = (char *)malloc(memsize*sizeof( char)); + if (currchar->bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + /* Make sure to free up the region if it's non-NULL */ + if (area){ + KillRegion (area); + } + return(NULL); + } + (void) memset(currchar->bits, 0, memsize); + fill(currchar->bits, h, paddedW, area, + T1_byte, T1_bit, T1_wordsize ); + } + /* area valid -> set metrics in cache for that character */ + currchar->metrics.leftSideBearing = area->xmin; + currchar->metrics.advanceX = NEARESTPEL(area->ending.x - area->origin.x); + currchar->metrics.advanceY = - NEARESTPEL(area->ending.y - area->origin.y); + currchar->metrics.rightSideBearing = area->xmax; + currchar->metrics.descent = - area->ymax; + currchar->metrics.ascent = - area->ymin; + currchar->bpp=1; + + /* By this point, it's clear that the 'area' struct exists, + and that we no longer need it, so free it up. */ + KillRegion (area); + } + } /* end of if ( ... ), needed characters are now in cache! */ + } /* end of for (ipFontArray[FontID].pEncMap[(int) ustring[i]]; + /* Advance to next character in high resolution */ + if (ustring[i]==fontarrayP->space_position) + h_anchor +=(int)spacewidth; + /* check for a substituted char or notdef and get missing escapement */ + else if (afm_ind==0) { + /* Setup apropriate charspace matrix */ + S=(struct XYspace *)IDENTITY; + /* Make this permanent so that scaling it in fontfcnB_ByName will + make a duplicate of it, and this duplicate can thus be safely + destroyed. Fixes the somewhat smaller memory leak */ + S=(struct XYspace *)Permanent + (Transform(S, pFontBase->pFontArray[FontID].FontTransform[0], + pFontBase->pFontArray[FontID].FontTransform[1], + pFontBase->pFontArray[FontID].FontTransform[2], + pFontBase->pFontArray[FontID].FontTransform[3])); + /* Get metrics values */ + area=fontfcnB_ByName( FontID, 0, S, ".notdef", &mode, + pFontBase->pFontArray[FontID].pType1Data, DO_RASTER); + if (area==NULL || mode!=0){ + sprintf( err_warn_msg_buf, + "Could not get charspace representation of \".notdef\", Font %d, mode=%d!", + FontID, mode); + T1_PrintLog( "T1_SetString()", err_warn_msg_buf, + T1LOG_ERROR); + T1_errno=mode; + return( NULL); + } + /* value to add to hanchor */ + h_anchor +=NEARESTPEL(area->ending.x); + /* make sure to free S */ + if (S) { + KillSpace (S); + } + /* make sure to free area */ + if (area) { + KillRegion (area); + } + } + else{ + currchar=&(font_ptr->pFontCache[ustring[i]]); + pixel_h_anchor_corr[i]=((int)floor(h_anchor*factor+0.5)); + /* Store maximum rsb ...*/ + if ( pixel_h_anchor_corr[i]+currchar->metrics.rightSideBearing > rsb_max){ + rsb_max=pixel_h_anchor_corr[i]+currchar->metrics.rightSideBearing; + } + /* ... and minimum lsb */ + if ( pixel_h_anchor_corr[i]+currchar->metrics.leftSideBearing < lsb_min){ + lsb_min=pixel_h_anchor_corr[i]+currchar->metrics.leftSideBearing; + } + /* Advance by current chars width */ + /* h_anchor +=T1_GetCharWidth( FontID, ustring[i]); */ + if (afm_ind>0) { /* we have a standard character */ + h_anchor +=(fontarrayP->pAFMData->cmi[afm_ind-1].wx) * fontarrayP->extend; + } + else { /* afm_ind must be negative so that we have a composite char */ + h_anchor +=(fontarrayP->pAFMData->ccd[-(afm_ind+1)].wx) * fontarrayP->extend; + } + /* If kerning, insert kerning amount */ + if ((imetrics.ascent>overallascent) + overallascent=currchar->metrics.ascent; + if (currchar->metrics.descentmetrics.descent; + } + } + string_glyph.metrics.advanceX=(int)floor(h_anchor*factor+0.5); + + /* We have to check for underlining and such things. They may affect the + bounding box of the glyph */ + if (modflag & T1_UNDERLINE){ + T1_ComputeLineParameters( FontID, T1_UNDERLINE, + string_glyph.metrics.advanceX, + size, + &underline_startx, &underline_endx, + &underline_starty, &underline_endy); + /* Check whether rsb is affected ...*/ + if ( underline_endx > rsb_max){ + rsb_max=underline_endx; + } + /* ... and for lsb */ + if ( underline_startx < lsb_min){ + lsb_min=underline_startx; + } + + /* Vertical metrics may also be affected. */ + if (underline_starty > overallascent) + overallascent=underline_starty; + if (underline_endy < overalldescent) + overalldescent=underline_endy; + } + if (modflag & T1_OVERLINE){ + T1_ComputeLineParameters( FontID, T1_OVERLINE, + string_glyph.metrics.advanceX, + size, + &overline_startx, &overline_endx, + &overline_starty, &overline_endy); + /* Check whether rsb is affected ...*/ + if ( overline_endx > rsb_max){ + rsb_max=overline_endx; + } + /* ... and for lsb */ + if ( overline_startx < lsb_min){ + lsb_min=overline_startx; + } + + /* Vertical metrics may also be affected. */ + if (overline_starty > overallascent) + overallascent=overline_starty; + if (overline_endy < overalldescent) + overalldescent=overline_endy; + } + if (modflag & T1_OVERSTRIKE){ + T1_ComputeLineParameters( FontID, T1_OVERSTRIKE, + string_glyph.metrics.advanceX, + size, + &overstrike_startx, &overstrike_endx, + &overstrike_starty, &overstrike_endy); + /* Check whether rsb is affected ...*/ + if ( overstrike_endx > rsb_max){ + rsb_max=overstrike_endx; + } + /* ... and for lsb */ + if ( overstrike_startx < lsb_min){ + lsb_min=overstrike_startx; + } + + /* Vertical metrics may also be affected. */ + if (overstrike_starty > overallascent) + overallascent=overstrike_starty; + if (overstrike_endy < overalldescent) + overalldescent=overstrike_endy; + } + + + + /* Set the string-glyphs' metrics: */ + /* Bearings: */ + string_glyph.metrics.rightSideBearing=rsb_max; + string_glyph.metrics.leftSideBearing=lsb_min; + /* ascent and descent: */ + string_glyph.metrics.ascent=overallascent; + string_glyph.metrics.descent=overalldescent; + + + + /* Now, allocate memory for the resulting bitmap and set it to 0: */ + h=overallascent - overalldescent; + w=string_glyph.metrics.rightSideBearing-string_glyph.metrics.leftSideBearing; + + paddedW = PAD( w, T1_pad); + if ( h > 0 && w > 0){ + memsize = h * paddedW / 8; + /* We alloc some amount more in order to avoid alignment check in + bit-blitting loop */ + memsize += T1_pad/8; + string_glyph.bits = (char *)malloc( memsize); + if (string_glyph.bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + } + else { + /* We have only characters without pixels in the string -> + we allow this and only set the advance width in the glyph. + The bits pointer will be NULL. We reset rsb and lsb */ + string_glyph.metrics.rightSideBearing=0; + string_glyph.metrics.leftSideBearing=0; + string_glyph.metrics.ascent=0; + string_glyph.metrics.descent=0; + } + + if (string_glyph.bits != NULL) { + + memset(string_glyph.bits, 0, memsize); + + /* Now comes the loop for bitmap blitting: */ + for (i=0;ipFontCache[ustring[i]]); + + /* First, we have to correct the positioning values to refer to + the bitmap BBox */ + pixel_h_anchor_corr[i] -= lsb_min; + pixel_h_anchor_corr[i] += currchar->metrics.leftSideBearing; + + /* Compute vertical anchor for current char-bitmap: */ + v_anchor=overallascent - currchar->metrics.ascent; + char_paddedW=PAD( currchar->metrics.rightSideBearing + - currchar->metrics.leftSideBearing , T1_pad); + /* We have to check for Big Endian. In that case, we have to + act on byte-level */ + if (T1_byte){ + BitShift = pixel_h_anchor_corr[i] % 8; + ByteOffset = pixel_h_anchor_corr[i] / 8; + } + else { + BitShift = pixel_h_anchor_corr[i] % T1_pad; + ByteOffset = pixel_h_anchor_corr[i] / T1_pad; + if (T1_pad==32) + ByteOffset *=4; + else if (T1_pad==16) + ByteOffset *=2; + } +#ifdef T1_AA_TYPE64 + /* We compile this part only if long is 64 bits to be conform to ANSI C */ + if (T1_pad==32 && T1_byte==0){ + /* The following loop steps through the lines of the character bitmap: */ + for (j=0;jmetrics.ascent-currchar->metrics.descent;j++){ + Target_l= (unsigned T1_AA_TYPE32 *)(string_glyph.bits +((v_anchor+j)*paddedW/8) + +ByteOffset); + /* The following loop copies the scanline of a character bitmap: */ + if (currchar->bits != NULL) { + p_l = (unsigned T1_AA_TYPE32 *)(currchar->bits+(char_paddedW/8*j)); + if (BitShift == 0) { + for (k=char_paddedW >> 5; k; k--) + *Target_l++ |= *p_l++; + } else { + for (k=0; k < char_paddedW / 32 ; k++){ + BitBuf_l= ((T1_AA_TYPE64)(*p_l++)) << BitShift; + *Target_l++ |= BitBuf_l; + *Target_l |= BitBuf_l>>l_shift; + } /* End of for ( .. ) stepping through columns */ + } + } /* End of if(currchar->bits != NULL) */ + } /* End of for( .. ) steppin' through lines of char bitmap */ + }/* end if (T1_pad==32) */ + else +#endif + if (T1_pad==16 && T1_byte==0){ + /* The following loop steps through the lines of the character bitmap: */ + for (j=0;jmetrics.ascent-currchar->metrics.descent;j++){ + Target_s= (unsigned T1_AA_TYPE16 *)(string_glyph.bits +((v_anchor+j)*paddedW/8) + +ByteOffset); + /* The following loop copies the scanline of a character bitmap: */ + if (currchar->bits != NULL) { + p_s = (unsigned T1_AA_TYPE16 *)(currchar->bits+(char_paddedW/8*j)); + if (BitShift == 0) { + for (k=char_paddedW >> 4; k; k--) + *Target_s++ |= *p_s++; + } + else{ + for (k=char_paddedW >> 4; k; k--){ + BitBuf_s= ((T1_AA_TYPE32)(*p_s++))<>s_shift; + } /* End of for ( .. ) stepping through columns */ + } + } /* End of if(currchar->bits != NULL) */ + } /* End of for( .. ) steppin' through lines of char bitmap */ + }/* end if (T1_pad==16 */ + else{ /* T1_pad = 8 or Big Endian machine */ + /* The following loop steps through the lines of the character bitmap: */ + for (j=0;jmetrics.ascent-currchar->metrics.descent;j++){ + Target_c= (unsigned char *)(string_glyph.bits +((v_anchor+j)*paddedW/8) + +ByteOffset); + /* The following loop copies the scanline of a character bitmap: */ + if (currchar->bits != NULL) { + p_c = (unsigned char *)(currchar->bits+(char_paddedW/8*j)); + if (BitShift == 0){ + for (k=char_paddedW >> 3; k; k--) + *Target_c++ |= *p_c++; + } + else{ + for (k=char_paddedW >> 3; k; k--){ + BitBuf_c = ((T1_AA_TYPE16)(*p_c++)) << BitShift; + *Target_c++ |= BitBuf_c; + *Target_c |= BitBuf_c>>c_shift; + } /* End of for ( .. ) stepping through columns */ + } + } /* End of if(currchar->bits != NULL) */ + } /* End of for( .. ) steppin' through lines of char bitmap */ + } /* end if (T1_pad==8) and/or BigEndian */ + } + } /* if (string_glyph.bits != NULL) */ + + + /* We now put the underlining rule on the glyph */ + if (modflag & T1_UNDERLINE){ + start=-string_glyph.metrics.leftSideBearing; + for (i=string_glyph.metrics.ascent-underline_starty; + islant+0.5); + middle = ((start+string_glyph.metrics.advanceX) / 8) - (start / 8); + startmask = 0xFF << (start % 8); + endmask = (char) ~(0xFF << ((start+string_glyph.metrics.advanceX) % 8)); + Target_c= (unsigned char *)(string_glyph.bits +(i*paddedW/8) + + (start / 8)); + j=middle; + if (j == 0) + *Target_c++ |= startmask & endmask; + else { + *Target_c++ |= startmask; + while (--j > 0) + *Target_c++ = (unsigned char) 0xFF; + if ((endmask)) + *Target_c |= endmask; + } + } + } + /* Put an overstrike rule on the glyph */ + if (modflag & T1_OVERSTRIKE){ + start=-string_glyph.metrics.leftSideBearing; + for (i=string_glyph.metrics.ascent-overstrike_starty; + islant+0.5); + middle = ((start+string_glyph.metrics.advanceX) / 8) - (start / 8); + startmask = 0xFF << (start % 8); + endmask = (char) ~(0xFF << ((start+string_glyph.metrics.advanceX) % 8)); + Target_c= (unsigned char *)(string_glyph.bits +(i*paddedW/8) + + (start / 8)); + j=middle; + if (j == 0) + *Target_c++ |= startmask & endmask; + else { + *Target_c++ |= startmask; + while (--j > 0) + *Target_c++ = (unsigned char) 0xFF; + if ((endmask)) + *Target_c |= endmask; + } + } + } + /* Put an overline rule */ + if (modflag & T1_OVERLINE){ + start=-string_glyph.metrics.leftSideBearing; + for (i=string_glyph.metrics.ascent-overline_starty; + islant+0.5); + middle = ((start+string_glyph.metrics.advanceX) / 8) - (start / 8); + startmask = 0xFF << (start % 8); + endmask = (char) ~(0xFF << ((start+string_glyph.metrics.advanceX) % 8)); + Target_c= (unsigned char *)(string_glyph.bits +(i*paddedW/8) + + (start / 8)); + j=middle; + if (j == 0) + *Target_c++ |= startmask & endmask; + else { + *Target_c++ |= startmask; + while (--j > 0) + *Target_c++ = (unsigned char) 0xFF; + if ((endmask)) + *Target_c |= endmask; + } + } + } + + /* Check for writing direction and re-compute dimensions appropriately: */ + if (modflag & T1_RIGHT_TO_LEFT){ + string_glyph.metrics.advanceX *= -1; + string_glyph.metrics.leftSideBearing += string_glyph.metrics.advanceX; + string_glyph.metrics.rightSideBearing += string_glyph.metrics.advanceX; + } + + return(&string_glyph); + } /* end of "if (rot_flag==0.0)" */ + + + /* fnt_ptr now points to the correct FontSizeDeps-struct => + lets now raster the character */ + mode=0; + kern_pairs=(int *)calloc(no_chars, sizeof(int)); + if ((modflag & T1_KERNING)) + for (i=0; ipFontEnc, + ustring, no_chars, &mode, + fontarrayP->pType1Data, + kern_pairs, spacewidth, + DO_RASTER); + KillSpace (Current_S); + + /* In all cases, free memory for kerning pairs */ + free(kern_pairs); + + /* fill the string_glyph-structure */ + if (mode > 0) { + sprintf( err_warn_msg_buf, "fontfcnB() set mode=%d", mode); + T1_PrintLog( "T1_SetString()", err_warn_msg_buf, T1LOG_WARNING); + T1_errno=mode; + /* make sure to get rid of area if it's there */ + if (area){ + KillRegion (area); + } + return(NULL); + } + if (area == NULL){ + T1_PrintLog( "T1_SetString()", "area=NULL returned by fontfcnB()", T1LOG_WARNING); + T1_errno=mode; + return(NULL); + } + + if (mode == FF_NOTDEF_SUBST) { + sprintf( err_warn_msg_buf, + "\".notdef\" substituted somewhere in string from font %d", + FontID); + T1_PrintLog( "T1_SetString()", err_warn_msg_buf, T1LOG_WARNING); + mode=0; + } + + h = area->ymax - area->ymin; + w = area->xmax - area->xmin; + paddedW = PAD(w, T1_pad); + if (h > 0 && w > 0) { + memsize = h * paddedW / 8 + 1; + /* This is for the users copy of the character, for security-reasons + the original pointer to the cache area is not used. The entry string_glyph.bits + is free'ed every time this function is called: */ + string_glyph.bits = (char *)malloc(memsize*sizeof( char)); + if (string_glyph.bits == NULL) { + T1_errno=T1ERR_ALLOC_MEM; + /* make sure to get rid of area if it's there */ + if (area){ + KillRegion (area); + } + /* it's safe to free this, since this is a rotated glyph and + therefore it's a copy of the original one */ + return(NULL); + } + } + else { + h = w = 0; + area->xmin = area->xmax = 0; + area->ymin = area->ymax = 0; + } + + string_glyph.metrics.leftSideBearing=area->xmin; + string_glyph.metrics.advanceX=NEARESTPEL(area->ending.x - area->origin.x); + string_glyph.metrics.advanceY=-NEARESTPEL(area->ending.y - area->origin.y); + string_glyph.metrics.rightSideBearing=area->xmax; + string_glyph.metrics.descent=-area->ymax; + string_glyph.metrics.ascent=-area->ymin; + + if (h > 0 && w > 0) { + (void) memset(string_glyph.bits, 0, memsize); + fill(string_glyph.bits, h, paddedW, area, T1_byte, T1_bit, T1_wordsize ); + } + else { /* We have no black pixels */ + string_glyph.metrics.leftSideBearing=0; + string_glyph.metrics.advanceX=NEARESTPEL(area->ending.x - area->origin.x); + string_glyph.metrics.advanceY=-NEARESTPEL(area->ending.y - area->origin.y); + string_glyph.metrics.rightSideBearing=0; + string_glyph.metrics.descent=0; + string_glyph.metrics.ascent=0; + } + + + /* make sure to get rid of area if it's there */ + if (area){ + KillRegion (area); + } + /* Check for writing direction and re-compute dimensions appropriately: */ + if (modflag & T1_RIGHT_TO_LEFT){ + string_glyph.metrics.advanceX *= -1; + string_glyph.metrics.advanceY *= -1; + string_glyph.metrics.leftSideBearing += string_glyph.metrics.advanceX; + string_glyph.metrics.rightSideBearing += string_glyph.metrics.advanceX; + string_glyph.metrics.descent += string_glyph.metrics.advanceY; + string_glyph.metrics.ascent += string_glyph.metrics.advanceY; + } + return(&string_glyph); +} + + + +void fill(dest, h, w, area, byte, bit, wordsize) + register char *dest; /* destination bitmap */ + int h,w; /* dimensions of 'dest', w padded */ + register struct region *area; /* region to write to 'dest' */ + int byte,bit; /* flags; LSBFirst or MSBFirst */ + int wordsize; /* number of bits per word for LSB/MSB purposes */ +{ + register struct edgelist *edge; /* for looping through edges */ + register char *p; /* current scan line in 'dest' */ + register int y; /* for looping through scans */ + register int wbytes = w / 8; /* number of bytes in width */ + register pel *leftP,*rightP; /* pointers to X values, left and right */ + int xmin = area->xmin; /* upper left X */ + int ymin = area->ymin; /* upper left Y */ + + for (edge = area->anchor; VALIDEDGE(edge); edge = edge->link->link) { + + p = dest + (edge->ymin - ymin) * wbytes; + leftP = edge->xvalues; + rightP = edge->link->xvalues; + + for (y = edge->ymin; y < edge->ymax; y++) { + fillrun(p, *leftP++ - xmin , *rightP++ - xmin, bit); + p += wbytes; + } + } + /* + Now, as an afterthought, we'll go reorganize if odd byte order requires + it: + */ + /* We do not reorganize since t1lib internally always uses LSBFirst */ + /* + if ( 0 && wordsize != 8) { + register int i; + printf("Reorganizing data ..\n"); + + switch (wordsize) { + case 16: + { + register unsigned short data,*p; + p = (unsigned short *) dest; + for (i = h * w /16; --i >= 0;) { + data = *p; + *p++ = (data << 8) + (data >> 8); + } + break; + } + case 64: + case 32: + { + register ULONG data,*p; + p = (ULONG *) dest; + for (i = h * w / 32; --i >= 0;) { + data = *p; + *p++ = (data << 24) + (data >> 24) + + (0xFF00 & (data >> 8)) + + (0xFF0000 & (data << 8)); + } + if (wordsize == 64) { + p = (ULONG *) dest; + for (i = h * w / 64; --i >= 0;) { + data = *p++; + p[-1] = p[0]; + *p++ = data; + } + } + break; + } + default: + abort("xiFill: unknown format"); + } + } + */ +} + +#define ALLONES 0xFF + +void fillrun(register char *p, pel x0, pel x1, int bit) +{ + register int startmask,endmask; /* bits to set in first and last char*/ + register int middle; /* number of chars between start and end + 1 */ + + if (x1 <= x0) + return; + middle = x1/8 - x0/8; + p += x0/8; + x0 &= 7; x1 &= 7; + if (bit == LSBFirst) { + startmask = ALLONES << x0; + endmask = ~(ALLONES << x1); + } + else { + startmask = ALLONES >> x0; + endmask = ~(ALLONES >> x1); + } + if (middle == 0) + *p++ |= startmask & endmask; + else { + *p++ |= startmask; + while (--middle > 0){ + *p++ = (unsigned char)ALLONES; + } + if (endmask) + *p |= endmask; + } +} + + +/* outline */ +#undef CHECK_OUTLINEFILL +#ifdef CHECK_OUTLINEFILL +void fill(dest, h, w, area, byte, bit, wordsize) + register char *dest; /* destination bitmap */ + int h,w; /* dimensions of 'dest', w padded */ + register struct region *area; /* region to write to 'dest' */ + int byte,bit; /* flags; LSBFirst or MSBFirst */ + int wordsize; /* number of bits per word for LSB/MSB purposes */ +{ + register struct edgelist *edge; /* for looping through edges */ + register char *p; /* current scan line in 'dest' */ + register int y; /* for looping through scans */ + register int wbytes = w / 8; /* number of bytes in width */ + register pel *leftP,*rightP; /* pointers to X values, left and right */ + int xmin = area->xmin; /* upper left X */ + int ymin = area->ymin; /* upper left Y */ + + for (edge = area->anchor; VALIDEDGE(edge); edge = edge->link->link) { + + p = dest + (edge->ymin - ymin) * wbytes; + leftP = edge->xvalues; + rightP = edge->link->xvalues; + + printf("leftP=%d, RightP=%d,\n", *leftP, *rightP); + + + for (y = edge->ymin; y < edge->ymax; y++) { + printf("leftP=%d, RightP=%d,y=%d\n", *leftP, *rightP, y); + + fillrun(p, *leftP++ - xmin, *rightP++ - xmin, bit); + p += wbytes; + } + } +} +#endif + + +/* T1_CopyGlyph(): Make a copy of an existent glyph-structure to save it + for later usage by the user. */ +GLYPH *T1_CopyGlyph( GLYPH *glyph) +{ + GLYPH *dest; + long size; + + + if (glyph==NULL){ + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + /* Assign padding value */ + T1_pad=pFontBase->bitmap_pad; + /* Allocate memory for struct: */ + if ((dest=(GLYPH *)malloc(sizeof(GLYPH)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + /* Copy the structure members: */ + *dest=*glyph; + /* Allocate memory for bitmap, initialize pointer to it and copy bitmap: */ + size=PAD((dest->metrics.rightSideBearing-dest->metrics.leftSideBearing)* + glyph->bpp, T1_pad) / 8; + size=size*(dest->metrics.ascent-dest->metrics.descent); + /* We must check whether there's actually a bits-pointer different from + NULL. If not omit the following step: */ + if (glyph->bits!=NULL){ + if ((dest->bits=(char *)malloc(size*sizeof(char)))==NULL){ + free(dest); + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + memcpy(dest->bits,glyph->bits,size); + } + return(dest); +} + +/* T1_DumpGlyph(): Dump a glyph-representation to stdout: */ +void T1_DumpGlyph( GLYPH *glyph) +{ + int i,j,h,w; /* i=line-index, j=column-index */ + long paddedW; + + + printf("Dataformat: T1_bit=%d, T1_byte=%d, T1_wordsize=%d, T1_pad=%d\n", + T1_bit, T1_byte, T1_pad, T1_pad); + + if (glyph==NULL){ + return; + } + + h=glyph->metrics.ascent-glyph->metrics.descent; + w=glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing; + + paddedW=PAD(w,T1_pad); + + printf("GlyphInfo: h=%d, w=%d, paddedW=%ld\n", h, w, paddedW); + + for ( i=0; ibits[i*paddedW/T1_pad+j], 1); + else if (T1_pad==16) + for (j=0; jbits)[i*paddedW/T1_pad+j], 1); + } + else + for (j=0; jbits)[i*paddedW/T1_pad+j], 1); + } + printf("\n"); + } +} + + + +/* This function will essentially return the bounding box of the + line-rule */ +void T1_ComputeLineParameters( int FontID, int mode, + int width, float size, + int *startx, int *endx, + int *starty, int *endy) +{ + float position=0.0, thickness=0.0; + int startx1, startx2, endx1, endx2; + + if (mode & T1_UNDERLINE){ + position=pFontBase->pFontArray[FontID].UndrLnPos + * DeviceSpecifics.scale_y; + thickness=pFontBase->pFontArray[FontID].UndrLnThick + * DeviceSpecifics.scale_y; + } + else if (mode & T1_OVERLINE){ + position=pFontBase->pFontArray[FontID].OvrLnPos + * DeviceSpecifics.scale_y; + thickness=pFontBase->pFontArray[FontID].OvrLnThick + * DeviceSpecifics.scale_y; + } + else if (mode & T1_OVERSTRIKE){ + position=pFontBase->pFontArray[FontID].OvrStrkPos + * DeviceSpecifics.scale_y; + thickness=pFontBase->pFontArray[FontID].OvrStrkThick + * DeviceSpecifics.scale_y; + } + + *starty=(int) floor((position+0.5*(thickness-DeviceSpecifics.y_resolution/1000.0)) + *size/1000.0 +0.5 ); + startx1=(int) floor(*starty*pFontBase->pFontArray[FontID].slant+0.5); + *endy =*starty - (int) floor(thickness/1000.0*size+0.5); + startx2=(int) floor(*endy*pFontBase->pFontArray[FontID].slant+0.5); + *startx=startx1 < startx2 ? startx1 : startx2; + endx1 = width + + (int) floor(*starty*pFontBase->pFontArray[FontID].slant+0.5); + endx2 = width + + (int) floor(*endy*pFontBase->pFontArray[FontID].slant+0.5); + *endx=endx1 < endx2 ? endx2 : endx1; + + /* We take care that at least one pixel is drawn */ + if (*starty==*endy) + *endy -=1; + + return; + +} + + + +/* The following function concatenates two glyphs. Optional offsets + x_off, y_off are respected. By the function. + If either glyph is NULL or the glyphs have distinct depth, NULL is + returned. */ +GLYPH *T1_ConcatGlyphs( GLYPH *glyph_1, GLYPH *glyph_2, + int x_off, int y_off, int modflag) +{ + + int lsb1, lsb2, rsb1, rsb2; + int advanceX1, advanceX2, advanceY1, advanceY2; + int ascent1, ascent2, descent1, descent2; + int rsb, lsb, ascent, descent, advanceX, advanceY; + int vanchor, w, h, wscanline, wscanline1, wscanline2, bpp; + int memsize, BitShift; + GLYPH *glyph1, *glyph2; + unsigned T1_AA_TYPE16 BitBuf_c; + unsigned T1_AA_TYPE32 BitBuf_s; + unsigned long BitBuf_l; /* This is only actually used if sizeof long = 8 */ + int i, j, k; + int ByteOffset; + + unsigned char *Target_c, *p_c; + unsigned T1_AA_TYPE16 *Target_s, *p_s; + unsigned T1_AA_TYPE32 *Target_l, *p_l; + + static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1}; + + + /* We handle the Right-To-Left concatenation the simple way: + 1) Change the order of the two glyphs + 2) Invert the sign of the y-part of the offset + 3) Recalculate the dimensions of the resulating glyph. + */ + /* Check for writing direction and reorganize appropriately: */ + if (modflag & T1_RIGHT_TO_LEFT){ + glyph1=glyph_2; + glyph2=glyph_1; + y_off=-y_off; + } + else { + glyph1=glyph_1; + glyph2=glyph_2; + } + + if (glyph1==NULL){ + T1_errno=T1ERR_INVALID_PARAMETER; + return( NULL); + } + if (glyph2==NULL){ + T1_errno=T1ERR_INVALID_PARAMETER; + return( NULL); + } + if (glyph1->bpp != glyph2->bpp){ + T1_errno=T1ERR_INVALID_PARAMETER; + return( NULL); + } + + /* We have two glyph different from NULL */ + /* Reset glyph, if necessary */ + if (glyph.bits!=NULL){ + free(glyph.bits); + glyph.bits=NULL; + } + glyph.metrics.leftSideBearing=0; + glyph.metrics.rightSideBearing=0; + glyph.metrics.advanceX=0; + glyph.metrics.advanceY=0; + glyph.metrics.ascent=0; + glyph.metrics.descent=0; + glyph.pFontCacheInfo=NULL; + glyph.bpp=1; + + /* Assign dimens */ + lsb1=glyph1->metrics.leftSideBearing; + rsb1=glyph1->metrics.rightSideBearing; + ascent1=glyph1->metrics.ascent; + descent1=glyph1->metrics.descent; + advanceX1=glyph1->metrics.advanceX + x_off; + advanceY1=glyph1->metrics.advanceY + y_off; + + lsb2=glyph2->metrics.leftSideBearing; + rsb2=glyph2->metrics.rightSideBearing; + ascent2=glyph2->metrics.ascent; + descent2=glyph2->metrics.descent; + advanceX2=glyph2->metrics.advanceX; + advanceY2=glyph2->metrics.advanceY; + + lsb=lsb1 < lsb2+advanceX1 ? lsb1 : lsb2+advanceX1; + rsb=rsb1 > rsb2+advanceX1 ? rsb1 : rsb2+advanceX1; + ascent=ascent1 > ascent2+advanceY1 ? ascent1 : ascent2+advanceY1; + descent=descent1 < descent2+advanceY1 ? descent1 : descent2+advanceY1; + advanceX=advanceX1+advanceX2; + advanceY=advanceY1+advanceY2; + + bpp=glyph1->bpp; + w=rsb-lsb; + h=ascent-descent; + wscanline=PAD( w*bpp, T1_pad) / 8; + wscanline1=PAD( (rsb1-lsb1)*bpp, T1_pad) / 8; + wscanline2=PAD( (rsb2-lsb2)*bpp, T1_pad) / 8; + memsize=wscanline*h; + if ((glyph.bits=(char *)calloc( memsize + 1, sizeof(unsigned char)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + + if (bpp==1){ + if (T1_pad==32 && T1_byte==0 && sizeof(long)==8){ + /* The following loop steps through the lines of the first glyph: */ + vanchor=ascent-ascent1; + BitShift=(lsb1-lsb) % 32; + ByteOffset=(lsb1-lsb)/32*4; + for ( i=0; ibits+(wscanline1*i)); + if (BitShift == 0){ + for (k=wscanline1/4; k; k--) + *Target_l++ |= *p_l++; + } + else{ + for (k=wscanline1/4; k; k--){ + BitBuf_l = ((long)*p_l++) << BitShift; + *Target_l++ |= BitBuf_l; + *Target_l |= BitBuf_l>>l_shift; + } + } + } + /* The following loop steps through the lines of the second glyph: */ + vanchor=ascent-(ascent2+advanceY1); + BitShift=(lsb2+advanceX1-lsb) % 32; + ByteOffset=(lsb2+advanceX1-lsb)/32*4; + for ( i=0; ibits+(wscanline2*i)); + if (BitShift == 0){ + for (k=wscanline2/4; k; k--) + *Target_l++ |= *p_l++; + } + else{ + for (k=wscanline2/4; k; k--){ + BitBuf_l = ((long)*p_l++) << BitShift; + *Target_l++ |= BitBuf_l; + *Target_l |= BitBuf_l>>l_shift; + } + } + } + } + else if(T1_pad==16 && T1_byte==0){ + /* The following loop steps through the lines of the first glyph: */ + vanchor=ascent-ascent1; + BitShift=(lsb1-lsb) % 16; + ByteOffset=(lsb1-lsb)/16*2; + for ( i=0; ibits+(wscanline1*i)); + if (BitShift == 0){ + for (k=wscanline1/2; k; k--) + *Target_s++ |= *p_s++; + } + else{ + for (k=wscanline1/2; k; k--){ + BitBuf_s = ((T1_AA_TYPE32)*p_s++) << BitShift; + *Target_s++ |= BitBuf_s; + *Target_s |= BitBuf_s>>s_shift; + } + } + } + /* The following loop steps through the lines of the second glyph: */ + vanchor=ascent-(ascent2+advanceY1); + BitShift=(lsb2+advanceX1-lsb) % 16; + ByteOffset=(lsb2+advanceX1-lsb)/16*2; + for ( i=0; ibits+(wscanline2*i)); + if (BitShift == 0){ + for (k=wscanline2/2; k; k--) + *Target_s++ |= *p_s++; + } + else{ + for (k=wscanline2/2; k; k--){ + BitBuf_s = ((T1_AA_TYPE32)*p_s++) << BitShift; + *Target_s++ |= BitBuf_s; + *Target_s |= BitBuf_s>>s_shift; + } + } + } + } + else{ /* T1_pad==8 or Big Endian machine */ + /* The following loop steps through the lines of the first glyph: */ + vanchor=ascent-ascent1; + BitShift=(lsb1-lsb) % 8; + ByteOffset=(lsb1-lsb) / 8; + for ( i=0; ibits+(wscanline1*i)); + if (BitShift == 0){ + for (k=wscanline1; k; k--) + *Target_c++ |= *p_c++; + } + else{ + for (k=wscanline1; k; k--){ + BitBuf_c = ((T1_AA_TYPE16)*p_c++) << BitShift; + *Target_c++ |= BitBuf_c; + *Target_c |= BitBuf_c>>c_shift; + } + } + } + /* The following loop steps through the lines of the second glyph: */ + vanchor=ascent-(ascent2+advanceY1); + BitShift=(lsb2+advanceX1-lsb) % 8; + ByteOffset=(lsb2+advanceX1-lsb) / 8; + for ( i=0; ibits+(wscanline2*i)); + if (BitShift == 0){ + for (k=wscanline2; k; k--) + *Target_c++ |= *p_c++; + } + else{ + for (k=wscanline2; k; k--){ + BitBuf_c = ((T1_AA_TYPE16)*p_c++) << BitShift; + *Target_c++ |= BitBuf_c; + *Target_c |= BitBuf_c>>c_shift; + } + } + } + } + } /* end of if (bpp==1) ... */ + else if (bpp==8){ + /* Set background */ + for ( i=0; ibits+(wscanline1*i)); + memcpy( Target_c, p_c, (rsb1-lsb1)); + } + /* The following loop steps through the lines of the second glyph. + Note that we only set the pixel if it is not background! */ + vanchor=ascent-(ascent2+advanceY1); + for ( i=0; ibits+(wscanline2*i)); + for (j=0; j<(rsb2-lsb2); j++) + if (p_c[j] != (unsigned char) T1aa_bg) + Target_c[j]=p_c[j]; + } + } /* end of if (bpp==8) ... */ + else if (bpp==16){ + /* Set background */ + for ( i=0; ibits+(wscanline1*i)); + memcpy( Target_s, p_s, (rsb1-lsb1)*2); + } + /* The following loop steps through the lines of the second glyph. + Note that we only set the pixel if it is not background! */ + vanchor=ascent-(ascent2+advanceY1); + for ( i=0; ibits+(wscanline2*i)); + for (j=0; j<(rsb2-lsb2); j++) + if (p_s[j] != (unsigned T1_AA_TYPE16) T1aa_bg) + Target_s[j]=p_s[j]; + } + } /* end of if (bpp==16) ... */ + else if (bpp==32){ + /* Set background */ + for ( i=0; ibits+(wscanline1*i)); + memcpy( Target_l, p_l, (rsb1-lsb1)*4); + } + /* The following loop steps through the lines of the second glyph. + Note that we only set the pixel if it is not background! */ + vanchor=ascent-(ascent2+advanceY1); + for ( i=0; ibits+(wscanline2*i)); + for (j=0; j<(rsb2-lsb2); j++) + if (p_l[j] != (unsigned T1_AA_TYPE32) T1aa_bg) + Target_l[j]=p_l[j]; + } + } /* end of if (bpp==32) ... */ + + + /* Check for writing direction and re-compute dimens appropriately: */ + if (modflag & T1_RIGHT_TO_LEFT){ + advanceX=-advanceX1-advanceX2; + advanceY=-advanceY1-advanceY2; + lsb=lsb1 < lsb2+advanceX1 ? advanceX+lsb1 : advanceX+lsb2+advanceX1; + rsb=rsb1 > rsb2+advanceX1 ? advanceX+rsb1 : advanceX+rsb2+advanceX1; + ascent=ascent1 > ascent2+advanceY1 ? ascent1 : ascent2+advanceY1; + descent=descent1 < descent2+advanceY1 ? descent1 : descent2+advanceY1; + ascent += advanceY; + descent += advanceY; + } + + glyph.metrics.leftSideBearing=lsb; + glyph.metrics.rightSideBearing=rsb; + glyph.metrics.advanceX=advanceX; + glyph.metrics.advanceY=advanceY; + glyph.metrics.ascent=ascent; + glyph.metrics.descent=descent; + glyph.bpp=bpp; + + /* + printf("lsb=%d, rsb=%d, adX=%d, adY=%d asc=%d, desc=%d\n", + glyph.metrics.leftSideBearing, + glyph.metrics.rightSideBearing, + glyph.metrics.advanceX, + glyph.metrics.advanceY, + glyph.metrics.ascent, + glyph.metrics.descent ); + */ + + return( &glyph); + +} + + + +/* T1_FillOutline(): Create a filled glyph from an outline description */ +GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag) +{ + struct region *area=NULL; + + static GLYPH glyph={NULL,{0,0,0,0,0,0},NULL,1}; + volatile int memsize=0; + int i; + LONG h,w; + LONG paddedW; + + + /* We return to this if something goes wrong deep in the rasterizer */ + if ((i=setjmp( stck_state))!=0) { + T1_errno=T1ERR_TYPE1_ABORT; + sprintf( err_warn_msg_buf, "t1_abort: Reason: %s", + t1_get_abort_message( i)); + T1_PrintLog( "T1_FillOutline()", err_warn_msg_buf, + T1LOG_ERROR); + return( NULL); + } + + /* Reset character glyph, if necessary */ + if (glyph.bits!=NULL){ + free(glyph.bits); + glyph.bits=NULL; + } + glyph.metrics.leftSideBearing=0; + glyph.metrics.rightSideBearing=0; + glyph.metrics.advanceX=0; + glyph.metrics.advanceY=0; + glyph.metrics.ascent=0; + glyph.metrics.descent=0; + glyph.pFontCacheInfo=NULL; + glyph.bpp=1; + + + /* Assign padding value */ + T1_pad=pFontBase->bitmap_pad; + if (pFontBase->endian) + T1_byte=1; + else + T1_byte=0; + T1_wordsize=T1_pad; + + /* Create a region from outline */ + area=(struct region *)Interior( (struct segment *)path, + WINDINGRULE+CONTINUITY); + + /* fill the glyph-structure */ + if (area == NULL){ + T1_PrintLog( "T1_FillOutline()", "area=NULL returned by Interior()", T1LOG_WARNING); + T1_errno=1000; + return(NULL); + } + h = area->ymax - area->ymin; + w = area->xmax - area->xmin; + + + paddedW = PAD(w, T1_pad); + if ( (area->xmin > area->xmax) || (area->ymin > area->ymax) ){ + /* There was a character like .notdef or space, that didn't + produce any black pixels on the bitmap! -> we return a glyph with + correct metrics and bitmap pointer set to NULL */ + sprintf( err_warn_msg_buf, + "No black pixels in outline %p", path); + T1_PrintLog( "T1_FillOutline()", err_warn_msg_buf, T1LOG_WARNING); + + glyph.metrics.leftSideBearing = 0; + glyph.metrics.advanceX = NEARESTPEL(area->ending.x - area->origin.x); + glyph.metrics.advanceY = - NEARESTPEL(area->ending.y - area->origin.y); + glyph.metrics.rightSideBearing = 0; + glyph.metrics.descent = 0; + glyph.metrics.ascent = 0; + /* make sure to get rid of 'area' before leaving! */ + KillRegion (area); + return( &glyph); + } + if (h > 0 && w > 0) { + memsize = h * paddedW / 8 + 1; + /* This is for the users copy of the character, for security-reasons + the original pointer to the cache area is not used. The entry glyph.bits + is free'ed every time this function is called: */ + glyph.bits = (char *)malloc(memsize*sizeof( char)); + if (glyph.bits == NULL){ + T1_errno=T1ERR_ALLOC_MEM; + /* make sure to get rid of area if it's there */ + if (area){ + KillRegion (area); + } + return(NULL); + } + + } + else { + h = w = 0; + area->xmin = area->xmax = 0; + area->ymin = area->ymax = 0; + } + + glyph.metrics.leftSideBearing = area->xmin; + glyph.metrics.advanceX = NEARESTPEL(area->ending.x - area->origin.x); + glyph.metrics.advanceY = - NEARESTPEL(area->ending.y - area->origin.y); + glyph.metrics.rightSideBearing = area->xmax; + glyph.metrics.descent = - area->ymax; + glyph.metrics.ascent = - area->ymin; + + + if (h > 0 && w > 0) { + (void) memset(glyph.bits, 0, memsize); + fill(glyph.bits, h, paddedW, area, T1_byte, T1_bit, T1_wordsize ); + } + + /* Check for writing direction and re-compute dimensions appropriately: */ + if (modflag & T1_RIGHT_TO_LEFT){ + glyph.metrics.advanceX *= -1; + glyph.metrics.advanceY *= -1; + glyph.metrics.leftSideBearing += glyph.metrics.advanceX; + glyph.metrics.rightSideBearing += glyph.metrics.advanceX; + glyph.metrics.descent += glyph.metrics.advanceY; + glyph.metrics.ascent += glyph.metrics.advanceY; + } + + /* make sure to get rid of area if it's there */ + if (area){ + KillRegion (area); + } + return( &glyph); + + +} diff -Naur xdvik-22.40l/libs/t1lib/t1set.h xdvik-22.40n/libs/t1lib/t1set.h --- xdvik-22.40l/libs/t1lib/t1set.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1set.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,87 @@ +/*-------------------------------------------------------------------------- + ----- File: t1set.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-05-27 + ----- Description: This file is part of the t1-library. It contains + definitions and declarations for t1set.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#ifdef T1SET_C + +GLYPH *T1_SetChar( int FontID, char charcode, + float size, T1_TMATRIX *transform); +GLYPH *T1_SetString( int FontID, char *string, volatile int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +void fill(char *dest, int h, int w, + struct region *area, int byte, int bit, + int wordsize); +void fillrun(char *p, pel x0, pel x1, int bit); +GLYPH *T1_CopyGlyph(GLYPH *glyph); +void T1_DumpGlyph( GLYPH *glyph); +void T1_ComputeLineParameters( int FontID, int width, + int mode, float size, + int *startx, int *endx, + int *starty, int *endy); +GLYPH *T1_ConcatGlyphs( GLYPH *glyph1, GLYPH *glyph2, + int x_off, int y_off, int modflag); +void T1_DumpGlyph( GLYPH *glyph); +GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag); + + +#else + +extern GLYPH *T1_SetChar( int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_SetString( int FontID, char *string, volatile int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern void fill(char *dest, int h, int w, + struct region *area, int byte, int bit, + int wordsize); +extern void fillrun(char *p, pel x0, pel x1, int bit); +extern GLYPH *T1_CopyGlyph(GLYPH *glyph); +extern void T1_DumpGlyph( GLYPH *glyph); +extern GLYPH *T1_ConcatGlyphs( GLYPH *glyph1, GLYPH *glyph2, + int x_off, int y_off, int modflag); +extern void T1_DumpGlyph( GLYPH *glyph); +extern GLYPH *T1_FillOutline( T1_OUTLINE *path, int modflag); + +#endif + + +extern struct region *fontfcnB(int FontID, int modflag, + struct XYspace *S, char **ev, + unsigned char index, int *mode, + psfont *Font_Ptr, + int do_raster); +extern struct region *fontfcnB_string( int FontID, int modflag, + struct XYspace *S, char **ev, + unsigned char *string, int no_chars, + int *mode, psfont *Font_Ptr, + int *kern_pairs, long spacewidth, + int do_raster); +extern struct region *fontfcnB_ByName( int FontID, int modflag, + struct XYspace *S, + char *charname, + int *mode, psfont *Font_Ptr, + int do_raster); diff -Naur xdvik-22.40l/libs/t1lib/t1subset.c xdvik-22.40n/libs/t1lib/t1subset.c --- xdvik-22.40l/libs/t1lib/t1subset.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1subset.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,835 @@ +/*-------------------------------------------------------------------------- + ----- File: t1subset.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-09-09 + ----- Description: This file is part of the t1-library. It contains + functions for subsetting type 1 fonts. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1SUBSET_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" + + +#include "t1types.h" +#include "t1extern.h" +#include "t1finfo.h" +#include "t1misc.h" +#include "t1base.h" +#include "t1subset.h" + +/* Segment header for pfb-files (reminder): + + Segment-header: + + Byte 1: always 128 (0x80) + + Byte 2: 1 = ASCII text + 2 = Binary text + 3 = End of file indicator (EOF) + + Byte 3: least significant byte \ + Byte 4: \ Length of + Byte 5: / data segment in bytes + Byte 6: most significant byte / + + */ +#define SEGMENT_ASCII 1 +#define SEGMENT_BINARY 2 +#define SEGMENT_EOF 3 + + + +static char *charstringP; +static int charstringL; + + +/* We define two lookup tables to make a fast conversion from + binary bytes to ASCII-hex bytes. */ +static unsigned char highHexByte[256]={ + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31, + 0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32,0x32, + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, + 0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34,0x34, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, + 0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37,0x37, + 0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38, + 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43,0x43, + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x45, + 0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46,0x46 +}; +static unsigned char lowHexByte[256]={ + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46 +}; + + +/* parameters for eexec encryption */ +static unsigned short int eexec_r; +static unsigned short int eexec_c1=52845; +static unsigned short int eexec_c2=22719; + +/* Eexec-encrption according to the Adobe Black Book */ +static unsigned char EexecEncrypt( unsigned char plain) +{ + + unsigned char cipher; + + cipher = (plain ^ (eexec_r>>8)); + eexec_r = (cipher + eexec_r) * eexec_c1 + eexec_c2; + return( cipher); +} + + + +static int locateCharString( int FontID, char *charname) +{ + + int namelen; + int dictlen; + int i; + psdict *CharStringsP; + + + namelen=strlen( charname); + + CharStringsP=pFontBase->pFontArray[FontID].pType1Data->CharStringsP; + + dictlen=CharStringsP[0].key.len; + for ( i=1; i<=dictlen; i++) { + if (namelen==CharStringsP[i].key.len) { + /* This could be the charstring in question */ + if (strncmp( charname, + CharStringsP[i].key.data.nameP, + namelen)==0) { + /* It is the the desired charstring */ + charstringP=CharStringsP[i].value.data.valueP; + charstringL=CharStringsP[i].value.len; + return( i); + } + } + } + /* charstring not found ??? */ + return( 0); + +} + + + +static int make_pfb_segment_header( char *ptr, int type, unsigned long size) +{ + ptr[0]=(char) 0x80; + ptr[1]=type; + if (type==3) + return( 2); + ptr[2]=(char)(size & 0xFF); + ptr[3]=(char)((size>>8) & 0xFF); + ptr[4]=(char)((size>>16) & 0xFF); + ptr[5]=(char)((size>>24) & 0xFF); + return( 6); +} + + + + +/* A function for reading a Type 1 font file. eexec-decryption + is done on the fly. */ +char *T1_SubsetFont( int FontID, + char *mask, + unsigned int flags, + int linewidth, + unsigned long maxblocksize, + unsigned long *bufsize) +{ + + FILE *ifp; + static char *filebuf=NULL; + unsigned long filesize=0; + int filesegs=0; + + char *outbuf=NULL; + unsigned long outsize=0; + char *encryptbuf=NULL; + unsigned long encryptsize=0; + int encryptsegs=0; + char *trailerbuf=NULL; + unsigned long trailersize=0; + int trailersegs=0; + char linebuf[1025]; + + char *csdone; /* stores which charstrings already have been written */ + int currstring_no=0; + char *charnameP; + unsigned char cipher; + char rdstring[3]; + char ndstring[3]; + + int retval=1; + + /* Indices. Could save a few but debugging becomes easier this way */ + int i=0; + int j=0; + int k=0; + int l=0; + int m=0; + int n=0; + int o=0; + + int notdefencoded=0; + int stdenc=0; + int reencode=0; + int colcount=0; + int tr_len=-1; + int encrypt=1; /* 1=ASCII-hex, 2=Binary, 0=None (for debugging) */ + int dindex=0; + int nocharstrings=0; + + + + /* Otherwise we would get invalid accesses later */ + if (CheckForFontID(FontID)!=1) { + T1_errno=T1ERR_INVALID_FONTID; + return(NULL); + } + + + /* Check parameters */ + if ( (mask==NULL) || (bufsize==NULL) || (linewidth < 8) || + (linewidth > 1024) || (maxblocksize < 4) ) { + T1_errno=T1ERR_INVALID_PARAMETER; + return(NULL); + } + + for ( j=0; j<256; j++) { + if (mask[j]!=0) { + nocharstrings++; + } + } + + + /* adjust encrypting type according to flags. Default is ASCII-hex + encryption because the output may be verbatim inserted into a + PostScript-file. */ + if (flags & T1_SUBSET_ENCRYPT_BINARY) + encrypt=2; + else if (flags & T1_SUBSET_ENCRYPT_NONE) + encrypt=0; + + /* Open and initialize scanning machinery */ + T1io_reset(); + if ((ifp = (FILE *)T1Open(T1_GetFontFilePath( FontID), "r"))==NULL) { + T1_errno=T1ERR_FILE_OPEN_ERR; + return(NULL); + } + + if (encrypt==0) + sprintf( err_warn_msg_buf, "Subsetting Font %d, flags=0x%X, non-encrypted debug output", + FontID, flags); + else if (encrypt==1) + sprintf( err_warn_msg_buf, "Subsetting Font %d, flags=0x%X, ASCII-hex output with linelength %d", + FontID, flags, linewidth); + else if (encrypt==2) + sprintf( err_warn_msg_buf, "Subsetting Font %d, flags=0x%X, Binary output with maximum blocksize %lu", + FontID, flags, maxblocksize); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_DEBUG); + + /* Get size of file */ + filesize=T1GetFileSize( ifp); + sprintf( err_warn_msg_buf, "Source file %s is %lu bytes long", + T1_GetFontFilePath( FontID), filesize); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_DEBUG); + if ((filebuf=(char *)calloc( filesize, sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + + while (retval>0) { + /* get a line from the file. We have to read enough characters to + ensure that "eexec" does not get split between two reads. + Otherwise, decryption would not be started. */ + retval=T1Gets(&(filebuf[i]), 1025, ifp); + i+=retval; + if ( (dindex==0) && (T1GetDecrypt()>0) ) { + dindex=i-retval; /* from this point on we have decrypted bytes */ + sprintf( err_warn_msg_buf, "Human-readable header finished (%d data bytes)", + dindex); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_DEBUG); + } + + /* Encoding handling */ + if (strstr( &(filebuf[i-retval]), "/Encoding")!=NULL) { + if (strstr( &(filebuf[i-retval]), "StandardEncoding")!=NULL) { + stdenc=1; + if ((flags & T1_SUBSET_FORCE_REENCODE)!=0) { + /* we ignore the current line ... */ + i-=retval; + /* and put the encoding header into the buffer */ + i+=sprintf( &(filebuf[i]), + "/Encoding 256 array\n0 1 255 {1 index exch /.notdef put} for\n" + ); + reencode=1; + } + else { + T1_PrintLog( "T1_SubsetFont()", "Leaving StandardEncoding untouched", + T1LOG_DEBUG); + reencode=0; + } + } + else { + /* The encoding is explicitly defined in the font file. We skip the + whole definition unless reencoding should be skipped. */ + stdenc=0; + retval=T1Gets(&(filebuf[i]), 1025, ifp); + i+=retval; + while (retval>0) { + /* get a line and check for end of encoding definition. */ + retval=T1Gets(&(filebuf[i]), 1025, ifp); + if ((flags & T1_SUBSET_SKIP_REENCODE)!=0) { /* we store the encoding + defined here */ + i+=retval; + reencode=0; + } + else { + reencode=1; + } + if ( (dindex==0) && (T1GetDecrypt()>0) ) { + dindex=i; /* from this point we have decrypted bytes */ + } + if (strstr( &(filebuf[i-retval]), "readonly def")!=NULL) { + break; + } + } + if (reencode==0) + T1_PrintLog( "T1_SubsetFont()", "Preserving FontSpecific Encoding", + T1LOG_DEBUG); + } + + /* At this point, if required, the actual encoding definition + follows */ + if ( reencode!=0) { + k=0; + for ( j=0; j<256; j++) { + if (mask[j]!=0) { + charnameP=T1_GetCharName( FontID, j); + i+=sprintf( &(filebuf[i]), "dup %d /%s put\n", j, + charnameP); + k++; + if (strcmp(charnameP, ".notdef")==0) + notdefencoded=1; + } + } + /* finish encoding definition */ + i+=sprintf( &(filebuf[i]), "readonly def\n"); + sprintf( err_warn_msg_buf, "Encoded %d characters", + k); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_DEBUG); + k=0; + } + + } /* end of if (...encoding handling...) */ + + /* Extract the names are used for the charstring definitions. + We will later need them! */ + if (strstr( &(filebuf[i-retval]), "/RD")!=NULL) { + sprintf( rdstring, "RD"); + } + if (strstr( &(filebuf[i-retval]), "/ND")!=NULL) { + sprintf( ndstring, "ND"); + } + if (strstr( &(filebuf[i-retval]), "/-|")!=NULL) { + sprintf( rdstring, "-|"); + } + if (strstr( &(filebuf[i-retval]), "/|-")!=NULL) { + sprintf( ndstring, "|-"); + } + + if (strstr( &(filebuf[i-retval]), "/CharStrings")!=NULL) { + /* replace dictionary with one of an appropriate size: */ + i -=retval; + sprintf( err_warn_msg_buf, "Private dictionary finished (%u data bytes)", + i-dindex); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_DEBUG); + /* if .notdef is not in the encoding mask, we have to reserve + room for the additional charstring .notdef. Note that still + nocharstrings is an upper bound estimation, which is reached + in cases where no characters are encoded more than one time. */ + if (notdefencoded==0) + nocharstrings++; + + i+=sprintf( &(filebuf[i]), "2 index /CharStrings %d dict dup begin\n", + nocharstrings); + break; + } + } /* the portion until Charstrings-dict is now read in */ + + + /* We now have to write the CharStrings. + Each charstring must be written once, even if the respective + character appears more than once in the encoding. So we set up + table to remember which charstrings already have been written. + + Note: The indices returned by locateCharString() range from 1 to n, so that + we have to decrement the index when filling the csdone array! + */ + if (( csdone=(char *)calloc( pFontBase->pFontArray[FontID].pType1Data->CharStringsP[0].key.len, + sizeof(char)))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + free( filebuf); + T1Close( ifp); + return( NULL); + } + + /* The .notdef character is in force! */ + if ((currstring_no=locateCharString( FontID, ".notdef"))==0) { + T1_errno=T1ERR_UNSPECIFIED; + free( csdone); + T1Close( ifp); + return( NULL); + } + i+=sprintf( &(filebuf[i]), "/.notdef %d %s ", charstringL, rdstring); + memcpy(&(filebuf[i]), charstringP, charstringL); + i+=charstringL; + i+=sprintf( &(filebuf[i]), " %s\n", ndstring); + csdone[currstring_no-1]=1; + /* Now, step through the specifier matrix and write only the + necessary charstrings. */ + for ( j=0; j<256; j++) { + if (mask[j]!=0) { + charnameP=T1_GetCharName( FontID, j); + if ((currstring_no=locateCharString( FontID, charnameP))==0) { + /* This is mysterious, but causes no harm because .notdef + will be substituted */ + sprintf( err_warn_msg_buf, "Could not locate CS ""%s"" for index %d", + charnameP, j); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_WARNING); + continue; + } + /* Process charstring only if it has not already been done */ + if (csdone[currstring_no-1]==0) { + k=i; + i+=sprintf( &(filebuf[i]), "/%s %d %s ", charnameP, charstringL, rdstring); + memcpy(&(filebuf[i]), charstringP, charstringL); + i+=charstringL; + i+=sprintf( &(filebuf[i]), " %s\n", ndstring); + csdone[currstring_no-1]=1; + sprintf( err_warn_msg_buf, + "Processing of CS ""%s"" for index %d successful (len=%d bytes, line=%d bytes)", + charnameP, j, charstringL, i-k); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_DEBUG); + } + else { + sprintf( err_warn_msg_buf, "Skipped multiple processing of CS ""%s"" (index %d)", + charnameP, j); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_DEBUG); + } + } + } + if (csdone!=NULL) + free( csdone); + /* All charstrings are written. Some PostScript code follows */ + i+=sprintf( &(filebuf[i]), + "end\nend\nreadonly put\nnoaccess put\ndup /FontName get exch definefont pop\nmark currentfile closefile\n"); + sprintf( err_warn_msg_buf, + "Charstrings and Font definition finished (%d data bytes, from which %d bytes will be encrypted)", + i, i-dindex); + T1_PrintLog( "T1_SubsetFont()", err_warn_msg_buf, + T1LOG_DEBUG); + + /* we compute the size of the encrypted area. */ + if (encrypt==1) { + encryptsize=i-dindex; + encryptsize+=4; /* the four random bytes */ + encryptsize*=2; /* since we use ASCII-hex output */ + encryptsize+=(int)ceil((double)encryptsize/linewidth); /* we need a few newline characters + to adjust the output format */ + } + else if (encrypt==2) { /* binary encryption. The whole data is contiguous + and only at the end of the data a newline is + added. */ + encryptsize=i-dindex+1; + encryptsize+=4; /* the four random bytes */ + } + else { /*The case of no encryption does not produce + valid fonts, it is for debugging purposes only */ + encryptsize=i-dindex+1; + } + + + /* we add the size of the 512 zeros and the cleartomark */ + trailersize+=ZEROS; + trailersize+=(int)ceil((double)ZEROS/linewidth); + trailersize+=12; /* cleartomark */ + + /* Search for remaining PostScript code in the last 1024 bytes. This + should suffice for any font. */ + tr_len=T1GetTrailer( linebuf, 1025, ifp); + T1Close(ifp); /* we do not need the file any longer */ + + /* And we add the size of the trailer. A trailer only consisting of + a newline is ignored because the newline has already been included + in the cleartomark-string. */ + if ( !((tr_len==1) && ((linebuf[0]=='\n') || (linebuf[0]=='\r')) ) ) { + trailersize+=tr_len; + } + + + if ((encryptbuf=(char *)calloc( encryptsize, 1))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + free( filebuf); + return( NULL); + } + + /* Allocate one byte in orer to be able to use sprintf() (which appends + an ASCII-\0).*/ + if ((trailerbuf=(char *)calloc( trailersize+1, 1))==NULL) { + T1_errno=T1ERR_ALLOC_MEM; + free( filebuf); + free( encryptbuf); + return( NULL); + } + + k=0; + colcount=0; + + /* perform eexec-encryption */ + eexec_r=55665; + if (encrypt==0) { + for (j=dindex; jpFontArray[FontID].pType1Data->Private[LENIV].value.data.integer); + +} diff -Naur xdvik-22.40l/libs/t1lib/t1subset.h xdvik-22.40n/libs/t1lib/t1subset.h --- xdvik-22.40l/libs/t1lib/t1subset.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1subset.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,76 @@ +/*-------------------------------------------------------------------------- + ----- File: t1subset.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + declarations and definitions for t1subset.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independ from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#ifdef T1SUBSET_C + + +#define T1_SUBSET_DEFAULT 0x00 +#define T1_SUBSET_FORCE_REENCODE 0x01 +#define T1_SUBSET_SKIP_REENCODE 0x02 +#define T1_SUBSET_ENCRYPT_BINARY 0x04 +/* This is only for debugging, it does not produce valid font-files! */ +#define T1_SUBSET_ENCRYPT_NONE 0x08 + + +/* Functions used from the t1io-module, partially written + and added for font-subsetting. We don't care about the + special F_FILE-type defined in that module because all + accesses are done via pointers. */ +extern unsigned long T1GetFileSize( FILE *f); +extern FILE *T1Open( char *fn, char *mode); +extern int T1Gets(char *string, int size, FILE *f); +extern int T1GetDecrypt( void); +extern int T1GetTrailer(char *string, int size, FILE *f); +extern int T1Close( FILE *f); +extern void T1io_reset( void); + +char *T1_SubsetFont( int FontID, + char *mask, + unsigned int flags, + int linewidth, + unsigned long maxblocksize, + unsigned long *bufsize); +char *T1_GetCharString( int FontID, char *charname, int *len); +int T1_GetlenIV( int FontID); + + +#define ZEROS 512 + +#else + +extern char *T1_SubsetFont( int FontID, + char *mask, + unsigned int flags, + int linewidth, + unsigned long maxblocksize, + unsigned long *bufsize); +extern char *T1_GetCharString( int FontID, char *charname, int *len); +extern int T1_GetlenIV( int FontID); + + +#endif diff -Naur xdvik-22.40l/libs/t1lib/t1trans.c xdvik-22.40n/libs/t1lib/t1trans.c --- xdvik-22.40l/libs/t1lib/t1trans.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1trans.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,536 @@ +/*-------------------------------------------------------------------------- + ----- File: t1trans.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + functions for transforming fonts and setting + line-parameters. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1TRANS_C + + +#include +#include +#include +#include +#if defined(_MSC_VER) +# include +# include +# include +#else +# include +#endif +#include +#include +#include + +#include "../type1/ffilest.h" +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" + + +#include "t1types.h" +#include "t1extern.h" +#include "t1trans.h" +#include "t1base.h" + + +/* T1_ExtendFont(): Extend the font referenced by FontID by the factor + extend. This is only allowed if no size dependent data exists. + Of course, the font must already have been loaded. + Returns 0 for success and -1 otherwise. + */ +int T1_ExtendFont( int FontID, double extend) +{ + + /* First, check for font residing in memory: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + /* Second, check whether size-dependent data exists: */ + if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + pFontBase->pFontArray[FontID].extend=extend; + pFontBase->pFontArray[FontID].FontTransform[0] = extend; + return(0); +} + + + +/* T1_GetExtend(): Return the current extension factor of the + font FontID + Return: 0.0 if font not loaded + current extent otherwise +*/ +double T1_GetExtend( int FontID) +{ + /* First, check for font residing in memory: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0.0); + } + + return( pFontBase->pFontArray[FontID].extend); +} + + + + +/* T1_SlantFont(): Slant the font referenced by FontID by the factor + extend. This is only allowed if no size dependent data exists. + Of course, the font must already have been loaded. + Returns 0 for success and -1 otherwise. + */ +int T1_SlantFont( int FontID, double slant) +{ + + /* First, check for font residing in memory: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + /* Second, check whether size-dependent data exists: */ + if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + pFontBase->pFontArray[FontID].slant=slant; + pFontBase->pFontArray[FontID].FontTransform[2] = slant; + return(0); +} + + + +/* T1_GetSlant(): Return the current slanting factor of the + font FontID + Return: 0.0 if font not loaded + current slant otherwise (may also be 0.0!) +*/ +double T1_GetSlant( int FontID) +{ + /* First, check for font residing in memory: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0.0); + } + + return( pFontBase->pFontArray[FontID].slant); +} + + + +/* T1_TransformFont(): Transform the font referenced by FontID according + to the transform matrix. This is only allowed if no size dependent + data exists. Of course, the font must already have been loaded. + Returns 0 for success and -1 otherwise. + */ +int T1_TransformFont( int FontID, T1_TMATRIX *matrix) +{ + + /* First, check for font residing in memory: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + /* Second, check whether size-dependent data exists: */ + if (pFontBase->pFontArray[FontID].pFontSizeDeps != NULL){ + T1_errno=T1ERR_OP_NOT_PERMITTED; + return(-1); + } + + pFontBase->pFontArray[FontID].FontTransform[0] = matrix->cxx; + pFontBase->pFontArray[FontID].FontTransform[1] = matrix->cxy; + pFontBase->pFontArray[FontID].FontTransform[2] = matrix->cyx; + pFontBase->pFontArray[FontID].FontTransform[3] = matrix->cyy; + return(0); +} + + + +/* T1_GetTransform(): Return the current transformation matrix for the + font FontID + Return: [0.0, 0.0, 0.0, 0.0] if font not loaded + current tmatrix otherwise +*/ +T1_TMATRIX T1_GetTransform( int FontID) +{ + T1_TMATRIX tmatrix={0.0, 0.0, 0.0, 0.0}; + + /* First, check for font residing in memory: */ + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(tmatrix); + } + + tmatrix.cxx=pFontBase->pFontArray[FontID].FontTransform[0]; + tmatrix.cxy=pFontBase->pFontArray[FontID].FontTransform[1]; + tmatrix.cyx=pFontBase->pFontArray[FontID].FontTransform[2]; + tmatrix.cyy=pFontBase->pFontArray[FontID].FontTransform[3]; + + return( tmatrix); +} + + + +/* Functions for setting line-parameters: + linetypeis expected to be an OR'ed combination of + T1_UNDERLINE, T1_OVERLINE and T1_OVERSTRIKE. + */ +int T1_SetLinePosition( int FontID, int linetype, float value) +{ + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + if (linetype & T1_UNDERLINE){ + pFontBase->pFontArray[FontID].UndrLnPos=value; + return( 0); + } + if (linetype & T1_OVERLINE){ + pFontBase->pFontArray[FontID].OvrLnPos=value; + return( 0); + } + if (linetype & T1_OVERSTRIKE){ + pFontBase->pFontArray[FontID].OvrStrkPos=value; + return( 0); + } + + /* The linetype was bad */ + T1_errno=T1ERR_INVALID_PARAMETER; + return( -1); + +} + + + +int T1_SetLineThickness( int FontID, int linetype, float value) +{ + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(-1); + } + + if (linetype & T1_UNDERLINE){ + pFontBase->pFontArray[FontID].UndrLnThick=value; + return( 0); + } + if (linetype & T1_OVERLINE){ + pFontBase->pFontArray[FontID].OvrLnThick=value; + return( 0); + } + if (linetype & T1_OVERSTRIKE){ + pFontBase->pFontArray[FontID].OvrStrkThick=value; + return( 0); + } + + /* The linetype was bad */ + T1_errno=T1ERR_INVALID_PARAMETER; + return( -1); + +} + + +float T1_GetLinePosition( int FontID, int linetype) +{ + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0.0); + } + + if (linetype & T1_UNDERLINE) + return( pFontBase->pFontArray[FontID].UndrLnPos); + if (linetype & T1_OVERLINE) + return( pFontBase->pFontArray[FontID].OvrLnPos); + if (linetype & T1_OVERSTRIKE) + return( pFontBase->pFontArray[FontID].OvrStrkPos); + + /* The linetype was bad */ + T1_errno=T1ERR_INVALID_PARAMETER; + return( 0.0); + +} + + + +float T1_GetLineThickness( int FontID, int linetype) +{ + + if (CheckForFontID(FontID)!=1){ + T1_errno=T1ERR_INVALID_FONTID; + return(0.0); + } + + if (linetype & T1_UNDERLINE) + return( pFontBase->pFontArray[FontID].UndrLnThick); + if (linetype & T1_OVERLINE) + return( pFontBase->pFontArray[FontID].OvrLnThick); + if (linetype & T1_OVERSTRIKE) + return( pFontBase->pFontArray[FontID].OvrStrkThick); + + /* The linetype was bad */ + T1_errno=T1ERR_INVALID_PARAMETER; + return( 0.0); + +} + + +/* Functions for intuitively transforming matrices. All function operate on their + original objects. In case NULL is specified, a unity-matrix is allocated by + the function and then tranformed appropriately. Note that in order to concatenate + transformation in the sense of t1lib the current transformation matrix must be + left-multiplied by the trnasformation to be applied! */ +/* Rotation: + ( x11' x21' ) ( cos(a) -sin(a) ) ( x11 x21 ) + ( ) = ( ) * ( ) + ( x12' x22' ) ( sin(a) cos(a) ) ( x12 x22 ) +*/ +T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, double angle) +{ + T1_TMATRIX tmat; + + if (matrix==NULL){ + if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + matrix->cxx=1.0; + matrix->cyx=0.0; + matrix->cxy=0.0; + matrix->cyy=1.0; + } + memcpy( &tmat, matrix, sizeof(T1_TMATRIX)); + /* Convert angle to radians: */ + angle=angle*PI/180.0; + /* multiply matrices */ + matrix->cxx=cos((double)angle) * tmat.cxx - sin((double)angle) * tmat.cxy; + matrix->cyx=cos((double)angle) * tmat.cyx - sin((double)angle) * tmat.cyy; + matrix->cxy=sin((double)angle) * tmat.cxx + cos((double)angle) * tmat.cxy; + matrix->cyy=sin((double)angle) * tmat.cyx + cos((double)angle) * tmat.cyy; + return( matrix); +} + + +/* Horizontal mirroring */ +/* H-Mirror: + ( x11' x21' ) ( -1 0 ) ( x11 x21 ) ( -x11 -x21 ) + ( ) = ( ) * ( ) = ( ) + ( x12' x22' ) ( 0 1 ) ( x12 x22 ) ( x12 x22 ) +*/ +T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix) +{ + + if (matrix==NULL){ + if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + matrix->cxx=1.0; + matrix->cyx=0.0; + matrix->cxy=0.0; + matrix->cyy=1.0; + } + matrix->cxx *=-1.0; + matrix->cyx *=-1.0; + return( matrix); +} + + +/* Vertical mirroring */ +/* V-Mirror: + ( x11' x21' ) ( 1 0 ) ( x11 x21 ) ( x11 x21 ) + ( ) = ( ) * ( ) = ( ) + ( x12' x22' ) ( 0 -1 ) ( x12 x22 ) ( -x12 -x22 ) +*/ +T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix) +{ + + if (matrix==NULL){ + if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + matrix->cxx=1.0; + matrix->cyx=0.0; + matrix->cxy=0.0; + matrix->cyy=1.0; + } + matrix->cxy *=-1.0; + matrix->cyy *=-1.0; + return( matrix); + +} + + +/* Horizontal shearing */ +/* H-Shearing: + ( x11' x21' ) ( 1 f ) ( x11 x21 ) ( x11+f*x12 x21+f*x22 ) + ( ) = ( ) * ( ) = ( ) + ( x12' x22' ) ( 0 1 ) ( x12 x22 ) ( x12 x22 ) +*/ +T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, double shear) +{ + + if (matrix==NULL){ + if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + matrix->cxx=1.0; + matrix->cyx=0.0; + matrix->cxy=0.0; + matrix->cyy=1.0; + } + matrix->cxx +=shear*matrix->cxy; + matrix->cyx +=shear*matrix->cyy; + return( matrix); + +} + + +/* Vertical shearing */ +/* V-Shearing: + ( x11' x21' ) ( 1 0 ) ( x11 x21 ) ( x11 x21 ) + ( ) = ( ) * ( ) = ( ) + ( x12' x22' ) ( f 1 ) ( x12 x22 ) ( x12+f*x11 x22+f*x21 ) +*/ +T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, double shear) +{ + + if (matrix==NULL){ + if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + matrix->cxx=1.0; + matrix->cyx=0.0; + matrix->cxy=0.0; + matrix->cyy=1.0; + } + matrix->cxy +=shear*matrix->cxx; + matrix->cyy +=shear*matrix->cyx; + return( matrix); + +} + + +/* Horizontal extension */ +/* Horizontal-Extension: + ( x11' x21' ) ( f 0 ) ( x11 x21 ) ( f*x11 f*x21 ) + ( ) = ( ) * ( ) = ( ) + ( x12' x22' ) ( 0 1 ) ( x12 x22 ) ( x12 x22 ) +*/ +T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, double extent) +{ + + if (matrix==NULL){ + if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + matrix->cxx=1.0; + matrix->cyx=0.0; + matrix->cxy=0.0; + matrix->cyy=1.0; + } + matrix->cxx *=extent; + matrix->cyx *=extent; + return( matrix); + +} + + +/* Vertical extension */ +/* Vertical-Extension: + ( x11' x21' ) ( 1 0 ) ( x11 x21 ) ( x11 x21 ) + ( ) = ( ) * ( ) = ( ) + ( x12' x22' ) ( 0 f ) ( x12 x22 ) ( f*x12 f*x22 ) +*/ +T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, double extent) +{ + + if (matrix==NULL){ + if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + matrix->cxx=1.0; + matrix->cyx=0.0; + matrix->cxy=0.0; + matrix->cyy=1.0; + } + matrix->cxy *=extent; + matrix->cyy *=extent; + return( matrix); + +} + + +/* General transformation */ +/* + ( x11 x21 ) ( y11 y21 ) ( x11*y11+x21*y12 x11*y21+x21*y22 ) + ( ) * ( ) = ( ) + ( x12 x22 ) ( y12 y22 ) ( x12*y11+x22*y12 x12*y21+x22*y22 ) +*/ +T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, + double cxx, double cyx, + double cxy, double cyy) +{ + T1_TMATRIX tmat; + + if (matrix==NULL){ + if ((matrix=(T1_TMATRIX *)malloc( sizeof(T1_TMATRIX)))==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return( NULL); + } + matrix->cxx=1.0; + matrix->cyx=0.0; + matrix->cxy=0.0; + matrix->cyy=1.0; + } + memcpy( &tmat, matrix, sizeof(T1_TMATRIX)); + matrix->cxx=cxx * tmat.cxx + cyx * tmat.cxy; + matrix->cyx=cxx * tmat.cyx + cyx * tmat.cyy; + matrix->cxy=cxy * tmat.cxx + cyy * tmat.cxy; + matrix->cyy=cxy * tmat.cyx + cyy * tmat.cyy; + + return( matrix); +} + + diff -Naur xdvik-22.40l/libs/t1lib/t1trans.h xdvik-22.40n/libs/t1lib/t1trans.h --- xdvik-22.40l/libs/t1lib/t1trans.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1trans.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,75 @@ +/*-------------------------------------------------------------------------- + ----- File: t1trans.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + definitions and declarations fort t1trans.c + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#ifdef T1TRANS_C + +int T1_ExtendFont( int FontID, double extend); +int T1_SlantFont( int FontID, double slant); +int T1_TransformFont( int FontID, T1_TMATRIX *matrix); +double T1_GetExtend( int FontID); +double T1_GetSlant( int FontID); +T1_TMATRIX T1_GetTransform( int FontID); +int T1_SetLinePosition( int FontID, int linetype, float value); +int T1_SetLineThickness( int FontID, int linetype, float value); +float T1_GetLinePosition( int FontID, int linetype); +float T1_GetLineThickness( int FontID, int linetype); +T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, double angle); +T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix); +T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix); +T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, double shear); +T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, double shear); +T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, double extent); +T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, double extent); +T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, + double cxx, double cyx, + double cxy, double cyy); + +#else + +extern int T1_ExtendFont( int FontID, double extend); +extern int T1_SlantFont( int FontID, double slant); +extern int T1_TransformFont( int FontID, T1_TMATRIX *matrix); +extern double T1_GetExtend( int FontID); +extern double T1_GetSlant( int FontID); +extern T1_TMATRIX T1_GetTransform( int FontID); +extern int T1_SetLinePosition( int FontID, int linetype, float value); +extern int T1_SetLineThickness( int FontID, int linetype, float value); +extern float T1_GetLinePosition( int FontID, int linetype); +extern float T1_GetLineThickness( int FontID, int linetype); +extern T1_TMATRIX *T1_RotateMatrix( T1_TMATRIX *matrix, double angle); +extern T1_TMATRIX *T1_MirrorHMatrix( T1_TMATRIX *matrix); +extern T1_TMATRIX *T1_MirrorVMatrix( T1_TMATRIX *matrix); +extern T1_TMATRIX *T1_ShearHMatrix( T1_TMATRIX *matrix, double shear); +extern T1_TMATRIX *T1_ShearVMatrix( T1_TMATRIX *matrix, double shear); +extern T1_TMATRIX *T1_ExtendHMatrix( T1_TMATRIX *matrix, double extent); +extern T1_TMATRIX *T1_ExtendVMatrix( T1_TMATRIX *matrix, double extent); +extern T1_TMATRIX *T1_TransformMatrix( T1_TMATRIX *matrix, + double cxx, double cyx, + double cxy, double cyy); + +#endif + diff -Naur xdvik-22.40l/libs/t1lib/t1types.h xdvik-22.40n/libs/t1lib/t1types.h --- xdvik-22.40l/libs/t1lib/t1types.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1types.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,221 @@ +/*-------------------------------------------------------------------------- + ----- File: t1types.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-06-04 + ----- Description: This file is part of the t1-library. It contains + type definitions used by the t1-library. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + + +#define T1TYPES_H + + +typedef struct +{ + int flags; + int chars; + int hkern; +} METRICS_ENTRY; + + +typedef struct +{ + char *pFontFileName; /* Pointer to the font's filename */ + char *pAfmFileName; /* Pointer to the afm filename, IFF set explicitly */ + FontInfo *pAFMData; /* A pointer to a struct which gives access to all + the data contained in the .afm-file. If this + pointer is NULL, no .afm-file had been found. + => There's no advanced info on the font available. + */ + psfont *pType1Data; /* A pointer to a struct giving access to all + information contained in the .pfa/.pfb-file. This + is needed! */ + int *pEncMap; /* For fast mapping from charnames to encoding + indices */ + METRICS_ENTRY *pKernMap; /* dito */ + int KernMapSize; + char **pFontEnc; /* This is the pointer to the encoding array + associated with that particular font. If + FontEnc=NULL, it means the internal + (fontspecific) encoding is to be used. */ + char *vm_base; /* The base address of the virtual memory area for this + font. It must be stored in order to be able to realloc + and free those memory areas later. */ + void *pFontSizeDeps; /* This one points to a linked list of structures + which store all font size dependent data. */ + double FontMatrix[4]; /* Two matrices which store the font matrix and special + Transformation to be applied, such as slant and + extend or probably some rotation. */ + double FontTransform[4]; + float slant; /* A slant factor for the font */ + float extend; /* A extension factor for the font */ + float UndrLnPos; /* Parameters for ~lining rules */ + float UndrLnThick; + float OvrLnPos; + float OvrLnThick; + float OvrStrkPos; + float OvrStrkThick; + unsigned short physical; /* This entry is used to decide, whether a + font is associated with an own physical + fontfile, or whether it has been created + as a "logical" font by copying another + "physical" font. */ + unsigned short refcount; /* At load time this counter is set to 1. Every + time, a T1_CopyFont() is executed on this font, + this counter is incremented by 1. This gives + the possibility to decide whether a physical + font is used by some logical font. */ + short space_position; /* The position where "space" is encoded, is saved + in this entry. The space character needs special + treatment. Saving its position here yields faster + execution during rastering of strings with a + user-supplied space-offset! */ + short info_flags; /* Here some info may be stored */ +} FONTPRIVATE; + + +/* A structure representing a matrix */ +typedef struct +{ + double cxx; + double cyx; + double cxy; + double cyy; +} T1_TMATRIX; + + +/* Following struct is used for storing all information for a particular + rendered character glyph */ +typedef struct +{ + char *bits; /* A pointer to the characters local bitmap */ + struct /* A struct containing diverse metric information */ + { + int ascent; + int descent; + int leftSideBearing; + int rightSideBearing; + int advanceX; + int advanceY; + } metrics; + void *pFontCacheInfo; + unsigned long bpp; /* The number of bits that represent 1 pixel */ +} GLYPH; + + + +/* Next comes the struct declaration for FontSizeDeps, which stores size + specific data of a font */ +typedef struct +{ + GLYPH *pFontCache; /* Pointer to the cache area of this + font at this size */ + void *pNextFontSizeDeps; /* A pointer to the next size's + FontSizeDeps-structure. */ + void *pPrevFontSizeDeps; /* A pointer to the previous size's + FontSizeDeps-structure or NULL if + the current is the first. */ + struct XYspace *pCharSpaceLocal; /* This is a scaled version of the + global version for this font. */ + float size; /* The desired size, to be specified + in bp's. */ + int antialias; /* Switch for marking the current size + antialiased */ +} FONTSIZEDEPS; + + + +/* A data that makes most important information available to user. */ +typedef struct +{ + int width; /* The glyph's width */ + BBox bbox; /* The glyph's bounding box */ + int numchars; /* The number of characters in the glyph (string) */ + int *charpos; /* A pointer to an integer array were the horizontal + positions in (afm units) of the individual + characters in the string are stored */ +} METRICSINFO; + + +/* Handling of outlines: These definitions decouple from the type 1 rasterizers + def's and make the necessary stuff available to end users */ + +#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ +/* From/to conversion of pels/fractpels */ +#define T1_TOPATHPOINT(p) (((long)p)<>FRACTBITS) + +/* A fractional point */ +typedef struct { + long x; + long y; +} T1_PATHPOINT; + + +/* A straight outline segment, stroked or not stroked */ +typedef struct pathsegment { + char type; /* type of segment (line or move) */ + unsigned char flag; /* type1 rasterizer internal stuff */ + short references; /* type1 rasterizer internal stuff */ + unsigned char size; /* size of the structure */ + unsigned char context; /* index to device context */ + struct pathsegment *link; /* pointer to next structure in linked list */ + struct pathsegment *last; /* pointer to last structure in list */ + T1_PATHPOINT dest; /* relative ending location of path segment */ +} T1_PATHSEGMENT; + +/* A third order bezier segment */ +typedef struct bezierpathsegment { + char type; /* type of segment (bezier) */ + unsigned char flag; /* type1 rasterizer internal stuff */ + short references; /* type1 rasterizer internal stuff */ + unsigned char size; /* as with any 'segment' type */ + unsigned char context; /* as with any 'segment' type */ + T1_PATHSEGMENT *link; /* as with any 'segment' type */ + T1_PATHSEGMENT *last; /* as with any 'segment' type */ + T1_PATHPOINT dest; /* ending point (D) */ + T1_PATHPOINT B; /* control point B */ + T1_PATHPOINT C; /* control point C */ +} T1_BEZIERSEGMENT; + +typedef T1_PATHSEGMENT T1_OUTLINE; + + +/* Two structures for handling composite character data */ +/* One structure for each symbol of the composite character */ +typedef struct +{ + int piece; /* the index of the current symbol */ + int deltax; /* horizontal displacement of current symbol in CS */ + int deltay; /* vertical displacement of current symbol in CS */ +} T1_COMP_PIECE; + +/* This one defines the composite character, the number of pieces and how to + access their data. */ +typedef struct +{ + int compchar; /* the base character in the current encoding */ + int numPieces; /* the number of defined pieces including the base char */ + T1_COMP_PIECE *pieces; /* a pointer to the pieces' information */ +} T1_COMP_CHAR_INFO; + diff -Naur xdvik-22.40l/libs/t1lib/t1x11.c xdvik-22.40n/libs/t1lib/t1x11.c --- xdvik-22.40l/libs/t1lib/t1x11.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1x11.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,861 @@ +/*-------------------------------------------------------------------------- + ----- File: t1x11.c + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-11-01 + ----- Description: This file is part of the t1-library. It contains + functions for generating glyphs with data in + X11-Pixmap format. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#define T1X11_C + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "../type1/types.h" +#include "parseAFM.h" +#include "../type1/objects.h" +#include "../type1/spaces.h" +#include "../type1/util.h" +#include "../type1/fontfcn.h" +#include "../type1/regions.h" + +#include "t1types.h" +#include "t1extern.h" +#include "t1set.h" +#include "t1aaset.h" +#include "t1load.h" +#include "t1finfo.h" +#include "t1misc.h" +#include "t1x11.h" +#include "t1base.h" + + + +#define T1GCMASK GCForeground | GCBackground + +/* As a fall back */ +#ifndef T1_AA_TYPE16 +#define T1_AA_TYPE16 short +#endif +#ifndef T1_AA_TYPE32 +#define T1_AA_TYPE32 int +#endif + + + +/* The three important X11 parameters t1lib has to deal with: */ +static Display *T1_display=NULL; /* Must be accessible from t1delete.c */ +static Visual *T1_visual=NULL; +static Colormap T1_colormap; +static unsigned int T1_depth=0; +static int T1_byte_order; +static int lastlevel=0; +static unsigned long oldfg_n=0, oldbg_n=0, oldfg_l=0, oldbg_l=0; +static unsigned long oldfg_h=0, oldbg_h=0, oldfg=0, oldbg=0; + + +extern int T1aa_SmartOn; /* from t1aaset.c */ +extern float T1aa_smartlimit1; +extern float T1aa_smartlimit2; + + + +static XColor aacolors[AAMAXPLANES]; +static unsigned long aapixels[AAMAXPLANES]; + + +/* The following parameter determines whether t1lib will use logical + positioning of chars and string (place the origin at specified + destination-point) or absolute positioning with respect to the + origin (upper left corner) of the generated bitmap/pixmap. */ +static int T1_lposition=1; + + + +/* T1_SetX11Params(): Set X11-parameters which t1lib has to know in order + to properly generate pixmaps from characters */ +int T1_SetX11Params( Display *display, + Visual *visual, + unsigned int depth, + Colormap colormap) +{ + + T1_display =display; + T1_visual =visual; + T1_depth =depth; + T1_colormap =colormap; + + if (T1_CheckEndian()==0) + T1_byte_order=0; + else + T1_byte_order=1; + + /* For bug hunting: */ + if (ImageByteOrder( T1_display)==0) + T1_PrintLog( "T1_SetX11Params()", + "X-Server uses Little Endian data representation", + T1LOG_DEBUG); + else + T1_PrintLog( "T1_SetX11Params()", + "X-Server uses Big Endian data representation", + T1LOG_DEBUG); + + return(0); +} + + + +/* T1_SetCharX(): Generate an object of type GLYPH, i.e, a glyph with + a pixmap ID instead of a pointer to a bitmap: */ + +GLYPH *T1_SetCharX( Drawable d, GC gc, int mode, int x_dest, int y_dest, + int FontID, char charcode, + float size, T1_TMATRIX *transform) +{ + GLYPH *pglyph; + static GLYPH xglyph={NULL,{0,0,0,0,0,0},NULL,0}; + + int height, width; + Pixmap clipmask=0; + int opaque; + + + xglyph.metrics.leftSideBearing=0; + xglyph.metrics.rightSideBearing=0; + xglyph.metrics.advanceX=0; + xglyph.metrics.advanceY=0; + xglyph.metrics.ascent=0; + xglyph.metrics.descent=0; + xglyph.pFontCacheInfo=NULL; + + + opaque=mode; + + + if ((pglyph=T1_SetChar( FontID, charcode, size, transform))==NULL){ + T1_PrintLog( "T1_SetCharX()", + "T1_SetChar() returned NULL-pointer!", + T1LOG_WARNING); + return(NULL); + } + + /* Check for empty bitmap */ + if (pglyph->bits==NULL) { + xglyph=*pglyph; + return( &xglyph); + } + + width=pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing; + height=pglyph->metrics.ascent-pglyph->metrics.descent; + + + clipmask=XCreateBitmapFromData( T1_display, + d, + (char *)pglyph->bits, + PAD(width, pFontBase->bitmap_pad), + height + ); + + /* Correct position */ + if (T1_lposition){ + x_dest += pglyph->metrics.leftSideBearing; + y_dest -= pglyph->metrics.ascent; + } + + if (opaque==0){ + XSetClipMask(T1_display, gc, clipmask); + XSetClipOrigin(T1_display, gc, x_dest, y_dest); + } + + XCopyPlane( T1_display, clipmask, d, gc, 0, 0, + width, height, x_dest, y_dest, 0x01); + + if (clipmask){ + XFreePixmap( T1_display, clipmask); + clipmask=0; + XSetClipMask(T1_display, gc, None); + XSetClipOrigin(T1_display, gc, 0, 0); + } + + pglyph->bits=NULL; /* Since XDestroyImage() free's this also! */ + xglyph.metrics.leftSideBearing=pglyph->metrics.leftSideBearing; + xglyph.metrics.rightSideBearing=pglyph->metrics.rightSideBearing; + xglyph.metrics.advanceX=pglyph->metrics.advanceX; + xglyph.metrics.advanceY=pglyph->metrics.advanceY; + xglyph.metrics.ascent=pglyph->metrics.ascent; + xglyph.metrics.descent=pglyph->metrics.descent; + xglyph.bpp=pglyph->bpp; + + return( &xglyph); + + +} + + + +/* T1_SetStringX(...): Draw a string of characters into an X11 drawable */ +GLYPH *T1_SetStringX( Drawable d, GC gc, int mode, int x_dest, int y_dest, + int FontID, char *string, int len, + long spaceoff, int modflag, float size, + T1_TMATRIX *transform) +{ + GLYPH *pglyph; + static GLYPH xglyph={NULL,{0,0,0,0,0,0},NULL,0}; + + int height, width; + Pixmap clipmask=0; + int opaque; + + + xglyph.metrics.leftSideBearing=0; + xglyph.metrics.rightSideBearing=0; + xglyph.metrics.advanceX=0; + xglyph.metrics.advanceY=0; + xglyph.metrics.ascent=0; + xglyph.metrics.descent=0; + xglyph.pFontCacheInfo=NULL; + + + opaque=mode; + + + if ((pglyph=T1_SetString( FontID, string, len, + spaceoff, modflag, size, + transform))==NULL){ + T1_PrintLog( "T1_SetStringX()", + "T1_SetString() returned NULL-pointer!", + T1LOG_WARNING); + return(NULL); + } + + /* Check for empty bitmap */ + if (pglyph->bits==NULL) { + xglyph=*pglyph; + return( &xglyph); + } + + width=pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing; + height=pglyph->metrics.ascent-pglyph->metrics.descent; + + clipmask=XCreateBitmapFromData( T1_display, + d, + (char *)pglyph->bits, + PAD(width, pFontBase->bitmap_pad), /* width */ + height + ); + + /* Correct position */ + if (T1_lposition){ + x_dest += pglyph->metrics.leftSideBearing; + y_dest -= pglyph->metrics.ascent; + } + + if (opaque==0){ + XSetClipMask(T1_display, gc, clipmask); + XSetClipOrigin(T1_display, gc, x_dest, y_dest); + } + + XCopyPlane( T1_display, clipmask, d, gc, 0, 0, + width, height, x_dest, y_dest, 0x01); + + if (clipmask){ + XFreePixmap( T1_display, clipmask); + clipmask=0; + XSetClipMask(T1_display, gc, None); + XSetClipOrigin(T1_display, gc, 0, 0); + } + + pglyph->bits=NULL; /* Since XDestroyImage() free's this also! */ + xglyph.metrics.leftSideBearing=pglyph->metrics.leftSideBearing; + xglyph.metrics.rightSideBearing=pglyph->metrics.rightSideBearing; + xglyph.metrics.advanceX=pglyph->metrics.advanceX; + xglyph.metrics.advanceY=pglyph->metrics.advanceY; + xglyph.metrics.ascent=pglyph->metrics.ascent; + xglyph.metrics.descent=pglyph->metrics.descent; + xglyph.bpp=pglyph->bpp; + + return( &xglyph); + + +} + + + +/* T1_AASetCharX(): Generate an object of type GLYPH, i.e, a glyph with + a pixmap ID instead of a pointer to a bitmap: */ +GLYPH *T1_AASetCharX( Drawable d, GC gc, int mode, int x_dest, int y_dest, + int FontID, char charcode, + float size, T1_TMATRIX *transform) +{ + int j, k; + + GLYPH *pglyph; + XImage *ximage; + + static GLYPH xglyph={NULL,{0,0,0,0,0,0},NULL,0}; + + int height, width, width_pad; + + XGCValues xgcvalues; + static unsigned long fg, bg; + + Pixmap clipmask=0; + int clipmask_h, clipmask_v, line_off; + char *clipmask_ptr; + + int opaque; + + + + xglyph.metrics.leftSideBearing=0; + xglyph.metrics.rightSideBearing=0; + xglyph.metrics.advanceX=0; + xglyph.metrics.advanceY=0; + xglyph.metrics.ascent=0; + xglyph.metrics.descent=0; + xglyph.pFontCacheInfo=NULL; + + + opaque=mode; + + xglyph.bpp=T1_depth; + + /* In order to be able to contruct the pixmap we need to know + foreground and background color as well the copy function */ + XGetGCValues( T1_display, gc, T1GCMASK, &xgcvalues); + fg=xgcvalues.foreground; + bg=xgcvalues.background; + + + /* At this point we must compute the colors that are needed to do + antialiasing between fore- and background. The following function + fills the static aacolors */ + if (T1aa_SmartOn==0) + j=T1_AAGetLevel(); + else if (size>=T1aa_smartlimit2) + j=1; + else if (size>=T1aa_smartlimit1) + j=2; + else + j=4; + if ( j!=lastlevel || fg!=oldfg || bg!=oldbg ){ + switch ( j){ + case 1: + if ( fg!=oldfg_n || bg!=oldbg_n){ + oldfg_n=fg; + oldbg_n=bg; + /* computing colors is not necessary here */ + T1_AANSetGrayValues( bg, fg); + } + break; + case 2: + if ( fg!=oldfg_l || bg!=oldbg_l){ + T1_ComputeAAColorsX( fg, bg, AAMAXPLANES); + /*~derekn*/ + /* If fg=bg, the clipmask will be messed up; in this case */ + /* we can arbitrarily change bg to get a correct clipmask. */ + if (opaque == 0 && fg == bg) + aapixels[0] = bg = (fg > 0) ? fg - 1 : fg + 1; + oldfg_l=fg; + oldbg_l=bg; + T1_AASetGrayValues(aapixels[0], /* white */ + aapixels[4], + aapixels[8], + aapixels[12], + aapixels[16] ); /* black */ + } + break; + case 4: + if ( fg!=oldfg_h || bg!=oldbg_h){ + T1_ComputeAAColorsX( fg, bg, AAMAXPLANES); + /*~derekn*/ + /* If fg=bg, the clipmask will be messed up; in this case */ + /* we can arbitrarily change bg to get a correct clipmask. */ + if (opaque == 0 && fg == bg) + aapixels[0] = bg = (fg > 0) ? fg - 1 : fg + 1; + oldfg_h=fg; + oldbg_h=bg; + T1_AAHSetGrayValues( aapixels); + } + break; + } + lastlevel=j; + oldfg=fg; + oldbg=bg; + } + + if ((pglyph=T1_AASetChar( FontID, charcode, size, + transform))==NULL){ + T1_PrintLog( "T1_AASetCharX()", + "T1_AASetChar() returned NULL-pointer!", + T1LOG_WARNING); + return(NULL); + } + + /* Check for empty bitmap */ + if (pglyph->bits==NULL) { + xglyph=*pglyph; + return( &xglyph); + } + + width=pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing; + height=pglyph->metrics.ascent-pglyph->metrics.descent; + + + /* Correct position */ + if (T1_lposition){ + x_dest += pglyph->metrics.leftSideBearing; + y_dest -= pglyph->metrics.ascent; + } + + if (opaque==0){ + clipmask_v=height; + clipmask_h=width; + width_pad=PAD(width*T1aa_bpp, pFontBase->bitmap_pad)/T1aa_bpp; + clipmask_ptr=(char *)calloc((PAD(clipmask_h, 8)>>3) * clipmask_v, sizeof( char)); + if (clipmask_ptr==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + /* Note: We pad the clipmask always to byte boundary */ + if (pglyph->bpp==8) + for ( k=0; k>3); + for (j=0; jbits))[k*width_pad+j]!=bg) + clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); + } + } + else if (pglyph->bpp==16) + for ( k=0; k>3); + for (j=0; jbits))[k*width_pad+j]!=(T1_AA_TYPE16)bg) + clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); + } + } + else + for ( k=0; k>3); + for (j=0; jbits))[k*width_pad+j]!=(T1_AA_TYPE32)bg) + clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); + } + } + + clipmask=XCreateBitmapFromData( T1_display, + d, + (char *)clipmask_ptr, + width, + height + ); + free( clipmask_ptr); + XSetClipMask(T1_display, gc, clipmask); + XSetClipOrigin(T1_display, gc, x_dest, y_dest); + + } + ximage=XCreateImage( T1_display, + T1_visual, + T1_depth, + ZPixmap, /* XYBitmap or XYPixmap */ + 0, /* No offset */ + (char *)pglyph->bits, + width, + height, + pFontBase->bitmap_pad, + 0 /*PAD(width,8)/8*/ /* number of bytes per line */ + ); + ximage->byte_order=T1_byte_order; + XPutImage(T1_display, + d, + gc, + ximage, + 0, + 0, + x_dest, + y_dest, + width, + height + ); + XDestroyImage(ximage); + if (clipmask){ + XFreePixmap( T1_display, clipmask); + clipmask=0; + XSetClipMask(T1_display, gc, None); + XSetClipOrigin(T1_display, gc, 0, 0); + } + + pglyph->bits=NULL; /* Since XDestroyImage() free's this also! */ + xglyph.metrics.leftSideBearing=pglyph->metrics.leftSideBearing; + xglyph.metrics.rightSideBearing=pglyph->metrics.rightSideBearing; + xglyph.metrics.advanceX=pglyph->metrics.advanceX; + xglyph.metrics.advanceY=pglyph->metrics.advanceY; + xglyph.metrics.ascent=pglyph->metrics.ascent; + xglyph.metrics.descent=pglyph->metrics.descent; + xglyph.bpp=pglyph->bpp; + + return( &xglyph); + + +} + + + +/* T1_AASetStringX(...): Draw a string of characters into an X11 drawable */ +GLYPH *T1_AASetStringX( Drawable d, GC gc, int mode, int x_dest, int y_dest, + int FontID, char *string, int len, + long spaceoff, int modflag, float size, + T1_TMATRIX *transform) +{ + int j, k; + + GLYPH *pglyph; + XImage *ximage; + + + static GLYPH xglyph={NULL,{0,0,0,0,0,0},NULL,0}; + + int height, width, width_pad; + + XGCValues xgcvalues; + static unsigned long fg, bg; + + + Pixmap clipmask=0; + int clipmask_h, clipmask_v, line_off; + char *clipmask_ptr; + + int opaque; + + + xglyph.metrics.leftSideBearing=0; + xglyph.metrics.rightSideBearing=0; + xglyph.metrics.advanceX=0; + xglyph.metrics.advanceY=0; + xglyph.metrics.ascent=0; + xglyph.metrics.descent=0; + xglyph.pFontCacheInfo=NULL; + + + opaque=mode; + + + /* In order to be able to contruct the pixmap we need to know + foreground and background color as well the copy function */ + XGetGCValues( T1_display, gc, T1GCMASK, &xgcvalues); + fg=xgcvalues.foreground; + bg=xgcvalues.background; + + xglyph.bpp=T1_depth; + + /* At this point we must compute the colors that are needed to do + antialiasing between fore- and background. The following function + fills the static aacolors */ + if (T1aa_SmartOn==0) + j=T1_AAGetLevel(); + else if (size>=T1aa_smartlimit2) + j=1; + else if (size>=T1aa_smartlimit1) + j=2; + else + j=4; + if ( j!=lastlevel || fg!=oldfg || bg!=oldbg ){ + switch ( j){ + case 1: + if ( fg!=oldfg_n || bg!=oldbg_n){ + oldfg_n=fg; + oldbg_n=bg; + /* computing colors is not necessary here */ + T1_AANSetGrayValues( bg, fg); + } + break; + case 2: + if ( fg!=oldfg_l || bg!=oldbg_l){ + T1_ComputeAAColorsX( fg, bg, AAMAXPLANES); + /*~derekn*/ + /* If fg=bg, the clipmask will be messed up; in this case */ + /* we can arbitrarily change bg to get a correct clipmask. */ + if (opaque == 0 && fg == bg) + aapixels[0] = bg = (fg > 0) ? fg - 1 : fg + 1; + oldfg_l=fg; + oldbg_l=bg; + T1_AASetGrayValues(aapixels[0], /* white */ + aapixels[4], + aapixels[8], + aapixels[12], + aapixels[16] ); /* black */ + } + break; + case 4: + if ( fg!=oldfg_h || bg!=oldbg_h){ + T1_ComputeAAColorsX( fg, bg, AAMAXPLANES); + /*~derekn*/ + /* If fg=bg, the clipmask will be messed up; in this case */ + /* we can arbitrarily change bg to get a correct clipmask. */ + if (opaque == 0 && fg == bg) + aapixels[0] = bg = (fg > 0) ? fg - 1 : fg + 1; + oldfg_h=fg; + oldbg_h=bg; + T1_AAHSetGrayValues( aapixels); + } + break; + } + lastlevel=j; + oldfg=fg; + oldbg=bg; + } + + + if ((pglyph=T1_AASetString( FontID, string, len, + spaceoff, modflag, size, + transform))==NULL){ + T1_PrintLog( "T1_AASetStringX()", + "T1_AASetString() returned NULL-pointer!", + T1LOG_WARNING); + return(NULL); + } + + /* Check for empty bitmap */ + if (pglyph->bits==NULL) { + xglyph=*pglyph; + return( &xglyph); + } + + width=pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing; + height=pglyph->metrics.ascent-pglyph->metrics.descent; + + + /* Correct position */ + if (T1_lposition){ + x_dest += pglyph->metrics.leftSideBearing; + y_dest -= pglyph->metrics.ascent; + } + + if (opaque==0){ + clipmask_v=height; + clipmask_h=width; + width_pad=PAD(width*T1aa_bpp, pFontBase->bitmap_pad)/T1aa_bpp; + clipmask_ptr=(char *)calloc((PAD(clipmask_h, 8)>>3) * clipmask_v, sizeof( char)); + if (clipmask_ptr==NULL){ + T1_errno=T1ERR_ALLOC_MEM; + return(NULL); + } + /* Note: We pad the clipmask always to byte boundary */ + if (pglyph->bpp==8) + for ( k=0; k>3); + for (j=0; jbits))[k*width_pad+j]!=bg) + clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); + } + } + else if (pglyph->bpp==16) + for ( k=0; k>3); + for (j=0; jbits))[k*width_pad+j]!=(T1_AA_TYPE16)bg) + clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); + } + } + else + for ( k=0; k>3); + for (j=0; jbits))[k*width_pad+j]!=(T1_AA_TYPE32)bg) + clipmask_ptr[line_off+(j>>3)] |= (0x01<<(j%8)); + } + } + + clipmask=XCreateBitmapFromData( T1_display, + d, + (char *)clipmask_ptr, + width, + height + ); + free( clipmask_ptr); + XSetClipMask(T1_display, gc, clipmask); + XSetClipOrigin(T1_display, gc, x_dest, y_dest); + + } + ximage=XCreateImage( T1_display, + T1_visual, + T1_depth, + ZPixmap, /* XYBitmap or XYPixmap */ + 0, /* No offset */ + (char *)pglyph->bits, + width, + height, + pFontBase->bitmap_pad, /* lines padded to bytes */ + 0 /*PAD(width,8)/8*/ /* number of bytes per line */ + ); + ximage->byte_order=T1_byte_order; + XPutImage(T1_display, + d, + gc, + ximage, + 0, + 0, + x_dest, + y_dest, + width, + height + ); + XDestroyImage(ximage); + if (clipmask){ + XFreePixmap( T1_display, clipmask); + clipmask=0; + XSetClipMask(T1_display, gc, None); + XSetClipOrigin(T1_display, gc, 0, 0); + } + + pglyph->bits=NULL; /* Since XDestroyImage() free's this also! */ + xglyph.metrics.leftSideBearing=pglyph->metrics.leftSideBearing; + xglyph.metrics.rightSideBearing=pglyph->metrics.rightSideBearing; + xglyph.metrics.advanceX=pglyph->metrics.advanceX; + xglyph.metrics.advanceY=pglyph->metrics.advanceY; + xglyph.metrics.ascent=pglyph->metrics.ascent; + xglyph.metrics.descent=pglyph->metrics.descent; + xglyph.bpp=pglyph->bpp; + + return( &xglyph); + + +} + + + +/* T1_ComputeAAColorsX(): Compute the antialiasing colors in dependency + of foreground and background */ +int T1_ComputeAAColorsX( unsigned long fg, unsigned long bg, int nolevels) +{ + + static unsigned long last_fg; + static unsigned long last_bg; + long delta_red, delta_green, delta_blue; + int i; + int nocolors=0; + + + aacolors[0].pixel=bg; + aacolors[nolevels-1].pixel=fg; + + if ((fg==last_fg)&&(bg==last_bg)) + return(nocolors); + + /* Get RGB values for fore- and background */ + XQueryColor( T1_display, T1_colormap, &aacolors[0]); + XQueryColor( T1_display, T1_colormap, &aacolors[nolevels-1]); + delta_red = (aacolors[nolevels-1].red - aacolors[0].red)/(nolevels-1); + delta_green = (aacolors[nolevels-1].green - aacolors[0].green)/(nolevels-1); + delta_blue = (aacolors[nolevels-1].blue - aacolors[0].blue)/(nolevels-1); + aapixels[0]=aacolors[0].pixel; + aapixels[nolevels-1]=aacolors[nolevels-1].pixel; + + for (i=1; ibits==NULL) { + T1_errno=T1ERR_INVALID_PARAMETER; + return( NULL); + } + + if (pglyph->bpp==1) { /* we have a bitmap glyph */ + ximage=XCreateImage( T1_display, + T1_visual, + 1, + XYBitmap, /* XYBitmap or XYPixmap */ + 0, /* No offset */ + (char *)pglyph->bits, + pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing, + pglyph->metrics.ascent-pglyph->metrics.descent, + pFontBase->bitmap_pad, + 0 /* number of bytes per line */ + ); + } + else { /* we have an anztialiased glyph */ + ximage=XCreateImage( T1_display, + T1_visual, + T1_depth, + ZPixmap, /* XYBitmap or XYPixmap */ + 0, /* No offset */ + (char *)pglyph->bits, + pglyph->metrics.rightSideBearing-pglyph->metrics.leftSideBearing, + pglyph->metrics.ascent-pglyph->metrics.descent, + pFontBase->bitmap_pad, + 0 /* number of bytes per line */ + ); + } + + if (ximage==NULL) { + T1_errno=T1ERR_X11; + return( NULL); + } + ximage->byte_order=T1_byte_order; /* Set t1lib´s byteorder */ + + return( ximage); + +} + diff -Naur xdvik-22.40l/libs/t1lib/t1x11.h xdvik-22.40n/libs/t1lib/t1x11.h --- xdvik-22.40l/libs/t1lib/t1x11.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/t1x11.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,87 @@ +/*-------------------------------------------------------------------------- + ----- File: t1x11.h + ----- Author: Rainer Menzner (Rainer.Menzner@web.de) + ----- Date: 2001-04-01 + ----- Description: This file is part of the t1-library. It contains + definitions and declarations for t1x11.c. + ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. + As of version 0.5, t1lib is distributed under the + GNU General Public Library Lincense. The + conditions can be found in the files LICENSE and + LGPL, which should reside in the toplevel + directory of the distribution. Please note that + there are parts of t1lib that are subject to + other licenses: + The parseAFM-package is copyrighted by Adobe Systems + Inc. + The type1 rasterizer is copyrighted by IBM and the + X11-consortium. + ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) + ----- Credits: I want to thank IBM and the X11-consortium for making + their rasterizer freely available. + Also thanks to Piet Tutelaers for his ps2pk, from + which I took the rasterizer sources in a format + independent from X11. + Thanks to all people who make free software living! +--------------------------------------------------------------------------*/ + +#include + +#ifdef T1X11_C + +int T1_SetX11Params( Display *display, + Visual *visual, + unsigned int depth, + Colormap colormap); +GLYPH *T1_SetCharX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char charcode, + float size, T1_TMATRIX *transform); +GLYPH *T1_SetStringX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +GLYPH *T1_AASetCharX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char charcode, + float size, T1_TMATRIX *transform); +GLYPH *T1_AASetStringX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +int T1_ComputeAAColorsX( unsigned long fg, + unsigned long bg, + int nolevels); +int T1_GetDepthOfDrawable( Drawable drawable); +void T1_LogicalPositionX( int pos_switch); + + +#else + +extern Display *T1_display; + +extern int T1_SetX11Params( Display *display, + Visual *visual, + unsigned int depth, + Colormap colormap); +extern GLYPH *T1_SetCharX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_SetStringX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_AASetCharX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char charcode, + float size, T1_TMATRIX *transform); +extern GLYPH *T1_AASetStringX( Drawable d, GC gc, int mode, int x, int y, + int FontID, char *string, int len, + long spaceoff, int modflag, + float size, T1_TMATRIX *transform); +extern int T1_ComputeAAColorsX( unsigned long fg, + unsigned long bg, + int nolevels); +extern int T1_GetDepthOfDrawable( Drawable drawable); +extern void T1_LogicalPositionX( int pos_switch); + + +#endif + diff -Naur xdvik-22.40l/libs/t1lib/type1afm/.dependencies xdvik-22.40n/libs/t1lib/type1afm/.dependencies --- xdvik-22.40l/libs/t1lib/type1afm/.dependencies Wed Apr 18 14:24:15 2001 +++ xdvik-22.40n/libs/t1lib/type1afm/.dependencies Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -type1afm.lo: type1afm.c ../lib/t1lib/t1lib.h diff -Naur xdvik-22.40l/libs/t1lib/type1afm/CVS/Entries xdvik-22.40n/libs/t1lib/type1afm/CVS/Entries --- xdvik-22.40l/libs/t1lib/type1afm/CVS/Entries Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/type1afm/CVS/Entries Thu Jan 1 00:00:00 1970 @@ -1,4 +0,0 @@ -/.dependencies/1.1.1.1/Wed Apr 18 14:24:15 2001//Txdvik_22_40_STABLE -/Makefile.in/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/type1afm.c/1.2.8.1/Sun Oct 14 12:30:24 2001//Txdvik_22_40_STABLE -D diff -Naur xdvik-22.40l/libs/t1lib/type1afm/CVS/Repository xdvik-22.40n/libs/t1lib/type1afm/CVS/Repository --- xdvik-22.40l/libs/t1lib/type1afm/CVS/Repository Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/type1afm/CVS/Repository Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -xdvik/libs/t1lib/type1afm diff -Naur xdvik-22.40l/libs/t1lib/type1afm/CVS/Root xdvik-22.40n/libs/t1lib/type1afm/CVS/Root --- xdvik-22.40l/libs/t1lib/type1afm/CVS/Root Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/type1afm/CVS/Root Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/t1lib/type1afm/CVS/Tag xdvik-22.40n/libs/t1lib/type1afm/CVS/Tag --- xdvik-22.40l/libs/t1lib/type1afm/CVS/Tag Sat Aug 31 23:06:36 2002 +++ xdvik-22.40n/libs/t1lib/type1afm/CVS/Tag Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/t1lib/type1afm/Makefile.in xdvik-22.40n/libs/t1lib/type1afm/Makefile.in --- xdvik-22.40l/libs/t1lib/type1afm/Makefile.in Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/type1afm/Makefile.in Thu Jan 1 00:00:00 1970 @@ -1,104 +0,0 @@ -# Makefile.in -# -# This file is part of the t1lib-package! See documentation and Readme files -# of the t1lib-package for copyright restrictions. -# -# Targets provided: -# all (default) -# install -# uninstall -# clean -# -# Author: Rainer Menzner (Rainer.Menzner@web.de) -# Date: 02/19/1997 -# Last modified: 2001-04-01 -# -# Modified by H.Kakugawa to use libtool - -LIBTOOL = ../libtool -SHELL = /bin/sh -CC = @CC@ -CPP = @CPP@ -CFLAGS = @CFLAGS@ -OPTIONS = @OPTIONS@ -X_LIBS = @X_LIBS@ -TOPSRC = @top_srcdir@ -XPM_LIB = -lXpm -XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ -LDFLAGS = @LDFLAGS@ -LDLIBS = @LDLIBS@ -AR = ar rc -RANLIB = @RANLIB@ -RM = rm -f -X_CFLAGS = @X_CFLAGS@ -YACC = @YACC@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -ALLCFLAGS = $(CFLAGS) -SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(ALLCFLAGS)' 'OPTIONS=$(OPTIONS)' -@SET_MAKE@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @top_srcdir@/ac-tools/mkinstalldirs -prefix = @prefix@ -exec_prefix = @exec_prefix@ -includedir = @includedir@ -bindir = @bindir@ -datadir = @datadir@ -libdir = @libdir@ -mandir = @mandir@/man1 -manext = .1 -no_x = @no_x@ - - -# targets to build - -MAIN_TARGET = @MAIN_TARGET@ - -OBJS = \ - type1afm.lo - -SRCS = \ - type1afm.c - -T1LIB = ../lib/libt1.la - - -all: type1afm - -type1afm: $(OBJS) ../lib/t1lib.h - $(LIBTOOL) --mode=link \ - $(CC) -o type1afm $(LDFLAGS) $(OBJS) $(T1LIB) $(LDLIBS) - -.SUFFIXES: .lo -.c.lo: - $(LIBTOOL) --mode=compile \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< - -.PHONY: clean - -dependencies: dummy - gcc -MM *.c | sed 's/\.o:/.lo:/g' > .dependencies - -clean: dummy - $(RM) type1afm *.o *.lo .libs/* *~ \#*\# *.log *.bak - -rmdir .libs - -install: dummy - $(MKINSTALLDIRS) $(bindir) - $(LIBTOOL) --mode=install \ - $(INSTALL_PROGRAM) type1afm $(bindir)/type1afm - - -uninstall: dummy - $(LIBTOOL) --mode=uninstall \ - $(RM) $(bindir)/type1afm - - -dummy: - -# Dependencies of object files -include .dependencies - diff -Naur xdvik-22.40l/libs/t1lib/type1afm/type1afm.c xdvik-22.40n/libs/t1lib/type1afm/type1afm.c --- xdvik-22.40l/libs/t1lib/type1afm/type1afm.c Sun Oct 14 12:30:24 2001 +++ xdvik-22.40n/libs/t1lib/type1afm/type1afm.c Thu Jan 1 00:00:00 1970 @@ -1,140 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: type1afm.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-05-20 - ----- Description: This file is part of t1lib. The program type1afm - extracts metrics information from Type 1 font files - and dumps it to afm files. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#include -#include -/* Note: We include t1lib.h from lib/t1lib. That way the objectfile does only - need to be rebuild when the header itself changes and not each time the - library has been recompiled */ -#include "../lib/t1lib/t1lib.h" - - -void printusage( void); - - -int main(int argc, char *argv[]) -{ - - int i, j, result; - int rasterflags=0; - - - if (argc==1){ - printusage(); - return(0); - } - - /* If we want to log anything, then log all */ - T1_SetLogLevel(T1LOG_DEBUG); - /* Check whether logfile is requested */ - if (strcmp( argv[1], "-l")==0){ - if (argc==2){ - printusage(); - return(0); - } - j=2; - if ((T1_InitLib( LOGFILE | - IGNORE_CONFIGFILE | - IGNORE_FONTDATABASE)==NULL)){ - fprintf(stderr, "Initialization of t1lib failed\n"); - return(1); - } - } - else{ - j=1; - if ((T1_InitLib( NO_LOGFILE | - IGNORE_CONFIGFILE | - IGNORE_FONTDATABASE)==NULL)){ - fprintf(stderr, "Initialization of t1lib failed\n"); - return(1); - } - } - - /* First, build font data base */ - for (i=j; i [ ...]\n"); - fprintf(stdout, "\n"); - fprintf(stdout, "Generate afm-file from Adobe Type 1 font file (T1lib-%s)!\n", - T1_GetLibIdent()); - fprintf(stdout, "Options: -l Write a log-file t1lib.log\n"); -} - diff -Naur xdvik-22.40l/libs/t1lib/win32/CVS/Entries xdvik-22.40n/libs/t1lib/win32/CVS/Entries --- xdvik-22.40l/libs/t1lib/win32/CVS/Entries Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/win32/CVS/Entries Thu Jan 1 00:00:00 1970 @@ -1,7 +0,0 @@ -/T1_DLL.dsp/1.1/Thu Apr 19 20:59:01 2001//Txdvik_22_40_STABLE -/T1_DLL.dsw/1.1/Thu Apr 19 20:59:01 2001//Txdvik_22_40_STABLE -/T1_Static.dsp/1.1/Thu Apr 19 20:59:01 2001//Txdvik_22_40_STABLE -/T1_Static.dsw/1.1/Thu Apr 19 20:59:01 2001//Txdvik_22_40_STABLE -/sysconf.h/1.1/Thu Apr 19 20:59:01 2001//Txdvik_22_40_STABLE -/t1.def/1.1/Thu Apr 19 20:59:01 2001//Txdvik_22_40_STABLE -D diff -Naur xdvik-22.40l/libs/t1lib/win32/CVS/Repository xdvik-22.40n/libs/t1lib/win32/CVS/Repository --- xdvik-22.40l/libs/t1lib/win32/CVS/Repository Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/win32/CVS/Repository Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -xdvik/libs/t1lib/win32 diff -Naur xdvik-22.40l/libs/t1lib/win32/CVS/Root xdvik-22.40n/libs/t1lib/win32/CVS/Root --- xdvik-22.40l/libs/t1lib/win32/CVS/Root Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/win32/CVS/Root Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/t1lib/win32/CVS/Tag xdvik-22.40n/libs/t1lib/win32/CVS/Tag --- xdvik-22.40l/libs/t1lib/win32/CVS/Tag Sat Aug 31 23:06:37 2002 +++ xdvik-22.40n/libs/t1lib/win32/CVS/Tag Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/t1lib/win32/T1_DLL.dsp xdvik-22.40n/libs/t1lib/win32/T1_DLL.dsp --- xdvik-22.40l/libs/t1lib/win32/T1_DLL.dsp Thu Apr 19 20:59:01 2001 +++ xdvik-22.40n/libs/t1lib/win32/T1_DLL.dsp Thu Jan 1 00:00:00 1970 @@ -1,481 +0,0 @@ -# Microsoft Developer Studio Project File - Name="T1_DLL" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** $BJT=8$7$J$$$G$/$@$5$$(B ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=T1_DLL - Win32 Debug MD -!MESSAGE $B$3$l$OM-8z$J%a%$%/%U%!%$%k$G$O$"$j$^$;$s!#(B $B$3$N%W%m%8%'%/%H$r%S%k%I$9$k$?$a$K$O(B NMAKE $B$r;HMQ$7$F$/$@$5$$!#(B -!MESSAGE [$B%a%$%/%U%!%$%k$N%(%/%9%]!<%H(B] $B%3%^%s%I$r;HMQ$7$Fe$G%^%/%m$N@_Dj$rDj5A$7$^$9!#Nc(B: -!MESSAGE -!MESSAGE NMAKE /f "T1_DLL.mak" CFG="T1_DLL - Win32 Debug MD" -!MESSAGE -!MESSAGE $BA*Br2DG=$J%S%k%I(B $B%b!<%I(B: -!MESSAGE -!MESSAGE "T1_DLL - Win32 Release" ("Win32 (x86) Dynamic-Link Library" $BMQ(B) -!MESSAGE "T1_DLL - Win32 Debug" ("Win32 (x86) Dynamic-Link Library" $BMQ(B) -!MESSAGE "T1_DLL - Win32 Release MD" ("Win32 (x86) Dynamic-Link Library" $BMQ(B) -!MESSAGE "T1_DLL - Win32 Debug MD" ("Win32 (x86) Dynamic-Link Library" $BMQ(B) -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "T1_DLL - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Lib" -# PROP Intermediate_Dir "DLL_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "T1_DLL_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "T1_DLL_EXPORTS" /YX /Fd"Lib/T1.pdb" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Lib/T1.dll" - -!ELSEIF "$(CFG)" == "T1_DLL - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Lib" -# PROP Intermediate_Dir "DLL_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "T1_DLL_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "T1_DLL_EXPORTS" /YX /Fd"Lib/T1d.pdb" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Lib/T1d.dll" /pdbtype:sept - -!ELSEIF "$(CFG)" == "T1_DLL - Win32 Release MD" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "T1_DLL___Win32_Release_MD" -# PROP BASE Intermediate_Dir "T1_DLL___Win32_Release_MD" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Lib" -# PROP Intermediate_Dir "DLLMD_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "T1_DLL_EXPORTS" /YX /Fd"Lib/T1.pdb" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "T1_DLL_EXPORTS" /YX /Fd"Lib/T1MD.pdb" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Lib/T1.dll" -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Lib/T1MD.dll" - -!ELSEIF "$(CFG)" == "T1_DLL - Win32 Debug MD" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "T1_DLL___Win32_Debug_MD" -# PROP BASE Intermediate_Dir "T1_DLL___Win32_Debug_MD" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Lib" -# PROP Intermediate_Dir "DLLMD_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "T1_DLL_EXPORTS" /YX /Fd"Lib/T1d.pdb" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "T1_DLL_EXPORTS" /YX /Fd"Lib/T1MDd.pdb" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Lib/T1d.dll" /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Lib/T1MDd.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "T1_DLL - Win32 Release" -# Name "T1_DLL - Win32 Debug" -# Name "T1_DLL - Win32 Release MD" -# Name "T1_DLL - Win32 Debug MD" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\lib\type1\arith.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\curves.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontfcn.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\hints.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\lines.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\objects.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\parseAFM.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\paths.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\regions.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\scanfont.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\spaces.c -# End Source File -# Begin Source File - -SOURCE=.\t1.def -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1aaset.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1afmtool.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1base.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1delete.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1enc.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1env.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1finfo.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1io.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1load.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1outline.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1set.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1snap.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1stub.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1trans.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\token.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\type1.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\util.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\lib\type1\arith.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\blues.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\cluts.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\curves.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\digit.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\ffilest.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\font.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontfcn.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontfile.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontmisc.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fonts.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontstruct.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontxlfd.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fsmasks.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\hdigit.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\hints.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\lines.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\objects.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\parseAFM.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\paths.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\paths_rmz.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\pictures.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\regions.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\spaces.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\spaces_rmz.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\strokes.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\sysconf.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1aaset.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1afmtool.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1base.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1delete.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1enc.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1env.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1extern.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1finfo.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1global.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1hdigit.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1imager.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1load.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1misc.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1outline.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1set.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1stdio.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1trans.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1types.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1x11.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\token.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\tokst.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\trig.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\util.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\Xstuff.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff -Naur xdvik-22.40l/libs/t1lib/win32/T1_DLL.dsw xdvik-22.40n/libs/t1lib/win32/T1_DLL.dsw --- xdvik-22.40l/libs/t1lib/win32/T1_DLL.dsw Thu Apr 19 20:59:01 2001 +++ xdvik-22.40n/libs/t1lib/win32/T1_DLL.dsw Thu Jan 1 00:00:00 1970 @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# $B7Y9p(B: $B$3$N%o!<%/%9%Z!<%9(B $B%U%!%$%k(B $B$rJT=8$^$?$O:o=|$7$J$$$G$/$@$5$$(B! - -############################################################################### - -Project: "T1_DLL"=.\T1_DLL.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff -Naur xdvik-22.40l/libs/t1lib/win32/T1_Static.dsp xdvik-22.40n/libs/t1lib/win32/T1_Static.dsp --- xdvik-22.40l/libs/t1lib/win32/T1_Static.dsp Thu Apr 19 20:59:01 2001 +++ xdvik-22.40n/libs/t1lib/win32/T1_Static.dsp Thu Jan 1 00:00:00 1970 @@ -1,458 +0,0 @@ -# Microsoft Developer Studio Project File - Name="T1_Static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** $BJT=8$7$J$$$G$/$@$5$$(B ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=T1_Static - Win32 Debug MD -!MESSAGE $B$3$l$OM-8z$J%a%$%/%U%!%$%k$G$O$"$j$^$;$s!#(B $B$3$N%W%m%8%'%/%H$r%S%k%I$9$k$?$a$K$O(B NMAKE $B$r;HMQ$7$F$/$@$5$$!#(B -!MESSAGE [$B%a%$%/%U%!%$%k$N%(%/%9%]!<%H(B] $B%3%^%s%I$r;HMQ$7$Fe$G%^%/%m$N@_Dj$rDj5A$7$^$9!#Nc(B: -!MESSAGE -!MESSAGE NMAKE /f "T1_Static.mak" CFG="T1_Static - Win32 Debug MD" -!MESSAGE -!MESSAGE $BA*Br2DG=$J%S%k%I(B $B%b!<%I(B: -!MESSAGE -!MESSAGE "T1_Static - Win32 Release" ("Win32 (x86) Static Library" $BMQ(B) -!MESSAGE "T1_Static - Win32 Debug" ("Win32 (x86) Static Library" $BMQ(B) -!MESSAGE "T1_Static - Win32 Release MD" ("Win32 (x86) Static Library" $BMQ(B) -!MESSAGE "T1_Static - Win32 Debug MD" ("Win32 (x86) Static Library" $BMQ(B) -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "T1_Static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Lib" -# PROP Intermediate_Dir "Static_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /Fd"Lib\T1_Static.pdb" /FD /c -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "T1_Static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Lib" -# PROP Intermediate_Dir "Static_Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /Fd"Lib/T1_Staticd.pdb" /FD /GZ /c -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Lib\T1_Staticd.lib" - -!ELSEIF "$(CFG)" == "T1_Static - Win32 Release MD" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "T1_Static___Win32_Release_MD" -# PROP BASE Intermediate_Dir "T1_Static___Win32_Release_MD" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Lib" -# PROP Intermediate_Dir "StaticMD_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Zi /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /Fd"Lib\T1_StaticMD.pdb" /FD /c -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Lib\T1_StaticMD.lib" - -!ELSEIF "$(CFG)" == "T1_Static - Win32 Debug MD" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "T1_Static___Win32_Debug_MD" -# PROP BASE Intermediate_Dir "T1_Static___Win32_Debug_MD" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Lib" -# PROP Intermediate_Dir "StaticMD_Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /Fd"Lib/T1_Staticd.pdb" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /Fd"Lib/T1_StaticMDd.pdb" /FD /GZ /c -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"Lib\T1_Staticd.lib" -# ADD LIB32 /nologo /out:"Lib\T1_StaticMDd.lib" - -!ENDIF - -# Begin Target - -# Name "T1_Static - Win32 Release" -# Name "T1_Static - Win32 Debug" -# Name "T1_Static - Win32 Release MD" -# Name "T1_Static - Win32 Debug MD" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\lib\type1\arith.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\curves.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontfcn.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\hints.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\lines.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\objects.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\parseAFM.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\paths.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\regions.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\scanfont.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\spaces.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1aaset.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1afmtool.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1base.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1delete.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1enc.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1env.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1finfo.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1io.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1load.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1outline.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1set.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1snap.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1stub.c -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1trans.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\token.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\type1.c -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\util.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\lib\type1\arith.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\blues.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\cluts.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\curves.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\digit.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\ffilest.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\font.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontfcn.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontfile.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontmisc.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fonts.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontstruct.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fontxlfd.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\fsmasks.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\hdigit.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\hints.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\lines.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\objects.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\parseAFM.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\paths.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\paths_rmz.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\pictures.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\regions.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\spaces.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\spaces_rmz.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\strokes.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\sysconf.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1aaset.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1afmtool.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1base.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1delete.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1enc.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1env.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1extern.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1finfo.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1global.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1hdigit.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1imager.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1load.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1misc.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1outline.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1set.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\t1stdio.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1trans.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1types.h -# End Source File -# Begin Source File - -SOURCE=..\lib\t1lib\t1x11.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\token.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\tokst.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\trig.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\util.h -# End Source File -# Begin Source File - -SOURCE=..\lib\type1\Xstuff.h -# End Source File -# End Group -# End Target -# End Project diff -Naur xdvik-22.40l/libs/t1lib/win32/T1_Static.dsw xdvik-22.40n/libs/t1lib/win32/T1_Static.dsw --- xdvik-22.40l/libs/t1lib/win32/T1_Static.dsw Thu Apr 19 20:59:01 2001 +++ xdvik-22.40n/libs/t1lib/win32/T1_Static.dsw Thu Jan 1 00:00:00 1970 @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# $B7Y9p(B: $B$3$N%o!<%/%9%Z!<%9(B $B%U%!%$%k(B $B$rJT=8$^$?$O:o=|$7$J$$$G$/$@$5$$(B! - -############################################################################### - -Project: "T1_Static"=".\T1_Static.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff -Naur xdvik-22.40l/libs/t1lib/win32/sysconf.h xdvik-22.40n/libs/t1lib/win32/sysconf.h --- xdvik-22.40l/libs/t1lib/win32/sysconf.h Thu Apr 19 20:59:01 2001 +++ xdvik-22.40n/libs/t1lib/win32/sysconf.h Thu Jan 1 00:00:00 1970 @@ -1,51 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: sysconf.h.in - ----- Author: Rainer Menzner (rmz@neuroinformatik.ruhr-uni-bochum.de) - ----- Date: 02/24/1998 - ----- Description: This file is part of the t1-library. Some system - dependent definitions are stored here. sysconf.h - is generated from this file automatically by the - configure-script. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-1998. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - - -#undef __CHAR_UNSIGNED__ -#define SIZEOF_CHAR 1 -#define SIZEOF_SHORT 2 -#define SIZEOF_INT 4 -#define SIZEOF_LONG 4 -#define SIZEOF_LONG_LONG 8 -#define SIZEOF_FLOAT 4 -#define SIZEOF_DOUBLE 8 -#define SIZEOF_LONG_DOUBLE 12 -#define SIZEOF_VOID_P 4 - -#if defined(_MSC_VER) -# define T1LIB_IDENT "1.0" -# define GLOBAL_CONFIG_DIR "/usr/local/share/t1lib-1.0" -# define T1_AA_TYPE16 short -# define T1_AA_TYPE32 int -#endif - -#if defined(_MSC_VER) && !defined(_WIN32) -# define _WIN32 1 -#endif diff -Naur xdvik-22.40l/libs/t1lib/win32/t1.def xdvik-22.40n/libs/t1lib/win32/t1.def --- xdvik-22.40l/libs/t1lib/win32/t1.def Thu Apr 19 20:59:01 2001 +++ xdvik-22.40n/libs/t1lib/win32/t1.def Thu Jan 1 00:00:00 1970 @@ -1,110 +0,0 @@ -EXPORTS - T1_AAFillOutline - T1_AAGetLevel - T1_AAHSetGrayValues - T1_AANSetGrayValues - T1_AASetBitsPerPixel - T1_AASetChar - T1_AASetGrayValues - T1_AASetLevel - T1_AASetSmartLimits - T1_AASetSmartMode - T1_AASetString - T1_AbsolutePath - T1_AddFont - T1_AddToFileSearchPath - T1_CheckEndian - T1_CloseLib - T1_ComputeLineParameters - T1_ConcatGlyphs - T1_ConcatOutlines - T1_CopyFont - T1_CopyGlyph - T1_DeleteAllSizes - T1_DeleteEncoding - T1_DeleteFont - T1_DeleteSize - T1_DumpGlyph - T1_DumpPath - ;T1_DumpPixmap - T1_ExtendFont - T1_ExtendHMatrix - T1_ExtendVMatrix - T1_FillOutline - T1_FreeGlyph - T1_GenerateAFMFallbackInfo - T1_Get_no_fonts - T1_GetAfmFileName - T1_GetAllCharNames - T1_GetBitmapPad - T1_GetCharBBox - T1_GetCharName - T1_GetCharOutline - T1_GetCharWidth - T1_GetEncodingIndex - T1_GetEncodingScheme - T1_GetFamilyName - T1_GetFileSearchPath - T1_GetFontBBox - T1_GetFontFileName - T1_GetFontName - T1_GetFullName - T1_GetIsFixedPitch - T1_GetItalicAngle - T1_GetKerning - T1_GetLibIdent - T1_GetLinePosition - T1_GetLineThickness - T1_GetMetricsInfo - T1_GetMoveOutline - T1_GetNotice - T1_GetStringBBox - T1_GetStringOutline - T1_GetStringWidth - T1_GetUnderlinePosition - T1_GetUnderlineThickness - T1_GetVersion - T1_GetWeight - T1_InitLib - T1_LoadEncoding - T1_LoadFont - T1_ManipulatePath - T1_MirrorHMatrix - T1_MirrorVMatrix - T1_PrintLog - T1_QueryLigs - T1_QueryX11Support - T1_ReencodeFont - T1_RelativePath - T1_RotateMatrix - T1_ScaleOutline - T1_SetAfmFileName - T1_SetBitmapPad - T1_SetChar - T1_SetDefaultEncoding - T1_SetDeviceResolutions - T1_SetFileSearchPath - T1_SetFontDataBase - T1_SetLinePosition - T1_SetLineThickness - T1_SetLogLevel - T1_SetRasterFlags - T1_SetString - T1_ShearHMatrix - T1_ShearVMatrix - T1_SlantFont - T1_TransformMatrix - T1_WriteAFMFallbackFile -; T1_AADoLine -; T1_AAInit -; T1_DoLine -; T1Close -; T1Decrypt -; T1eexec -; T1Fill -; T1Getc -; T1io_reset -; T1lib_parseFile -; T1Open -; T1Read -; T1Ungetc diff -Naur xdvik-22.40l/libs/t1lib/withenable.ac xdvik-22.40n/libs/t1lib/withenable.ac --- xdvik-22.40l/libs/t1lib/withenable.ac Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/t1lib/withenable.ac Sat Sep 14 00:24:47 2002 @@ -0,0 +1,10 @@ +AC_ARG_WITH(system-t1lib, + [ --with-system-t1lib use installed t1 library]) + +AC_ARG_WITH(t1lib_libdir, +[ --with-t1lib-libdir=DIR + Specify directory where the t1 library (libt1.a) resides.]) + +AC_ARG_WITH(t1lib_include, +[ --with-t1lib-include=DIR + Specify the t1lib header files location.]) diff -Naur xdvik-22.40l/libs/t1lib/xglyph/.dependencies xdvik-22.40n/libs/t1lib/xglyph/.dependencies --- xdvik-22.40l/libs/t1lib/xglyph/.dependencies Wed Apr 18 14:24:15 2001 +++ xdvik-22.40n/libs/t1lib/xglyph/.dependencies Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -xglyph.lo: xglyph.c ../lib/t1lib/t1lib.h ../lib/t1lib/t1libx.h diff -Naur xdvik-22.40l/libs/t1lib/xglyph/CVS/Entries xdvik-22.40n/libs/t1lib/xglyph/CVS/Entries --- xdvik-22.40l/libs/t1lib/xglyph/CVS/Entries Sat Aug 31 22:50:46 2002 +++ xdvik-22.40n/libs/t1lib/xglyph/CVS/Entries Thu Jan 1 00:00:00 1970 @@ -1,6 +0,0 @@ -/.dependencies/1.1.1.1/Wed Apr 18 14:24:15 2001//Txdvik_22_40_STABLE -/FontDataBase/1.1.1.1/Wed Apr 18 14:24:15 2001//Txdvik_22_40_STABLE -/Makefile.in/1.2/Wed Apr 18 23:23:16 2001//Txdvik_22_40_STABLE -/t1lib.config/1.1.1.1.8.1/Mon Jan 7 15:50:18 2002//Txdvik_22_40_STABLE -/xglyph.c/1.2.8.2/Mon Jan 7 15:50:18 2002//Txdvik_22_40_STABLE -D diff -Naur xdvik-22.40l/libs/t1lib/xglyph/CVS/Repository xdvik-22.40n/libs/t1lib/xglyph/CVS/Repository --- xdvik-22.40l/libs/t1lib/xglyph/CVS/Repository Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/xglyph/CVS/Repository Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -xdvik/libs/t1lib/xglyph diff -Naur xdvik-22.40l/libs/t1lib/xglyph/CVS/Root xdvik-22.40n/libs/t1lib/xglyph/CVS/Root --- xdvik-22.40l/libs/t1lib/xglyph/CVS/Root Sat Aug 31 22:50:44 2002 +++ xdvik-22.40n/libs/t1lib/xglyph/CVS/Root Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/t1lib/xglyph/CVS/Tag xdvik-22.40n/libs/t1lib/xglyph/CVS/Tag --- xdvik-22.40l/libs/t1lib/xglyph/CVS/Tag Sat Aug 31 23:06:37 2002 +++ xdvik-22.40n/libs/t1lib/xglyph/CVS/Tag Thu Jan 1 00:00:00 1970 @@ -1 +0,0 @@ -Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/t1lib/xglyph/FontDataBase xdvik-22.40n/libs/t1lib/xglyph/FontDataBase --- xdvik-22.40l/libs/t1lib/xglyph/FontDataBase Wed Apr 18 14:24:15 2001 +++ xdvik-22.40n/libs/t1lib/xglyph/FontDataBase Thu Jan 1 00:00:00 1970 @@ -1,10 +0,0 @@ -8 -bchr.afm -bchri.afm -bchb.afm -bchbi.afm -dcr10.afm -dcti10.afm -dcbx10.afm -dcbxti10.afm - diff -Naur xdvik-22.40l/libs/t1lib/xglyph/Makefile.in xdvik-22.40n/libs/t1lib/xglyph/Makefile.in --- xdvik-22.40l/libs/t1lib/xglyph/Makefile.in Wed Apr 18 23:23:16 2001 +++ xdvik-22.40n/libs/t1lib/xglyph/Makefile.in Thu Jan 1 00:00:00 1970 @@ -1,109 +0,0 @@ -# Makefile.in -# -# This file is part of the t1lib-package! See documentation and Readme files -# of the t1lib-package for copyright restrictions. -# -# Targets provided: -# all (default) -# install -# uninstall -# clean -# -# Author: Rainer Menzner (Rainer.Menzner@web.de) -# Date: 04/06/1997 -# Last modified: 2001-04-01 -# -# Modified by H.Kakugawa to use libtool - -LIBTOOL = ../libtool -SHELL = /bin/sh -CC = @CC@ -CPP = @CPP@ -CFLAGS = @CFLAGS@ -OPTIONS = @OPTIONS@ -X_LIBS = @X_LIBS@ -TOPSRC = @top_srcdir@ -XPM_LIB = -lXpm -XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ -LDFLAGS = @LDFLAGS@ -LDLIBS = @LDLIBS@ -AR = ar rc -RANLIB = @RANLIB@ -RM = rm -f -X_CFLAGS = @X_CFLAGS@ -YACC = @YACC@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -ALLCFLAGS = $(CFLAGS) -SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(ALLCFLAGS)' 'OPTIONS=$(OPTIONS)' -@SET_MAKE@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = @top_srcdir@/ac-tools/mkinstalldirs -prefix = @prefix@ -exec_prefix = @exec_prefix@ -includedir = @includedir@ -bindir = @bindir@ -datadir = @datadir@ -libdir = @libdir@ -mandir = @mandir@/man1 -manext = .1 -no_x = @no_x@ - - -# targets to build - -MAIN_TARGET = @MAIN_TARGET@ - -OBJS = \ - xglyph.lo - -SRCS = \ - xglyph.c - -T1LIB = ../lib/libt1.la -T1LIBX = ../lib/libt1x.la -XAWLIB = -lXaw -lXt -lXmu - - -all: xglyph - - -xglyph: $(OBJS) $(T1LIBX) $(T1LIB) - $(LIBTOOL) --mode=link \ - $(CC) -o xglyph $(LDFLAGS) $(OBJS) $(T1LIBX) $(T1LIB) \ - $(X_LIBS) $(XAWLIB) $(XLIB) $(LDLIBS) - -.SUFFIXES: .lo -.c.lo: - $(LIBTOOL) --mode=compile \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< - - -.PHONY: clean - - -dependencies: dummy - gcc -MM *.c | sed 's/\.o:/.lo:/g' > .dependencies - -clean: dummy - $(RM) xglyph *.lo *.o .libs/* *~ \#*\# *.log *.bak - -rmdir .libs - - -install: dummy - $(MKINSTALLDIRS) $(bindir) - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xglyph $(bindir)/xglyph - - -uninstall: dummy - $(LIBTOOL) --mode=uninstall $(RM) -f $(bindir)/xglyph - - -dummy: - -# Dependencies of object files (generated by "gcc -MM *.c"): -include .dependencies - diff -Naur xdvik-22.40l/libs/t1lib/xglyph/t1lib.config xdvik-22.40n/libs/t1lib/xglyph/t1lib.config --- xdvik-22.40l/libs/t1lib/xglyph/t1lib.config Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/xglyph/t1lib.config Thu Jan 1 00:00:00 1970 @@ -1,8 +0,0 @@ -This is a configuration file for t1lib - -TYPE1=.:../Fonts/type1 -FONTDATABASE=./FontDataBase -ENCODING=.:../Fonts/enc -AFM=.:../Fonts/afm - - diff -Naur xdvik-22.40l/libs/t1lib/xglyph/xglyph.c xdvik-22.40n/libs/t1lib/xglyph/xglyph.c --- xdvik-22.40l/libs/t1lib/xglyph/xglyph.c Mon Jan 7 15:50:18 2002 +++ xdvik-22.40n/libs/t1lib/xglyph/xglyph.c Thu Jan 1 00:00:00 1970 @@ -1,4468 +0,0 @@ -/*-------------------------------------------------------------------------- - ----- File: xglyph.c - ----- Author: Rainer Menzner (Rainer.Menzner@web.de) - ----- Date: 2001-10-03 - ----- Description: This file is part of the t1-library. The program xglyph - allows viewing of character- and string-glyphs. Diverse - parameters may be interactively configured. - ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. - As of version 0.5, t1lib is distributed under the - GNU General Public Library Lincense. The - conditions can be found in the files LICENSE and - LGPL, which should reside in the toplevel - directory of the distribution. Please note that - there are parts of t1lib that are subject to - other licenses: - The parseAFM-package is copyrighted by Adobe Systems - Inc. - The type1 rasterizer is copyrighted by IBM and the - X11-consortium. - ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) - ----- Credits: I want to thank IBM and the X11-consortium for making - their rasterizer freely available. - Also thanks to Piet Tutelaers for his ps2pk, from - which I took the rasterizer sources in a format - independent from X11. - Thanks to all people who make free software living! ---------------------------------------------------------------------------*/ - -/* definitions for activating special tests for features of t1lib - via commandline arguments: */ -#define CHECK_PERFORMANCE 0x0001 -#define CHECK_T1_COPYFONT_T1_ADDFONT 0x0002 -#define CHECK_CONCATGLYPHS 0x0004 -#define CHECK_CONCATOUTLINES 0x0008 -#define CHECK_FOR_BAD_CHARS 0x0010 -#define CHECK_DEFAULT_ENCODING 0x0020 -#define CHECK_SMART_AA 0x0040 -#define NO_GRID 0x0080 -#define CHECK_AA_CACHING 0x0100 -#define CHECK_NO_AFM 0x0200 - -/* #define SHOW_MANIPULATE_PATHS */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include - - -/* The following stuff is necessary for compiling and running - xglyph on. Submitted by John Hasstedt (John.Hasstedt@sunysb.edu), - who did the VMS-port of t1lib. */ -#if defined(__VMS) && __CRTL_VER < 70000000 -# define putenv(p) \ -printf("You must define T1LIB_CONFIG before running this program\n"); \ -exit; -# define gettimeofday(p1,p2) -#endif - - -/* Note: We include t1lib.h and t1libx.h from lib/t1lib. That way the - objectfile does only need to be rebuild when the header itself - changes and not each time the library has been recompiled */ -#include "../lib/t1lib/t1lib.h" -#include "../lib/t1lib/t1libx.h" - -#ifndef PI -#define PI 3.1415927 -#endif - -/* utility functions */ -BBox ComputeRotBBox( BBox, float); -long time_diff(struct timeval *, struct timeval *); - -/* fallback-function */ -void exitprog( Widget, XtPointer, XtPointer); -void togglekerning( Widget, XtPointer, XtPointer); -void toggleligatur( Widget, XtPointer, XtPointer); -void toggler2l( Widget, XtPointer, XtPointer); -void toggleunderline( Widget, XtPointer, XtPointer); -void toggleoverline( Widget, XtPointer, XtPointer); -void toggleoverstrike( Widget, XtPointer, XtPointer); -void showchar( Widget , XtPointer , XtPointer ); -void showstring( Widget , XtPointer , XtPointer ); -void aashowchar( Widget , XtPointer , XtPointer ); -void aashowstring( Widget , XtPointer , XtPointer ); -void showcharX( Widget , XtPointer , XtPointer ); -void showstringX( Widget , XtPointer , XtPointer ); -void aashowcharX( Widget , XtPointer , XtPointer ); -void aashowstringX( Widget , XtPointer , XtPointer ); -void showabout( Widget , XtPointer , XtPointer ); -void toggleopacity( Widget, XtPointer, XtPointer); -void setcolor( Widget, XtPointer, XtPointer); -void fonttable( Widget, XtPointer, XtPointer); -void toggleaalevel( Widget, XtPointer, XtPointer); -int ComputeAAColorsX( unsigned long fg, unsigned long bg, int nolevels); -void printusage( int max); -int CheckTransform( void); - - - - -#define DOUBLEMARGIN 10 -#define SIMPLEMARGIN 5 -#define XOUTPUT_HALFVSIZE 200 -#define XOUTPUT_HALFHSIZE 300 -#define XGLYPH_PAD 16 -#define T1LIBENCFILE "IsoLatin1.enc" -#define MAXENCODINGS 10 -#define TESTFONTFILE "eufm10.pfb" -#define SHOWGRID -#define CROSS_SIZE 6 - -#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad)) -#define DIALOGWIDTH 170 -#define DIALOGHEIGHT 20 -#define ACTIONBUTTONHEIGHT 20 -#define APPLICATIONHEIGHT 690 -#define EDITABLE_COLOR "red" -#define MESSAGEBOXHEIGHT 180 -#define AAMAXPLANES 17 -#define GRAY0 WhitePixel(display, screen_number) -#define GRAY1 gray1.pixel -#define GRAY2 gray2.pixel -#define GRAY3 gray3.pixel -#define GRAY4 BlackPixel(display, screen_number) - -#define min(a,b) (a < b ? a : b) -#define max(a,b) (a > b ? a : b) - - -#define DEFAULT_SIZE "100.0" -#define DEFAULT_CHAR "65" - -/* Global variables for rasterizer parameters */ -float Size=400.0, Slant=0.0, Extent=1.0, Angle=0.0; -int Modflag=0; -int FontID=0, Caching=1, DeviceResolution=72; -int nofonts; - -long Space=0; -int Opacity=0; -int aalevel; -char TestString[1024]="Test"; -int TestChar=70; -char EncodingFile[128]=""; -char LastEncodingFile[128]=""; -struct -{ - char *encfilename; - char **encoding; -} -encstruct[MAXENCODINGS]; - -int *last_resolution; -float *lastExtent; -float *lastSlant; -int LigDetect=0; -unsigned long fg, bg, outbg; -Pixmap tmp_pixmap=0; -Pixmap white_pixmap=0; - - -Pixmap perf_pixmap; -Pixmap pixmap; -XImage *ximage; -XColor edit_color, gray0, gray1, gray2, gray3, gray4; -XColor white, black, gray, red, green, blue, pink4, yellow, - gridcolor1, gridcolor2,wozu; -XColor aacolors[AAMAXPLANES]; -unsigned long aapixels[AAMAXPLANES]; - -XGCValues xgcvalues; - - -unsigned short dummy; -char input; -int overallwidth; -char commandline[256]; -GLYPH *glyph; -GLYPH *glyph1, *glyph2; -char **Encoding=NULL; -unsigned int height, width; -char statusstring[1024]; -T1_TMATRIX matrix; -T1_TMATRIX *matrixP; -static char msg_buf[256]; - - -/* How t1lib pads lines: */ -int t1_pad=0; - -/* When to swap bytes in aa-pixels? */ -int xglyph_byte_order; - -/* The following is for time measurements: */ -struct timeval time_start, time_stop; -struct timeval *time_ptr_start, *time_ptr_stop; -void *void_ptr; - - - -/* Global X(t)-stuff */ -Display *display; -Screen *screen; -int screennumber; -int depth; -Widget TopLevel; -Widget OutputWindow; -Widget Output; -Widget OutputWindow2; -Widget Output2; -Widget dialogfontid; -Widget dialogsize; -Widget dialogslant; -Widget dialogextent; -Widget dialogangle; -Widget dialogteststring; -Widget dialogtestcharacter; -Widget dialogdevres; -Widget dialogencfile; -Widget dialogspace; -Widget dialogtmatrix; -Widget labelstatus; -Widget fgcolorbutton; -Widget bgcolorbutton; - - -/* color setting widgets */ -Widget fgwhitebutton; -Widget fgblackbutton; -Widget fggraybutton; -Widget fgredbutton; -Widget fggreenbutton; -Widget fgbluebutton; -Widget bgwhitebutton; -Widget bgblackbutton; -Widget bggraybutton; -Widget bgredbutton; -Widget bggreenbutton; -Widget bgbluebutton; -Widget fglabel; -Widget bglabel; -Widget colorbox; -Widget fgstatus; -Widget bgstatus; - - -Widget optionsbox; - - -/* Commandline handling */ -char *xglyphoptions[]={"--help", - "--Help", - "--noGrid", - "--setPad", - "--logError", - "--logWarning", - "--logStatistic", - "--logDebug", - "--ignoreForceBold", - "--ignoreFamilyAlignment", - "--ignoreHinting", - "--ignoreAFM", - "--debugLine", - "--debugRegion", - "--debugPath", - "--debugFont", - "--debugHint", - "--checkPerformance", - "--checkCopyFont", - "--checkConcatGlyphs", - "--checkConcatOutlines", - "--checkBadCharHandling", - "--checkDefaultEncoding", - "--checkSmartAntialiasing", - "--checkAACaching", - NULL}; -int extraflags=0; - -/* #define SHOW_MANIPULATE_PATHS */ -#ifdef SHOW_MANIPULATE_PATHS -void mymanipulate( long *x, long *y, int type) -{ - double corr; - double dx, dy; - - dx=(double)*x; - dy=(double)*y; - - /* we have to scale down because we deal with fractional pels */ - /* - corr=0.000000000000004*dx*dx; - dy *=1.0+corr; - */ - /* -#define PERIOD 500.0 - corr=65536.0*0.5*sin(2*PI/PERIOD/65536.0*dx); - dy +=corr*30.0; - */ - *y=(long)dy; - -} -#endif - - - -int main( int argc, char **argv) -{ - - - XtAppContext TopLevelApp; - Arg args[10]; - - - int i, j, numopts=0; - - Widget kerningbutton; - Widget ligaturbutton; - Widget r2lbutton; - Widget showcharbutton; - Widget showstringbutton; - Widget aashowcharbutton; - Widget aashowstringbutton; - Widget showcharbuttonX; - Widget showstringbuttonX; - Widget aashowcharbuttonX; - Widget aashowstringbuttonX; - Widget stringlabel; - Widget aboutbutton; - Widget opacitybutton; - Widget underlinebutton; - Widget overstrikebutton; - Widget overlinebutton; - Widget transbox; - Widget fonttablebutton; - Widget aalevelbutton; - - - Widget exitbutton; - - Widget box; - - - int rasterflags=0, initflags=0, optfound; - int loglevel=0; - - i=0; - j=0; - - while (xglyphoptions[i++]!=NULL) - numopts++; - - for ( i=1; i no option */ - break; - } - - - /* Assign address of time parameter */ - time_ptr_start=&time_start; - time_ptr_stop=&time_stop; - - /* Check for environment entry. If not set, set it to current - directory so that configuration file is found there */ - if (getenv("T1LIB_CONFIG")==NULL){ - putenv( "T1LIB_CONFIG=./t1lib.config"); - } - - - /* Set log-level: */ - T1_SetLogLevel( loglevel & (~(0x01<<8))); - - - /* Get padding value if not set from commandline. For 32 bit architectures - like Intel, 16 might be the best padding default value: */ - if (t1_pad==0) - t1_pad=16; - if (T1_SetBitmapPad( t1_pad)!=0){ - t1_pad=T1_GetBitmapPad(); - } - - - /* Initialize t1-library. If xglyph is called with arguments - that are no options, we assume that the arguments are font - files and ignore the fontdata base file. At this point the value of - "i" is the number of commandline arg that is supposed to contain a - fontfile name (or it is argc, if no files where specified). - - Note further that "loglevel" contains (1) info whether to create a log - file in the first bit of the higher byte of the lower word and - (2) info which loglevel to set. (3) It further may contain more - initialization flags. - */ - if ((extraflags & CHECK_AA_CACHING)){ - loglevel |= (T1_AA_CACHING<<8); - } - - if (i==argc){ - if (T1_InitLib( (loglevel>>8) | initflags )==NULL){ - fprintf(stderr,"Initialization of t1lib failed (T1_errno=%d)!\n", - T1_errno); - return(-1); - } - } - else{ /* There are still arguments which we interprete as fontfile names */ - if (T1_InitLib( (loglevel>>8) | initflags | IGNORE_FONTDATABASE )==NULL){ - fprintf(stderr,"Initialization of t1lib failed (T1_errno=%d)!\n", - T1_errno); - return(-1); - } - /* We start adding fonts as the i-th commandline arguments */ - for ( j=i; j" ); i++; - XtSetValues(r2lbutton,args,i); - XtAddCallback( r2lbutton, XtNcallback, - (XtCallbackProc) toggler2l, (XtPointer) 0 ); - - - /* The toggle widget for underlining (un-)setting */ - underlinebutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 55 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, "Underline" ); i++; - XtSetValues(underlinebutton,args,i); - XtAddCallback( underlinebutton, XtNcallback, - (XtCallbackProc) toggleunderline, (XtPointer) 0 ); - - - /* The toggle widget for underlining (un-)setting */ - overlinebutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 55 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, "Overline" ); i++; - XtSetValues(overlinebutton,args,i); - XtAddCallback( overlinebutton, XtNcallback, - (XtCallbackProc) toggleoverline, (XtPointer) 0 ); - - - /* The toggle widget for underlining (un-)setting */ - overstrikebutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 55 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, "Overstrike" ); i++; - XtSetValues(overstrikebutton,args,i); - XtAddCallback( overstrikebutton, XtNcallback, - (XtCallbackProc) toggleoverstrike, (XtPointer) 0 ); - - - /* The button to raster and display the current character using - the current settings */ - showcharbutton = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 60 ); i++; - XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++; - XtSetArg( args[i], XtNlabel, "Char"); i++; - XtSetValues(showcharbutton,args,i); - XtAddCallback( showcharbutton, XtNcallback, - (XtCallbackProc) showchar, (XtPointer) 0 ); - - - /* The button to raster and display the current string using - the current settings */ - showstringbutton = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 60 ); i++; - XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++; - XtSetArg( args[i], XtNlabel, "String"); i++; - XtSetValues(showstringbutton,args,i); - XtAddCallback( showstringbutton, XtNcallback, - (XtCallbackProc) showstring, (XtPointer) 0 ); - - - /* The button to raster and display the current character using - the current settings and antialiasing */ - aashowcharbutton = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 120 ); i++; - XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++; - XtSetArg( args[i], XtNlabel, "AAChar"); i++; - XtSetValues(aashowcharbutton,args,i); - XtAddCallback( aashowcharbutton, XtNcallback, - (XtCallbackProc) aashowchar, (XtPointer) 0 ); - - - /* The button to raster and display the current string using - the current settings and antialiasing */ - aashowstringbutton = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 120 ); i++; - XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++; - XtSetArg( args[i], XtNlabel, "AAString"); i++; - XtSetValues(aashowstringbutton,args,i); - XtAddCallback( aashowstringbutton, XtNcallback, - (XtCallbackProc) aashowstring, (XtPointer) 0 ); - - - /* The button to raster and display the current character using - the current settings */ - showcharbuttonX = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 60 ); i++; - XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++; - XtSetArg( args[i], XtNlabel, "CharX"); i++; - XtSetValues(showcharbuttonX,args,i); - XtAddCallback( showcharbuttonX, XtNcallback, - (XtCallbackProc) showcharX, (XtPointer) 0 ); - - - /* The button to raster and display the current string using - the current settings */ - showstringbuttonX = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 60 ); i++; - XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++; - XtSetArg( args[i], XtNlabel, "StringX"); i++; - XtSetValues(showstringbuttonX,args,i); - XtAddCallback( showstringbuttonX, XtNcallback, - (XtCallbackProc) showstringX, (XtPointer) 0 ); - - - /* The button to raster and display the current character using - the current settings and antialiasing */ - aashowcharbuttonX = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 120 ); i++; - XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++; - XtSetArg( args[i], XtNlabel, "AACharX"); i++; - XtSetValues(aashowcharbuttonX,args,i); - XtAddCallback( aashowcharbuttonX, XtNcallback, - (XtCallbackProc) aashowcharX, (XtPointer) 0 ); - - - /* The button to raster and display the current string using - the current settings and antialiasing */ - aashowstringbuttonX = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 120 ); i++; - XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++; - XtSetArg( args[i], XtNlabel, "AAStringX"); i++; - XtSetValues(aashowstringbuttonX,args,i); - XtAddCallback( aashowstringbuttonX, XtNcallback, - (XtCallbackProc) aashowstringX, (XtPointer) 0 ); - - - /* The box for color trasp/op and fonttable button */ - transbox=XtCreateManagedWidget("box", boxWidgetClass, box, NULL, 0); - i=0; - XtSetArg(args[i], XtNheight,20); i++; - XtSetArg(args[i], XtNwidth,90); i++; - XtSetValues(transbox,args,i); - - - /* The button to display an AA font table */ - fonttablebutton = XtCreateManagedWidget("Com", commandWidgetClass, transbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 80 ); i++; - XtSetArg( args[i], XtNheight, 15 ); i++; - XtSetArg( args[i], XtNlabel, "Font Table"); i++; - XtSetValues(fonttablebutton,args,i); - XtAddCallback( fonttablebutton, XtNcallback, - (XtCallbackProc) fonttable, (XtPointer) 0 ); - - - /* The toggle widget for opacity/transparency */ - opacitybutton = XtCreateManagedWidget("toggle", toggleWidgetClass, transbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 80 ); i++; - XtSetArg( args[i], XtNheight, 15 ); i++; - XtSetArg( args[i], XtNlabel, "Transparent" ); i++; - XtSetValues(opacitybutton,args,i); - XtAddCallback( opacitybutton, XtNcallback, - (XtCallbackProc) toggleopacity, (XtPointer) 0 ); - outbg=pink4.pixel; /* the initial bgcolor for transparent mode */ - - - /* The toggle widget for opacity/transparency */ - aalevelbutton = XtCreateManagedWidget("toggle", toggleWidgetClass, transbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 80 ); i++; - XtSetArg( args[i], XtNheight, 15 ); i++; - XtSetArg( args[i], XtNlabel, "AA-Low" ); i++; - XtSetValues(aalevelbutton,args,i); - XtAddCallback( aalevelbutton, XtNcallback, - (XtCallbackProc) toggleaalevel, (XtPointer) 0 ); - aalevel=T1_AA_LOW; /* the initial bgcolor for transparent mode */ - - - /* The box for color selecting buttons for the - X11-rastering functions */ - colorbox=XtCreateManagedWidget("box", boxWidgetClass, box, NULL, 0); - i=0; - XtSetArg(args[i], XtNheight,20); i++; - XtSetArg(args[i], XtNwidth,280); i++; - XtSetValues(colorbox,args,i); - /* FG-label */ - fgstatus = XtCreateManagedWidget("label", labelWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, fg); i++; - XtSetValues(fgstatus,args,i); - - fglabel = XtCreateManagedWidget("label", labelWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 80 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, "Foreground"); i++; - XtSetValues(fglabel,args,i); - - fgwhitebutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, white.pixel); i++; - XtSetValues(fgwhitebutton,args,i); - XtAddCallback( fgwhitebutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - fgblackbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, black.pixel); i++; - XtSetValues(fgblackbutton,args,i); - XtAddCallback( fgblackbutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - fggraybutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, gray.pixel); i++; - XtSetValues(fggraybutton,args,i); - XtAddCallback( fggraybutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - fgredbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, red.pixel); i++; - XtSetValues(fgredbutton,args,i); - XtAddCallback( fgredbutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - fggreenbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, green.pixel); i++; - XtSetValues(fggreenbutton,args,i); - XtAddCallback( fggreenbutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - fgbluebutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, blue.pixel); i++; - XtSetValues(fgbluebutton,args,i); - XtAddCallback( fgbluebutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - /* BG-label */ - bgstatus = XtCreateManagedWidget("label", labelWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, bg); i++; - XtSetValues(bgstatus,args,i); - - bglabel = XtCreateManagedWidget("label", labelWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 80 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, "Background"); i++; - XtSetValues(bglabel,args,i); - - bgwhitebutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, white.pixel); i++; - XtSetValues(bgwhitebutton,args,i); - XtAddCallback( bgwhitebutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - bgblackbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, black.pixel); i++; - XtSetValues(bgblackbutton,args,i); - XtAddCallback( bgblackbutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - bggraybutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, gray.pixel); i++; - XtSetValues(bggraybutton,args,i); - XtAddCallback( bggraybutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - bgredbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, red.pixel); i++; - XtSetValues(bgredbutton,args,i); - XtAddCallback( bgredbutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - bggreenbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, green.pixel); i++; - XtSetValues(bggreenbutton,args,i); - XtAddCallback( bggreenbutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - bgbluebutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 20 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, ""); i++; - XtSetArg( args[i], XtNbackground, blue.pixel); i++; - XtSetValues(bgbluebutton,args,i); - XtAddCallback( bgbluebutton, XtNcallback, - (XtCallbackProc) setcolor, (XtPointer) 0 ); - - - - /* Label for the next box */ - stringlabel=XtCreateManagedWidget("Label", labelWidgetClass, box, - NULL, 0); - i=0; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNlabel, "Test-String:"); i++; - XtSetValues(stringlabel,args,i); - - - - - /* An input-box for the test-string */ - dialogteststring=XtCreateManagedWidget("dialog1", asciiTextWidgetClass, box, - NULL, 0); - i=0; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight,30); i++; - XtSetArg(args[i], XtNwrap, XawtextWrapLine); i++; - XtSetArg(args[i], XtNeditType, XawtextEdit ); i++; - XtSetArg(args[i], XtNforeground, edit_color.pixel); i++; - XtSetValues(dialogteststring,args,i); - - - - /* Label for the next box */ - labelstatus=XtCreateManagedWidget("Label", labelWidgetClass, box, - NULL, 0); - i=0; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, "No Messages!"); i++; - XtSetValues(labelstatus,args,i); - - - - /* The button to exit the program */ - exitbutton = XtCreateManagedWidget("Com2", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 100 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNx, 0 ); i++; - XtSetArg( args[i], XtNy, 0 ); i++; - XtSetArg( args[i], XtNlabel, " Exit Program"); i++; - XtSetValues(exitbutton,args,i); - XtAddCallback( exitbutton, XtNcallback, - (XtCallbackProc) exitprog, (XtPointer) 0 ); - - - /* The About widget for the about message */ - aboutbutton = XtCreateManagedWidget("Com", commandWidgetClass, box, - NULL, 0); - i=0; - XtSetArg( args[i], XtNwidth, 55 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, "About" ); i++; - XtSetValues(aboutbutton,args,i); - XtAddCallback( aboutbutton, XtNcallback, - (XtCallbackProc) showabout, (XtPointer) 0 ); - - - XtRealizeWidget(TopLevel); - XtPopup(Output,XtGrabNone); - - if( extraflags & CHECK_PERFORMANCE){ - XtPopup(Output2,XtGrabNone); - } - - - /* Set parameters for X11-support */ - T1_SetX11Params( display, DefaultVisual(display, screennumber), - DefaultDepth( display, screennumber), - DefaultColormap(display, screennumber)); - - - /* Create a dummy-pixmap because we need one to destroy before - the next is created! */ - pixmap = XCreatePixmap(display, - XtWindow(OutputWindow), - 200, - 200, - DefaultDepth(display,screennumber) - ); - - - - XtAppMainLoop(TopLevelApp); - - return(0); - -} - - -/* Compute the BBox of a rotated box: */ -BBox ComputeRotBBox( BBox inbox, float angle) -{ - - int i; - BBox resultbox={ 0, 0, 0, 0}; - struct point - { - double x; - double y; - } p[4], P[4]; - - double sinalpha, cosalpha; - - sinalpha=sin((double)angle*PI/180); - cosalpha=cos((double)angle*PI/180); - - /* initialize points */ - p[0].x=(double) inbox.llx; - p[0].y=(double) inbox.lly; - p[1].x=(double) inbox.urx; - p[1].y=(double) inbox.lly; - p[2].x=(double) inbox.urx; - p[2].y=(double) inbox.ury; - p[3].x=(double) inbox.llx; - p[3].y=(double) inbox.ury; - - /* - fprintf( stderr, "InBox: (%f,%f), (%f,%f), (%f,%f), (%f,%f)\n", - p[0].x, p[0].y, p[1].x, p[1].y, p[2].x, p[2].y, - p[3].x, p[3].y); - */ - /* Compute tranformed points */ - P[0].x=p[0].x*cosalpha-p[0].y*sinalpha; - P[0].y=p[0].x*sinalpha+p[0].y*cosalpha; - P[1].x=p[1].x*cosalpha-p[1].y*sinalpha; - P[1].y=p[1].x*sinalpha+p[1].y*cosalpha; - P[2].x=p[2].x*cosalpha-p[2].y*sinalpha; - P[2].y=p[2].x*sinalpha+p[2].y*cosalpha; - P[3].x=p[3].x*cosalpha-p[3].y*sinalpha; - P[3].y=p[3].x*sinalpha+p[3].y*cosalpha; - /* - fprintf( stderr, "RotPoints: (%f,%f), (%f,%f), (%f,%f), (%f,%f)\n", - P[0].x, P[0].y, P[1].x, P[1].y, P[2].x, P[2].y, - P[3].x, P[3].y); - */ - - /* Get BBox: */ - for (i=0; i<4; i++){ - if (P[i].x < (float) resultbox.llx) - resultbox.llx=(int) floor(P[i].x +0.5); - if (P[i].x > (float) resultbox.urx) - resultbox.urx=(int) floor(P[i].x +0.5); - if (P[i].y < (float) resultbox.lly) - resultbox.lly=(int) floor(P[i].y +0.5); - if (P[i].y > (float) resultbox.ury) - resultbox.ury=(int) floor(P[i].y +0.5); - } - - return(resultbox); - -} - - - - -void exitprog(Widget exitbutton, XtPointer client_data , XtPointer call_data) -{ - - int i; - - for (i=0; i< T1_Get_no_fonts(); i++){ - /* printf("Enc-Scheme=%s\n", T1_GetEncodingScheme( i));*/ - ; - } - - T1_CloseLib(); - - exit(0); -} - - -void togglekerning( Widget kerningbutton, XtPointer client_data, XtPointer call_data) -{ - int i; - char state=0; - Arg args[10]; - - - /* Get state of toggle Button: */ - i=0; - XtSetArg(args[i], XtNstate, &state); i++; - XtGetValues(kerningbutton,args,1); - - if ((state)) - Modflag |= T1_KERNING; - else - Modflag &= ~T1_KERNING; - -} - - - -void toggleligatur( Widget ligaturbutton, XtPointer client_data, XtPointer call_data) -{ - int i; - char state=0; - Arg args[10]; - - - /* Get state of toggle Button: */ - i=0; - XtSetArg(args[i], XtNstate, &state); i++; - XtGetValues(ligaturbutton,args,1); - - LigDetect=state; - -} - - - -void toggler2l( Widget r2lbutton, XtPointer client_data, XtPointer call_data) -{ - int i; - char state=0; - Arg args[10]; - - - /* Get state of toggle Button: */ - i=0; - XtSetArg(args[i], XtNstate, &state); i++; - XtGetValues(r2lbutton,args,1); - - if ((state)) - Modflag |= T1_RIGHT_TO_LEFT; - else - Modflag &= ~T1_RIGHT_TO_LEFT; - - /* Invert state */ - i=0; - if (state){ - XtSetArg( args[i], XtNwidth, 55 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, "<--|" ); i++; - } - else{ - XtSetArg( args[i], XtNwidth, 55 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - XtSetArg( args[i], XtNlabel, "|-->" ); i++; - } - XtSetValues(r2lbutton,args,i); -} - - - -void toggleunderline( Widget underlinebutton, XtPointer client_data, XtPointer call_data) -{ - int i; - char state=0; - Arg args[10]; - - - /* Get state of toggle Button: */ - i=0; - XtSetArg(args[i], XtNstate, &state); i++; - XtGetValues(underlinebutton,args,1); - - if ((state)) - Modflag |= T1_UNDERLINE; - else - Modflag &= ~T1_UNDERLINE; - -} - - - -void toggleoverline( Widget overlinebutton, XtPointer client_data, XtPointer call_data) -{ - int i; - char state=0; - Arg args[10]; - - - /* Get state of toggle Button: */ - i=0; - XtSetArg(args[i], XtNstate, &state); i++; - XtGetValues( overlinebutton,args,1); - - if ((state)) - Modflag |= T1_OVERLINE; - else - Modflag &= ~T1_OVERLINE; - -} - - - -void toggleoverstrike( Widget overstrikebutton, XtPointer client_data, XtPointer call_data) -{ - int i; - char state=0; - Arg args[10]; - - - /* Get state of toggle Button: */ - i=0; - XtSetArg(args[i], XtNstate, &state); i++; - XtGetValues( overstrikebutton,args,1); - - if ((state)) - Modflag |= T1_OVERSTRIKE; - else - Modflag &= ~T1_OVERSTRIKE; - -} - - - -void toggleopacity( Widget opacitybutton, XtPointer client_data, XtPointer call_data) -{ - int i; - char state=0; - Arg args[10]; - - - /* Get state of toggle Button: */ - i=0; - XtSetArg(args[i], XtNstate, &state); i++; - XtGetValues(opacitybutton,args,1); - - i=0; - XtSetArg( args[i], XtNstate, state); i++; - XtSetArg( args[i], XtNwidth, 80 ); i++; - XtSetArg( args[i], XtNheight, 20 ); i++; - - Opacity=state; - - /* Invert state */ - if (state){ - XtSetArg( args[i], XtNlabel, "Opaque" ); i++; - XtSetValues(opacitybutton,args,i); - outbg=bg; - } - else{ - XtSetArg( args[i], XtNlabel, "Transparent" ); i++; - XtSetValues(opacitybutton,args,i); - outbg=pink4.pixel; - } - -} - - - -/* Toggle the antialiasing level */ -void toggleaalevel( Widget aalevelbutton, XtPointer client_data, XtPointer call_data) -{ - int i; - char state=0; - Arg args[10]; - - - /* Get state of toggle Button: */ - i=0; - XtSetArg(args[i], XtNstate, &state); i++; - XtGetValues( aalevelbutton,args,1); - - i=0; - XtSetArg( args[i], XtNstate, state); i++; - XtSetArg( args[i], XtNwidth, 80 ); i++; - XtSetArg( args[i], XtNheight, 15 ); i++; - - - /* Invert state */ - if (state){ - XtSetArg( args[i], XtNlabel, "AA-High" ); i++; - XtSetValues(aalevelbutton,args,i); - aalevel=T1_AA_HIGH; - } - else{ - XtSetArg( args[i], XtNlabel, "AA-Low" ); i++; - XtSetValues(aalevelbutton,args,i); - aalevel=T1_AA_LOW; - } - -} - - - -/* Set a new fore/background color */ -void setcolor( Widget widget, XtPointer client_data, XtPointer call_data) -{ - int i; - Arg args[10]; - - /* foreground colors */ - if (widget==fgwhitebutton){ - fg=white.pixel; - i=0; - XtSetArg( args[i], XtNbackground, fg ); i++; - XtSetValues(fgstatus,args,i); - return; - } - if (widget==fgblackbutton){ - fg=black.pixel; - i=0; - XtSetArg( args[i], XtNbackground, fg ); i++; - XtSetValues(fgstatus,args,i); - return; - } - if (widget==fggraybutton){ - fg=gray.pixel; - i=0; - XtSetArg( args[i], XtNbackground, fg ); i++; - XtSetValues(fgstatus,args,i); - return; - } - if (widget==fgredbutton){ - fg=red.pixel; - i=0; - XtSetArg( args[i], XtNbackground, fg ); i++; - XtSetValues(fgstatus,args,i); - return; - } - if (widget==fggreenbutton){ - fg=green.pixel; - i=0; - XtSetArg( args[i], XtNbackground, fg ); i++; - XtSetValues(fgstatus,args,i); - return; - } - if (widget==fgbluebutton){ - fg=blue.pixel; - i=0; - XtSetArg( args[i], XtNbackground, fg ); i++; - XtSetValues(fgstatus,args,i); - return; - } - /* background colors */ - if (widget==bgwhitebutton){ - bg=white.pixel; - if (Opacity) - outbg=bg; - i=0; - XtSetArg( args[i], XtNbackground, bg ); i++; - XtSetValues(bgstatus,args,i); - return; - } - if (widget==bgblackbutton){ - bg=black.pixel; - if (Opacity) - outbg=bg; - i=0; - XtSetArg( args[i], XtNbackground, bg ); i++; - XtSetValues(bgstatus,args,i); - return; - } - if (widget==bggraybutton){ - bg=gray.pixel; - if (Opacity) - outbg=bg; - i=0; - XtSetArg( args[i], XtNbackground, bg ); i++; - XtSetValues(bgstatus,args,i); - return; - } - if (widget==bgredbutton){ - bg=red.pixel; - if (Opacity) - outbg=bg; - i=0; - XtSetArg( args[i], XtNbackground, bg ); i++; - XtSetValues(bgstatus,args,i); - return; - } - if (widget==bggreenbutton){ - bg=green.pixel; - if (Opacity) - outbg=bg; - i=0; - XtSetArg( args[i], XtNbackground, bg ); i++; - XtSetValues(bgstatus,args,i); - return; - } - if (widget==bgbluebutton){ - bg=blue.pixel; - if (Opacity) - outbg=bg; - i=0; - XtSetArg( args[i], XtNbackground, bg ); i++; - XtSetValues(bgstatus,args,i); - return; - } - /* we shouldn't get here */ - return; - -} - - - -void showchar( Widget showcharbutton, XtPointer client_data, XtPointer call_data) -{ - int i, j; - Arg args[10]; - - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogtestcharacter), "%d", &TestChar); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - if (CheckTransform()==0 && Angle==0.0){ - matrixP=NULL; - } - else{ - matrixP=T1_RotateMatrix( &matrix, Angle); - } - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - for (j=0; jmetrics.ascent - glyph->metrics.descent; - overallwidth=glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing; - width=overallwidth; - - /* Prepare status message: */ - sprintf(statusstring,"Elapsed time: %ld Microseconds\nLeftSideBearing: %d\nRightSideBearing: %d\nAscent: %d\nDescent: %d\nAdvanceX: %d\nAdvanceY: %d\nBits Per Pixel: %ld\nImage Size: %ld Bytes\nPostScript Fontname: %s\nCharactername: %s\nT1_errno: %d\n", - time_diff(time_ptr_start,time_ptr_stop), - glyph->metrics.leftSideBearing, - glyph->metrics.rightSideBearing, - glyph->metrics.ascent, - glyph->metrics.descent, - glyph->metrics.advanceX, - glyph->metrics.advanceY, - glyph->bpp, - PAD(glyph->bpp*(glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing),XGLYPH_PAD)/8*(glyph->metrics.ascent-glyph->metrics.descent), - T1_GetFontName(FontID), - T1_GetCharName(FontID,(char)TestChar), - T1_errno); - - if (glyph->bits !=NULL) { - ximage=XCreateImage( display, - DefaultVisual(display, screennumber), - 1, /* depths for bitmap is 1 */ - XYBitmap, /* XYBitmap or XYPixmap */ - 0, /* No offset */ - glyph->bits, - width, - height, - t1_pad, /* lines padded to bytes */ - 0 /*PAD(width,8)/8*/ /* number of bytes per line */ - ); - /* Force bit and byte order */ - ximage->bitmap_bit_order=0; - ximage->byte_order=0; - XFreePixmap(display,pixmap); - pixmap = XCreatePixmap(display, - XtWindow(TopLevel), - width, - height, - DefaultDepth(display,screennumber) - ); - XPutImage(display, - pixmap, - DefaultGC( display, screennumber), - ximage, - 0, - 0, - 0, - 0, - width, - height - ); - XDestroyImage(ximage); - } - - - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - - i=0; - XtSetArg( args[i], XtNwidth, width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, height + DOUBLEMARGIN); i++; - if (glyph->bits != NULL) { - XtSetArg( args[i], XtNbitmap, pixmap); i++; - } - else { - XtSetArg( args[i], XtNbitmap, 0); i++; - } - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, WhitePixel(display,screennumber)); i++; - XtSetArg( args[i], XtNforeground, BlackPixel(display,screennumber)); i++; - XtSetValues(OutputWindow ,args,i); - - - i=0; - XtSetArg( args[i], XtNwidth, width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, height + DOUBLEMARGIN); i++; - if (glyph->bits != NULL) { - XtSetArg( args[i], XtNbitmap, pixmap); i++; - } - else { - XtSetArg( args[i], XtNbitmap, 0); i++; - } - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetValues(Output ,args,i); - - glyph->bits=NULL; /* Since XDestroyImage() free's this also! */ -} - - - -void showstring( Widget showstringbutton, XtPointer client_data, XtPointer call_data) -{ - int i,j,k,l,m,none_found; - Arg args[10]; - char *theString='\0'; - char *ligtheString='\0'; - char *succs, *ligs; - char buf_char; - - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogspace),"%ld", &Space); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - if (CheckTransform()==0 && Angle==0.0){ - matrixP=NULL; - } - else{ - matrixP=T1_RotateMatrix( &matrix, Angle); - } - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - for (j=0; j0){ - buf_char=theString[j]; - while (k>0){ - none_found=1; - for (l=0;lcompchar > -1 ? T1_GetCharName( FontID, ccd->compchar) : "not_enc", - ccd->compchar, - ccd->numPieces); - - printf( " basechar %s (%d)\n", - ccd->pieces[0].piece > -1 ? T1_GetCharName( FontID, ccd->pieces[0].piece) : "not_enc", - ccd->pieces[0].piece); - printf( " accent %s (%d)\n", - ccd->pieces[1].piece > -1 ? T1_GetCharName( FontID, ccd->pieces[1].piece) : "not_enc", - ccd->pieces[1].piece); - } - T1_FreeCompCharData( ccd); - } - - } - */ - - - - XSetForeground( display, DefaultGC( display, screennumber), black.pixel); - XSetBackground( display, DefaultGC( display, screennumber), white.pixel); - /* Reset T1_errno: */ - T1_errno=0; - gettimeofday(time_ptr_start, void_ptr); - - if( extraflags & CHECK_CONCATGLYPHS){ - glyph2=T1_SetString(FontID,(char *)ligtheString,0,Space,Modflag,Size,matrixP); - glyph1=T1_CopyGlyph( glyph2); - glyph2=T1_SetString(FontID+1,(char *)ligtheString,0,Space,Modflag,Size,matrixP); - glyph=T1_ConcatGlyphs( glyph1, glyph2, 0, 0, Modflag); - } - else if( extraflags & CHECK_CONCATOUTLINES){ - { - T1_OUTLINE *path=NULL; - path=T1_GetStringOutline(FontID,(char *)ligtheString, - 0,Space,Modflag,Size,matrixP); - if (path==NULL){ - return; - } -#ifdef SHOW_MANIPULATE_PATHS - T1_AbsolutePath( path); - T1_ManipulatePath( path, &mymanipulate); - T1_RelativePath( path); -#else - T1_ConcatOutlines( path, - T1_GetStringOutline(FontID+1,(char *)ligtheString, - 0,Space,Modflag,Size,matrixP)); -#endif - glyph=T1_FillOutline( path, Modflag); - } - } - else{ - if( extraflags & CHECK_FOR_BAD_CHARS){ - sscanf( XawDialogGetValueString(dialogtestcharacter), "%d", &TestChar); - ligtheString[strlen(ligtheString)/2]=(unsigned char) TestChar; - } - glyph=T1_SetString(FontID,(char *)ligtheString,0,Space,Modflag,Size,matrixP); - } - - - gettimeofday(time_ptr_stop, void_ptr); - - free(ligtheString); - - if ( glyph ==NULL ) { - sprintf(statusstring, "t1lib: Couldn't generate Bitmap, T1_errno=%d!", T1_errno); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - - height=glyph->metrics.ascent - glyph->metrics.descent; - overallwidth=glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing; - width=overallwidth; - - /* Prepare status message: */ - sprintf(statusstring,"Elapsed time: %ld Microseconds\nLeftSideBearing: %d\nRightSideBearing: %d\nAscent: %d\nDescent: %d\nAdvanceX: %d\nAdvanceY: %d\nBits Per Pixel: %ld\nImage Size: %ld Bytes\nPostScript Fontname: %s\nT1_errno: %d\n", - time_diff(time_ptr_start,time_ptr_stop), - glyph->metrics.leftSideBearing, - glyph->metrics.rightSideBearing, - glyph->metrics.ascent, - glyph->metrics.descent, - glyph->metrics.advanceX, - glyph->metrics.advanceY, - glyph->bpp, - PAD(glyph->bpp*(glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing),XGLYPH_PAD)/8*(glyph->metrics.ascent-glyph->metrics.descent), - T1_GetFontName(FontID), - T1_errno); - - if (glyph->bits != NULL) { - ximage=XCreateImage( display, - DefaultVisual(display, screennumber), - 1, /* depths for bitmap is 1 */ - XYBitmap, /* XYBitmap or XYPixmap */ - 0, /* No offset */ - glyph->bits, - width, - height, - t1_pad, /* lines padded to bytes */ - 0 /*PAD(width,8)/8*/ /* number of bytes per line */ - ); - /* Force bit and byte order */ - ximage->bitmap_bit_order=LSBFirst; - ximage->byte_order=LSBFirst; - XFreePixmap(display,pixmap); - pixmap = XCreatePixmap(display, - XtWindow(TopLevel), - width, - height, - DefaultDepth(display,screennumber) - ); - XPutImage(display, - pixmap, - DefaultGC( display, screennumber), - ximage, - 0, - 0, - 0, - 0, - width, - height - ); - XDestroyImage(ximage); - } - - - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, height + DOUBLEMARGIN); i++; - if (glyph->bits != NULL) { - XtSetArg( args[i], XtNbitmap, pixmap); i++; - } - else { - XtSetArg( args[i], XtNbitmap, 0); i++; - } - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, WhitePixel(display,screennumber)); i++; - XtSetValues(OutputWindow ,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, height + DOUBLEMARGIN); i++; - if (glyph->bits != NULL) { - XtSetArg( args[i], XtNbitmap, pixmap); i++; - } - else { - XtSetArg( args[i], XtNbitmap, 0); i++; - } - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, WhitePixel(display,screennumber)); i++; - XtSetValues(Output ,args,i); - - glyph->bits=NULL; /* Since XDestroyImage() free's this also! */ -} - - - -void aashowchar( Widget showcharbutton, XtPointer client_data, XtPointer call_data) -{ - int i, j; - Arg args[10]; - - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogtestcharacter), "%d", &TestChar); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - if (CheckTransform()==0 && Angle==0.0){ - matrixP=NULL; - } - else{ - matrixP=T1_RotateMatrix( &matrix, Angle); - } - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - for (j=0; jmetrics.ascent - glyph->metrics.descent; - overallwidth=glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing; - width=overallwidth; - - /* Prepare status message: */ - sprintf(statusstring,"Elapsed time: %ld Microseconds\nLeftSideBearing: %d\nRightSideBearing: %d\nAscent: %d\nDescent: %d\nAdvanceX: %d\nAdvanceY: %d\nBits Per Pixel: %ld\nImage Size: %ld Bytes\nPostScript Fontname: %s\nCharactername: %s\nT1_errno: %d\n", - time_diff(time_ptr_start,time_ptr_stop), - glyph->metrics.leftSideBearing, - glyph->metrics.rightSideBearing, - glyph->metrics.ascent, - glyph->metrics.descent, - glyph->metrics.advanceX, - glyph->metrics.advanceY, - glyph->bpp, - PAD(glyph->bpp*(glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing),XGLYPH_PAD)/8*(glyph->metrics.ascent-glyph->metrics.descent), - T1_GetFontName(FontID), - T1_GetCharName(FontID,(char)TestChar), - T1_errno); - - - /* - printf("glyph->bits=%u\n", glyph->bits); - printf("glyph->metrics.leftSideBearing=%u\n", glyph->metrics.leftSideBearing); - printf("glyph->metrics.rightSideBearing=%u\n", glyph->metrics.rightSideBearing); - printf("glyph->metrics.advanceX=%u\n", glyph->metrics.advanceX); - printf("glyph->metrics.ascent=%u\n", glyph->metrics.ascent); - printf("glyph->metrics.descent=%u\n", glyph->metrics.descent); - printf("glyph->pFontCacheInfo=%u\n", glyph->pFontCacheInfo); - */ - - if (glyph->bits != NULL) { - ximage=XCreateImage( display, - DefaultVisual(display, screennumber), - DefaultDepth(display,screennumber), /* depths for bitmap is 1 */ - ZPixmap, /* XYBitmap or XYPixmap */ - 0, /* No offset */ - glyph->bits, - width, - height, - t1_pad, /* lines padded to bytes */ - 0 /*PAD(width,8)/8*/ /* number of bytes per line */ - ); - ximage->byte_order=xglyph_byte_order; - XFreePixmap(display,pixmap); - pixmap = XCreatePixmap(display, - XtWindow(TopLevel), - width, - height, - DefaultDepth(display,screennumber) /* 8 */ /* depth */ - ); - XPutImage(display, - pixmap, - DefaultGC( display, screennumber), - ximage, - 0, - 0, - 0, - 0, - width, - height - ); - XDestroyImage(ximage); - } - - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, height + DOUBLEMARGIN); i++; - if (glyph->bits != NULL) { - XtSetArg( args[i], XtNbitmap, pixmap); i++; - } - else { - XtSetArg( args[i], XtNbitmap, 0); i++; - } - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, WhitePixel(display,screennumber)); i++; - XtSetValues(OutputWindow ,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, height + DOUBLEMARGIN); i++; - if (glyph->bits != NULL) { - XtSetArg( args[i], XtNbitmap, pixmap); i++; - } - else { - XtSetArg( args[i], XtNbitmap, 0); i++; - } - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetValues(Output ,args,i); - - glyph->bits=NULL; /* Since XDestroyImage() free's this also! */ -} - - - -void aashowstring( Widget showstringbutton, XtPointer client_data, XtPointer call_data) -{ - int i,j,k,l,m,none_found; - Arg args[10]; - char *theString='\0'; - char *ligtheString='\0'; - char *succs, *ligs; - char buf_char; - - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogspace),"%ld", &Space); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - if (CheckTransform()==0 && Angle==0.0){ - matrixP=NULL; - } - else{ - matrixP=T1_RotateMatrix( &matrix, Angle); - } - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - for (j=0; j0){ - buf_char=theString[j]; - while (k>0){ - none_found=1; - for (l=0;lmetrics.ascent - glyph->metrics.descent; - overallwidth=glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing; - width=overallwidth; - - /* Prepare status message: */ - sprintf(statusstring,"Elapsed time: %ld Microseconds\nLeftSideBearing: %d\nRightSideBearing: %d\nAscent: %d\nDescent: %d\nAdvanceX: %d\nAdvanceY: %d\nBits Per Pixel: %ld\nImage Size: %ld Bytes\nPostScript Fontname: %s\nT1_errno: %d\n", - time_diff(time_ptr_start,time_ptr_stop), - glyph->metrics.leftSideBearing, - glyph->metrics.rightSideBearing, - glyph->metrics.ascent, - glyph->metrics.descent, - glyph->metrics.advanceX, - glyph->metrics.advanceY, - glyph->bpp, - PAD(glyph->bpp*(glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing),XGLYPH_PAD)/8*(glyph->metrics.ascent-glyph->metrics.descent), - T1_GetFontName(FontID), - T1_errno); - - - /* - printf("glyph->bits=%u\n", glyph->bits); - printf("glyph->metrics.leftSideBearing=%u\n", glyph->metrics.leftSideBearing); - printf("glyph->metrics.rightSideBearing=%u\n", glyph->metrics.rightSideBearing); - printf("glyph->metrics.advanceX=%u\n", glyph->metrics.advanceX); - printf("glyph->metrics.ascent=%u\n", glyph->metrics.ascent); - printf("glyph->metrics.descent=%u\n", glyph->metrics.descent); - printf("glyph->pFontCacheInfo=%u\n", glyph->pFontCacheInfo); - */ - - if (glyph->bits != NULL) { - ximage=XCreateImage( display, - DefaultVisual(display, screennumber), - DefaultDepth(display,screennumber), - ZPixmap, /* XYBitmap or XYPixmap */ - 0, /* No offset */ - glyph->bits, - width, - height, - t1_pad, /* lines padded to bytes */ - 0 /* number of bytes per line */ - ); - ximage->byte_order=xglyph_byte_order; - XFreePixmap(display,pixmap); - pixmap = XCreatePixmap(display, - XtWindow(TopLevel), - width, - height, - DefaultDepth(display,screennumber) - ); - XPutImage(display, - pixmap, - DefaultGC( display, screennumber), - ximage, - 0, - 0, - 0, - 0, - width, - height - ); - XDestroyImage(ximage); - } - - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, height + DOUBLEMARGIN); i++; - if (glyph->bits != NULL) { - XtSetArg( args[i], XtNbitmap, pixmap); i++; - } - else { - XtSetArg( args[i], XtNbitmap, 0); i++; - } - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, WhitePixel( display, screennumber)); i++; - XtSetValues(OutputWindow ,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, height + DOUBLEMARGIN); i++; - if (glyph->bits != NULL) { - XtSetArg( args[i], XtNbitmap, pixmap); i++; - } - else { - XtSetArg( args[i], XtNbitmap, 0); i++; - } - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, WhitePixel( display, screennumber)); i++; - XtSetValues(Output ,args,i); - - glyph->bits=NULL; /* Since XDestroyImage() free's this also! */ -} - - - -void showcharX( Widget showcharbutton, XtPointer client_data, XtPointer call_data) -{ - int i, j; - Arg args[10]; - int tmp_width, tmp_height; - - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogtestcharacter), "%d", &TestChar); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - if (CheckTransform()==0 && Angle==0.0){ - matrixP=NULL; - } - else{ - matrixP=T1_RotateMatrix( &matrix, Angle); - } - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - for (j=0; jmetrics.advanceX - CROSS_SIZE, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY, - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX + CROSS_SIZE, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY); - XDrawLine( display, tmp_pixmap, DefaultGC( display, screennumber), - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY - CROSS_SIZE, - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY + CROSS_SIZE); - } - } - XSetForeground( display, DefaultGC( display, screennumber), fg); - - /* Check for errors */ - if (glyph==NULL) { - sprintf(statusstring, "t1lib: Couldn't generate Bitmap, T1_errno=%d!", T1_errno); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - /* Prepare status message: */ - sprintf(statusstring,"Elapsed time: %ld Microseconds\nLeftSideBearing: %d\nRightSideBearing: %d\nAscent: %d\nDescent: %d\nAdvanceX: %d\nAdvanceY: %d\nBits Per Pixel: %ld\nImage Size: %ld Bytes\nPostScript Fontname: %s\nCharactername: %s\nT1_errno: %d\n", - time_diff(time_ptr_start,time_ptr_stop), - glyph->metrics.leftSideBearing, - glyph->metrics.rightSideBearing, - glyph->metrics.ascent, - glyph->metrics.descent, - glyph->metrics.advanceX, - glyph->metrics.advanceY, - glyph->bpp, - PAD(glyph->bpp*(glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing),XGLYPH_PAD)/8*(glyph->metrics.ascent-glyph->metrics.descent), - T1_GetFontName(FontID), - T1_GetCharName(FontID,(char)TestChar), - T1_errno); - - /* Finally, set the resources: */ - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, tmp_width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, tmp_height + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNbitmap, tmp_pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, outbg); i++; - XtSetValues(OutputWindow ,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, tmp_width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, tmp_height + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNbitmap, tmp_pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetValues(Output ,args,i); - -} - - - -void showstringX( Widget showstringbutton, XtPointer client_data, XtPointer call_data) -{ - int i,j,k,l,m,none_found; - Arg args[10]; - int tmp_width, tmp_height; - - char *theString='\0'; - char *ligtheString='\0'; - char *succs, *ligs; - char buf_char; - - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogspace),"%ld", &Space); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - if (CheckTransform()==0 && Angle==0.0){ - matrixP=NULL; - } - else{ - matrixP=T1_RotateMatrix( &matrix, Angle); - } - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - for (j=0; j0){ - buf_char=theString[j]; - while (k>0){ - none_found=1; - for (l=0;lmetrics.advanceX - CROSS_SIZE, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY, - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX + CROSS_SIZE, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY); - XDrawLine( display, tmp_pixmap, DefaultGC( display, screennumber), - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY - CROSS_SIZE, - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY + CROSS_SIZE); - } - } - - XSetForeground( display, DefaultGC( display, screennumber), fg); - - /* Free the ligature-converted string */ - free(ligtheString); - - /* Check for errors */ - if (glyph==NULL) { - sprintf(statusstring, "t1lib: Couldn't generate Bitmap, T1_errno=%d!", T1_errno); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - /* Prepare status message: */ - sprintf(statusstring,"Elapsed time: %ld Microseconds\nLeftSideBearing: %d\nRightSideBearing: %d\nAscent: %d\nDescent: %d\nAdvanceX: %d\nAdvanceY: %d\nBits Per Pixel: %ld\nImage Size: %ld Bytes\nPostScript Fontname: %s\nT1_errno: %d\n", - time_diff(time_ptr_start,time_ptr_stop), - glyph->metrics.leftSideBearing, - glyph->metrics.rightSideBearing, - glyph->metrics.ascent, - glyph->metrics.descent, - glyph->metrics.advanceX, - glyph->metrics.advanceY, - glyph->bpp, - PAD(glyph->bpp*(glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing),XGLYPH_PAD)/8*(glyph->metrics.ascent-glyph->metrics.descent), - T1_GetFontName(FontID), - T1_errno); - - - /* Finally, set resources */ - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, tmp_width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, tmp_height + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNbitmap, tmp_pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, outbg); i++; - XtSetValues(OutputWindow ,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, tmp_width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, tmp_height + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNbitmap, tmp_pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, outbg); i++; - XtSetValues(Output ,args,i); - -} - - - -void aashowcharX( Widget showcharbutton, XtPointer client_data, XtPointer call_data) -{ - int i, j; - Arg args[10]; - int tmp_width, tmp_height; - - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogtestcharacter), "%d", &TestChar); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - if (CheckTransform()==0 && Angle==0.0){ - matrixP=NULL; - } - else{ - matrixP=T1_RotateMatrix( &matrix, Angle); - } - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - for (j=0; jmetrics.advanceX - CROSS_SIZE, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY, - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX + CROSS_SIZE, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY); - XDrawLine( display, tmp_pixmap, DefaultGC( display, screennumber), - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY - CROSS_SIZE, - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY + CROSS_SIZE); - } - } - - XSetForeground( display, DefaultGC( display, screennumber), fg); - - /* Check for errors */ - if (glyph==NULL) { - sprintf(statusstring, "t1lib: Couldn't generate Bitmap, T1_errno=%d!", T1_errno); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - /* Prepare status message: */ - sprintf(statusstring,"Elapsed time: %ld Microseconds\nLeftSideBearing: %d\nRightSideBearing: %d\nAscent: %d\nDescent: %d\nAdvanceX: %d\nAdvanceY: %d\nBits Per Pixel: %ld\nImage Size: %ld Bytes\nPostScript Fontname: %s\nCharactername: %s\nT1_errno: %d\n", - time_diff(time_ptr_start,time_ptr_stop), - glyph->metrics.leftSideBearing, - glyph->metrics.rightSideBearing, - glyph->metrics.ascent, - glyph->metrics.descent, - glyph->metrics.advanceX, - glyph->metrics.advanceY, - glyph->bpp, - PAD(glyph->bpp*(glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing),XGLYPH_PAD)/8*(glyph->metrics.ascent-glyph->metrics.descent), - T1_GetFontName(FontID), - T1_GetCharName(FontID,(char)TestChar), - T1_errno); - - /* Finally, set the resources: */ - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, tmp_width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, tmp_height + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNbitmap, tmp_pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, outbg); i++; - XtSetValues(OutputWindow ,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, tmp_width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, tmp_height + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNbitmap, tmp_pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetValues(Output ,args,i); - -} - - - -void aashowstringX( Widget showstringbutton, XtPointer client_data, XtPointer call_data) -{ - int i,j,k,l,m,none_found; - Arg args[10]; - int tmp_width, tmp_height; - - char *theString='\0'; - char *ligtheString='\0'; - char *succs, *ligs; - char buf_char; - - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogspace),"%ld", &Space); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - if (CheckTransform()==0 && Angle==0.0){ - matrixP=NULL; - } - else{ - matrixP=T1_RotateMatrix( &matrix, Angle); - } - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - else - for (j=0; j0){ - buf_char=theString[j]; - while (k>0){ - none_found=1; - for (l=0;lmetrics.advanceX - CROSS_SIZE, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY, - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX + CROSS_SIZE, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY); - XDrawLine( display, tmp_pixmap, DefaultGC( display, screennumber), - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY - CROSS_SIZE, - XOUTPUT_HALFHSIZE + glyph->metrics.advanceX, - XOUTPUT_HALFVSIZE - glyph->metrics.advanceY + CROSS_SIZE); - } - } - - XSetForeground( display, DefaultGC( display, screennumber), fg); - - /* Free the ligature-converted string */ - free(ligtheString); - - /* Check for errors */ - if (glyph==NULL) { - sprintf(statusstring, "t1lib: Couldn't generate Bitmap, T1_errno=%d!", T1_errno); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - /* Prepare status message: */ - sprintf(statusstring,"Elapsed time: %ld Microseconds\nLeftSideBearing: %d\nRightSideBearing: %d\nAscent: %d\nDescent: %d\nAdvanceX: %d\nAdvanceY: %d\nBits Per Pixel: %ld\nImage Size: %ld Bytes\nPostScript Fontname: %s\nT1_errno: %d\n", - time_diff(time_ptr_start,time_ptr_stop), - glyph->metrics.leftSideBearing, - glyph->metrics.rightSideBearing, - glyph->metrics.ascent, - glyph->metrics.descent, - glyph->metrics.advanceX, - glyph->metrics.advanceY, - glyph->bpp, - PAD(glyph->bpp*(glyph->metrics.rightSideBearing-glyph->metrics.leftSideBearing),XGLYPH_PAD)/8*(glyph->metrics.ascent-glyph->metrics.descent), - T1_GetFontName(FontID), - T1_errno); - - - - /* Finally, set resources */ - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, tmp_width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, tmp_height + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNbitmap, tmp_pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, outbg); i++; - XtSetValues(OutputWindow ,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, tmp_width + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNheight, tmp_height + DOUBLEMARGIN); i++; - XtSetArg( args[i], XtNbitmap, tmp_pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, outbg); i++; - XtSetValues(Output ,args,i); - -} - - -void fonttable( Widget fonttablebutton, XtPointer client_data, XtPointer call_data) -{ - - int i, j; - - Arg args[10]; - static Pixmap pixmap=0; - int x, y; - int CellLeftMargin, CellTopMargin; - int ColAdvance, RowAdvance; - int width, height; - int FontID, DeviceResolution; - float Size, Extent, Slant; - float scale; - - BBox fontbbox, tmpbbox; - - sscanf( XawDialogGetValueString(dialogfontid),"%d", &FontID); - sscanf( XawDialogGetValueString(dialogsize),"%f", &Size); - sscanf( XawDialogGetValueString(dialogangle),"%f", &Angle); - sscanf( XawDialogGetValueString(dialogspace),"%ld", &Space); - sscanf( XawDialogGetValueString(dialogdevres),"%d", &DeviceResolution); - - if (FontID<0 || FontID>=T1_Get_no_fonts()) { - sprintf(statusstring, "t1lib: FontID out of range!"); - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - return; - } - - /* We don't obey rotation when displaying a fonttable */ - matrixP=NULL; - - if (DeviceResolution!=last_resolution[FontID]){ - /* Delete all size dependent data for that font */ - for ( i=0; i reset to internal encoding */ - for (i=0; i so load it */ - i=0; - while (encstruct[i].encfilename != NULL) - i++; - encstruct[i].encoding=T1_LoadEncoding(EncodingFile); - encstruct[i].encfilename=(char *)malloc(strlen(EncodingFile)+1); - if (encstruct[i].encoding==NULL){ - free( encstruct[i].encfilename); - encstruct[i].encfilename=NULL; - } - i++; - } - else - for (j=0; jfontbbox.urx) - fontbbox.urx=tmpbbox.urx; - if (tmpbbox.ury>fontbbox.ury) - fontbbox.ury=tmpbbox.ury; - } - } - - /* We scale the font bounding box according to extent, slant and - device resolution. For the slant, we assume that the font contains - at least one character which reaches to the upper right corner and - the same for lower left corner. */ - scale=DeviceResolution/72.0; - fontbbox.urx=fontbbox.urx+(int)((float)fontbbox.ury*Slant); - fontbbox.llx=fontbbox.llx+(int)((float)fontbbox.lly*Slant); - fontbbox.urx=(int)((float)fontbbox.urx*Extent); - fontbbox.llx=(int)((float)fontbbox.llx*Extent); - fontbbox.llx=(int)((float)fontbbox.llx*scale); - fontbbox.urx=(int)((float)fontbbox.urx*scale); - fontbbox.lly=(int)((float)fontbbox.lly*scale); - fontbbox.ury=(int)((float)fontbbox.ury*scale); - - /* Left and top margin of the char-origins with respect upper left corner - of cell */ - CellTopMargin=SIMPLEMARGIN + fontbbox.ury; - if (fontbbox.llx < 0){ - CellLeftMargin= - fontbbox.llx; - } - else{ - CellLeftMargin=0; - } - /* How much to advance in which direction when incrementing */ - ColAdvance=CellLeftMargin + fontbbox.urx ; - RowAdvance=CellTopMargin - fontbbox.lly ; - /* Scale the charspace values */ - CellTopMargin = (int) floor((double)CellTopMargin*Size/1000.0+0.5)+SIMPLEMARGIN; - CellLeftMargin = (int) floor((double)CellLeftMargin*Size/1000.0+0.5)+SIMPLEMARGIN; - ColAdvance = (int) floor((double)ColAdvance*Size/1000.0+0.5)+DOUBLEMARGIN; - RowAdvance = (int) floor((double)RowAdvance*Size/1000.0+0.5)+DOUBLEMARGIN; - /* Overall width and height of map */ - width=1+(16*ColAdvance); - height=1+(16*RowAdvance); - - /* We clip to a window as large as the screen in this function */ - if (width > 1024) - width=WidthOfScreen(screen); - if (height > 768) - height=HeightOfScreen(screen); - - /* Create pixmap of appropriate size, */ - if (pixmap!=0) - XFreePixmap( display, pixmap); - pixmap=XCreatePixmap( display, - XtWindow(TopLevel), - width, - height, - depth - ); - /* We always use opaque mode */ - XSetForeground( display, DefaultGC( display, screennumber), bg); - XFillRectangle( display, pixmap, DefaultGC( display, screennumber), - 0, 0, width, height); - XSetForeground( display, DefaultGC( display, screennumber), fg); - XSetBackground( display, DefaultGC( display, screennumber), bg); - - /* Draw cell grid: */ - for (j=0; j<17; j++){ - XDrawLine( display, pixmap, DefaultGC( display, screennumber), - j*ColAdvance, 0, - j*ColAdvance, height); - } - for (j=0; j<17; j++){ - XDrawLine( display, pixmap, DefaultGC( display, screennumber), - 0, j*RowAdvance, - width, j*RowAdvance); - } - - /* Reset T1_errno: */ - T1_errno=0; - /* Set antialiasing level */ - T1_AASetLevel( aalevel); - /* Draw characters into pixmap */ - for ( i=0; i<16; ) { /* row-loop */ - for ( j=0; j<16; j++) { - x=1+(j*ColAdvance)+CellLeftMargin; - y=1+CellTopMargin+(i*RowAdvance); - glyph=T1_AASetCharX( pixmap, DefaultGC( display, screennumber), 1, - x, y, FontID, (char) (i*16+j), Size, matrixP); - if (x>width) { - sprintf( msg_buf, "Clipping row %d horizontally at column %d", i, j); - T1_PrintLog( "fonttable()", msg_buf, T1LOG_STATISTIC); - break; - } - - } - if (y>height) { - sprintf( msg_buf, "Clipping vertically at row %d", i); - T1_PrintLog( "fonttable()", msg_buf, T1LOG_STATISTIC); - break; - } - i++; - } - - /* If font was not loadable */ - if (T1_GetFontName( FontID)==NULL) - sprintf(statusstring, "t1lib: Can't get font name, T1_errno=%d!", T1_errno); - else - sprintf(statusstring,"Font %s, final T1_errno = %d", - T1_GetFontName( FontID), T1_errno); - - /* Finally, set resources */ - i=0; - XtSetArg(args[i], XtNbitmap,NULL); i++; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, XtUnspecifiedPixmap); i++; - XtSetArg(args[i], XtNlabel, statusstring); i++; - XtSetValues(labelstatus,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, width); i++; - XtSetArg( args[i], XtNheight, height); i++; - XtSetArg( args[i], XtNbitmap, pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, outbg); i++; - XtSetValues(OutputWindow ,args,i); - - i=0; - XtSetArg( args[i], XtNwidth, width); i++; - XtSetArg( args[i], XtNheight, height); i++; - XtSetArg( args[i], XtNbitmap, pixmap); i++; - XtSetArg( args[i], XtNresize, 1);i++; - XtSetArg( args[i], XtNinternalWidth, 0); i++; - XtSetArg( args[i], XtNinternalHeight, 0); i++; - XtSetArg( args[i], XtNbackground, outbg); i++; - XtSetValues(Output ,args,i); - - -} - - - -/* This function shows the About-message */ -void showabout( Widget aboutbutton, XtPointer client_data, XtPointer call_data) -{ - int i; - Arg args[10]; - Pixmap about=0; - XGCValues xgcvalues; - GC gc; - static char ident[80]=""; - -#define T1GCMASK GCForeground | GCBackground - - if (about==0) { - about=XCreatePixmap( display, XtWindow(TopLevel), - 380, MESSAGEBOXHEIGHT, depth); - } - gc=DefaultGC( display, screennumber); - - XGetGCValues( display, gc, T1GCMASK, &xgcvalues); - fg=xgcvalues.foreground; - bg=xgcvalues.background; - - XSetForeground( display, gc, white.pixel); - XFillRectangle( display, about, gc, 0, 0, 380, MESSAGEBOXHEIGHT); - XSetForeground( display, gc, black.pixel); - XSetBackground( display, gc, white.pixel); - - /* Set antialiasing level */ - T1_AASetLevel( aalevel); - sprintf( ident, "This is xglyph, T1Lib Version %s", T1_GetLibIdent()); - glyph=T1_AASetStringX( about, gc, 1, 10, 30, /* x_dest, y_dest */ - 0, ident, - 0, 0.0, T1_UNDERLINE | T1_KERNING, 20.0, NULL); - glyph=T1_AASetStringX( about, gc, 1, 10, 60, /* x_dest, y_dest */ - 0, "xglyph is an interactive tool for illustrating some", - 0, 0.0, T1_KERNING, 15.0, NULL); - glyph=T1_AASetStringX( about, gc, 1, 10, 80, /* x_dest, y_dest */ - 0, "of the T1Lib features. T1Lib is distributed under", - 0, 0.0, T1_KERNING, 15.0, NULL); - glyph=T1_AASetStringX( about, gc, 1, 10, 100, /* x_dest, y_dest */ - 0, "the GNU General Public Library License (LGPL).", - 0, 0.0, T1_KERNING, 15.0, NULL); - glyph=T1_AASetStringX( about, gc, 1, 10, 133, /* x_dest, y_dest */ - 0, "Enjoy it!", - 0, 0.0, T1_KERNING, 15.0, NULL); - XSetForeground( display, gc, fg); - XSetBackground( display, gc, bg); - - i=0; - XtSetArg(args[i], XtNwidth,380); i++; - XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++; - XtSetArg(args[i], XtNbackgroundPixmap, about); i++; - XtSetArg(args[i], XtNlabel, ""); i++; - XtSetValues(labelstatus,args,i); -} - - - -/* This function returns a time difference in Microseconds, provided that - the time difference is not greater than approximately 35 minutes. */ -long time_diff(struct timeval *time_ptr_start, struct timeval *time_ptr_stop) -{ - return((time_ptr_stop->tv_sec - - time_ptr_start->tv_sec)*1000000 - +(time_ptr_stop->tv_usec - - time_ptr_start->tv_usec)); -} - - -/* T1_ComputeAAColorsX(): Compute the antialiasing colors in dependency - of foreground and background */ -int ComputeAAColorsX( unsigned long fg, unsigned long bg, int nolevels) -{ - - static unsigned long last_fg; - static unsigned long last_bg; - unsigned long delta_red, delta_green, delta_blue; - int i; - int nocolors=0; - - - aacolors[0].pixel=bg; - aacolors[nolevels-1].pixel=fg; - - if ((fg==last_fg)&&(bg==last_bg)) - return(nocolors); - - /* Get RGB values for fore- and background */ - XQueryColor( display, DefaultColormap(display,screennumber), &aacolors[0]); - XQueryColor( display, DefaultColormap(display,screennumber), &aacolors[nolevels-1]); - delta_red = (aacolors[nolevels-1].red - aacolors[0].red)/(nolevels-1); - delta_green = (aacolors[nolevels-1].green - aacolors[0].green)/(nolevels-1); - delta_blue = (aacolors[nolevels-1].blue - aacolors[0].blue)/(nolevels-1); - aapixels[0]=aacolors[0].pixel; - aapixels[nolevels-1]=aacolors[nolevels-1].pixel; - - for (i=1; iffilest.h), t1funcs.c, t1info.c and + t1test.c). + - MSDOS concession: all file extensions .c.orig and .h.orig renamed + to .crg respectivally .hrg + - patch to handle /negationslash and /mapsto from LucidaMath-Symbol + correctly in t1funcs.c (ILH: Lee Hetherington). +92-05: AMIGA/Aztec: + - added type1.ami (contains order of objects in library) + - added Makefile.ami + - added bstring.c (contains a bzero()) +92-05: - fixed a reference to a NULL pointer in t1info.c + - more verbose error messages in type1 library (NDW: Norman Walsh) + - changed memory heuristic in type1 library from static (one chunk) + into dynamic (up to a maximum of 10 chunks). This was needed for + big fonts like daysrib.pfa (reported by Norman Walsh). + (Changes in t1funcs.c and t1malloc.c) + - added Makefile.tcc for MSDOS/Turbo C, removed Makefile.dos +92-06: - added Makefile.djg for MSDOS/GCC 386 (djgpp) + - fixed bug in t1io.c so MSDOS can read its own .pfb format +92-08: - fixed alligment problem for machines with wordlength other than 32 + bits (patch in util.c). Reported by J"urgen Marenda + for DataGeneral AViiON (Motorola + M88k machine) + - The type1 library did not render Oblique fonts correctly. + Erik Schenk provided a patch for + this problem (patches in fontfcn.c and t1util.c). + - Official X11.5 patches (Stephen Gildea 920728) merged in the type1 + library version of ps2pk. These patches were available on: + export.lcs.mit.edu:/pub/R5/contrib-fixes/Type1.patch + - portability: index() in t1info.c replaced by strchr() +94-01: Version 1.4 (bug fix release) + - types.h: added basic type definitions for non 32-bit platforms + - fontfcn.c: made `virtual memory' management dynamically + (reported by Norman Walsh, needed for complicated fonts) + - Makefile.*: improved + - original X11R5 sources no longer included (see X11R5 sources if + you want to see them) + - t1malloc.c removed, not longer needed. +95-11 Version 1.5 + - Makefile.bcc, Makefile.djg and Makefile.wat removed in favour + of Makefile.unx and Makefile.emx + - bzero() dropped in favour of ANSI C's memset() + - Improved cooperation between the master makefile and + its depending makefiles (thanks ) diff -Naur xdvik-22.40l/libs/type1/CVS/Entries xdvik-22.40n/libs/type1/CVS/Entries --- xdvik-22.40l/libs/type1/CVS/Entries Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/CVS/Entries Mon Sep 16 17:44:59 2002 @@ -0,0 +1,61 @@ +/CHANGES/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/Makefile.in/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/README/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/README.RMz/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/Xstuff.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/acconfig.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/arith.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/arith.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/blues.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/bstring.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/c-auto.in/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/cluts.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/configure/1.1.2.2/Mon Sep 16 17:45:29 2002//Txdvik_22_40_STABLE +/configure.in/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/curves.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/curves.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/digit.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/ffilest.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/font.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/fontfcn.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/fontfcn.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/fontfile.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/fontmisc.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/fonts.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/fontstruct.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/fontxlfd.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/fsmasks.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/hdigit.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/hints.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/hints.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/lines.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/lines.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/objects.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/objects.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/paths.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/paths.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/paths_rmz.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/pictures.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/regions.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/regions.h/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/scanfont.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/spaces.c/1.1.2.1/Sat Sep 14 00:24:47 2002//Txdvik_22_40_STABLE +/spaces.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/spaces_rmz.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/strokes.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/t1hdigit.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/t1imager.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/t1intf.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/t1io.c/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/t1snap.c/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/t1stdio.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/t1stub.c/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/token.c/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/token.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/tokst.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/trig.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/type1.c/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/types.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/util.c/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/util.h/1.1.2.1/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +D diff -Naur xdvik-22.40l/libs/type1/CVS/Repository xdvik-22.40n/libs/type1/CVS/Repository --- xdvik-22.40l/libs/type1/CVS/Repository Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/CVS/Repository Mon Sep 16 17:44:57 2002 @@ -0,0 +1 @@ +xdvik/libs/type1 diff -Naur xdvik-22.40l/libs/type1/CVS/Root xdvik-22.40n/libs/type1/CVS/Root --- xdvik-22.40l/libs/type1/CVS/Root Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/CVS/Root Mon Sep 16 17:44:57 2002 @@ -0,0 +1 @@ +:pserver:anonymous@cvs.xdvi.sourceforge.net:/cvsroot/xdvi diff -Naur xdvik-22.40l/libs/type1/CVS/Tag xdvik-22.40n/libs/type1/CVS/Tag --- xdvik-22.40l/libs/type1/CVS/Tag Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/CVS/Tag Mon Sep 16 17:44:59 2002 @@ -0,0 +1 @@ +Txdvik_22_40_STABLE diff -Naur xdvik-22.40l/libs/type1/Makefile.in xdvik-22.40n/libs/type1/Makefile.in --- xdvik-22.40l/libs/type1/Makefile.in Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/Makefile.in Sat Sep 14 00:24:47 2002 @@ -0,0 +1,25 @@ +ac_include ../../texk/make/common.mk +ac_include ../../texk/make/programs.mk +ac_include ../../texk/make/library.mk +ac_include ../../texk/make/paths.mk + +RANLIB = @RANLIB@ + +OBJS = arith.o bstring.o curves.o fontfcn.o hints.o lines.o objects.o \ + paths.o regions.o scanfont.o spaces.o t1io.o t1snap.o t1stub.o token.o \ + type1.o util.o + +libtype1.a: $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + $(RANLIB) $@ + +all: libtype1.a +uninstall: + +mostlyclean clean: + rm -f *.o libtype1.a + +distclean realclean extraclean configclean: clean + rm -f config.status config.log Makefile config.cache c-auto.h + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff -Naur xdvik-22.40l/libs/type1/README xdvik-22.40n/libs/type1/README --- xdvik-22.40l/libs/type1/README Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/README Sat Sep 14 00:24:47 2002 @@ -0,0 +1,25 @@ +This directory contains a rasterizer for "Type 1" (PostScript) format +outline fonts. It was donated by IBM for the R5 contrib tape and has +been maintained since then by the MIT X Consortium. This version is +compatible with X11R5 public patch 13. + +To be used, this rasterizer must be bound into the X server and the font +server. It is most convenient to do this if this directory is moved +into the 'mit' directory tree (i.e., mit/font/lib/font/Type1, a peer of +the 'Speedo' directory). Of course, mit/font/lib/font/Imakefile must be +made aware of its new subdirectory and the objects in it. In any case, +you must ensure that the library mit/font/lib/font/libfont.a contains +this code. + +In addition, the rasterizer must be "registered" with X. The source in +mit/fonts/lib/font/fontfile/renderers.c, specifically the routine +FontFileRegisterFontFileFunctions(), must be modified to add the line: + + Type1RegisterFontFileFunctions(); + +after the call to "SpeedoRegisterFontFileFunctions". + +Some Type 1 fonts have been donated; see, for example, the directory +contrib/fonts/scaled/Type1. In order to use them, they must be in the +font path, either by combining them in some existing font object +directory, or adding a new font directory to the path. diff -Naur xdvik-22.40l/libs/type1/README.RMz xdvik-22.40n/libs/type1/README.RMz --- xdvik-22.40l/libs/type1/README.RMz Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/README.RMz Sat Sep 14 00:24:47 2002 @@ -0,0 +1,12 @@ +Dear Folks, + +this directory basically contains the Type 1 rasterizer code, donated +to the X11-project by IBM and afterwards modified by Piet Tutelaers +for his ps2pk-package. But there are several files modified by +myself. Thus the state of this directory is not an official one and +subject to further changes! + +Before version 0.6 of t1lib I have cleaned the sources, removed the X11-dummy +function and made the sources more ANSI-C compliant. + + (03/09/1998, RMz) diff -Naur xdvik-22.40l/libs/type1/Xstuff.h xdvik-22.40n/libs/type1/Xstuff.h --- xdvik-22.40l/libs/type1/Xstuff.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/Xstuff.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,42 @@ +#ifndef NULL +#define NULL 0 +#endif + +#ifndef XMD_H +#define XMD_H 1 + +#include "types.h" + +/* + * Bitfield suffixes for the protocol structure elements, if you + * need them. Note that bitfields are not guarranteed to be signed + * (or even unsigned) according to ANSI C. + */ +#ifdef WORD64 +#define B32 :32 +#define B16 :16 +#else +#define B32 +#define B16 +#endif + +typedef struct { + SHORT leftSideBearing B16, + rightSideBearing B16, + characterWidth B16, + ascent B16, + descent B16; + USHORT attributes; +} xCharInfo; +#endif /* XMD_H */ + +#ifndef _FS_PROTO_H_ +#define _FS_PROTO_H_ + +typedef struct { + USHORT x_resolution B16; + USHORT y_resolution B16; + USHORT point_size B16; +} fsResolution; + +#endif /* _FS_PROTO_H_ */ diff -Naur xdvik-22.40l/libs/type1/acconfig.h xdvik-22.40n/libs/type1/acconfig.h --- xdvik-22.40l/libs/type1/acconfig.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/acconfig.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,119 @@ +/* Define to determine the integer type to be used in bitmaps. The type used + will be "unsigned BMTYPE". */ +#define BMTYPE int + +/* Define to the length (in bytes) of the above type. */ +#define BMBYTES 4 + +/* Define if your C compiler does not do string concatenation. */ +#undef CC_K_AND_R + +/* Define if your system has STREAMS (and if X uses it). */ +#undef HAVE_STREAMS + +/* Define if you are using SunOS 4.x. */ +#undef SUNOS4 + +/* Define if you are using Linux 2.1.xxx -- 2.2.8, + or if you find it necessary. */ +#undef FLAKY_SIGPOLL + +/* Define if your system has and poll(). */ +#undef HAVE_POLL + +/* Define if your system has waitpid(). */ +#undef HAVE_WAITPID + +/* Define if your system has putenv(). */ +#undef HAVE_PUTENV + +/* Define to use the Xaw toolkit. */ +#undef XAW + +/* Define this and XAW to use the Xaw3d toolkit. */ +#undef XAW3D + +/* Define to use the Motif toolkit. */ +#undef MOTIF + +/* Define to enable greyscale anti-aliasing for shrunken bitmaps. */ +#undef GREY + +/* Define to enable radio buttons on the side of the window for common + commands. */ +#undef BUTTONS + +/* Define to enable calling of mktexpk to automatically create missing + pixel files. */ +#undef MKTEXPK + +/* Define to enable old-style MakeTeXPK scripts to automatically create missing + pixel files. */ +#undef MAKETEXPK + +/* Define to point to the mktexpk or MakeTeXPK script (optional). */ +#undef MKTEXPK_PATH + +/* Define to enable gf format files (in addition to pk format). */ +#undef USE_GF + +/* Define to enable PostScript support via ghostscript. */ +#undef PS_GS + +/* Define to point to the ghostscript interpreter (optional). */ +#undef GS_PATH + +/* Define to enable PostScript support via Display PostScript. */ +#undef PS_DPS + +/* Define to enable PostScript support via NeWS (Sun OpenWindows). */ +#undef PS_NEWS + +/* Define to enable support for a configuration file. Its value must be a + colon-separated list of paths to search. */ +#undef DEFAULT_CONFIG_PATH + +/* Define to enable support for a configuration file (as above), including + support for the variables $SELFAUTODIR and $SELFAUTOPARENT. */ +#undef SELFAUTO + +/* Define to enable support for an additional app-defaults file (located with + the texmf hierarchy). */ +#undef EXTRA_APP_DEFAULTS + +/* Define to use DOS-style names for font files (e.g., dpi300/cmr10.pk instead + of cmr10.300pk). */ +#undef DOSNAMES + +/* Define to use A4 as the default paper size. */ +#undef A4 + +/* Define to enable right-to-left typesetting. */ +#undef TEXXET + +/* Define to set a default mfmode and resolution. */ +#undef MFMODE + +/* Define to use hypertex */ +#undef HTEX + +/* ??? */ +#undef LDT1LIB + +#undef MAKE_OMEGA_OCP_BY_DEFAULT +#undef MAKE_OMEGA_OFM_BY_DEFAULT +#undef MAKE_TEX_MF_BY_DEFAULT +#undef MAKE_TEX_PK_BY_DEFAULT +#undef MAKE_TEX_TFM_BY_DEFAULT + +/* Define to compile in statusline */ +#undef STATUSLINE + +/* Define to compile in t1lib */ +#undef T1LIB + +#undef HAVE_CC_CONCAT + +#undef HAVE_VSNPRINTF + +#undef NOTOOL diff -Naur xdvik-22.40l/libs/type1/arith.c xdvik-22.40n/libs/type1/arith.c --- xdvik-22.40l/libs/type1/arith.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/arith.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,424 @@ +/* $XConsortium: arith.c,v 1.2 91/10/10 11:14:06 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + /* ARITH CWEB V0006 ******** */ +/* +:h1.ARITH Module - Portable Module for Multiple Precision Fixed Point Arithmetic + +This module provides division and multiplication of 64-bit fixed point +numbers. (To be more precise, the module works on numbers that take +two 'longs' to store. That is almost always equivalent to saying 64-bit +numbers.) + +Note: it is frequently easy and desirable to recode these functions in +assembly language for the particular processor being used, because +assembly language, unlike C, will have 64-bit multiply products and +64-bit dividends. This module is offered as a portable version. + +&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) and Sten F. Andler + + +:h3.Include Files + +The included files are: +*/ + +#include + +#include "types.h" +#include "objects.h" +#include "spaces.h" +#include "arith.h" + +/* +:h3. +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +Reference for all algorithms: Donald E. Knuth, "The Art of Computer +Programming, Volume 2, Semi-Numerical Algorithms," Addison-Wesley Co., +Massachusetts, 1969, pp. 229-279. + +Knuth talks about a 'digit' being an arbitrary sized unit and a number +being a sequence of digits. We'll take a digit to be a 'short'. +The following assumption must be valid for these algorithms to work: +:ol. +:li.A 'long' is two 'short's. +:eol. +The following code is INDEPENDENT of: +:ol. +:li.The actual size of a short. +:li.Whether shorts and longs are stored most significant byte +first or least significant byte first. +:eol. + +SHORTSIZE is the number of bits in a short; LONGSIZE is the number of +bits in a long; MAXSHORT is the maximum unsigned short: +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +ASSEMBLE concatenates two shorts to form a long: +*/ +#define ASSEMBLE(hi,lo) ((((ULONG)hi)<>SHORTSIZE) +#define LOWDIGIT(u) ((u)&MAXSHORT) + +/* +SIGNBITON tests the high order bit of a long 'w': +*/ +#define SIGNBITON(w) (((LONG)w)<0) + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h2.Double Long Arithmetic + +:h3.DLmult() - Multiply Two Longs to Yield a Double Long + +The two multiplicands must be positive. +*/ + +void DLmult(product, u, v) + register doublelong *product; + register ULONG u; + register ULONG v; +{ + register ULONG u1, u2; /* the digits of u */ + register ULONG v1, v2; /* the digits of v */ + register unsigned int w1, w2, w3, w4; /* the digits of w */ + register ULONG t; /* temporary variable */ +/* printf("DLmult(? ?, %x, %x)\n", u, v); */ + u1 = HIGHDIGIT(u); + u2 = LOWDIGIT(u); + v1 = HIGHDIGIT(v); + v2 = LOWDIGIT(v); + + if (v2 == 0) w4 = w3 = w2 = 0; + else + { + t = u2 * v2; + w4 = LOWDIGIT(t); + t = u1 * v2 + HIGHDIGIT(t); + w3 = LOWDIGIT(t); + w2 = HIGHDIGIT(t); + } + + if (v1 == 0) w1 = 0; + else + { + t = u2 * v1 + w3; + w3 = LOWDIGIT(t); + t = u1 * v1 + w2 + HIGHDIGIT(t); + w2 = LOWDIGIT(t); + w1 = HIGHDIGIT(t); + } + + product->high = ASSEMBLE(w1, w2); + product->low = ASSEMBLE(w3, w4); +} + +/* +:h2.DLdiv() - Divide Two Longs by One Long, Yielding Two Longs + +Both the dividend and the divisor must be positive. +*/ + +void DLdiv(quotient, divisor) + doublelong *quotient; /* also where dividend is, originally */ + ULONG divisor; +{ + register ULONG u1u2 = quotient->high; + register ULONG u3u4 = quotient->low; + register LONG u3; /* single digit of dividend */ + register int v1,v2; /* divisor in registers */ + register LONG t; /* signed copy of u1u2 */ + register int qhat; /* guess at the quotient digit */ + register ULONG q3q4; /* low two digits of quotient */ + register int shift; /* holds the shift value for normalizing */ + register int j; /* loop variable */ + +/* printf("DLdiv(%x %x, %x)\n", quotient->high, quotient->low, divisor); */ + /* + * Knuth's algorithm works if the dividend is smaller than the + * divisor. We can get to that state quickly: + */ + if (u1u2 >= divisor) { + quotient->high = u1u2 / divisor; + u1u2 %= divisor; + } + else + quotient->high = 0; + + if (divisor <= MAXSHORT) { + + /* + * This is the case where the divisor is contained in one + * 'short'. It is worthwhile making this fast: + */ + u1u2 = ASSEMBLE(u1u2, HIGHDIGIT(u3u4)); + q3q4 = u1u2 / divisor; + u1u2 %= divisor; + u1u2 = ASSEMBLE(u1u2, LOWDIGIT(u3u4)); + quotient->low = ASSEMBLE(q3q4, u1u2 / divisor); + return; + } + + + /* + * At this point the divisor is a true 'long' so we must use + * Knuth's algorithm. + * + * Step D1: Normalize divisor and dividend (this makes our 'qhat' + * guesses more accurate): + */ + for (shift=0; !SIGNBITON(divisor); shift++, divisor <<= 1) { ; } + shift--; + divisor >>= 1; + + if ((u1u2 >> (LONGSIZE - shift)) != 0 && shift != 0) + abort("DLdiv: dividend too large", 1); + u1u2 = (u1u2 << shift) + ((shift == 0) ? 0 : u3u4 >> (LONGSIZE - shift)); + u3u4 <<= shift; + + /* + * Step D2: Begin Loop through digits, dividing u1,u2,u3 by v1,v2, + * then shifting U left by 1 digit: + */ + v1 = HIGHDIGIT(divisor); + v2 = LOWDIGIT(divisor); + q3q4 = 0; + u3 = HIGHDIGIT(u3u4); + + for (j=0; j < 2; j++) { + + /* + * Step D3: make a guess (qhat) at the next quotient denominator: + */ + qhat = (HIGHDIGIT(u1u2) == v1) ? MAXSHORT : u1u2 / v1; + /* + * At this point Knuth would have us further refine our + * guess, since we know qhat is too big if + * + * v2 * qhat > ASSEMBLE(u1u2 % v, u3) + * + * That would make sense if u1u2 % v was easy to find, as it + * would be in assembly language. I ignore this step, and + * repeat step D6 if qhat is too big. + */ + + /* + * Step D4: Multiply v1,v2 times qhat and subtract it from + * u1,u2,u3: + */ + u3 -= qhat * v2; + /* + * The high digit of u3 now contains the "borrow" for the + * rest of the substraction from u1,u2. + * Sometimes we can lose the sign bit with the above. + * If so, we have to force the high digit negative: + */ + t = HIGHDIGIT(u3); + if (t > 0) + t |= -1 << SHORTSIZE; + t += u1u2 - qhat * v1; +/* printf("..>divide step qhat=%x t=%x u3=%x u1u2=%x v1=%x v2=%x\n", + qhat, t, u3, u1u2, v1, v2); */ + while (t < 0) { /* Test is Step D5. */ + + /* + * D6: Oops, qhat was too big. Add back in v1,v2 and + * decrease qhat by 1: + */ + u3 = LOWDIGIT(u3) + v2; + t += HIGHDIGIT(u3) + v1; + qhat--; +/* printf("..>>qhat correction t=%x u3=%x qhat=%x\n", t, u3, qhat); */ + } + /* + * Step D7: shift U left one digit and loop: + */ + u1u2 = t; + if (HIGHDIGIT(u1u2) != 0) + abort("divide algorithm error", 2); + u1u2 = ASSEMBLE(u1u2, LOWDIGIT(u3)); + u3 = LOWDIGIT(u3u4); + q3q4 = ASSEMBLE(q3q4, qhat); + } + quotient->low = q3q4; +/* printf("DLdiv returns %x %x\n", quotient->high, quotient->low); */ + return; +} + +/* +:h3.DLadd() - Add Two Double Longs + +In this case, the doublelongs may be signed. The algorithm takes the +piecewise sum of the high and low longs, with the possibility that the +high should be incremented if there is a carry out of the low. How to +tell if there is a carry? Alex Harbury suggested that if the sum of +the lows is less than the max of the lows, there must have been a +carry. Conversely, if there was a carry, the sum of the lows must be +less than the max of the lows. So, the test is "if and only if". +*/ + +void DLadd(u, v) + doublelong *u; /* u = u + v */ + doublelong *v; +{ + register ULONG lowmax = TYPE1_MAX(u->low, v->low); + +/* printf("DLadd(%x %x, %x %x)\n", u->high, u->low, v->high, v->low); */ + u->high += v->high; + u->low += v->low; + if (lowmax > u->low) + u->high++; +} +/* +:h3.DLsub() - Subtract Two Double Longs + +Testing for a borrow is even easier. If the v.low is greater than +u.low, there must be a borrow. +*/ + +void DLsub(u, v) + doublelong *u; /* u = u - v */ + doublelong *v; +{ +/* printf("DLsub(%x %x, %x %x)\n", u->high, u->low, v->high, v->low);*/ + u->high -= v->high; + if (v->low > u->low) + u->high--; + u->low -= v->low; +} +/* +:h3.DLrightshift() - Macro to Shift Double Long Right by N +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h2.Fractional Pel Arithmetic +*/ +/* +:h3.FPmult() - Multiply Two Fractional Pel Values + +This funtion first calculates w = u * v to "doublelong" precision. +It then shifts w right by FRACTBITS bits, and checks that no +overflow will occur when the resulting value is passed back as +a fractpel. +*/ + +fractpel FPmult(u, v) + register fractpel u,v; +{ + doublelong w; + register int negative = FALSE; /* sign flag */ + int maxshort = MAXSHORT; /* To avoid that overflow warning (RMz) */ + + if ((u == 0) || (v == 0)) return (0); + + + if (u < 0) {u = -u; negative = TRUE;} + if (v < 0) {v = -v; negative = !negative;} + + if (u == TOFRACTPEL(1)) return ((negative) ? -v : v); + if (v == TOFRACTPEL(1)) return ((negative) ? -u : u); + + DLmult(&w, u, v); + DLrightshift(w, FRACTBITS); + if (w.high != 0 || SIGNBITON(w.low)) { + IfTrace2(TRUE,"FPmult: overflow, %dx%d\n", u, v); + w.low = TOFRACTPEL(maxshort); + } + + return ((negative) ? -w.low : w.low); +} + +/* +:h3.FPdiv() - Divide Two Fractional Pel Values + +These values may be signed. The function returns the quotient. +*/ + +fractpel FPdiv(dividend, divisor) + register fractpel dividend; + register fractpel divisor; +{ + doublelong w; /* result will be built here */ + int negative = FALSE; /* flag for sign bit */ + int maxshort = MAXSHORT; /* To avoid that overflow warning (RMz) */ + + if (dividend < 0) { + dividend = -dividend; + negative = TRUE; + } + if (divisor < 0) { + divisor = -divisor; + negative = !negative; + } + w.low = dividend << FRACTBITS; + w.high = dividend >> (LONGSIZE - FRACTBITS); + DLdiv(&w, divisor); + if (w.high != 0 || SIGNBITON(w.low)) { + IfTrace2(TRUE,"FPdiv: overflow, %d/%d\n", dividend, divisor); + w.low = TOFRACTPEL(maxshort); + } + return( (negative) ? -w.low : w.low); +} + +/* +:h3.FPstarslash() - Multiply then Divide + +Borrowing a chapter from the language Forth, it is useful to define +an operator that first multiplies by one constant then divides by +another, keeping the intermediate result in extended precision. +*/ + +fractpel FPstarslash(a, b, c) + register fractpel a,b,c; /* result = a * b / c */ +{ + doublelong w; /* result will be built here */ + int negative = FALSE; + int maxshort = MAXSHORT; /* To avoid that overflow warning (RMz) */ + + if (a < 0) { a = -a; negative = TRUE; } + if (b < 0) { b = -b; negative = !negative; } + if (c < 0) { c = -c; negative = !negative; } + + DLmult(&w, a, b); + DLdiv(&w, c); + if (w.high != 0 || SIGNBITON(w.low)) { + IfTrace3(TRUE,"FPstarslash: overflow, %d*%d/%d\n", a, b, c); + w.low = TOFRACTPEL(maxshort); + } + return((negative) ? -w.low : w.low); +} diff -Naur xdvik-22.40l/libs/type1/arith.h xdvik-22.40n/libs/type1/arith.h --- xdvik-22.40l/libs/type1/arith.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/arith.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,62 @@ +/* $XConsortium: arith.h,v 1.2 91/10/10 11:17:49 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + +#include "types.h" + +void DLmult(),DLdiv(),DLadd(),DLsub(); + +fractpel FPmult(); +fractpel FPdiv(); +fractpel FPstarslash(); + +/*END SHARED*/ +/*SHARED*/ + +#define SHORTSIZE (sizeof(SHORT)*8) +#define LONGSIZE (SHORTSIZE*2) +#define MAXSHORT ((1<> N) + (((ULONG) dl.high) << (LONGSIZE - N)); \ + dl.high >>= N; \ +} + +/*END SHARED*/ diff -Naur xdvik-22.40l/libs/type1/blues.h xdvik-22.40n/libs/type1/blues.h --- xdvik-22.40l/libs/type1/blues.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/blues.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,95 @@ +/* $XConsortium: blues.h,v 1.2 91/10/10 11:17:52 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * Portions Copyright (c) 1990 Adobe Systems Incorporated. + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark or Adobe + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. + * + * IBM, LEXMARK, AND ADOBE PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY + * WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE + * ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING + * ANY DUTY TO SUPPORT OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY + * PORTION OF THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM, + * LEXMARK, OR ADOBE) ASSUMES THE ENTIRE COST OF ALL SERVICING, REPAIR AND + * CORRECTION. IN NO EVENT SHALL IBM, LEXMARK, OR ADOBE BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "types.h" + +extern psobj *GetType1CharString(); + +#define TOPLEFT 1 +#define BOTTOMRIGHT 2 + +#define NUMBLUEVALUES 14 +#define NUMOTHERBLUES 10 +#define NUMFAMILYBLUES 14 +#define NUMFAMILYOTHERBLUES 10 +#define NUMSTEMSNAPH 12 +#define NUMSTEMSNAPV 12 +#define NUMSTDHW 1 +#define NUMSTDVW 1 + +#define DEFAULTBOLDSTEMWIDTH 2.0 + +#define MAXALIGNMENTZONES ((NUMBLUEVALUES+NUMOTHERBLUES)/2) +#define DEFAULTBLUESCALE 0.039625 +#define DEFAULTBLUESHIFT 7 +#define DEFAULTBLUEFUZZ 1 +#define DEFAULTSTDHW 0 +#define DEFAULTSTDVW 0 +#define DEFAULTFORCEBOLD FALSE +#define DEFAULTLANGUAGEGROUP 0 +#define DEFAULTRNDSTEMUP FALSE +#define DEFAULTLENIV 4 +#define DEFAULTEXPANSIONFACTOR 0.06 + +/* see Type 1 Font Format book for explanations of these values */ +/* Note that we're currently doing nothing for minfeature and password. */ +struct blues_struct { + struct blues_struct *next; /* ptr to next Blues structure in list */ + int numBlueValues; /* # of BlueValues in following array */ + int BlueValues[NUMBLUEVALUES]; + int numOtherBlues; /* # of OtherBlues values in following array */ + int OtherBlues[NUMOTHERBLUES]; + int numFamilyBlues; /* # of FamilyBlues values in following array */ + int FamilyBlues[NUMFAMILYBLUES]; + int numFamilyOtherBlues; /* # of FamilyOtherBlues values in */ + int FamilyOtherBlues[NUMFAMILYOTHERBLUES]; /* this array */ + DOUBLE BlueScale; + int BlueShift; + int BlueFuzz; + DOUBLE StdHW; + DOUBLE StdVW; + int numStemSnapH; /* # of StemSnapH values in following array */ + DOUBLE StemSnapH[NUMSTEMSNAPH]; + int numStemSnapV; /* # of StemSnapV values in following array */ + DOUBLE StemSnapV[NUMSTEMSNAPV]; + int ForceBold; + int LanguageGroup; + int RndStemUp; + int lenIV; + DOUBLE ExpansionFactor; +}; + +/* the alignment zone structure -- somewhat similar to the stem structure */ +/* see Adobe Type1 Font Format book about the terms used in this structure */ +struct alignmentzone { + int topzone; /* TRUE if a topzone, FALSE if a bottom zone */ + DOUBLE bottomy, topy; /* interval of this alignment zone */ +}; diff -Naur xdvik-22.40l/libs/type1/bstring.c xdvik-22.40n/libs/type1/bstring.c --- xdvik-22.40l/libs/type1/bstring.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/bstring.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,9 @@ +/* + * A simple memset() in case your ANSI C does not provide it + */ + +memset(void *s, int c, int length) +{ char *p = s; + + while (length--) *(p++) = c; +} diff -Naur xdvik-22.40l/libs/type1/c-auto.in xdvik-22.40n/libs/type1/c-auto.in --- xdvik-22.40l/libs/type1/c-auto.in Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/c-auto.in Sat Sep 14 00:24:47 2002 @@ -0,0 +1,10 @@ +/* c-auto.in. Generated automatically from configure.in by autoheader. */ + +#undef MAKE_OMEGA_OCP_BY_DEFAULT +#undef MAKE_OMEGA_OFM_BY_DEFAULT +#undef MAKE_TEX_MF_BY_DEFAULT +#undef MAKE_TEX_PK_BY_DEFAULT +#undef MAKE_TEX_TFM_BY_DEFAULT + +/* Define if you have the memset function. */ +#undef HAVE_MEMSET diff -Naur xdvik-22.40l/libs/type1/cluts.h xdvik-22.40n/libs/type1/cluts.h --- xdvik-22.40l/libs/type1/cluts.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/cluts.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,35 @@ +/* $XConsortium: cluts.h,v 1.2 91/10/10 11:17:54 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* STUB */ + +#define KillCLUT(T) +#define CopyCLUT(T) T +#define UniqueCLUT(T) + diff -Naur xdvik-22.40l/libs/type1/configure xdvik-22.40n/libs/type1/configure --- xdvik-22.40l/libs/type1/configure Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/configure Mon Sep 16 17:45:29 2002 @@ -0,0 +1,1661 @@ +#! /bin/sh + +# From configure.in configure.in 1.00 + + + + + + + + + + + + + + + + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --without-mktexmf-default do not run mktexmf if MF source missing" +ac_help="$ac_help + --without-mktexpk-default do not run mktexpk if PK font missing" +ac_help="$ac_help + --without-mktextfm-default do not run mktextfm if TFM file missing" +ac_help="$ac_help + --without-mkocp-default do not run mkocp if OCP file missing" +ac_help="$ac_help + --without-mkofm-default do not run mkofm if OFM file missing" +ac_help="$ac_help + --enable-multiplatform put executables in bin/PLATFORM" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=t1stub.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +ac_aux_dir= +for ac_dir in ../../config $srcdir/../../config; do + if test -f $ac_dir/install-sh; then + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ../../config $srcdir/../../config" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:585: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:614: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:645: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:697: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:730: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 741 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:772: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:777: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:805: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:837: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:858: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:919: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +for ac_func in memset +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:950: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1005: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test "x$USE_MAINTAINER_MODE" = xyes; then + MAINT= + else + MAINT='#M#' + fi + + + +echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 +echo "configure:1024: checking for loader (symbol LD)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$LD" && LD=ld +cf_cv_subst_LD=$LD +fi + +LD=${cf_cv_subst_LD} +echo "$ac_t""$LD" 1>&6 + + +echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 +echo "configure:1038: checking for archiver (symbol AR)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$AR" && AR=ar +cf_cv_subst_AR=$AR +fi + +AR=${cf_cv_subst_AR} +echo "$ac_t""$AR" 1>&6 + + +echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 +echo "configure:1052: checking for archiver options (symbol AR_OPTS)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$AR_OPTS" && AR_OPTS=rc +cf_cv_subst_AR_OPTS=$AR_OPTS +fi + +AR_OPTS=${cf_cv_subst_AR_OPTS} +echo "$ac_t""$AR_OPTS" 1>&6 + + + +# Check whether --with-mktexmf-default or --without-mktexmf-default was given. +if test "${with_mktexmf_default+set}" = set; then + withval="$with_mktexmf_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_MF_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mktexpk-default or --without-mktexpk-default was given. +if test "${with_mktexpk_default+set}" = set; then + withval="$with_mktexpk_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_PK_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mktextfm-default or --without-mktextfm-default was given. +if test "${with_mktextfm_default+set}" = set; then + withval="$with_mktextfm_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_TEX_TFM_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mkocp-default or --without-mkocp-default was given. +if test "${with_mkocp_default+set}" = set; then + withval="$with_mkocp_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_OMEGA_OCP_BY_DEFAULT 1 +EOF + +fi +# Check whether --with-mkofm-default or --without-mkofm-default was given. +if test "${with_mkofm_default+set}" = set; then + withval="$with_mkofm_default" + : +else + withval=yes +fi + +if test "x$withval" = xyes; then + cat >> confdefs.h <<\EOF +#define MAKE_OMEGA_OFM_BY_DEFAULT 1 +EOF + +fi + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:1144: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +# Check whether --enable-multiplatform or --disable-multiplatform was given. +if test "${enable_multiplatform+set}" = set; then + enableval="$enable_multiplatform" + if test "x$enable_multiplatform" = xyes && + test "x$bindir" = 'x${exec_prefix}/bin' +then + bindir="$bindir/$host" +fi +fi + + +echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 +echo "configure:1176: checking where the main texmf tree is located" >&5 +texmfmain= +if test "x$datadir" != 'x${prefix}/share'; then + # First case, datadir is defined... + eval p=\"$datadir\" + # Unconditionally set the directory, but... + texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` + # ... do complain if it wasn't found. + if test -d "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + echo "$ac_t""not found" 1>&6 + echo "configure: warning: No texmf tree found at $texmfmain. + If you do not have the files, you can retrieve a minimal set from + ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts + in systems/web2c. Winging it." 1>&2 + fi +else + # Second case, datadir is default... + if test "x$prefix" = "xNONE"; then + p="$ac_default_prefix" + else + eval p=\"$prefix\" + fi + for e in share/texmf lib/texmf texmf; do + if test -d "$p/$e"; then + texmfmain="$p/$e" + break + fi + done + texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` + if test -n "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + eval texmfmain="$datadir/texmf" + echo "$ac_t""not found" 1>&6 + echo "configure: warning: The main texmf tree was not found. + Specify the location of its parent directory with the --datadir option. + If you do not have the files, you can retrieve a minimal set from + ftp://ftp.tug.org/tex/texklib.tar.gz, which is mirrored on CTAN hosts + in systems/web2c. Winging it by using the default location + $texmfmain." 1>&2 + fi +fi + + + +if test "x${GCC}" = "xyes" +then + CFLAGS="$CFLAGS" + echo $ac_n "checking "for gcc strength-reduce bug"""... $ac_c" 1>&6 +echo "configure:1227: checking "for gcc strength-reduce bug"" >&5 +if eval "test \"`echo '$''{'ac_cv_c_gcc_strength_bug'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_gcc_strength_bug="yes" +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_gcc_strength_bug="no" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_gcc_strength_bug="yes" +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_gcc_strength_bug" 1>&6 + if test "$ac_cv_c_gcc_strength_bug" = "yes" + then + CFLAGS="$CFLAGS -fno-strength-reduce" + fi +fi + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "Makefile c-auto.h:c-auto.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@CPP@%$CPP%g +s%@RANLIB@%$RANLIB%g +s%@MAINT@%$MAINT%g +s%@LD@%$LD%g +s%@AR@%$AR%g +s%@AR_OPTS@%$AR_OPTS%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@texmfmain@%$texmfmain%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*|[A-z]:/*) # Absolute path. + srcdir="$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` + # Replace lines of the form ac_include foo with the contents of foo: + # first, from the ac_include lines construct a list of file names. + # From that list, we construct a second list of those files that exist. + # Then we construct lists of sed commands for including those files, + # and a sed command that removes the ac_include lines. We don't attempt + # to read non-existent files because some (buggy) versions of sed choke + # on this. Have to use sed because old (Ultrix, SunOS) awk does not support + # getline or system. (Anyway, configure scripts aren't supposed to use awk.) + # Can't use only one -e and commands {dr foo} because foo has to be last. + # Be careful, because the filename may contain /. Be careful with + # whitespace; we need to use echo. + # + # No support for the multiple-output file :-separated stuff. + # + file_substs=`sed -n \ +'/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' \ + "$ac_given_srcdir/$ac_file_in"` + # Create the sed command line ... + file_subst_cmd='sed' + for ac_inc in $file_substs; do + if test -f "$ac_given_srcdir/$ac_inc"; then + ac_mung=`echo $ac_inc | sed 's,/,%,g'` + file_subst_cmd="$file_subst_cmd -e '/^ac_include $ac_mung$/r $ac_inc'" + fi + done + file_subst_cmd="$file_subst_cmd -e '/^ac_include/d'" + # ... and fix the whitespace and escaped slashes. + file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \ +-e 's/ac_include /ac_include[ ]*/g'` + # cd into the srcdir because the files being included more or less + # must be part of the distribution. I can't find any way to do + # variable substitution in the sed commands (so the user could have, + # e.g., $top_srcdir in their ac_include line). + (cd $ac_given_srcdir && eval $file_subst_cmd $ac_file_in) \ + | sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff -Naur xdvik-22.40l/libs/type1/configure.in xdvik-22.40n/libs/type1/configure.in --- xdvik-22.40l/libs/type1/configure.in Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/configure.in Sat Sep 14 00:24:47 2002 @@ -0,0 +1,36 @@ +AC_REVISION([configure.in 1.00]) +AC_INIT(t1stub.c) +AC_CONFIG_AUX_DIR(../../config) +AC_CONFIG_HEADER(c-auto.h:c-auto.in) + +AC_PROG_MAKE_SET +AC_PROG_CC +AC_PROG_CPP +AC_PROG_RANLIB +AC_CHECK_FUNCS(memset) + +sinclude(../../texk/kpathsea/withenable.ac) + +dnl **** Check for gcc strength-reduce bug **** +if test "x${GCC}" = "xyes" +then + CFLAGS="$CFLAGS" + AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug, + AC_TRY_RUN([ +int main(void) { + static int Array[[3]]; + unsigned int B = 3; + int i; + for(i=0; i FPHALF) + return(0); /* not done yet */ + else + return(1); /* done */ +} + +/* +:h3.StepBezierRecurse() - The Recursive Logic in StepBezier() + +The recursion involves dividing the control polygon into two smaller +control polygons by finding the midpoints of the lines. This idea is +described in any graphics text book and its simplicity is what caused +Bezier to define his curves as he did. If the input region 'R' is NULL, +the result is a path that is the 'flattened' curve; otherwise StepBezier +returns nothing special. +*/ +static struct segment *StepBezierRecurse(I,xA,yA,xB,yB,xC,yC,xD,yD) + struct bezierinfo *I; /* Region under construction or NULL */ + fractpel xA,yA; /* A control point */ + fractpel xB,yB; /* B control point */ + fractpel xC,yC; /* C control point */ + fractpel xD,yD; /* D control point */ + +{ + if (BezierTerminationTest(xA,yA,xB,yB,xC,yC,xD,yD)) + { + if (I->region == NULL) + return(PathSegment(LINETYPE, xD - xA, yD - yA)); + else + StepLine(I->region, I->origin.x + xA, I->origin.y + yA, + I->origin.x + xD, I->origin.y + yD); + } + else + { + fractpel xAB,yAB; + fractpel xBC,yBC; + fractpel xCD,yCD; + fractpel xABC,yABC; + fractpel xBCD,yBCD; + fractpel xABCD,yABCD; + + xAB = xA + xB; yAB = yA + yB; + xBC = xB + xC; yBC = yB + yC; + xCD = xC + xD; yCD = yC + yD; + + xABC = xAB + xBC; yABC = yAB + yBC; + xBCD = xBC + xCD; yBCD = yBC + yCD; + + xABCD = xABC + xBCD; yABCD = yABC + yBCD; + + xAB >>= 1; yAB >>= 1; + xBC >>= 1; yBC >>= 1; + xCD >>= 1; yCD >>= 1; + xABC >>= 2; yABC >>= 2; + xBCD >>= 2; yBCD >>= 2; + xABCD >>= 3; yABCD >>= 3; + + if (I->region == NULL) + { + return( Join( + StepBezierRecurse(I, xA, yA, xAB, yAB, xABC, yABC, xABCD, yABCD), + StepBezierRecurse(I, xABCD, yABCD, xBCD, yBCD, xCD, yCD, xD, yD) + ) + ); + } + else + { + StepBezierRecurse(I, xA, yA, xAB, yAB, xABC, yABC, xABCD, yABCD); + StepBezierRecurse(I, xABCD, yABCD, xBCD, yBCD, xCD, yCD, xD, yD); + } + } + /*NOTREACHED*/ + /* To make ANSI-C-comnpiler happy (RMz): */ + return(0); +} + +/* +:h3.TOOBIG() - Macro to Test if a Coordinate is Too Big to Bezier SubDivide Normally + +Intermediate values in the Bezier subdivision are 8 times bigger than +the starting values. If this overflows, a 'long', we are in trouble: +*/ + +#define BITS (sizeof(LONG)*8) +#define HIGHTEST(p) (((p)>>(BITS-4)) != 0) /* includes sign bit */ +#define TOOBIG(xy) ((xy < 0) ? HIGHTEST(-xy) : HIGHTEST(xy)) + +/* +:h3.StepBezier() - Produce Run Ends for a Bezier Curve + +This is the entry point called from outside the module. +*/ + +struct segment *StepBezier(R, xA, yA, xB, yB, xC, yC, xD, yD) + struct region *R; /* Region under construction or NULL */ + fractpel xA,yA; /* A control point */ + fractpel xB,yB; /* B control point */ + fractpel xC,yC; /* C control point */ + fractpel xD,yD; /* D control point */ +{ + struct bezierinfo Info; + + Info.region = R; + Info.origin.x = xA; + Info.origin.y = yA; + + xB -= xA; + xC -= xA; + xD -= xA; + yB -= yA; + yC -= yA; + yD -= yA; + + if ( TOOBIG(xB) || TOOBIG(yB) || TOOBIG(xC) || TOOBIG(yC) + || TOOBIG(xD) || TOOBIG(yD) ) + abort("Beziers this big not yet supported", 3); + + return(StepBezierRecurse(&Info, + (fractpel) 0, (fractpel) 0, xB, yB, xC, yC, xD, yD)); +} + diff -Naur xdvik-22.40l/libs/type1/curves.h xdvik-22.40n/libs/type1/curves.h --- xdvik-22.40l/libs/type1/curves.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/curves.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,40 @@ +/* $XConsortium: curves.h,v 1.2 91/10/10 11:17:59 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + +#define StepConic(R,xA,yA,xB,yB,xC,yC,r) t1_StepConic(R,xA,yA,xB,yB,xC,yC,r) +#define StepBezier(R,xA,yA,xB,yB,xC,yC,xD,yD) t1_StepBezier(R,xA,yA,xB,yB,xC,yC,xD,yD) + +#define FlattenConic(xM,yM,xC,yC,r) t1_StepConic(NULL,(fractpel)0,(fractpel)0,xM,yM,xC,yC,r) +#define FlattenBezier(xB,yB,xC,yC,xD,yD) t1_StepBezier(NULL,(fractpel)0,(fractpel)0,xB,yB,xC,yC,xD,yD) + +struct segment *t1_StepConic(); +struct segment *t1_StepBezier(); + +/*END SHARED*/ diff -Naur xdvik-22.40l/libs/type1/digit.h xdvik-22.40n/libs/type1/digit.h --- xdvik-22.40l/libs/type1/digit.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/digit.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,64 @@ +/* $XConsortium: digit.h,v 1.2 91/10/10 11:18:01 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* -------------------------------------- */ +/* --- MACHINE GENERATED, DO NOT EDIT --- */ +/* -------------------------------------- */ + +#ifndef DIGIT +#define DIGIT 1 + +/* + * Digit Value Table -- + * + * The entries in the Digit Value Table map character + * codes in the set {0-9,a-z,A-Z} to their numeric + * values as part of numbers of radix 2-36. + * + */ +unsigned char digit_value[256] = { +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18, + 0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18, + 0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF +}; + +#endif diff -Naur xdvik-22.40l/libs/type1/ffilest.h xdvik-22.40n/libs/type1/ffilest.h --- xdvik-22.40l/libs/type1/ffilest.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/ffilest.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,151 @@ +/* + * $XConsortium: fontfilest.h,v 1.3 91/07/16 20:15:16 keith Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifndef _FONTFILEST_H_ +#define _FONTFILEST_H_ + +#ifdef XSERVER +#include +#else +#include "types.h" +#include "Xstuff.h" +#endif + +#include "fontmisc.h" +#include "fontstruct.h" +#include "fontfile.h" +#include "fontxlfd.h" + +typedef struct _FontName { + char *name; + short length; + short ndashes; +} FontNameRec; + +typedef struct _FontScaled { + FontScalableRec vals; + FontEntryPtr bitmap; + FontPtr pFont; +} FontScaledRec; + +typedef struct _FontScalableExtra { + FontScalableRec defaults; + int numScaled; + int sizeScaled; + FontScaledPtr scaled; + pointer private; +} FontScalableExtraRec; + +typedef struct _FontScalableEntry { + FontRendererPtr renderer; + char *fileName; + FontScalableExtraPtr extra; +} FontScalableEntryRec; + +/* + * This "can't" work yet - the returned alias string must be permanent, + * but this layer would need to generate the appropriate name from the + * resolved scalable + the XLFD values passed in. XXX + */ + +typedef struct _FontScaleAliasEntry { + char *resolved; +} FontScaleAliasEntryRec; + +typedef struct _FontBitmapEntry { + FontRendererPtr renderer; + char *fileName; + FontPtr pFont; +} FontBitmapEntryRec; + +typedef struct _FontAliasEntry { + char *resolved; +} FontAliasEntryRec; + +typedef struct _FontBCEntry { + FontScalableRec vals; + FontEntryPtr entry; +} FontBCEntryRec; + +typedef struct _FontEntry { + FontNameRec name; + int type; + union _FontEntryParts { + FontScalableEntryRec scalable; + FontBitmapEntryRec bitmap; + FontAliasEntryRec alias; + FontBCEntryRec bc; + } u; +} FontEntryRec; + +typedef struct _FontTable { + int used; + int size; + FontEntryPtr entries; + Bool sorted; +} FontTableRec; + +typedef struct _FontDirectory { + char *directory; + ULONG dir_mtime; + ULONG alias_mtime; + FontTableRec scalable; + FontTableRec nonScalable; +} FontDirectoryRec; + +typedef struct _FontRenderer { + char *fileSuffix; + int fileSuffixLen; + int (*OpenBitmap)(/* fpe, pFont, flags, entry, fileName, format, fmask */); + int (*OpenScalable)(/* fpe, pFont, flags, entry, fileName, vals, format, fmask */); + int (*GetInfoBitmap)(/* fpe, pFontInfo, entry, fileName */); + int (*GetInfoScalable)(/* fpe, pFontInfo, entry, fileName, vals */); + int number; +} FontRendererRec; + +typedef struct _FontRenders { + int number; + FontRendererPtr *renderers; +} FontRenderersRec, *FontRenderersPtr; + +typedef struct _BitmapInstance { + FontScalableRec vals; + FontBitmapEntryPtr bitmap; +} BitmapInstanceRec, *BitmapInstancePtr; + +typedef struct _BitmapScalablePrivate { + int numInstances; + BitmapInstancePtr instances; +} BitmapScalablePrivateRec, *BitmapScalablePrivatePtr; + +typedef struct _BitmapSources { + FontPathElementPtr *fpe; + int size; + int count; +} BitmapSourcesRec, *BitmapSourcesPtr; + +extern BitmapSourcesRec FontFileBitmapSources; + +#endif /* _FONTFILEST_H_ */ diff -Naur xdvik-22.40l/libs/type1/font.h xdvik-22.40n/libs/type1/font.h --- xdvik-22.40l/libs/type1/font.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/font.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,107 @@ +/* $XConsortium: font.h,v 1.8 91/07/19 21:03:49 rws Exp $ */ +/*********************************************************** +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +/* $NCDId: @(#)font.h,v 1.7 1991/06/24 17:00:23 lemke Exp $ */ + +#ifndef FONT_H +#define FONT_H + +#ifndef BitmapFormatByteOrderMask +#include "fsmasks.h" +#endif + +/* data structures */ +typedef struct _Font *FontPtr; +typedef struct _FontInfo *FontInfoPtr; +typedef struct _FontProp *FontPropPtr; +typedef struct _ExtentInfo *ExtentInfoPtr; +typedef struct _FontPathElement *FontPathElementPtr; +typedef struct _CharInfo *CharInfoPtr; +typedef struct _FontNames *FontNamesPtr; +typedef struct _FontResolution *FontResolutionPtr; + +#define NullCharInfo ((CharInfoPtr) 0) +#define NullFont ((FontPtr) 0) +#define NullFontInfo ((FontInfoPtr) 0) + + /* draw direction */ +#define LeftToRight 0 +#define RightToLeft 1 +#define BottomToTop 2 +#define TopToBottom 3 +typedef int DrawDirection; + +#define NO_SUCH_CHAR -1 + + +#define FontAliasType 0x1000 + +#define AllocError 80 +#define StillWorking 81 +#define FontNameAlias 82 +#define BadFontName 83 +#define Suspended 84 +#define Successful 85 +#define BadFontPath 86 +#define BadCharRange 87 +#define BadFontFormat 88 +#define FPEResetFailed 89 /* for when an FPE reset won't work */ + +/* OpenFont flags */ +#define FontLoadInfo 0x0001 +#define FontLoadProps 0x0002 +#define FontLoadMetrics 0x0004 +#define FontLoadBitmaps 0x0008 +#define FontLoadAll 0x000f +#define FontOpenSync 0x0010 + +/* Query flags */ +#define LoadAll 0x1 +#define FinishRamge 0x2 +#define EightBitFont 0x4 +#define SixteenBitFont 0x8 + +typedef char *closure; + +extern int StartListFontsWithInfo( /* client, length, pattern, maxNames */ ); +extern int ListFonts( /* client, length, pattern, maxNames */ ); + +extern FontNamesPtr MakeFontNamesRecord( /* size */ ); +extern void FreeFontNames(); +extern int AddFontNamesName(); + +extern int FontToFSError(); + +extern FontResolutionPtr GetClientResolution(); + +typedef struct _FontPatternCache *FontPatternCachePtr; + +extern FontPatternCachePtr MakeFontPatternCache (); +extern void FreeFontPatternCache (); +extern void EmtpyFontPatternCache (); +extern void CacheFontPattern (); +extern FontPtr FindCachedFontPattern (); +extern void RemoveCachedFontPattern (); + +#endif /* FONT_H */ diff -Naur xdvik-22.40l/libs/type1/fontfcn.c xdvik-22.40n/libs/type1/fontfcn.c --- xdvik-22.40l/libs/type1/fontfcn.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/fontfcn.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1105 @@ +/* $XConsortium: fontfcn.c,v 1.8 92/03/27 18:15:45 eswu Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */ + +#include +#include +#include + +#include "t1imager.h" +#include "util.h" +#include "fontfcn.h" +#include "fontmisc.h" +#include "paths_rmz.h" + +#include "../t1lib/parseAFM.h" +#include "../t1lib/t1types.h" +#include "../t1lib/t1extern.h" +#include "../t1lib/t1misc.h" +#include "../t1lib/t1base.h" +#include "../t1lib/t1finfo.h" + +extern xobject Type1Char(psfont *env, struct XYspace *S, + psobj *charstrP, psobj *subrsP, + psobj *osubrsP, + struct blues_struct *bluesP, + int *modeP, char *name); +extern xobject Type1Line(psfont *env, struct XYspace *S, + float line_position, + float line_thickness, + float line_length); +extern boolean Init_BuiltInEncoding( void); +void objFormatName(psobj *objP, int length, char *valueP); + +extern void T1io_reset( void); + +#define BEZIERTYPE 0x10+0x02 +#define LINETYPE 0x10+0x00 +#define MOVETYPE 0x10+0x05 + + +/***================================================================***/ +/* GLOBALS */ +/***================================================================***/ +static char CurCharName[257]=""; +static char BaseCharName[257]=""; +char CurFontName[120]; +char *CurFontEnv; +char *vm_base = NULL; + +static char notdef[]=".notdef"; + + +/* the following is inserted by RMz for VM checking and reallocating: */ +char *vm_used = NULL; +extern int vm_init_count; +extern int vm_init_amount; + +static psfont *FontP = NULL; +psfont TheCurrentFont; + + +/***================================================================***/ +/* SearchDict - look for name */ +/* - compare for match on len and string */ +/* return 0 - not found. */ +/* return n - nth element in dictionary. */ +/***================================================================***/ +int SearchDictName(dictP,keyP) + psdict *dictP; + psobj *keyP; +{ + int i,n; + + + n = dictP[0].key.len; + for (i=1;i<=n;i++) { /* scan the intire dictionary */ + if ( + (dictP[i].key.len == keyP->len ) + && + (strncmp(dictP[i].key.data.valueP, + keyP->data.valueP, + keyP->len) == 0 + ) + ) return(i); + } + return(0); +} +/***================================================================***/ +/* assignment of &TheCurrentFont removed by RMz: + */ +boolean initFont() +{ + if (!(vm_init())) return(FALSE); + vm_base = vm_next_byte(); + if (!(Init_BuiltInEncoding())) return(FALSE); + strcpy(CurFontName, ""); /* iniitialize to none */ + FontP->vm_start = vm_next_byte(); + FontP->FontFileName.len = 0; + FontP->FontFileName.data.valueP = CurFontName; + return(TRUE); +} +/***================================================================***/ +int resetFont(env) +char *env; +{ + + vm_next = FontP->vm_start; + vm_free = vm_size - ( vm_next - vm_base); + FontP->Subrs.len = 0; + FontP->Subrs.data.stringP = NULL; + FontP->CharStringsP = NULL; + FontP->Private = NULL; + FontP->fontInfoP = NULL; + FontP->BluesP = NULL; + /* This will load the font into the FontP */ + strcpy(CurFontName,env); + FontP->FontFileName.len = strlen(CurFontName); + FontP->FontFileName.data.nameP = CurFontName; + T1io_reset(); + + return(0); + +} +/***================================================================***/ +/* Read font used to attempt to load the font and, upon failure, + try a second time with twice as much memory. Unfortunately, if + it's a really complex font, simply using 2*vm_size may be insufficient. + I've modified it so that the program will try progressively larger + amounts of memory until it really runs out or the font loads + successfully. (ndw) +*/ +int readFont(env) +char *env; +{ + int rcode; + /* int memscale = 2; */ /* initially, try twice just like we used to ... */ + + /* restore the virtual memory and eliminate old font */ + + resetFont(env); + /* This will load the font into the FontP */ + + rcode = scan_font(FontP); + return(rcode); +} + + +static int isCompositeChar( int FontID, + char *charname) +{ + int i; + FontInfo *pAFMData; + + if (pFontBase->pFontArray[FontID].pAFMData==NULL) { + /* No AFM data present */ + return( -1); + } + + pAFMData=pFontBase->pFontArray[FontID].pAFMData; + for ( i=0; inumOfComps; i++) { + if (strcmp( pAFMData->ccd[i].ccName, charname)==0) + return( i); + } + + return( -1); + +} + + + +/* dump a description of path elements to stdout */ +static T1_PATHPOINT getDisplacement( struct segment *path) +{ + + register struct segment *ipath; + register struct beziersegment *ibpath; + T1_PATHPOINT point={0,0}; + + /* Step through the path list */ + ipath=(struct segment *)path; + + do { + if (ipath->type==LINETYPE) { + point.x+=ipath->dest.x; + point.y+=ipath->dest.y; + } + else if (ipath->type==MOVETYPE) { + point.x+=ipath->dest.x; + point.y+=ipath->dest.y; + } + else if (ipath->type==BEZIERTYPE) { + ibpath=(struct beziersegment *)ipath; + point.x+=ibpath->dest.x; + point.y+=ibpath->dest.y; + } + ipath=ipath->link; + } while (ipath!=NULL); + return( point); + +} + + + +/***================================================================***/ +/* RMz: instead of code, which is a character pointer to the name + of the character, we use "ev" which is a pointer to a desired + encoding vector (or NULL if font-internal encoding should be + used) and "index" as an index into the desired encoding vector! + The user thus has the opportunity of supplying whatever encoding + he wants. Font_Ptr is the pointer to the local psfont-structure. + */ + +xobject fontfcnB(int FontID, int modflag, + struct XYspace *S, char **ev, + unsigned char index, int *mode, + psfont *Font_Ptr, + int do_raster) +{ + + psobj *charnameP; /* points to psobj that is name of character*/ + FontInfo *pAFMData=NULL; + int i=-1; + int j=0; + int numPieces=1; + int N; + T1_PATHPOINT currdisp; + int basechar; + + psdict *CharStringsDictP; /* dictionary with char strings */ + psobj CodeName; /* used to store the translation of the name*/ + psobj *SubrsArrayP; + psobj *theStringP; + int localmode=0; + + struct segment *charpath=NULL; /* the path for this character */ + struct segment *tmppath1=NULL; + struct segment *tmppath2=NULL; + struct segment *tmppath3=NULL; + struct segment *tmppath4=NULL; + + + /* set the global font pointer to the address of already allocated + structure and setup pointers*/ + FontP=Font_Ptr; + CharStringsDictP = FontP->CharStringsP; + SubrsArrayP = &(FontP->Subrs); + charnameP = &CodeName; + + if (ev==NULL){ /* font-internal encoding should be used */ + charnameP->len = FontP->fontInfoP[ENCODING].value.data.arrayP[index].len; + charnameP->data.stringP = (unsigned char *) FontP->fontInfoP[ENCODING].value.data.arrayP[index].data.arrayP; + } + else{ /* some user-supplied encoding is to be used */ + charnameP->len = strlen(ev[index]); + charnameP->data.stringP = (unsigned char *) ev[index]; + } + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + + + /* search the chars string for this charname as key */ + basechar = SearchDictName(CharStringsDictP,charnameP); + if (basechar<=0) { + /* Check first, whether a char in question is a composite char */ + if ((i=isCompositeChar( FontID, CurCharName))>-1) { + /* i is now the index of the composite char definitions + (starting at 0). At this point it is clear that AFM-info + must be present -> fetch first component of composite char. */ + pAFMData=pFontBase->pFontArray[FontID].pAFMData; + charnameP->len=strlen( pAFMData->ccd[i].pieces[0].pccName); + charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[0].pccName; + numPieces=pAFMData->ccd[i].numOfPieces; + + if ((basechar=SearchDictName(CharStringsDictP,charnameP))<=0) { + /* this is bad, AFM-file and font file do not match. This + will most probably lead to errors or inconsistencies later. + However, we substitute .notdef and inform the user via + logfile and T1_errno. */ + sprintf( err_warn_msg_buf, + "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", + pAFMData->ccd[i].pieces[0].pccName, + pAFMData->ccd[i].ccName, FontID); + T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); + T1_errno=T1ERR_COMPOSITE_CHAR; + } + } + } + + if (basechar<=0) { /* This means the requested char is unknown or the + base char of a composite is not found -> + we substitute .notdef */ + charnameP = &CodeName; + charnameP->len = 7; + charnameP->data.stringP = (unsigned char *) notdef; + basechar = SearchDictName(CharStringsDictP,charnameP); + localmode=FF_NOTDEF_SUBST; + /* Font must be completely damaged if it doesn't define a .notdef */ + if (basechar<=0) { + *mode=FF_PARSE_ERROR; + return(NULL); + } + } /* if (basechar<=0) */ + /* basechar is now the index of the base character in the CharStrings + dictionary */ + + /* we provide the Type1Char() procedure with the name of the character + to rasterize for debugging purposes */ + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + /* get CharString and character path */ + theStringP = &(CharStringsDictP[basechar].value); + tmppath2 = (struct segment *) Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, + FontP->BluesP,mode,CurCharName); + /* if Type1Char reported an error, then return */ + if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) + return(NULL); + + /* Defer rastering to later, we first have to handle the composite + symbols */ + for (j=1; jlen=strlen( pAFMData->ccd[i].pieces[j].pccName); + charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[j].pccName; + /* get CharString definition */ + if ((N=SearchDictName(CharStringsDictP,charnameP))<=0) { + /* handling of errors, see comments above ... */ + sprintf( err_warn_msg_buf, + "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", + pAFMData->ccd[i].pieces[j].pccName, + pAFMData->ccd[i].ccName, FontID); + T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); + charnameP = &CodeName; + charnameP->len = 7; + charnameP->data.stringP = (unsigned char *) notdef; + N = SearchDictName(CharStringsDictP,charnameP); + localmode=FF_NOTDEF_SUBST; + /* damaged Font */ + if (N<=0) { + *mode=FF_PARSE_ERROR; + if (charpath!=NULL) { + KillPath( charpath); + } + return(NULL); + } + } + theStringP = &(CharStringsDictP[N].value); + tmppath1=(struct segment *)ILoc(S, + pAFMData->ccd[i].pieces[j].deltax, + pAFMData->ccd[i].pieces[j].deltay); + + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + charpath=(struct segment *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, + FontP->BluesP,mode,CurCharName); + /* return if Type1Char reports an error */ + if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) + return(NULL); + /* get escapement of current symbol */ + currdisp=getDisplacement( charpath); + /* concat displacement and symbol path */ + charpath=(struct segment *)Join(tmppath1,charpath); + /* for composite symbols we have to step back the char escapement. + this is, in order to be able to use accents that cause a + non zero displacement of the current point! We further have to + step back the displacement from composite char data. */ + tmppath1=(struct segment *)t1_PathSegment( MOVETYPE, -currdisp.x, -currdisp.y); + tmppath3=(struct segment *)ILoc(S, + -pAFMData->ccd[i].pieces[j].deltax, + -pAFMData->ccd[i].pieces[j].deltay); + tmppath3=(struct segment *)Join(tmppath1,tmppath3); + /* create path, or, respectively, append to existing path */ + if (tmppath4==NULL) { + tmppath4=(struct segment *)Join(charpath,tmppath3); + } + else { + charpath=(struct segment *)Join(charpath,tmppath3); + tmppath4=(struct segment *)Join(tmppath4,charpath); + } + } + + /* concat composite symbols and base char */ + if (tmppath4==NULL) { /* no previous composite symbols */ + charpath=tmppath2; /* a simple char */ + } + else { + charpath=(struct segment *)Join(tmppath4,tmppath2); + } + + + if (do_raster) { + /* fill with winding rule unless path was requested */ + if (*mode != FF_PATH) { + charpath = (struct segment *)Interior(charpath,WINDINGRULE+CONTINUITY); + } + } + + if (*mode==0) + *mode=localmode; + + return((xobject) charpath); +} + + + + +/***================================================================***/ +/* fontfcnA(env, mode) */ +/* */ +/* env is a pointer to a string that contains the fontname. */ +/* */ +/* 1) initialize the font - global indicates it has been done */ +/* 2) load the font */ +/* */ +/* This function has been modified by RMz. It now takes a pointer which + already contains the address of a valid type1 font structure as the + third argument. The value of this pointer is first handed to FontP + so that most other routines may be used without changes */ + +#define MAXTRIAL 4 + +/***================================================================***/ +Bool fontfcnA(env,mode,Font_Ptr) +char *env; +int *mode; +psfont *Font_Ptr; + +{ + int i, result; + + /* set the global font pointer to the address of already allocated + structure */ + FontP=Font_Ptr; + + InitImager(); + + /* Read the font program. */ + for (i=1; ifontInfoP; + objFormatName(&nameObj,strlen(infoName),infoName); + N = SearchDictName(dictP,&nameObj); + /* if found */ + if ( N > 0 ) { + *rcodeP = 0; + switch (dictP[N].value.type) { + case OBJ_ARRAY: + valueP = dictP[N].value.data.arrayP; + if (strcmp(infoName,"FontMatrix") == 0) { + /* 6 elments, return them as floats */ + for (i=0;i<6;i++) { + if (valueP->type == OBJ_INTEGER ) + ((float *)infoValue)[i] = valueP->data.integer; + else + ((float *)infoValue)[i] = valueP->data.real; + valueP++; + } + } + if (strcmp(infoName,"FontBBox") == 0) { + /* 4 elments for Bounding Box. all integers */ + for (i=0;i<4;i++) { + ((int *)infoValue)[i] = valueP->data.integer; + valueP++; + } + break; + case OBJ_INTEGER: + case OBJ_BOOLEAN: + *((int *)infoValue) = dictP[N].value.data.integer; + break; + case OBJ_REAL: + *((float *)infoValue) = dictP[N].value.data.real; + break; + case OBJ_NAME: + case OBJ_STRING: + *((char **)infoValue) = dictP[N].value.data.valueP; + break; + default: + *rcodeP = 1; + break; + } + } + } + else *rcodeP = 1; +} + + +/***================================================================***/ +/* RMz: instead of code, which is a character pointer to the name + of the character, we use "ev" which is a pointer to a desired + encoding vector (or NULL if font-internal encoding should be + used) and "index" as an index into the desired encoding vector! + The user thus has the opportunity of supplying whatever encoding + he wants. Font_Ptr is the pointer to the local psfont-structure. + */ +xobject fontfcnB_string( int FontID, int modflag, + struct XYspace *S, char **ev, + unsigned char *string, int no_chars, + int *mode, psfont *Font_Ptr, + int *kern_pairs, long spacewidth, + int do_raster) +{ + + psobj *charnameP; /* points to psobj that is name of character*/ + FontInfo *pAFMData=NULL; + int i=-1; + int j=0; + int k=0; + long acc_width=0; + int numPieces=1; + int N; + T1_PATHPOINT currdisp; + int basechar; + + psdict *CharStringsDictP; /* dictionary with char strings */ + psobj CodeName; /* used to store the translation of the name*/ + psobj *SubrsArrayP; + psobj *theStringP; + int localmode=0; + + struct segment *charpath=NULL; /* the path for this character */ + struct segment *tmppath1=NULL; + struct segment *tmppath2=NULL; + struct segment *tmppath3=NULL; + struct segment *tmppath4=NULL; + struct segment *tmppath5=NULL; + + + /* set the global font pointer to the address of already allocated + structure and setup pointers*/ + FontP=Font_Ptr; + CharStringsDictP = FontP->CharStringsP; + SubrsArrayP = &(FontP->Subrs); + charnameP = &CodeName; + + + /* In the following for-loop, all characters are processed, one after + the other. Between them, the amount of kerning is inserted. + The number of path variables used is somewhat numerous. We use the + follwing conventions: + + charpath: the overall path of the string. + tmppath5: the overall path of one component (possibly a composite symbol) + tmppath2: the path of a simple char or base char of a composite + tmppath4: the path of all "accents" of a composite symbol + */ + for (k=0; klen = FontP->fontInfoP[ENCODING].value.data.arrayP[string[k]].len; + charnameP->data.stringP = (unsigned char *) FontP->fontInfoP[ENCODING].value.data.arrayP[string[k]].data.arrayP; + } + else { /* some user-supplied encoding is to be used */ + charnameP = &CodeName; + charnameP->len = strlen(ev[string[k]]); + charnameP->data.stringP = (unsigned char*) ev[string[k]]; + } + + /* Spacing is to be under users control: => if space is the charname, don't + raster it. Rather, generate a horizontal movement of spacewidth: */ + if (strcmp((char *)charnameP->data.stringP, "space")==0){ + tmppath5=(struct segment *)ILoc(S, spacewidth,0); + acc_width += spacewidth; + } + else { + /* here a character or composite character is to be constructed */ + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + + /* search the CharString for this charname as key */ + basechar = SearchDictName(CharStringsDictP,charnameP); + if (basechar<=0) { + /* Check first, whether a char in question is a composite char */ + if ((i=isCompositeChar( FontID, CurCharName))>-1) { + /* i is now the index of the composite char definitions + (starting at 0). At this point it is clear that AFM-info + must be present -> fetch first component of composite char. */ + pAFMData=pFontBase->pFontArray[FontID].pAFMData; + charnameP->len=strlen( pAFMData->ccd[i].pieces[0].pccName); + charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[0].pccName; + numPieces=pAFMData->ccd[i].numOfPieces; + + if ((basechar=SearchDictName(CharStringsDictP,charnameP))<=0) { + /* this is bad, AFM-file and font file do not match. This + will most probably lead to errors or inconsistencies later. + However, we substitute .notdef and inform the user via + logfile and T1_errno. */ + sprintf( err_warn_msg_buf, + "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", + pAFMData->ccd[i].pieces[0].pccName, + pAFMData->ccd[i].ccName, FontID); + T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); + T1_errno=T1ERR_COMPOSITE_CHAR; + } + } + } + + if (basechar<=0) { /* This means the requested char is unknown or the + base char of a composite is not found -> + we substitute .notdef */ + charnameP = &CodeName; + charnameP->len = 7; + charnameP->data.stringP = (unsigned char *) notdef; + basechar = SearchDictName(CharStringsDictP,charnameP); + localmode=FF_NOTDEF_SUBST; + /* Font must be completely damaged if it doesn't define a .notdef */ + if (basechar<=0) { + *mode=FF_PARSE_ERROR; + return(NULL); + } + } /* if (basechar<=0) */ + /* basechar is now the index of the base character in the CharStrings + dictionary */ + + /* we provide the Type1Char() procedure with the name of the character + to rasterize for debugging purposes */ + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + /* get CharString and character path */ + theStringP = &(CharStringsDictP[basechar].value); + tmppath2 = (struct segment *) Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, + FontP->BluesP,mode,CurCharName); + strcpy( BaseCharName, CurCharName); + /* if Type1Char reports an error, clean up and return */ + if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) { + if (charpath!=NULL) { + KillPath( charpath); + } + if (tmppath1!=NULL) { + KillPath( tmppath1); + } + if (tmppath2!=NULL) { + KillPath( tmppath2); + } + if (tmppath3!=NULL) { + KillPath( tmppath3); + } + if (tmppath4!=NULL) { + KillPath( tmppath4); + } + if (tmppath5!=NULL) { + KillPath( tmppath5); + } + return(NULL); + } + + /* Defer rastering to later, we first have to handle the composite + symbols */ + for (j=1; jlen=strlen( pAFMData->ccd[i].pieces[j].pccName); + charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[j].pccName; + /* get CharString definition */ + if ((N=SearchDictName(CharStringsDictP,charnameP))<=0) { + /* handling of errors, see comments above ... */ + sprintf( err_warn_msg_buf, + "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", + pAFMData->ccd[i].pieces[j].pccName, + pAFMData->ccd[i].ccName, FontID); + T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); + charnameP = &CodeName; + charnameP->len = 7; + charnameP->data.stringP = (unsigned char *) notdef; + N = SearchDictName(CharStringsDictP,charnameP); + localmode=FF_NOTDEF_SUBST; + /* an undefined .notdef is fatal -> clean up and return */ + if (N<=0) { + *mode=FF_PARSE_ERROR; + if (charpath!=NULL) { + KillPath( charpath); + } + if (tmppath1!=NULL) { + KillPath( tmppath1); + } + if (tmppath2!=NULL) { + KillPath( tmppath2); + } + if (tmppath3!=NULL) { + KillPath( tmppath3); + } + if (tmppath4!=NULL) { + KillPath( tmppath4); + } + if (tmppath5!=NULL) { + KillPath( tmppath5); + } + return(NULL); + } + } + theStringP = &(CharStringsDictP[N].value); + tmppath1=(struct segment *)ILoc(S, + pAFMData->ccd[i].pieces[j].deltax, + pAFMData->ccd[i].pieces[j].deltay); + + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + tmppath5=(struct segment *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, + FontP->BluesP,mode,CurCharName); + /* return if Type1Char reports an error */ + if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) + return(NULL); + /* get escapement of current symbol */ + currdisp=getDisplacement( tmppath5); + /* concat displacement and symbol path */ + tmppath5=(struct segment *)Join(tmppath1,tmppath5); + /* for composite symbols we have to step back the char escapement. + this is, in order to be able to use accents that cause a + non zero displacement of the current point! We further have to + step back the displacement from composite char data. */ + tmppath1=(struct segment *)t1_PathSegment( MOVETYPE, -currdisp.x, -currdisp.y); + tmppath3=(struct segment *)ILoc(S, + -pAFMData->ccd[i].pieces[j].deltax, + -pAFMData->ccd[i].pieces[j].deltay); + tmppath3=(struct segment *)Join(tmppath1,tmppath3); + /* create path, or, respectively, append to existing path */ + if (tmppath4==NULL) { + tmppath4=(struct segment *)Join(tmppath5,tmppath3); + } + else { + tmppath5=(struct segment *)Join(tmppath5,tmppath3); + tmppath4=(struct segment *)Join(tmppath4,tmppath5); + } + } + + /* concat composite symbols and base char. We use tmppath5 to store + the path of the resulting (possibly composite) character. */ + if (tmppath4==NULL) { /* no previous composite symbols */ + tmppath5=tmppath2; /* a simple char */ + } + else { + tmppath5=(struct segment *)Join(tmppath4,tmppath2); + } + + + /* Accumulate displacement, but be careful: In case of composite + characters, we have to take the escapement of the base char only + into account, because accents do not cause spacing. The path is + constructed in a way that this automatically matches. + */ + if (numPieces>1) { /* composite character */ + acc_width +=pFontBase->pFontArray[FontID].pAFMData->ccd[-(pFontBase->pFontArray[FontID].pEncMap[string[k]]+1)].wx; + } + else { /* ordinary character */ + acc_width +=pFontBase->pFontArray[FontID].pAFMData->cmi[pFontBase->pFontArray[FontID].pEncMap[string[k]]-1].wx; + } + + } /* else (if (char==space) */ + + /* character path is now stored in tmppath5. It may be a composite character. + Insert kerning amount, if it is not the last character of the string. */ + if (kpFontArray[FontID].UndrLnPos, + pFontBase->pFontArray[FontID].UndrLnThick, + (float) acc_width); + charpath=(struct segment *)Join(charpath,tmppath2); + } + if (modflag & T1_OVERLINE){ + tmppath2=(struct segment *)Type1Line(FontP,S, + pFontBase->pFontArray[FontID].OvrLnPos, + pFontBase->pFontArray[FontID].OvrLnThick, + (float) acc_width); + charpath=(struct segment *)Join(charpath,tmppath2); + } + if (modflag & T1_OVERSTRIKE){ + tmppath2=(struct segment *)Type1Line(FontP,S, + pFontBase->pFontArray[FontID].OvrStrkPos, + pFontBase->pFontArray[FontID].OvrStrkThick, + (float) acc_width); + charpath=(struct segment *)Join(charpath,tmppath2); + } + + /* + printf("charpath->type: %x\n",charpath->type); + printf("path1->type: %x\n",path1->type); + printf("path2->type: %x\n",path2->type); + */ + + /* if Type1Char reported an error, then return */ + + if ( *mode == FF_PARSE_ERROR) return(NULL); + if ( *mode == FF_PATH_ERROR) return(NULL); + if (do_raster) { + /* fill with winding rule unless path was requested */ + if (*mode != FF_PATH) { + charpath = (struct segment *) Interior((path) charpath,WINDINGRULE+CONTINUITY); + } + } + + if (*mode==0) + *mode=localmode; + + return((path)charpath); +} + + +/* This special variant is for generating character bitmaps from + charactername */ +xobject fontfcnB_ByName( int FontID, int modflag, + struct XYspace *S, + unsigned char *charname, + int *mode, psfont *Font_Ptr, + int do_raster) +{ + + psobj *charnameP; /* points to psobj that is name of character*/ + FontInfo *pAFMData=NULL; + int i=-1; + int j=0; + int numPieces=1; + int N; + T1_PATHPOINT currdisp; + int basechar; + + psdict *CharStringsDictP; /* dictionary with char strings */ + psobj CodeName; /* used to store the translation of the name*/ + psobj *SubrsArrayP; + psobj *theStringP; + int localmode=0; + + struct segment *charpath=NULL; /* the path for this character */ + struct segment *tmppath1=NULL; + struct segment *tmppath2=NULL; + struct segment *tmppath3=NULL; + struct segment *tmppath4=NULL; + + + /* set the global font pointer to the address of already allocated + structure and setup pointers*/ + FontP=Font_Ptr; + CharStringsDictP = FontP->CharStringsP; + SubrsArrayP = &(FontP->Subrs); + charnameP = &CodeName; + + charnameP->len = strlen((char*)charname); + charnameP->data.stringP = charname; + + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + + + /* search the chars string for this charname as key */ + basechar = SearchDictName(CharStringsDictP,charnameP); + if (basechar<=0) { + /* Check first, whether a char in question is a composite char */ + if ((i=isCompositeChar( FontID, CurCharName))>-1) { + /* i is now the index of the composite char definitions + (starting at 0). At this point it is clear that AFM-info + must be present -> fetch first component of composite char. */ + pAFMData=pFontBase->pFontArray[FontID].pAFMData; + charnameP->len=strlen( pAFMData->ccd[i].pieces[0].pccName); + charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[0].pccName; + numPieces=pAFMData->ccd[i].numOfPieces; + + if ((basechar=SearchDictName(CharStringsDictP,charnameP))<=0) { + /* this is bad, AFM-file and font file do not match. This + will most probably lead to errors or inconsistencies later. + However, we substitute .notdef and inform the user via + logfile and T1_errno. */ + sprintf( err_warn_msg_buf, + "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", + pAFMData->ccd[i].pieces[0].pccName, + pAFMData->ccd[i].ccName, FontID); + T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); + T1_errno=T1ERR_COMPOSITE_CHAR; + } + } + } + + if (basechar<=0) { /* This means the requested char is unknown or the + base char of a composite is not found -> + we substitute .notdef */ + charnameP = &CodeName; + charnameP->len = 7; + charnameP->data.stringP = (unsigned char *) notdef; + basechar = SearchDictName(CharStringsDictP,charnameP); + localmode=FF_NOTDEF_SUBST; + /* Font must be completely damaged if it doesn't define a .notdef */ + if (basechar<=0) { + *mode=FF_PARSE_ERROR; + return(NULL); + } + } /* if (basechar<=0) */ + /* basechar is now the index of the base character in the CharStrings + dictionary */ + + /* we provide the Type1Char() procedure with the name of the character + to rasterize for debugging purposes */ + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + /* get CharString and character path */ + theStringP = &(CharStringsDictP[basechar].value); + tmppath2 = (struct segment *) Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, + FontP->BluesP,mode,CurCharName); + /* if Type1Char reported an error, then return */ + if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) + return(NULL); + + /* Defer rastering to later, we first have to handle the composite + symbols */ + for (j=1; jlen=strlen( pAFMData->ccd[i].pieces[j].pccName); + charnameP->data.stringP=(unsigned char*)pAFMData->ccd[i].pieces[j].pccName; + /* get CharString definition */ + if ((N=SearchDictName(CharStringsDictP,charnameP))<=0) { + /* handling of errors, see comments above ... */ + sprintf( err_warn_msg_buf, + "Charstring \"%s\" needed to construct composite char \"%s\" not defined (FontID=%d)", + pAFMData->ccd[i].pieces[j].pccName, + pAFMData->ccd[i].ccName, FontID); + T1_PrintLog( "fontfcnB():", err_warn_msg_buf, T1LOG_WARNING); + charnameP = &CodeName; + charnameP->len = 7; + charnameP->data.stringP = (unsigned char *) notdef; + N = SearchDictName(CharStringsDictP,charnameP); + localmode=FF_NOTDEF_SUBST; + /* damaged Font */ + if (N<=0) { + *mode=FF_PARSE_ERROR; + if (charpath!=NULL) { + KillPath( charpath); + } + return(NULL); + } + } + theStringP = &(CharStringsDictP[N].value); + tmppath1=(struct segment *)ILoc(S, + pAFMData->ccd[i].pieces[j].deltax, + pAFMData->ccd[i].pieces[j].deltay); + + strncpy( (char *)CurCharName, (char *)charnameP->data.stringP, charnameP->len); + CurCharName[charnameP->len]='\0'; + charpath=(struct segment *)Type1Char(FontP,S,theStringP,SubrsArrayP,NULL, + FontP->BluesP,mode,CurCharName); + /* return if Type1Char reports an error */ + if ( *mode == FF_PARSE_ERROR || *mode==FF_PATH_ERROR) + return(NULL); + /* get escapement of current symbol */ + currdisp=getDisplacement( charpath); + /* concat displacement and symbol path */ + charpath=(struct segment *)Join(tmppath1,charpath); + /* for composite symbols we have to step back the char escapement. + this is, in order to be able to use accents that cause a + non zero displacement of the current point! We further have to + step back the displacement from composite char data. */ + tmppath1=(struct segment *)t1_PathSegment( MOVETYPE, -currdisp.x, -currdisp.y); + tmppath3=(struct segment *)ILoc(S, + -pAFMData->ccd[i].pieces[j].deltax, + -pAFMData->ccd[i].pieces[j].deltay); + tmppath3=(struct segment *)Join(tmppath1,tmppath3); + /* create path, or, respectively, append to existing path */ + if (tmppath4==NULL) { + tmppath4=(struct segment *)Join(charpath,tmppath3); + } + else { + charpath=(struct segment *)Join(charpath,tmppath3); + tmppath4=(struct segment *)Join(tmppath4,charpath); + } + } + + /* concat composite symbols and base char */ + if (tmppath4==NULL) { /* no previous composite symbols */ + charpath=tmppath2; /* a simple char */ + } + else { + charpath=(struct segment *)Join(tmppath4,tmppath2); + } + + + if (do_raster) { + /* fill with winding rule unless path was requested */ + if (*mode != FF_PATH) { + charpath = (struct segment *)Interior(charpath,WINDINGRULE+CONTINUITY); + } + } + + if (*mode==0) + *mode=localmode; + + return((xobject) charpath); + +} + diff -Naur xdvik-22.40l/libs/type1/fontfcn.h xdvik-22.40n/libs/type1/fontfcn.h --- xdvik-22.40l/libs/type1/fontfcn.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/fontfcn.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,99 @@ +/* $XConsortium: fontfcn.h,v 1.3 92/03/26 16:42:23 eswu Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* Definition of a PostScript FONT */ +typedef struct ps_font { + char *vm_start; + psobj FontFileName; + psobj Subrs; + psdict *CharStringsP; + psdict *Private; + psdict *fontInfoP; +struct blues_struct *BluesP; +} psfont; +/***================================================================***/ +/* Routines in scan_font */ +/***================================================================***/ + +extern boolean Init_StdEnc(); +extern int scan_font(); +extern int GetFontInfo(); +/***================================================================***/ +/* Return codes from scan_font */ +/***================================================================***/ +#define SCAN_OK 0 +#define SCAN_FILE_EOF -1 +#define SCAN_ERROR -2 +#define SCAN_OUT_OF_MEMORY -3 +#define SCAN_FILE_OPEN_ERROR -4 +#define SCAN_MMFONT -5 /* font is a Multiple Master Font */ +#define SCAN_TRUE -6 +#define SCAN_FALSE -7 +#define SCAN_END -8 + +/***================================================================***/ +/* Name of FontInfo fields */ +/***================================================================***/ + +#define FONTNAME 1 +#define PAINTTYPE 2 +#define FONTTYPENUM 3 +#define FONTMATRIX 4 +#define FONTBBOX 5 +#define UNIQUEID 6 +#define STROKEWIDTH 7 +#define VERSION 8 +#define NOTICE 9 +#define FULLNAME 10 +#define FAMILYNAME 11 +#define WEIGHT 12 +#define ITALICANGLE 13 +#define ISFIXEDPITCH 14 +#define UNDERLINEPOSITION 15 +#define UNDERLINETHICKNESS 16 +#define ENCODING 17 +/***================================================================***/ +/* Name of Private values */ +/***================================================================***/ +#define BLUEVALUES 1 +#define OTHERBLUES 2 +#define FAMILYBLUES 3 +#define FAMILYOTHERBLUES 4 +#define BLUESCALE 5 +#define BLUESHIFT 6 +#define BLUEFUZZ 7 +#define STDHW 8 +#define STDVW 9 +#define STEMSNAPH 10 +#define STEMSNAPV 11 +#define FORCEBOLD 12 +#define LANGUAGEGROUP 13 +#define LENIV 14 +#define RNDSTEMUP 15 +#define EXPANSIONFACTOR 16 diff -Naur xdvik-22.40l/libs/type1/fontfile.h xdvik-22.40n/libs/type1/fontfile.h --- xdvik-22.40l/libs/type1/fontfile.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/fontfile.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,72 @@ +/* + * $XConsortium: fontfile.h,v 1.1 91/05/11 09:11:58 rws Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifndef _FONTFILE_H_ +#define _FONTFILE_H_ +typedef struct _FontEntry *FontEntryPtr; +typedef struct _FontTable *FontTablePtr; +typedef struct _FontName *FontNamePtr; +typedef struct _FontScaled *FontScaledPtr; +typedef struct _FontScalableExtra *FontScalableExtraPtr; +typedef struct _FontScalableEntry *FontScalableEntryPtr; +typedef struct _FontScaleAliasEntry *FontScaleAliasEntryPtr; +typedef struct _FontBitmapEntry *FontBitmapEntryPtr; +typedef struct _FontAliasEntry *FontAliasEntryPtr; +typedef struct _FontBCEntry *FontBCEntryPtr; +typedef struct _FontDirectory *FontDirectoryPtr; +typedef struct _FontRenderer *FontRendererPtr; + +#define NullFontEntry ((FontEntryPtr) 0) +#define NullFontTable ((FontTablePtr) 0) +#define NullFontName ((FontNamePtr) 0) +#define NullFontScaled ((FontScaled) 0) +#define NullFontScalableExtra ((FontScalableExtra) 0) +#define NullFontscalableEntry ((FontScalableEntry) 0) +#define NullFontScaleAliasEntry ((FontScaleAliasEntry) 0) +#define NullFontBitmapEntry ((FontBitmapEntry) 0) +#define NullFontAliasEntry ((FontAliasEntry) 0) +#define NullFontBCEntry ((FontBCEntry) 0) +#define NullFontDirectory ((FontDirectoryPtr) 0) +#define NullFontRenderer ((FontRendererPtr) 0) + +#define FONT_ENTRY_SCALABLE 0 +#define FONT_ENTRY_SCALE_ALIAS 1 +#define FONT_ENTRY_BITMAP 2 +#define FONT_ENTRY_ALIAS 3 +#define FONT_ENTRY_BC 4 + +#define MAXFONTNAMELEN 1024 +#define MAXFONTFILENAMELEN 1024 + +#define FontDirFile "fonts.dir" +#define FontAliasFile "fonts.alias" +#define FontScalableFile "fonts.scale" + +extern FontEntryPtr FontFileFindNameInDir (); +extern FontDirectoryPtr FontFileMakeDir (); +extern FontRendererPtr FontFileMatchRenderer (); +extern char *SaveString (); +extern FontScaledPtr FontFileFindScaledInstance (); +#endif /* _FONTFILE_H_ */ diff -Naur xdvik-22.40l/libs/type1/fontmisc.h xdvik-22.40n/libs/type1/fontmisc.h --- xdvik-22.40l/libs/type1/fontmisc.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/fontmisc.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,63 @@ +/* + * $XConsortium: fontmisc.h,v 1.5 91/05/12 16:15:48 rws Exp $ + * + * Copyright 1991 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifndef _FONTMISC_H_ +#define _FONTMISC_H_ + +#ifdef XSERVER +#include "Xfuncs.h" +#endif + +typedef unsigned char *pointer; +/* To suppress gcc-warning (11/25/97, RMz) */ +#ifndef T1DELETE_C +typedef int Bool; +#endif + +#ifndef X_PROTOCOL +typedef unsigned long Atom; +typedef unsigned long XID; +#endif +#ifndef LSBFirst +#define LSBFirst 0 +#define MSBFirst 1 +#endif + +#ifndef None +#define None 0l +#endif + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +extern char *NameForAtom (); + +#define lowbit(x) ((x) & (~(x) + 1)) + +#define assert(x) + +#endif /* _FONTMISC_H_ */ diff -Naur xdvik-22.40l/libs/type1/fonts.h xdvik-22.40n/libs/type1/fonts.h --- xdvik-22.40l/libs/type1/fonts.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/fonts.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,49 @@ +/* $XConsortium: fonts.h,v 1.2 91/10/10 11:18:09 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* STUB */ + +#define CopyFont(f) f +#define UniqueFont(f) f +#define KillFont(f) +#define KillText(t) +#define CopyText(t) t +#define I_DumpText(t) +#define CoerceText(t) t +#define TextDelta(t,pt) +#define XformText(p,s) +#define GimeSpace() FALSE + +#define LibInit() +#define InitFonts() +#define InitFiles() +#define TraceClose() + +#define FF_PARSE_ERROR -1 diff -Naur xdvik-22.40l/libs/type1/fontstruct.h xdvik-22.40n/libs/type1/fontstruct.h --- xdvik-22.40l/libs/type1/fontstruct.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/fontstruct.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,224 @@ +/* $Header: /cvsroot/xdvi/xdvik/libs/type1/fontstruct.h,v 1.1.2.1 2002/09/14 00:24:47 stefanulrich Exp $ */ +/*********************************************************** +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, +and the Massachusetts Institute of Technology, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Digital or MIT not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + + @(#)fontstruct.h 3.2 91/04/15 + +******************************************************************/ + +#ifndef FONTSTR_H +#define FONTSTR_H + +#ifdef XSERVER +#include +#else +#include "Xstuff.h" +#endif + +#include "font.h" + +/* + * This version of the server font data strucutre is only for describing + * the in memory data structure. The file structure is not necessarily a + * copy of this. That is up to the compiler and the OS layer font loading + * machinery. + */ + +#define GLYPHPADOPTIONS 4 /* 1, 2, 4, or 8 */ + +typedef enum { + Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit +} FontEncoding; + +typedef struct _FontProp { + long name; + long value; /* assumes ATOM is not larger than INT32 */ +} FontPropRec; + +typedef struct _FontResolution { + unsigned short x_resolution; + unsigned short y_resolution; + unsigned short point_size; +} FontResolutionRec; + +typedef struct _ExtentInfo { + DrawDirection drawDirection; + int fontAscent; + int fontDescent; + int overallAscent; + int overallDescent; + int overallWidth; + int overallLeft; + int overallRight; +} ExtentInfoRec; + +typedef struct _CharInfo { + xCharInfo metrics; /* info preformatted for Queries */ + char *bits; /* pointer to glyph image */ +} CharInfoRec; + +/* + * Font is created at font load time. It is specific to a single encoding. + * e.g. not all of the glyphs in a font may be part of a single encoding. + */ + +typedef struct _FontInfo { + unsigned short firstCol; + unsigned short lastCol; + unsigned short firstRow; + unsigned short lastRow; + unsigned short defaultCh; + unsigned int noOverlap:1; + unsigned int terminalFont:1; + unsigned int constantMetrics:1; + unsigned int constantWidth:1; + unsigned int inkInside:1; + unsigned int inkMetrics:1; + unsigned int allExist:1; + unsigned int drawDirection:2; + unsigned int cachable:1; + unsigned int anamorphic:1; + short maxOverlap; + short pad; + xCharInfo maxbounds; + xCharInfo minbounds; + xCharInfo ink_maxbounds; + xCharInfo ink_minbounds; + short fontAscent; + short fontDescent; + int nprops; + FontPropPtr props; + char *isStringProp; +} FontInfoRec; + +typedef struct _Font { + int refcnt; + FontInfoRec info; + char bit; + char byte; + char glyph; + char scan; + fsBitmapFormat format; + int (*get_glyphs) ( /* font, count, chars, encoding, count, glyphs */ ); + int (*get_metrics) ( /* font, count, chars, encoding, count, glyphs */ ); + int (*get_bitmaps) (/* client, font, flags, ranges, nranges, + nextents, extents */ ); + int (*get_extents) (/* client, font, format, flags, ranges, + nranges, nglyphs, offsets, glyphs */ ); + void (*unload_font) ( /* font */ ); + FontPathElementPtr fpe; + pointer svrPrivate; + pointer fontPrivate; + pointer fpePrivate; + int maxPrivate; + pointer *devPrivates; +} FontRec; + +extern Bool _FontSetNewPrivate (/* pFont, n, ptr */); +extern int AllocateFontPrivateIndex (); + +#define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (pointer) 0 : \ + (pFont)->devPrivates[n]) + +#define FontSetPrivate(pFont,n,ptr) ((n) > (pFont)->maxPrivate ? \ + _FontSetNewPrivate (pFont, n, ptr) : \ + ((((pFont)->devPrivates[n] = (ptr)) != 0) || TRUE)) + +typedef struct _FontNames { + int nnames; + int size; + int *length; + char **names; +} FontNamesRec; + +/* External view of font paths */ +typedef struct _FontPathElement { + int name_length; + char *name; + int type; + int refcount; + pointer private; +} FontPathElementRec; + +typedef struct _FPEFunctions { + int (*name_check) ( /* name */ ); + int (*init_fpe) ( /* fpe */ ); + int (*reset_fpe) ( /* fpe */ ); + int (*free_fpe) ( /* fpe */ ); + int (*open_font) ( /* client, fpe, flags, name, namelen, format, + fid, ppfont, alias */ ); + int (*close_font) ( /* pfont */ ); + int (*list_fonts) ( /* client, fpe, pattern, patlen, maxnames, + paths */ ); + int (*start_list_fonts_with_info) ( /* client, fpe, name, namelen, + maxnames, data */ ); + int (*list_next_font_with_info) ( /* client, fpe, name, namelen, + info, num, data */ ); + int (*wakeup_fpe) ( /* fpe, mask */ ); + int (*client_died) ( /* client, fpe */ ); +} FPEFunctionsRec, FPEFunctions; + +extern int InitFPETypes(); + +/* + * Various macros for computing values based on contents of + * the above structures + */ + +#define GLYPHWIDTHPIXELS(pci) \ + ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing) + +#define GLYPHHEIGHTPIXELS(pci) \ + ((pci)->metrics.ascent + (pci)->metrics.descent) + +#define GLYPHWIDTHBYTES(pci) (((GLYPHWIDTHPIXELS(pci))+7) >> 3) + +#define GLYPHWIDTHPADDED(bc) (((bc)+7) & ~0x7) + +#define BYTES_PER_ROW(bits, nbytes) \ + ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \ + :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \ + :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \ + :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \ + : 0) + +#define BYTES_FOR_GLYPH(ci,pad) (GLYPHHEIGHTPIXELS(ci) * \ + BYTES_PER_ROW(GLYPHWIDTHPIXELS(ci),pad)) +/* + * Macros for computing different bounding boxes for fonts; from + * the font protocol + */ + +#define FONT_MAX_ASCENT(pi) ((pi)->fontAscent > (pi)->ink_maxbounds.ascent ? \ + (pi)->fontAscent : (pi)->ink_maxbounds.ascent) +#define FONT_MAX_DESCENT(pi) ((pi)->fontDescent > (pi)->ink_maxbounds.descent ? \ + (pi)->fontDescent : (pi)->ink_maxbounds.descent) +#define FONT_MAX_HEIGHT(pi) (FONT_MAX_ASCENT(pi) + FONT_MAX_DESCENT(pi)) +#define FONT_MIN_LEFT(pi) ((pi)->ink_minbounds.leftSideBearing < 0 ? \ + (pi)->ink_minbounds.leftSideBearing : 0) +#define FONT_MAX_RIGHT(pi) ((pi)->ink_maxbounds.rightSideBearing > \ + (pi)->ink_maxbounds.characterWidth ? \ + (pi)->ink_maxbounds.rightSideBearing : \ + (pi)->ink_maxbounds.characterWidth) +#define FONT_MAX_WIDTH(pi) (FONT_MAX_RIGHT(pi) - FONT_MIN_LEFT(pi)) + +#endif /* FONTSTR_H */ diff -Naur xdvik-22.40l/libs/type1/fontxlfd.h xdvik-22.40n/libs/type1/fontxlfd.h --- xdvik-22.40l/libs/type1/fontxlfd.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/fontxlfd.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,45 @@ +/* + * $XConsortium: fontxlfd.h,v 1.1 91/05/11 09:12:07 rws Exp $ + * + * Copyright 1990 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifndef _FONTXLFD_H_ +#define _FONTXLFD_H_ + + +typedef struct _FontScalable { + int pixel, + point, + x, + y, + width; +} FontScalableRec, *FontScalablePtr; + +extern Bool FontParseXLFDName(); + +#define FONT_XLFD_REPLACE_NONE 0 +#define FONT_XLFD_REPLACE_STAR 1 +#define FONT_XLFD_REPLACE_ZERO 2 +#define FONT_XLFD_REPLACE_VALUE 3 + +#endif /* _FONTXLFD_H_ */ diff -Naur xdvik-22.40l/libs/type1/fsmasks.h xdvik-22.40n/libs/type1/fsmasks.h --- xdvik-22.40l/libs/type1/fsmasks.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/fsmasks.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,72 @@ +/* $XConsortium: fsmasks.h,v 1.2 91/05/13 16:46:16 gildea Exp $ */ +/* + * Copyright 1990, 1991 Network Computing Devices; + * Portions Copyright 1987 by Digital Equipment Corporation and the + * Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this protoype software + * and its documentation to Members and Affiliates of the MIT X Consortium + * any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Network Computing Devices, Digital or + * MIT not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. + * + * NETWORK COMPUTING DEVICES, DIGITAL AND MIT DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)fsmasks.h 4.1 91/05/02 + * + */ + +/* + * masks & values used by the font lib and the font server + */ + +#ifndef _FSMASKS_H_ +#define _FSMASKS_H_ + +#include "types.h" + +/* font format macros */ +#define BitmapFormatByteOrderMask (1L << 0) +#define BitmapFormatBitOrderMask (1L << 1) +#define BitmapFormatImageRectMask (3L << 2) +#define BitmapFormatScanlinePadMask (3L << 8) +#define BitmapFormatScanlineUnitMask (3L << 12) + +#define BitmapFormatByteOrderLSB (0) +#define BitmapFormatByteOrderMSB (1L << 0) +#define BitmapFormatBitOrderLSB (0) +#define BitmapFormatBitOrderMSB (1L << 1) + +#define BitmapFormatImageRectMin (0L << 2) +#define BitmapFormatImageRectMaxWidth (1L << 2) +#define BitmapFormatImageRectMax (2L << 2) + +#define BitmapFormatScanlinePad8 (0L << 8) +#define BitmapFormatScanlinePad16 (1L << 8) +#define BitmapFormatScanlinePad32 (2L << 8) +#define BitmapFormatScanlinePad64 (3L << 8) + +#define BitmapFormatScanlineUnit8 (0L << 12) +#define BitmapFormatScanlineUnit16 (1L << 12) +#define BitmapFormatScanlineUnit32 (2L << 12) +#define BitmapFormatScanlineUnit64 (3L << 12) + +#define BitmapFormatMaskByte (1L << 0) +#define BitmapFormatMaskBit (1L << 1) +#define BitmapFormatMaskImageRectangle (1L << 2) +#define BitmapFormatMaskScanLinePad (1L << 3) +#define BitmapFormatMaskScanLineUnit (1L << 4) + +typedef ULONG fsBitmapFormat; +typedef ULONG fsBitmapFormatMask; + +#endif /* _FSMASKS_H_ */ diff -Naur xdvik-22.40l/libs/type1/hdigit.h xdvik-22.40n/libs/type1/hdigit.h --- xdvik-22.40l/libs/type1/hdigit.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/hdigit.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,104 @@ +/* $XConsortium: hdigit.h,v 1.2 91/10/10 11:18:11 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* -------------------------------------- */ +/* --- MACHINE GENERATED, DO NOT EDIT --- */ +/* -------------------------------------- */ + +/* ... and yet, I did it. + The code would fail on ASCII-encrypted files if the lines + were separated by instead of (which is typical + DOSian, but appearently such files exist). Setting the 13th + element in the two LUTs to HWHITE_SPACE cures the problem. + + (RMz (Author of t1lib), 2000-05-18) +*/ + + +#ifndef HDIGIT +#define HDIGIT 1 + +/* + * Hex Digit Value Table -- + * + * The entries in the Digit Value Table map character codes in the set + * {0-9,a-f,A-F} to their numeric values for readhexstring + * (00 10...F0 for the high hex digit and 00 01...0F for the low). + * The white-space and hex string termination characters are. + * mapped to codes > 0xf0 to enable usage by several modules. + * 2 tables are build HighHex and LowHex. + * + */ + +/* Indicators for special characters in these tables */ +#define HERROR (0xfe) +#define HWHITE_SPACE (0xfd) +#define HRIGHT_ANGLE (0xfc) +#define LAST_HDIGIT (0xf0) + +#define HighHexP (HighHex+1) +unsigned char HighHex[257] = { 0xFF, + 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFE,0xFE,0xFD,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80,0x90,0xFE,0xFE,0xFE,0xFE,0xFC,0xFE, + 0xFE,0xA0,0xB0,0xC0,0xD0,0xE0,0xF0,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xA0,0xB0,0xC0,0xD0,0xE0,0xF0,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE +}; +#define LowHexP (LowHex+1) +unsigned char LowHex[257] = { 0xFF, + 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFE,0xFE,0xFD,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFD,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0xFE,0xFE,0xFE,0xFE,0xFC,0xFE, + 0xFE,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE, + 0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE +}; + +#endif diff -Naur xdvik-22.40l/libs/type1/hints.c xdvik-22.40n/libs/type1/hints.c --- xdvik-22.40l/libs/type1/hints.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/hints.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,928 @@ +/* $XConsortium: hints.c,v 1.4 91/10/10 11:18:13 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + /* HINTS CWEB V0006 ******** */ +/* +:h1.HINTS Module - Processing Rasterization Hints + +&author. Sten F. Andler; continuity by Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) and Duaine +W. Pryor, Jr. + + +:h3.Include Files + +The included files are: +*/ + +#include + +#include "types.h" +#include "objects.h" +#include "spaces.h" +#include "paths.h" +#include "regions.h" +#include "hints.h" + +/* +:h3.Functions Provided to the TYPE1IMAGER User + +None. +*/ + +/* +:h3.Functions Provided to Other Modules + +This module provides the following entry point to other modules: +*/ + + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h3.Macros Provided to Other Modules + +None. +*/ + +/* +:h2.InitHints() - Initialize hint data structure +*/ + +#define MAXLABEL 20 +static struct { + int inuse; + int computed; + struct fractpoint hint; +} oldHint[MAXLABEL]; + +#define ODD(x) (((int)(x)) & 01) +#define FPFLOOR(fp) TOFRACTPEL((fp) >> FRACTBITS) +#define FPROUND(fp) FPFLOOR((fp) + FPHALF) + +void InitHints() +{ + int i; + + for (i = 0; i < MAXLABEL; i++) + { + oldHint[i].inuse = FALSE; + oldHint[i].computed = FALSE; + } +} + +/* +:h3.CloseHints(hintP) - Reverse hints that are still open +*/ + +void CloseHints(hintP) + struct fractpoint *hintP; +{ + int i; + + for (i = 0; i < MAXLABEL; i++) + { + if (oldHint[i].inuse) + { + hintP->x -= oldHint[i].hint.x; + hintP->y -= oldHint[i].hint.y; + + oldHint[i].inuse = FALSE; + + IfTrace3((HintDebug > 1)," Hint %d was open, hint=(%d,%d)\n", + i, hintP->x, hintP->y); + } + } +} + +/* +:h3.ComputeHint(hP, currX, currY, hintP) - Compute the value of a hint +*/ + +static void ComputeHint(hP, currX, currY, hintP) + struct hintsegment *hP; + fractpel currX, currY; + struct fractpoint *hintP; +{ + fractpel currRef=0, currWidth=0; + int idealWidth; + fractpel hintValue=0; + char orientation; + +/* +By construction, width is never zero. Therefore we can use the +width value to determine if the hint has been rotated by a +multiple of 90 degrees. +*/ + + if (hP->width.y == 0) + { + orientation = 'v'; /* vertical */ + IfTrace0((HintDebug > 0)," vertical hint\n"); + } + else if (hP->width.x == 0) + { + orientation = 'h'; /* horizontal */ + IfTrace0((HintDebug > 0)," horizontal hint\n"); + } + else + { + IfTrace0((HintDebug > 0)," hint not vertical or horizontal\n"); + hintP->x = hintP->y = 0; + return; + } + + /* Compute currRef and currWidth with a unit of 1 pel */ + if (orientation == 'v') /* vertical */ + { + currRef = hP->ref.x + currX; + currWidth = TYPE1_ABS(hP->width.x); + } + else if (orientation == 'h') /* horizontal */ + { + currRef = hP->ref.y + currY; + currWidth = TYPE1_ABS(hP->width.y); + } + else /* error */ + { + abort("ComputeHint: invalid orientation", 4); + } + + IfTrace4((HintDebug > 1), + " currX=%d, currY=%d, currRef=%d, currWidth=%d\n", + currX, currY, + currRef, currWidth); + + if ((hP->hinttype == 'b') /* Bar or stem */ + || (hP->hinttype == 's')) /* Serif */ + { + idealWidth = NEARESTPEL(currWidth); + if (idealWidth == 0) idealWidth = 1; + if (ODD(idealWidth)) /* Is ideal width odd? */ + { + /* center "ref" over pel */ + hintValue = FPFLOOR(currRef) + FPHALF - currRef; + } + else + { + /* align "ref" on pel boundary */ + hintValue = FPROUND(currRef) - currRef; + } + if (HintDebug > 2) { + IfTrace1(TRUE," idealWidth=%d, ", idealWidth); + } + } + else if (hP->hinttype == 'c') /* Curve extrema */ + { + /* align "ref" on pel boundary */ + hintValue = FPROUND(currRef) - currRef; + } + else /* error */ + { + abort("ComputeHint: invalid hinttype", 5); + } + + IfTrace1((HintDebug > 1)," hintValue=%d", hintValue); + + if (orientation == 'v') /* vertical */ + { + hintP->x = hintValue; + hintP->y = 0; + } + else if (orientation == 'h') /* horizontal */ + { + hintP->x = 0; + hintP->y = hintValue; + } + else /* error */ + { + abort("ComputeHint: invalid orientation", 6); + } +} + +/* +:h3.ProcessHint(hP, currX, currY, hintP) - Process a rasterization hint +*/ + +void ProcessHint(hP, currX, currY, hintP) + struct hintsegment *hP; + fractpel currX, currY; + struct fractpoint *hintP; +{ + struct fractpoint thisHint; + + IfTrace4((HintDebug > 1)," ref=(%d,%d), width=(%d,%d)", + hP->ref.x, hP->ref.y, + hP->width.x, hP->width.y); + IfTrace4((HintDebug > 1),", %c %c %c %c", + hP->orientation, hP->hinttype, + hP->adjusttype, hP->direction); + IfTrace1((HintDebug > 1),", label=%d\n", hP->label); + + if ((hP->adjusttype == 'm') /* Move */ + || (hP->adjusttype == 'a')) /* Adjust */ + { + /* Look up hint in oldHint table */ + if ((hP->label >= 0) && (hP->label < MAXLABEL)) + { + if (oldHint[hP->label].computed) + /* Use old hint value if already computed */ + { + thisHint.x = oldHint[hP->label].hint.x; + thisHint.y = oldHint[hP->label].hint.y; + oldHint[hP->label].inuse = TRUE; + } + else + /* Compute new value for hint and store it for future use */ + { + ComputeHint(hP, currX, currY, &thisHint); + + oldHint[hP->label].hint.x = thisHint.x; + oldHint[hP->label].hint.y = thisHint.y; + oldHint[hP->label].inuse = TRUE; + oldHint[hP->label].computed = TRUE; + } + } + else /* error */ + { + abort("ProcessHint: invalid label", 7); + } + } + else if (hP->adjusttype == 'r') /* Reverse */ + { + /* Use the inverse of the existing hint value to reverse hint */ + if ((hP->label >= 0) && (hP->label < MAXLABEL)) + { + if (oldHint[hP->label].inuse) + { + thisHint.x = -oldHint[hP->label].hint.x; + thisHint.y = -oldHint[hP->label].hint.y; + oldHint[hP->label].inuse = FALSE; + } + else /* error */ + { + abort("ProcessHint: label is not in use", 8); + } + } + else /* error */ + { + abort("ProcessHint: invalid label", 9); + } + + } + else /* error */ + { + abort("ProcessHint: invalid adjusttype", 10); + } + IfTrace3((HintDebug > 1)," label=%d, thisHint=(%d,%d)\n", + hP->label, thisHint.x, thisHint.y); + + hintP->x += thisHint.x; + hintP->y += thisHint.y; + + IfTrace2((HintDebug > 1)," hint=(%d,%d)\n", + hintP->x, hintP->y); +} + +/* +:h2 id=subpath.Navigation Through Edge Lists + +For continuity checking purposes, we need to navigate through edge +lists by the "subpath" chains and answer questions about edges. The +subpath chain links together edges that were part of the same subpath +(no intervening move segments) when the interior of the path was +calculated. Here we use the term "edge" to mean every edge list +that was created in between changes of direction. + +The subpath chains are singly-linked circular chains. For the convenience +of building them, they direction of the list (from edge to edge) is the +reverse of the order in which they were built. Within any single edge, +the subpath chain goes from top-to-bottom. (There might be a violation +of this because of the way the user started the first chain; see +:hdref refid=fixsubp..). + +:h3.ISTOP() and ISBOTTOM() - Flag Bits for Edge Lists at the Top and +Bottom of Their SubPaths +*/ + +#define ISTOP(flag) ((flag)&0x20) +#define ISBOTTOM(flag) ((flag)&0x10) +/* +:h3.ISLEFT() - Flag Bit for Left Edges +*/ + +#define ISLEFT(flag) ((flag)&0x08) + +/* +:h3.XofY() - Macro to Find X Value at Given Y + +This macro can only be used if it is known that the Y is within the +given edgelist's ymin and ymax. +*/ + +#define XofY(edge, y) edge->xvalues[y - edge->ymin] + +/* +:h3.findXofY() - Like XofY(), Except not Restricted + +If the Y is out of bounds of the given edgelist, this macro will +call SearchXofY to search the edge's subpath chain for the correct +Y range. If the Y value is off the edge, MINPEL is returned. +*/ +#define findXofY(edge, y) ((y < edge->ymin || y >= edge->ymax) ? SearchXofY(edge, y) : XofY(edge, y)) + +/* +:h4.SearchXofY() - Routine Called by FindXofY() for Difficult Cases + +The concept of this routine is to follow the subpath chain to find the +edge just below (i.e., next in chain) or just above (i.e., immediately +before in chain. It is assumed that the Y value is no more than one +off of the edge's range; XofY() could be replace by FindXofY() to +call ourselves recursively if this were not true. +*/ + +static pel SearchXofY(edge, y) + register struct edgelist *edge; /* represents edge */ + register pel y; /* 'y' value to find edge for */ +{ + register struct edgelist *e; /* loop variable */ + + if (y < edge->ymin) { + if (ISTOP(edge->flag)) + return(MINPEL); + for (e = edge->subpath; e->subpath != edge; e = e->subpath) { ; } + if (e->ymax == edge->ymin) + return(XofY(e, y)); + } + else if (y >= edge->ymax) { + if (ISBOTTOM(edge->flag)) + return(MINPEL); + e = edge->subpath; + if (e->ymin == edge->ymax) + return(XofY(e, y)); + } + else + return(XofY(edge, y)); + + abort("bad subpath chain", 11); + /*NOTREACHED*/ + /* To make ANSI-C-compiler happy: */ + return(y); + +} +/* +:h3.ISBREAK() Macro - Tests if an Edge List is at a "Break" + +The subpath chains are organized top to bottom. When the bottom of +a given edge is reached, the subpath chain points to the top of the +next edge. We call this a "break" in the chain. The following macro +is the simple test for the break condition: +*/ + +#define ISBREAK(top,bot) (top->ymax != bot->ymin) + + +/* +:h3.ImpliedHorizontalLine() - Tests for Horizontal Connectivity + +This function returns true if two edges are connected horizontally. +They are connected horizontally if they are consecutive in the subpath, +and either we are at the bottom and the first edge is going down or we +are at the top and the first edge is going up. +*/ + +#define BLACKABOVE -1 +#define BLACKBELOW +1 +#define NONE 0 + +static int ImpliedHorizontalLine(e1, e2, y) + register struct edgelist *e1,*e2; /* two edges to check */ + register int y; /* y where they might be connected */ +{ + register struct edgelist *e3,*e4; + + if (ISDOWN(e1->flag) == ISDOWN(e2->flag)) + return(NONE); /* can't be consecutive unless different directions */ +/* +Now we check for consecutiveness: Can we get from 'e1' to 'e2' with +only one intervening break? Can we get from 'e2' to 'e1' with only one +intervening break? 'e3' will be as far as we can get after 'e1'; 'e4' +will be has far as we can get after 'e2': +*/ + for (e3 = e1; !ISBREAK(e3, e3->subpath); e3 = e3->subpath) { ; } + for (e3 = e3->subpath; e3 != e2; e3 = e3->subpath) + if (ISBREAK(e3, e3->subpath)) + break; + + for (e4 = e2; !ISBREAK(e4, e4->subpath); e4 = e4->subpath) { ; } + for (e4 = e4->subpath; e4 != e1; e4 = e4->subpath) + if (ISBREAK(e4, e4->subpath)) + break; +/* +If the edges are mutually consecutive, we must have horizontal lines +both top and bottom: +*/ + if (e3 == e2 && e4 == e1) + return(TRUE); +/* +If the edges are not consecutive either way, no horizontal lines are +possible: +*/ + if (e3 != e2 && e4 != e1) + return(NONE); +/* +Now let's swap 'e1' and 'e2' if necessary to enforce the rule that 'e2' +follows 'e1'. Remember that subpath chains go in the opposite direction +from the way the subpaths were built; this led to the simplest way +do build them. +*/ + if (e4 != e1) { + e2 = e1; + e1 = e3; /* remember e3 == e2, this just swaps 'e1' and 'e2' */ + } +/* +Now we have everything to return the answer: +*/ + if (ISTOP(e1->flag) && y == e1->ymin) + return(ISDOWN(e2->flag)); + else if (ISBOTTOM(e1->flag) && y == e1->ymax) + return(!ISDOWN(e2->flag)); + else + abort("ImpliedHorizontalLine: why ask?", 12); + /*NOTREACHED*/ + /* To make ANSI-C-compiler happy */ + return(0); + +} + +/* +:h3 id=fixsubp.FixSubPaths() - Must be Called to Organize Subpath Chains + +The region-building code in Interior(), in particular splitedge(), +maintains the rule that sub-paths are linked top-to-bottom except +at breaks. However, it is possible that there may be a "false break" +because the user started the subpath in the middle of an edge (and +went in the "wrong" direction from there, up instead of down). This +routine finds and fixes false breaks. + +Also, this routine sets the ISTOP and ISBOTTOM flags in the edge lists. +*/ + +static void FixSubPaths(R) + register struct region *R; /* anchor of region */ +{ + register struct edgelist *e; /* fast loop variable */ + register struct edgelist *edge; /* current edge in region */ + register struct edgelist *next; /* next in subpath after 'edge' */ + register struct edgelist *break1; /* first break after 'next' */ + register struct edgelist *break2=NULL; /* last break before 'edge' */ + register struct edgelist *prev; /* previous edge for fixing links */ + int left = TRUE; + + for (edge = R->anchor; edge != NULL; edge = edge->link) { + + if (left) + edge->flag |= ISLEFT(ON); + left = !left; + + next = edge->subpath; + + if (!ISBREAK(edge, next)) + continue; + if (edge->ymax < next->ymin) + abort("disjoint subpath?", 13); +/* +'edge' now contains an edgelist at the bottom of an edge, and 'next' +contains the next subsequent edgelist in the subpath, which must be at +the top. We refer to this a "break" in the subpath. +*/ + next->flag |= ISTOP(ON); + edge->flag |= ISBOTTOM(ON); + + if (ISDOWN(edge->flag) != ISDOWN(next->flag)) + continue; +/* +We are now in the unusual case; both edges are going in the same +direction so this must be a "false break" due to the way that the user +created the path. We'll have to fix it. +*/ + for (break1 = next; !ISBREAK(break1, break1->subpath); break1 = break1->subpath) { ; } + + for (e = break1->subpath; e != edge; e = e->subpath) + if (ISBREAK(e, e->subpath)) + break2 = e; +/* +Now we've set up 'break1' and 'break2'. I've found the following +diagram invaluable. 'break1' is the first break after 'next'. 'break2' +is the LAST break before 'edge'. +&drawing. + next + +------+ +---->+------+ + +--->| >-----+ | | >-----+ + | | | | | | | | + | +-------------+ | +-------------+ + | | |break1| | | | | + | +->| >-------+ +->| >-----+ + | | | | | | + | | | +-------------+ + | +------+ | | | + | +----------------+ | | | + | | +------+ | +->| >-----+ + | +->| >-----+ | | | | + | | | | | +-------------+ + | +-------------+ | | | | + | | |edge | | | |break2| + | +->| >-----+ | +->| >-----+ + | | | | | | | | + | | | | | | | | + | | | | | | | | + | +------+ | | +------+ | + | | | | + +---------------+ +---------------+ + +&edrawing. +We want to fix this situation by having 'edge' point to where 'break1' +now points, and having 'break1' point to where 'break2' now points. +Finally, 'break2' should point to 'next'. Also, we observe that +'break1' can't be a bottom, and is also not a top unless it is the same +as 'next': +*/ + edge->subpath = break1->subpath; + + break1->subpath = break2->subpath; + if (ISBREAK(break1, break1->subpath)) + abort("unable to fix subpath break?", 14); + + break2->subpath = next; + + break1->flag &= ~ISBOTTOM(ON); + if (break1 != next) + break1->flag &= ~ISTOP(ON); + } +/* +This region might contain "ambiguous" edges; edges exactly equal to +edge->link. Due to the random dynamics of where they get sorted into +the list, they can yield false crossings, where the edges appear +to cross. This confuses our continuity logic no end. Since we can +swap them without changing the region, we do. +*/ + for (edge = R->anchor, prev = NULL; VALIDEDGE(edge); prev = edge, edge = prev->link) { + + if (! ISAMBIGUOUS(edge->flag)) + continue; + + next = edge->subpath; + + while (ISAMBIGUOUS(next->flag) && next != edge) + next = next->subpath; +/* +We've finally found a non-ambiguous edge; we make sure it is left/right +compatible with 'edge': +*/ + if ( (ISLEFT(edge->flag) == ISLEFT(next->flag) && ISDOWN(edge->flag) == ISDOWN(next->flag) ) + || (ISLEFT(edge->flag) != ISLEFT(next->flag) && ISDOWN(edge->flag) != ISDOWN(next->flag) ) ) + continue; + +/* +Incompatible, we will swap 'edge' and the following edge in the list. +You may think that there must be a next edge in this swath. So did I. +No! If there is a totally ambiguous inner loop, for example, we could +get all the way to the outside without resolving ambiguity. +*/ + next = edge->link; /* note new meaning of 'next' */ + if (next == NULL || edge->ymin != next->ymin) + continue; + if (prev == NULL) + R->anchor = next; + else + prev->link = next; + edge->link = next->link; + next->link = edge; + edge->flag ^= ISLEFT(ON); + edge->flag &= ~ISAMBIGUOUS(ON); + next->flag ^= ISLEFT(ON); + next->flag &= ~ISAMBIGUOUS(ON); + edge = next; + } +} +/* +:h3.DumpSubPaths() + +A debug tool. +*/ + +static struct edgelist *before(); /* subroutine of DumpSubPaths */ + +static void DumpSubPaths(anchor) + struct edgelist *anchor; +{ + + register struct edgelist *edge,*e,*e2; + pel y; + + for (edge = anchor; VALIDEDGE(edge); edge = edge->link) { + if (ISPERMANENT(edge->flag)) + continue; + IfTrace0(TRUE, "BEGIN Subpath\n"); + for (e2 = edge; !ISPERMANENT(e2->flag);) { + if (ISDOWN(e2->flag)) { + IfTrace1(TRUE, ". Downgoing edge's top at %p\n", e2); + for (e = e2;; e = e->subpath) { + IfTrace4(TRUE, ". . [%5d] %5d @ %p[%x]\n", + e->ymin, *e->xvalues, e, e->flag); + for (y=e->ymin+1; y < e->ymax; y++) + IfTrace2(TRUE, ". . [%5d] %5d \"\n", y, e->xvalues[y-e->ymin]); + e->flag |= ISPERMANENT(ON); + if (ISBREAK(e, e->subpath)) + break; + } + } + else { + IfTrace1(TRUE, ". Upgoing edge's top at %p\n", e2); + for (e = e2; !ISBREAK(e, e->subpath); e = e->subpath) { ; } + for (;; e=before(e)) { + IfTrace4(TRUE, ". . [%5d] %5d @ %p[%x]\n", + e->ymax-1, e->xvalues[e->ymax-1-e->ymin], e, e->flag); + for (y=e->ymax-2; y >= e->ymin; y--) + IfTrace2(TRUE, ". . [%5d] %5d \"\n", y, e->xvalues[y-e->ymin]); + e->flag |= ISPERMANENT(ON); + if (e == e2) + break; + } + } + do { + e2 = before(e2); + } while (!ISBREAK(before(e2), e2)); + } + } +} + +static struct edgelist *before(e) + struct edgelist *e; +{ + struct edgelist *r; + for (r = e->subpath; r->subpath != e; r = r->subpath) { ; } + return(r); +} + +/* +:h2.Fixing Region Continuity Problems + +Small regions may become disconnected when their connecting segments are +less than a pel wide. This may be correct in some applications, but in +many (especially small font characters), it is more pleasing to keep +connectivity. ApplyContinuity() (invoked by +CONTINUITY on the +Interior() fill rule) fixes connection breaks. The resulting region +is geometrically less accurate, but may be more pleasing to the eye. +*/ +/* +Here are some macros which we will need: +*/ + +#define IsValidPel(j) (j!=MINPEL) + +/* +:h3.writeXofY() - Stuffs an X Value Into an "edgelist" + +writeXofY writes an x value into an edge at position 'y'. It must +update the edge's xmin and xmax. If there is a possibility that this +new x might exceed the region's bounds, updating those are the +responsibility of the caller. +*/ + +static void writeXofY(e, y, x) + struct edgelist *e; /* relevant edgelist */ + int y; /* y value */ + int x; /* new x value */ +{ + if (e->xmin > x) e->xmin = x; + if (e->xmax < x) e->xmax = x; + e->xvalues[y - e->ymin] = x; +} + +/*-------------------------------------------------------------------------*/ +/* the following three macros tell us whether we are at a birth point, a */ +/* death point, or simply in the middle of the character */ +/*-------------------------------------------------------------------------*/ +#define WeAreAtTop(e,i) (ISTOP(e->flag) && e->ymin == i) +#define WeAreAtBottom(e,i) (ISBOTTOM(e->flag) && e->ymax-1 == i) +#define WeAreInMiddle(e,i) \ + ((!ISTOP(e->flag) && !ISBOTTOM(e->flag))||(i < e->ymax-1 && i > e->ymin)) +/* +The following macro tests if two "edgelist" structures are in the same +swath: +*/ +#define SAMESWATH(e1,e2) (e1->ymin == e2->ymin) + +/* +:h3.CollapseWhiteRun() - Subroutine of ApplyContinuity() + +When we have a white run with an implied horizontal line above or +below it, we better have black on the other side of this line. This +function both tests to see if black is there, and adjusts the end +points (collapses) the white run as necessary if it is not. The +goal is to collapse the white run as little as possible. +*/ + +static void CollapseWhiteRun(anchor, yblack, left, right, ywhite) + struct edgelist *anchor; /* anchor of edge list */ + pel yblack; /* y of (hopefully) black run above or below */ + struct edgelist *left; /* edgelist at left of WHITE run */ + struct edgelist *right; /* edgelist at right of WHITE run */ + pel ywhite; /* y location of white run */ +{ + struct edgelist *edge; + struct edgelist *swathstart = anchor; + register pel x; + + if (XofY(left, ywhite) >= XofY(right, ywhite)) + return; +/* +Find the swath with 'yblack'. If we don't find it, completely collapse +the white run and return: +*/ + while (VALIDEDGE(swathstart)) { + if (yblack < swathstart->ymin) { + writeXofY(left, ywhite, XofY(right, ywhite)); + return; + } + if (yblack < swathstart->ymax) break; + swathstart = swathstart->link->link; + } + if(!VALIDEDGE(swathstart)) { + writeXofY(left, ywhite, XofY(right, ywhite)); + return; + } +/* +Now we are in the swath that contains 'y', the reference line above +or below that we are trying to maintain continuity with. If black +in this line begins in the middle of our white run, we must collapse +the white run from the left to that point. If black ends in the +middle of our white run, we must collapse the white run from the right +to that point. +*/ + for (edge = swathstart; VALIDEDGE(edge); edge = edge->link) { + + if (!SAMESWATH(swathstart,edge)) + break; + if( XofY(edge, yblack) > XofY(left, ywhite)) { + if (ISLEFT(edge->flag)) { + x = XofY(edge, yblack); + if (XofY(right, ywhite) < x) + x = XofY(right, ywhite); + writeXofY(left, ywhite, x); + } + else { + x = XofY(edge, yblack); + while (edge->link != NULL && SAMESWATH(edge, edge->link) + && x >= XofY(edge->link, yblack) ) { + edge = edge->link->link; + x = XofY(edge, yblack); + } + if (x < XofY(right, ywhite)) + writeXofY(right, ywhite, x); + return; + } + } + } + writeXofY(left, ywhite, XofY(right, ywhite)); +} + +/* +:h3.ApplyContinuity() - Fix False Breaks in a Region + +This is the externally visible routine called from the REGIONS module +when the +CONTINUITY flag is on the Interior() fill rule. +*/ + +void ApplyContinuity(R) +struct region *R; +{ + struct edgelist *left; + struct edgelist *right; + struct edgelist *edge,*e2; + pel rightXabove,rightXbelow,leftXabove,leftXbelow; + pel leftX,rightX; + int i; + LONG newcenter,abovecenter,belowcenter; + + FixSubPaths(R); + if (RegionDebug >= 3) + DumpSubPaths(R->anchor); + left = R->anchor; +/* loop through and do all of the easy checking. ( no tops or bottoms) */ + while(VALIDEDGE(left)) + { + right = left->link; + for(i=left->ymin;iymax;++i) + { + leftX = findXofY(left,i); + rightX = findXofY(right,i); + leftXbelow = findXofY(left,i+1); + rightXbelow = findXofY(right,i+1); + if(rightX <= leftX) + { +/* then, we have a break in a near vertical line */ + leftXabove = findXofY(left,i-1); + rightXabove = findXofY(right,i-1); + if( IsValidPel(leftXabove) && IsValidPel(rightXabove) ) + { + abovecenter = leftXabove + rightXabove; + } + else + { + abovecenter = leftX + rightX; + } + if( IsValidPel(leftXbelow) && IsValidPel(rightXbelow) ) + { + belowcenter = leftXbelow + rightXbelow; + } + else + { + belowcenter = leftX + rightX; + } + newcenter = abovecenter + belowcenter; + if( newcenter > 4*leftX ) + { + rightX = rightX + 1; + } + else if( newcenter < 4*leftX) + { + leftX = leftX - 1; + } + else + { + rightX = rightX + 1; + } + writeXofY(right,i,rightX); + writeXofY(left,i,leftX); + if(rightX > R->xmax) {R->xmax = rightX;} + if(leftX < R->xmin) {R->xmin = leftX;} + } + if( !WeAreAtBottom(left,i) && (leftXbelow>=rightX)) + { +/* then we have a break in a near horizontal line in the middle */ + writeXofY(right,i,leftXbelow); + } + if( !WeAreAtBottom(right,i) && (leftX >=rightXbelow)) + { +/* then we have a break in a near horizontal line in the middle */ + writeXofY(left,i,rightXbelow); + } + } + left = right->link; + } +/* +There may be "implied horizontal lines" between edges that have +implications for continuity. This loop looks for white runs that +have implied horizontal lines on the top or bottom, and calls +CollapseWhiteRuns to check and fix any continuity problems from +them. +*/ + for (edge = R->anchor; VALIDEDGE(edge); edge = edge->link) { + if ((!ISTOP(edge->flag) && !ISBOTTOM(edge->flag)) || ISLEFT(edge->flag)) + continue; /* at some future date we may want left edge logic here too */ + for (e2 = edge->link; VALIDEDGE(e2) && SAMESWATH(edge,e2); e2 = e2->link) { + if (ISTOP(e2->flag) && ISTOP(edge->flag) + && NONE != ImpliedHorizontalLine(edge,e2,edge->ymin)) { + if (ISLEFT(e2->flag)) + CollapseWhiteRun(R->anchor, edge->ymin-1, + edge, e2, edge->ymin); + } + if (ISBOTTOM(e2->flag) && ISBOTTOM(edge->flag) + && NONE != ImpliedHorizontalLine(edge,e2, edge->ymax)) { + if (ISLEFT(e2->flag)) + CollapseWhiteRun(R->anchor, edge->ymax, + edge, e2, edge->ymax-1); + } + } + } +} + + + + diff -Naur xdvik-22.40l/libs/type1/hints.h xdvik-22.40n/libs/type1/hints.h --- xdvik-22.40l/libs/type1/hints.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/hints.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,42 @@ +/* $XConsortium: hints.h,v 1.2 91/10/10 11:18:19 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + +#define InitHints() t1_InitHints() +void t1_InitHints(); /* Initialize hint data structure */ + +#define CloseHints(hintP) t1_CloseHints(hintP) +void t1_CloseHints(); /* Reverse hints that are still open */ + +#define ProcessHint(hP, currX, currY, hintP) t1_ProcessHint(hP, currX, currY, hintP) +void t1_ProcessHint(); /* Process a rasterization hint */ + +#define ApplyContinuity(R) t1_ApplyContinuity(R) +void t1_ApplyContinuity(); /* fix false connection breaks in a region */ +/*END SHARED*/ diff -Naur xdvik-22.40l/libs/type1/lines.c xdvik-22.40n/libs/type1/lines.c --- xdvik-22.40l/libs/type1/lines.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/lines.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,189 @@ +/* $XConsortium: lines.c,v 1.2 91/10/10 11:18:21 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + /* LINES CWEB V0003 ******** */ +/* +:h1.LINES Module - Rasterizing Lines + +&author. Duaine W. Pryor, Jr. and Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) + + +:h3.Include Files + +The included files are: +*/ + +#include + +#include "types.h" +#include "objects.h" +#include "spaces.h" +#include "regions.h" +#include "lines.h" + +/* +:h3.Functions Provided to the TYPE1IMAGER User + +None. +*/ + +/* +:h3.Functions Provided to Other Modules + +This module provides the following entry point to other modules: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h3.Macros Provided to Other Modules + +None. +*/ + +/* +:h2.StepLine() - Produces Run Ends for a Line After Checks + +The main work is done by Bresenham(); here we just perform checks and +get the line so that its Y direction is always increasing: +*/ + +void StepLine(R, x1, y1, x2, y2) + register struct region *R; /* region being built */ + register fractpel x1,y1; /* starting point */ + register fractpel x2,y2; /* ending point */ +{ + register fractpel dy; + + IfTrace4((LineDebug > 0), ".....StepLine: (%d,%d) to (%d,%d)\n", + x1, y1, x2, y2); + + dy = y2 - y1; + +/* +We execute the "GOING_TO" macro to call back the REGIONS module, if +necessary (like if the Y direction of the edge has changed): +*/ + GOING_TO(R, x1, y1, x2, y2, dy); + + if (dy == 0) + return; + + if (dy < 0) + Bresenham(R->edge, x2, y2, x1, y1); + else + Bresenham(R->edge, x1, y1, x2, y2); + return; +} +/* +:h3.Bresenham() - Actually Produces Run Ends + +This routine runs a Bresenham line-stepping +algorithm. See, for example, Newman and Sproul, :hp1/Principles +of Interactive Computer Graphics/, pp. 25-27. +When we enter this, we +are guaranteed that dy is positive. +We'd like to work in 8 bit precision, so we'll define some macros and +constants to let us do that: +*/ + +#define PREC 8 /* we'll keep fraction pels in 8 bit precision */ +/* +RoundFP() rounds down by 'b' bits: +*/ +#define RoundFP(xy,b) (((xy)+(1<<((b)-1)))>>(b)) + +/* +TruncFP() truncates down by 'b' bits: +*/ +#define TruncFP(xy,b) ((xy)>>(b)) + + +void Bresenham(edgeP,x1,y1,x2,y2) + register pel *edgeP; /* pointer to top of list (y == 0) */ + register fractpel x1,y1; /* starting point on line */ + register fractpel x2,y2; /* ending point on the line (down) */ +{ + register LONG dx,dy; /* change in x and y, in my own precision */ + register LONG x,y; /* integer pel starting point */ + register int count; /* integer pel delta y */ + register LONG d; /* the Bresenham algorithm error term */ + + x1 = TruncFP(x1, FRACTBITS-PREC); + y1 = TruncFP(y1, FRACTBITS-PREC); + x2 = TruncFP(x2, FRACTBITS-PREC); + y2 = TruncFP(y2, FRACTBITS-PREC); + + dx = x2 - x1; + dy = y2 - y1; +/* +Find the starting x and y integer pel coordinates: +*/ + + x = RoundFP(x1,PREC); + y = RoundFP(y1,PREC); + edgeP += y; + count = RoundFP(y2,PREC) - y; +/*------------------------------------------------------------------*/ +/* Force dx to be positive so that dfy will be negative */ +/* this means that vertical moves will decrease d */ +/*------------------------------------------------------------------*/ + if (dx<0) + { + dx = -dx; +#define P PREC + d=(dy*(x1-(x<>P; +#undef P + while(--count >= 0 ) + { + while(d<0) + { + --x; + d += dy; + } + *(edgeP++) = x; + d -= dx; + } + } + else /* positive dx */ + { +#define P PREC + d = (dy*((x<>P; +#undef P + while(--count >= 0 ) + { + while(d<0) + { + ++x; + d += dy; + } + *(edgeP++) = x; + d -= dx; + } + } +} diff -Naur xdvik-22.40l/libs/type1/lines.h xdvik-22.40n/libs/type1/lines.h --- xdvik-22.40l/libs/type1/lines.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/lines.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,37 @@ +/* $XConsortium: lines.h,v 1.2 91/10/10 11:18:23 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + +#define StepLine(R,x1,y1,x2,y2) t1_StepLine(R,x1,y1,x2,y2) +#define Bresenham(e,x1,y1,x2,y2) t1_Bresenham(e,x1,y1,x2,y2) + +void t1_StepLine(); /* check for special conditions, call Bresenham */ +void t1_Bresenham(); /* produce run ends for lines */ + +/*END SHARED*/ diff -Naur xdvik-22.40l/libs/type1/objects.c xdvik-22.40n/libs/type1/objects.c --- xdvik-22.40l/libs/type1/objects.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/objects.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1208 @@ +/* $XConsortium: objects.c,v 1.5 92/03/20 15:56:06 eswu Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + /* OBJECTS CWEB V0025 ******** */ +/* +:h1.OBJECTS Module - TYPE1IMAGER Objects Common Routines + +This module defines and implements the C structures that represent +objects in the TYPE1IMAGER. All common routines for manipulating these +objects are defined in this module. Specific routines for +specific objects are defined in the modules that deal with that +object type. + + +&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) + + +:h3.Include Files + +The included files are: +*/ +#define GLOBALS 1 /* see :hdref refid=debugvar. */ +/* +The following two includes are C standards; we include them because we +use 'toupper' and the 'str'-type functions in this module. Potentially +these may be defined as macros; if these ".h" files do not exist on your +system it is a pretty safe bet that these are external entry points and +you do do not need to include these header files. +*/ + + +#include "types.h" +#include +#include +#include +#include +#include + +/* +override incorrect system functions; for example you might define +a macro for "strcpy" that diverts it to "my_strcpy". +*/ + + /* moved these includes from above the */ + /* was included first (it contains com- */ + /* piler defines). dsr 081291 */ +#include "objects.h" +#include "spaces.h" +#include "paths.h" +#include "regions.h" +#include "fonts.h" +#include "pictures.h" +#include "strokes.h" +#include "cluts.h" +static char *TypeFmt(); +static int ObjectPostMortem(); + +/* +:h3.The "pointer" Macro - Define a Generic Pointer + +Sadly, many compilers will give a warning message when a pointer to +one structure is assigned to a pointer to another. We've even seen +some that give severe errors (when the wrong pointer type is used as +an initializer or returned from a function). TYPE1IMAGER has routines +like Dup and Allocate that are perfectly willing to duplicate or +allocate any of a number of different types of structures. How to +declare them in a truely portable way? + +Well, there is no single good answer that I've found. You can always +beg the question and "cast" everything. I find this distracting and the +resulting code ugly. On the other hand, we have found at least one +compiler that will accept "void *" as a generic pointer that can +assigned to any other pointer type without error or warning (apparently +this is also the ANSI standard). So, we define "void *" to be a generic +pointer. (You might have to change this for your compiler; the "ifndef" +allows the change to be made on the command line if you want.) +:i1/portability assumptions/ +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Functions Provided to the TYPE1IMAGER User + +This module provides the following TYPE1IMAGER entry points: +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +Note that entry points that are intended for use external to TYPE1IMAGER +begin with the characters :q/xi/. Macros are used to make the names +more mnemonic. +*/ + +/* +:h3.Functions Provided to Other Modules + +This module provides the following functions for other modules: +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +Note that entry points that intended for use within TYPE1IMAGER, but +which must be global because they are used across module boundaries, +begin with the characters :q/I_/. Macros are used to make the names +more mnemonic. + +Entry points totally within a module use mnemonic names and are +declared :hp2/static/. One of the compilers I used had a bug when +static functions were passed as addresses. Thus, some functions +which are logically "static" are not so declared. + +Note also the trick of declaring routines, like Consume(), with a +variable number of arguments. To avoid the restrictions on variable +numbers of arguments in the macro processor, we just replace the +text 'Consume' with 'I_Consume'. +*/ +/* +:h3.Macros Provided to Other Modules + +This is the module where we define all the useful constants like +TRUE, FALSE, and NULL, and simple expressions like TYPE1_MIN(), +TYPE1_MAX(), and TYPE1_ABS(). +We might as well get to it right here: +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +Notice that upper case is used for constant values and macro +definitions. I generally follow that convention. + +Many more global macros are defined later in this module. +*/ +/* +:h2.Basic TYPE1IMAGER Object Structure + +All TYPE1IMAGER objects which are available to the user have a common +header. This header is defined below: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +The following define is an attempt to centralize the definition of the +common xobject data shared by structures that are derived from the +generic xobject structure. For example, the structure font, defined in +fonts.shr : +&code. + struct font { + char type; + char flag; + int references; + ... other data types & structs ... + } +&ecode. +would now be defined as: +&code. + struct font { + XOBJ_COMMON + ... other data types & structs ... + } +&ecode. +Thus we have a better-structured inheritance mechanism. 3-26-91 PNM +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Object Type Definitions + +These constants define the values which go in the 'type' field of +an TYPE1IMAGER object structure: +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Flag Byte Definitions + +Many programmers define flag bits as a mask (for example, 0x04), and +test, set, and reset them as follows: + +&code. + if ((flag & PERMANENT) != 0) + + flag |= PERMANENT; + flag &= &inv.PERMANENT; +:exmp. + +I favor a style where the 'if' statement can ask a question: + +&code. + if (ISPERMANENT(flag)) + + flag |= ISPERMANENT(ON); + flag &= &inv.ISPERMANENT(ON); + +:exmp. +This said, we now define two bit settings of the flag byte of the +object. "ISPERMANENT" will be set by the user, when he calls +Permanent(). "ISIMMORTAL" will be used for compiled-in objects +that we don't want the user to ever destroy. +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +Flag bit definitions that apply to all objects are assigned +starting with the least significant (0x01) bit. Flag bit definitions +specific to a certain object type are assigned starting with the +most significant (0x80) bit. We hope they never meet. +*/ +/* +:h3 id=preserve.PRESERVE() Macro + +Occasionally an TYPE1IMAGER operator is implemented by calling other +TYPE1IMAGER operators. For example, Arc2() calls Conic(). When we +call more than one operator as a subroutine, we have to be careful +of temporary objects. A temporary object will be consumed by the +subroutine operator and then is no longer available for the caller. +This can be prevented simply by bumping a temporary object's reference +count. +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h3.RefRoll() Macro to Detect References Count Rollover + +The following macro is designed to check for reference count rollover. +A return value of TRUE means rollover has not occurred; a return value +of FALSE means we cannot increment the reference count. Note also that +those functions that use this macro must decrement the reference count +afterwards. 3-26-91 PNM +*/ + +#define RefRoll(obj) (++(obj)->references > 0) + +/* +:h2.TYPE1IMAGER Object Functions + +:h3.LONGCOPY() - Macro to Copy "long" Aligned Data + +Copying arbitrary bytes in C is a bit of a problem. "strcpy" can't be +used, because 0 bytes are special-cased. Most environments have a +routine "memcopy" or "bcopy" or "bytecopy" that copies memory containing +zero bytes. Sadly, there is no standard on the name of such a routine, +which makes it impossible to write truely portable code to use it. + +It turns out that TYPE1IMAGER, when it wants to copy data, frequently +knows that both the source and destination are aligned on "long" +boundaries. This allows us to copy by using "long *" pointers. This +is usually very efficient on almost all processors. Frequently, it +is more efficient than using general-purpose assembly language routines. +So, we define a macro to do this in a portable way. "dest" and "source" +must be long-aligned, and "bytes" must be a multiple of "sizeof(long)": +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Allocate() - Allocating a Memory Block + +Allocate returns a pointer to memory object that is a copy of +the template passed (if any). In addition, extra bytes may be +allocated contiguously with the object. (This may be useful for +variable size objects such as edge lists. See :hdref refid=regions..) + +Allocate() always returns a non-immortal object, even if the template is +immortal. Therefore a non-NULL template must have a "flag" byte. + +If the template is NULL, then 'size' bytes are cleared to all NULLs. + +If the template is non-NULL, a new object is allocated in memory. +It therefore seems logical that its reference count field should be +set to 1. So, a nun-NULL template must also have a "references" field. +PNM 3-26-91 +*/ + + +/* to pacify gcc we put the externals here ... */ +extern struct XYspace *USER; +extern jmp_buf stck_state; + + +struct xobject *t1_Allocate(size, template, extra) /* non-ANSI; type checking was too strict */ + register int size; /* number of bytes to allocate & initialize */ + register struct xobject *template; /* example structure to allocate */ + register int extra; /* any extra uninitialized bytes needed contiguously */ +{ + + register struct xobject *r; + + /* + * round up 'size' and 'extra' to be an integer number of 'long's: + */ + size = (size + sizeof(LONG) - 1) & -sizeof(LONG); + extra = (extra + sizeof(LONG) - 1) & -sizeof(LONG); + if (size + extra <= 0) + abort("Non-positive allocate?", 15); + r = (struct xobject *) malloc(size + extra); + + while (r == NULL) { + if (!GimeSpace()) { + IfTrace1(TRUE, "malloc attempted %d bytes.\n", + size + extra); + abort("We have REALLY run out of memory", 16); + } + r = (struct xobject *) malloc(size + extra); + } + + /* + * copy the template into the new memory: + */ + if (template != NULL) { + /* Added references count decrement if template is not permanent. + This is for the case where Allocate is called by a Dupxxxx + function, which was in turn called by Unique(). (PNM) */ + if (!ISPERMANENT(template->flag)) + --template->references; + LONGCOPY(r, template, size); + r->flag &= ~(ISPERMANENT(ON) | ISIMMORTAL(ON)); + /* added reference field 3-2-6-91 PNM */ + r->references = 1; + } + else { + register char **p1; + + for (p1=(char **)r; size > 0; size -= sizeof(char *)) + *p1++ = NULL; + } + + if (MemoryDebug > 1) { + register int *L; + L = (int *) r; + IfTrace4(TRUE, "Allocating at %p: %x %x %x\n", + L, L[-1], L[0], L[1]); + } + return(r); +} + +/* +:h3.Free() - Frees an Allocated Object + +This routine makes a sanity check to make sure the "type" field of the +standard object structure has not been cleared. If the object is +not a standard structure, then the macro "NonObjectFree" is available +that does not perform this check. + +In either case, the object must not be the NULL pointer. This preserves +portability, as the C system Xfree() will not always accept NULL. +*/ + +void Free(obj) /* non-ANSI to avoid overly strict type checking */ + register struct xobject *obj; /* structure to free */ +{ + if (obj->type == INVALIDTYPE) + abort("Free of already freed object?", 17); + obj->type = INVALIDTYPE; + + if (MemoryDebug > 1) { + register int *L; + L = (int *) obj; + IfTrace4(TRUE,"Freeing at %p: %x %x %x\n", L, L[-1], L[0], L[1]); + } + + free(obj); +} + +/* +:h3.Permanent() - Makes an Object Permanent + +Real simple--just set a flag. Every routine that consumes its objects +(which is almost every user entry) must check this flag, and not consume +the object if it is set. + +If a temporary object is made permanent, and there is more than one +reference to it, we must first Copy() it, then set the ISPERMANENT +flag. Note also that the reference count must be incremented when an +object is changed from temporary to permanent (see the ISUNIQUE macro). + +Note that the purpose of this function is to convert an object into a +permanent object: + If it was permanent to begin with, we do nothing; + If it was temporary and unique, we set the PERMANENT flag and increment +the reference count; + If it was temporary and nonunique, we must make a unique Copy(), set +the PERMANENT flag, and set the reference count to 2. We must also +decrement the original object's reference count, because what we have +done is to change one of the old temporary handles to a permanent one. +3-26-91 PNM +*/ + +struct xobject *t1_Permanent(obj) /* non-ANSI to avoid overly strict type checking */ + register struct xobject *obj; /* object to be made permanent */ +{ + IfTrace1((MustTraceCalls),"Permanent(%p)\n", obj); + + if ( (obj != NULL) && ( !(ISPERMANENT(obj->flag)) ) ) + { + /* there is a non-NULL, temporary object to be made permanent. + If there are multiple references to this object, first get + a new COPY(). + Note also that we have to decrement the reference count if + we do a Copy() here, because we are consuming the temporary + argument passed, and returning a unique, permanent one. + */ + if ( obj->references > 1) + { + obj = Copy(obj); + } + /* now set the permanent flag, and increment the reference + count, since a temporary object has now become permanent. */ + obj->references++; + obj->flag |= ISPERMANENT(ON); + } + return(obj); +} + +/* +:h3.Temporary() - Undoes the Effect of "Permanent()" + +This simply resets the "ISPERMANENT" flag. + +If a permanent object is made temporary, and there is more than one reference +to it, we must first Copy() it, then reset the ISPERMANENT flag. However, +if the permanent object has obly one reference, we need only decrement the +reference count ( and reset the flag). + +Note that this function, in the case of a PERMANENT argument, basically +converts the PERMANENT handle to a TEMPORARY one. Thus, in the case of +a nonunique, permanent argument passed, we not only make a Copy(), +we also decrement the reference count, to reflect the fact that we have +lost a permanent handle and gained a temporary one. +PNM 3-2-6-91 +*/ + +struct xobject *xiTemporary(obj) /* non-ANSI to avoid overly strict type checking */ + register struct xobject *obj; /* object to be made permanent */ +{ + IfTrace1((MustTraceCalls),"Temporary(%p)\n", obj); + + if (obj != NULL) { + /* if it's already temporary, there's nothing to do. */ + if ISPERMANENT(obj->flag) + { + /* if there are multiple references to this object, get a + Copy we can safely alter. Recall that the reference count + is incremented for permanent objects. + Recall further that Copy returns an object with the + same flag state and a reference count of 2 (for PERMANENT + objects). + Thus, regardless of whether or not we need to copy a + permanent object, we still decrement its reference + count and reset the flag. + */ + if (obj->references != 2 || ISIMMORTAL(obj->flag)) + { + /* not unique; consume handle, get a temporary Copy! */ + obj = Copy(obj); + } + /* else decrement the reference count (since it's going from + permanent to temporary) and clear the flag. */ + else { + obj->references--; + obj->flag &= ~ISPERMANENT(ON); + } + } + } + return(obj); +} + +/* +:h3.Dup() - Duplicate an Object + +Dup will increment the reference count of an object, only making a +Copy() if needed. +Note that Dup() retains the state of the permanent flag. +3-26-91 PNM +*/ + + +struct xobject *t1_Dup(obj) /* non-ANSI avoids overly strict type checking */ + register struct xobject *obj; /* object to be duplicated */ +{ + register char oldflag; /* copy of original object's flag byte */ + + IfTrace1((MustTraceCalls),"Dup(%p)\n", obj); + + if (obj == NULL) + return(NULL); + /* An immortal object must be Copy'ed, so that we get a mortal + copy of it, since we try not to destroy immortal objects. */ + if (ISIMMORTAL(obj->flag)) + return(Copy(obj)); + + /* if incrementing the reference count doesn't cause the count + to wrap, simply return the object with the count bumped. Note + that the RefRoll macro increments the count to perform the + rollover check, so we must decrement the count. */ + if (RefRoll(obj)) + return(obj); + + /* that didn't work out, so put the count back and call Copy(). */ + --obj->references; + oldflag = obj->flag; + obj = Copy(obj); + if (ISPERMANENT(oldflag)) + obj = Permanent(obj); + return(obj); +} + +/* +:h3.Copy() - Make a New Copy of an Object + +This is the generic Copy() where the object type is unknown. There +are specific Copyxxx functions for known object types. + +Copy will create a NEW temporary object, and WILL NOT simply bump the +reference count. + +Sometimes duplicating an object is just as simple as Allocating with it +as a template. But other objects are complicated linked lists. So, we +let each module provide us a routine (or macro) that duplicates the +objects it knows about. +*/ + +struct xobject *t1_Copy(obj) + register struct xobject *obj; /* object to be Copy'ed */ +{ + if (obj == NULL) + return(NULL); + + if (ISPATHTYPE(obj->type)) + obj = (struct xobject *) CopyPath(obj); + else + switch (obj->type) { + case SPACETYPE: + obj = (struct xobject *) CopySpace(obj); break; + case FONTTYPE: + obj = (struct xobject *) CopyFont(obj); break; + case REGIONTYPE: + obj = (struct xobject *) CopyRegion(obj); break; + case PICTURETYPE: + obj = (struct xobject *) CopyPicture(obj); break; + case LINESTYLETYPE: + obj = (struct xobject *) CopyLineStyle(obj); break; + case STROKEPATHTYPE: + obj = (struct xobject *) CopyStrokePath(obj); break; + case CLUTTYPE: + obj = (struct xobject *) CopyCLUT(obj); break; + default: + return(ArgErr("Copy: invalid object", obj, NULL)); + } + + return(obj); +} + +/* +:h3.Destroy() - Destroys an Object + +This can get complicated. Just like with Copy(), we let the experts +handle it. +*/ +struct xobject *Destroy(obj) /* non-ANSI avoids overly strict type checking */ + register struct xobject *obj; /* object to be destroyed */ +{ + IfTrace1((MustTraceCalls),"Destroy(%p)\n", obj); + + if (obj == NULL) + return(NULL); + if (ISIMMORTAL(obj->flag)) { + IfTrace1(TRUE,"Destroy of immortal object %p ignored\n", obj); + return(NULL); + } + if (ISPATHTYPE(obj->type)) + KillPath(obj); + else { + switch (obj->type) { + case REGIONTYPE: + KillRegion(obj); + break; + case SPACETYPE: + KillSpace(obj); + break; + case LINESTYLETYPE: + KillLineStyle(obj); + break; + case FONTTYPE: + KillFont(obj); + break; + case PICTURETYPE: + /* KillPicture macro removed from sources (RMz, 2001-04-01) + KillPicture(obj); + */ + break; + case STROKEPATHTYPE: + KillStrokePath(obj); + break; + case CLUTTYPE: + KillCLUT(obj); + break; + default: + return(ArgErr("Destroy: invalid object", obj, NULL)); + } + } + return(NULL); +} +/* +:h2.Generally Useful Macros + +:h3.FOLLOWING() - Macro to Point to the Data Following a Structure + +There are several places in TYPE1IMAGER where we will allocate variable +data that belongs to a structure immediately after that structure. +This is a performance technique, because it reduces the number of +trips we have to take through Xalloc() and Xfree(). It turns out C has +a very convenient way to point past a structure--if 'p' is a pointer +to a structure, 'p+1' is a pointer to the data after it. This +behavior of C is somewhat startling and somewhat hard to follow, if +you are not used to it, so we define a macro to point to the data +following a structure: +*/ +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.TYPECHECK() - Verify the Type of an Argument + +This macro tests the type of an argument. If the test fails, it consumes +any other arguments as necessary and causes the imbedding routine to +return the value 'whenBAD'. + +Note that the consumeables list should be an argument list itself, for +example (0) or (2,A,B). See :hdref refid=consume. below. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.ARGCHECK() - Perform an Arbitrary Check on an Argument + +This macro is a generalization of TYPECHECK to take an arbitrary +predicate. If the error occurs (i.e., the predicate is true), the +arbitrary message 'msg' is returned. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.TYPENULLCHECK() - Extension of TYPECHECK() for NULL arguments + +Many routines allow NULLs to be passed as arguments. 'whenBAD' will +be returned in this case, too. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.MAKECONSUME() - Create a "Consume"-type Macro + +Consuming an object means destroying it if it is not permanent. This +logic is so common to all the routines, that it is immortalized in this +macro. For example, ConsumePath(p) can be simply defined as +MAKECONSUME(p,KillPath(p)). In effect, this macro operates on a +meta-level. +:i1/consuming objects/ +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h3.MAKEUNIQUE() - Create a "Unique"-type Macro + +Many routines are written to modify their arguments in place. Thus, +they want to insure that they duplicate an object if it is permanent. +This is called making an object "unique". For example, UniquePath(p) +can be simply defined as MAKEUNIQUE(p,DupPath(p)). +:i1/unique objects/ +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +An object is unique (and directly alterable) if there is only one +reference to it, and it is not permanent (in which case we increment +the reference count, so we don't have to check the permanent bit). +3-26-91 PNM + +Note the rules for making a unique object: +&drawing. + IF (obj->references = 1) return(obj); + ELSE (references > 1) + IF (ISPERMANENT(obj->flag)) return(Dupxxx(obj)); + ELSE (nonunique, temporary object!) + obj->references--; return(Dupxxx(obj)); +&edrawing. +If we must make a Copy of a nonunique, temporary object, we decrement +reference count of the original object! +*/ + +/* +:h3.Unique() - Make a Unique Object + +Here is a generic 'Unique' function if the object type is not known. +Why didn't we build it with the MAKEUNIQUE macro, you ask? Well, we +used to, but there is at least one damn compiler in the world that +raises errors if the types of an "(a) ? b : c" expression do not match. +Also, when we changed Dup() to retain the permanent/temporary flag, we +wanted to make sure "Unique" always returned a temporary object. + +Note that we cannot use Dup() to create a copy of the object in question, +because Dup() may simply bump the reference count, and not return a +unique copy to us. That is why we use t1_Copy(). + +The purpose of this function is to make sure we have a copy of an object +that we can safely alter: +:ol. +:li.If we have a unique, temporary object, we simply return the argument. +:li.If we have a nonunique, temporary object, we have to make a new copy +of it, and decrement the reference count of the original object, to reflect +the fact that we traded temporary handles. +:li.If we have a permanent object, we make a temporary copy of it, but +we do not decrement the reference count of the original permanent object, +because permanent objects, by definition, are persistent. 3-2-6-91 PNM +:eol. +*/ + +struct xobject *t1_Unique(obj) + struct xobject *obj; +{ + /* if the original object is not already unique, make a unique + copy...Note also that if the object was not permanent, we must + consume the old handle! 3-26-91 PNM + NOTE : consumption of the old handle moved to Allocate. 4-18-91 */ + if (!obj || obj->references == 1) + return(obj); + + obj = Copy(obj); + /* and make sure we return a temporary object ! */ + if (ISPERMANENT(obj->flag)) + { + obj->flag &= ~ISPERMANENT(ON); + obj->references--; + } + return(obj); +} + + +/* +:h2.Initialization, Error, and Debug Routines + +:h3 id=debugvar.Declarations for Debug Purposes + +We declare all the debug flags here. Some link editors make the not +unreasonable restriction that only one module may declare and +initialize global variables; all the rest must declare the variable +'extern'. This is logical, but is somewhat awkward to implement with +C include files. We solve the problem by temporarily making the name +'extern' a null name if GLOBALS is defined. (GLOBALS is only defined +in this OBJECTS module.) Since 'externs' can't be initialized, we +have to handle that with #defines too. +:i1/GLOBALS (&#define.)/ +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +static char *ErrorMessage = NULL; + +/* +:h3.Pragmatics() - Set/Reset Debug Flags + +We provide a controlled way for the TYPE1IMAGER user to set and reset +our debugging and tracing: +*/ +void Pragmatics(username, value) + char *username; /* name of the flag */ + int value; /* value to set it to */ +{ + register char *p; /* temporary loop variable */ +#define NAMESIZE 40 + char name[NAMESIZE]; /* buffer to store my copy of 'username' */ + + if (strlen(username) >= NAMESIZE) + abort("Pragmatics name too large", 18); + strcpy(name, username); + for (p = name; *p != '\0'; p++) + *p = toupper(*p); + + if (!strcmp(name, "ALL")) + MustTraceCalls = InternalTrace = /* MustCrash = */ + LineIOTrace = value; + + else if (!strcmp(name, "LINEIOTRACE")) + LineIOTrace = value; + + else if (!strcmp(name, "TRACECALLS")) + MustTraceCalls = value; + + else if (!strcmp(name, "CHECKARGS")) + MustCheckArgs = value; + + else if (!strcmp(name, "PROCESSHINTS")) + ProcessHints = value; + + else if (!strcmp(name, "SAVEFONTPATHS")) + SaveFontPaths = value; + + else if (!strcmp(name, "CRASTERCOMPRESSIONTYPE")) + CRASTERCompressionType = value; + + else if (!strcmp(name, "CRASHONUSERERROR")) + MustCrash = value; + + else if (!strcmp(name, "DEBUG")) + StrokeDebug = SpaceDebug = PathDebug = ConicDebug = LineDebug = + RegionDebug = MemoryDebug = FontDebug = + HintDebug = ImageDebug = OffPageDebug = value; + + else if (!strcmp(name, "CONICDEBUG")) + ConicDebug = value; + + else if (!strcmp(name, "LINEDEBUG")) + LineDebug = value; + + else if (!strcmp(name, "REGIONDEBUG")) + RegionDebug = value; + + else if (!strcmp(name, "PATHDEBUG")) + PathDebug = value; + + else if (!strcmp(name, "SPACEDEBUG")) + SpaceDebug = value; + + else if (!strcmp(name, "STROKEDEBUG")) + StrokeDebug = value; + + else if (!strcmp(name, "MEMORYDEBUG")) + MemoryDebug = value; + + else if (!strcmp(name, "FONTDEBUG")) + FontDebug = value; + + else if (!strcmp(name, "HINTDEBUG")) + HintDebug = value; + + else if (!strcmp(name, "IMAGEDEBUG")) + ImageDebug = value; + + else if (!strcmp(name, "OFFPAGEDEBUG")) + OffPageDebug = value; + +#ifdef MC68000 +/* +The following pragmatics flag turns on or off instruction histograming +for performance analysis. It is only defined in the Delta card +environment. +*/ + else if (!strcmp(name, "PROFILE")) { + if (value) + StartProfile(); + else + StopProfile(); + } +#endif + /* GimeSpace() is define as false ... */ + /* + else if (!strcmp(name, "FLUSHCACHE")) { + while (GimeSpace()) { ; } + } + */ + else if (!strcmp(name, "CACHEDCHARS")) + CachedChars = (value <= 0) ? 1 : value; + + else if (!strcmp(name, "CACHEDFONTS")) + CachedFonts = (value <= 0) ? 1 : value; + + else if (!strcmp(name, "CACHEBLIMIT")) + CacheBLimit = value; + + else if (!strcmp(name, "CONTINUITY")) + Continuity = value; + + + else { + printf("Pragmatics flag = '%s'\n", name); + ArgErr("Pragmatics: flag not known", NULL, NULL); + } + return; +} + +/* +:h3.Consume() - Consume a List of Arguments + +This general purpose routine is provided in the case where the object +type(s) to be consumed are unknown or not yet verified, and/or it is +not known whether the object is permanent. + +If the type of the argument is known, it is faster to directly consume +that type, for example, ConsumeRegion() or ConsumePath(). Furthermore, +if it is already known that the object is temporary, it is faster to +just kill it rather than consume it, for example, KillSpace(). +*/ + +void Consume(n, obj1, obj2, obj3) /* non-ANSI avoids overly strict type checking */ + int n; + struct xobject *obj1,*obj2,*obj3; +{ + switch(n) { + + case 0: + return; + + case 1: + if (obj1 != NULL && !ISPERMANENT(obj1->flag)) + Destroy(obj1); + return; + + case 2: + if (obj1 != NULL && !ISPERMANENT(obj1->flag)) + Destroy(obj1); + if (obj2 != NULL && !ISPERMANENT(obj2->flag)) + Destroy(obj2); + return; + + case 3: + if (obj1 != NULL && !ISPERMANENT(obj1->flag)) + Destroy(obj1); + if (obj2 != NULL && !ISPERMANENT(obj2->flag)) + Destroy(obj2); + if (obj3 != NULL && !ISPERMANENT(obj3->flag)) + Destroy(obj3); + return; + + default: + abort("Consume: too many objects", 19); + } +} +/* +:h3.TypeErr() - Handles "Invalid Object Type" Errors +*/ + +struct xobject *TypeErr(name, obj, expect, ret) /* non-ANSI avoids overly strict type checking */ + char *name; /* Name of routine (for error message) */ + struct xobject *obj; /* Object in error */ + int expect; /* type expected */ + struct xobject *ret; /* object to return to caller */ +{ + static char typemsg[80]; + + if (MustCrash) + LineIOTrace = TRUE; + + sprintf(typemsg, "Wrong object type in %s; expected %s, found %s.\n", + name, TypeFmt(expect), TypeFmt(obj->type)); + IfTrace0(TRUE,typemsg); + + ObjectPostMortem(obj); + + if (MustCrash) + abort("Terminating because of CrashOnUserError...", 20); + else + ErrorMessage = typemsg; + +/* changed ISPERMANENT to ret->references > 1 3-26-91 PNM */ + if (ret != NULL && (ret->references > 1)) + ret = Dup(ret); + return(ret); +} + +/* +:h4.TypeFmt() - Returns Pointer to English Name of Object Type + +This is a subroutine of TypeErr(). +*/ + +static char *TypeFmt(type) + int type; /* type field */ +{ + char *r; + + if (ISPATHTYPE(type)) + if (type == TEXTTYPE) + r = "path or region (from TextPath)"; + else + r = "path"; + else { + switch (type) { + case INVALIDTYPE: + r = "INVALID (previously consumed?)"; + break; + case REGIONTYPE: + r = "region"; + break; + case SPACETYPE: + r = "XYspace"; + break; + case LINESTYLETYPE: + r = "linestyle"; + break; + case FONTTYPE: + r = "font"; + break; + case PICTURETYPE: + r = "picture"; + break; + case STROKEPATHTYPE: + r = "path (from StrokePath)"; + break; + default: + r = "UNKNOWN"; + break; + } + } + return(r); +} +/* +:h4.ObjectPostMortem() - Prints as Much as We Can About a Bad Object + +This is a subroutine of TypeErr() and ArgErr(). +*/ + +/*ARGSUSED*/ +static int ObjectPostMortem(obj) /* non-ANSI avoids overly strict type checking */ + register struct xobject *obj; +{ + + Pragmatics("Debug", 10); + IfTrace2(TRUE,"Bad object is of %s type %p\n", TypeFmt(obj->type), obj); + + IfTrace0((obj == (struct xobject *) USER), + "Suspect that InitImager() was omitted.\n"); + Pragmatics("Debug", 0); + /* We return a value to make ANSI-compiler happy */ + return(0); + +} + +/* +:h3.ArgErr() - Invalid Argument Passed to a Routine + +A common routine to report argument errors. It is usually called +is returned to the caller in case MustCrash is FALSE and ArgErr +returns to its caller. +*/ + +struct xobject *ArgErr(string, obj, ret) /* non-ANSI avoids overly strict type checking */ + char *string; /* description of error */ + struct xobject *obj; /* object, if any, that was in error */ + struct xobject *ret; /* object returned to caller or NULL */ +{ + if (MustCrash) + LineIOTrace = TRUE; + IfTrace1(TRUE,"ARGUMENT ERROR-- %s.\n", string); + if (obj != NULL) + ObjectPostMortem(obj); + if (MustCrash) + abort("Terminating because of CrashOnUserError...", 21); + else + ErrorMessage = string; + return(ret); +} + +/* +:h3.abort() - Crash Due to Error + +We divide by zero, and if that doesn't work, call exit(), the results of +which is system dependent (and thus is part of the Hourglass required +environment). +*/ +/* RMz: We now do a longjmp in order to be able to recover from the error */ +/*ARGSUSED*/ +void abort(string, no) + char *string; + int no; +{ + + LineIOTrace = TRUE; + TraceClose(); + longjmp( stck_state, no); + +} + +/* By RMz: Return the abort string to t1lib! */ +char *t1_get_abort_message( int number) +{ + static char *err_msgs[]={ + "DLdiv: dividend too large", /* 1 */ + "divide algorithm error", /* 2 */ + "Beziers this big not yet supported", /* 3 */ + "ComputeHint: invalid orientation", /* 4 */ + "ComputeHint: invalid hinttype", /* 5 */ + "ComputeHint: invalid orientation", /* 6 */ + "ProcessHint: invalid label", /* 7 */ + "ProcessHint: label is not in use", /* 8 */ + "ProcessHint: invalid label", /* 9 */ + "ProcessHint: invalid adjusttype", /* 10 */ + "bad subpath chain", /* 11 */ + "ImpliedHorizontalLine: why ask?", /* 12 */ + "disjoint subpath?", /* 13 */ + "unable to fix subpath break?", /* 14 */ + "Non-positive allocate?", /* 15 */ + "We have REALLY run out of memory", /* 16 */ + "Free of already freed object?", /* 17 */ + "Pragmatics name too large", /* 18 */ + "Consume: too many objects", /* 19 */ + "Terminating because of CrashOnUserError...", /* 20 */ + "Terminating because of CrashOnUserError...", /* 21 */ + "Fundamental TYPE1IMAGER assumptions invalid in this port", /* 22 */ + "Reverse: bad path segment", /* 23 */ + "UnClose: no LASTCLOSED", /* 24 */ + "PathTransform: invalid segment", /* 25 */ + "QueryPath: unknown segment", /* 26 */ + "QueryBounds: unknown type", /* 27 */ + "KillRegion: negative reference count", /* 28 */ + "newedge: height not positive", /* 29 */ + "Interior: path type error", /* 30 */ + "Unwind: uneven edges", /* 31 */ + "negative sized edge?", /* 32 */ + "splitedge: above top of list", /* 33 */ + "splitedge: would be null", /* 34 */ + "null splitedge", /* 35 */ + "vertjoin not disjoint", /* 36 */ + "SwathUnion: 0 height swath?", /* 37 */ + "discard(): ran off end", /* 38 */ + "UnJumble: unpaired edge?", /* 39 */ + "Tighten: existing edge bound was bad", /* 40 */ + "Tighten: existing region bound was bad", /* 41 */ + "EDGE ERROR: non EDGETYPE in list", /* 42 */ + "EDGE ERROR: overlapping swaths", /* 43 */ + "Context: QueryDeviceState didn't work", /* 44 */ + "QueryDeviceState returned invalid orientation", /* 45 */ + "Context: out of them", /* 46 */ + "MatrixInvert: can't", /* 47 */ + "xiStub called", /* 48 */ + "Illegal access type1 abort() message" /* 49 */ + }; + + /* no is valid from 1 to 48 */ + if ( (number<1)||(number>48)) + number=49; + return( err_msgs[number-1]); + +} + + +/* +:h3.REAL Miscellaneous Stuff + +:h4.ErrorMsg() - Return the User an Error Message +*/ + +char *ErrorMsg() +{ + register char *r; + + r = ErrorMessage; + ErrorMessage = NULL; + return(r); +} + +/* +:h4.InitImager() - Initialize TYPE1IMAGER + +We check that a short is 16 bits and a long 32 bits; we have made +those assumptions elsewhere in the code. (This is almost a C standard, +anyway.) Note that TYPE1IMAGER makes no assumptions about the size of an +'int'! +:i1/portability assumptions/ +*/ +void InitImager() +{ + +/* Check to see if we have been using our own malloc. If so,*/ +/* Undef malloc so that we can get to the system call. */ +/* All other calls to malloc are defined to Xalloc. */ + + if (sizeof(SHORT) != 2 || sizeof(LONG) != 4) + abort("Fundamental TYPE1IMAGER assumptions invalid in this port", 22); + InitSpaces(); + InitFonts(); + InitFiles(); +/* +In some environments, constants and/or exception handling need to be +*/ + LibInit(); +} +/* +:h4.TermImager() - Terminate TYPE1IMAGER + +This only makes sense in a server environment; true TYPE1IMAGER needs do +nothing. +*/ +void TermImager() +{ + return; +} +/* +:h4.reportusage() - A Stub to Get a Clean Link with Portable PMP +*/ +void reportusage( void) +{ + return; +} diff -Naur xdvik-22.40l/libs/type1/objects.h xdvik-22.40n/libs/type1/objects.h --- xdvik-22.40l/libs/type1/objects.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/objects.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,296 @@ +/* $XConsortium: objects.h,v 1.6 92/03/20 14:35:56 keith Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + +/*END SHARED*/ +/*SHARED*/ + +#include "types.h" + +#define Permanent(obj) t1_Permanent(obj) +#define Temporary(obj) t1_Temporary(obj) +#define Destroy(obj) t1_Destroy(obj) +#define Dup(obj) t1_Dup(obj) +#define InitImager() t1_InitImager() +#define TermImager() t1_TermImager() +#define Pragmatics(f,v) t1_Pragmatics(f,v) +#define ErrorMsg() t1_ErrorMsg() + +struct xobject *t1_Permanent(); /* make an object permanent */ +struct xobject *t1_Temporary(); /* make an object temporary */ +struct xobject *t1_Destroy(); /* destroy an object */ +struct xobject *t1_Dup(); /* duplicate an object */ +void t1_InitImager(); /* initialize TYPE1IMAGER */ +void t1_TermImager(); /* terminate TYPE1IMAGER */ +void t1_Pragmatics(); /* set debug flags, etc. */ +char *t1_ErrorMsg(); /* return last TYPE1IMAGER error message */ + +/*END SHARED*/ +/*SHARED*/ + +#define abort(line,no) t1_abort(line,no) +#define Allocate(n,t,s) t1_Allocate(n,t,s) +#define Free(obj) t1_Free(obj) +#define NonObjectFree(a) free(a) +#define Consume t1_Consume +#define ArgErr(s,o,r) t1_ArgErr(s,o,r) +#define TypeErr(n,o,e,r) t1_TypeErr(n,o,e,r) +#define Copy(obj) t1_Copy(obj) +#define Unique(obj) t1_Unique(obj) + +void t1_abort(); /* crash; software logic error */ +struct xobject *t1_Allocate(); /* allocate memory */ +void t1_Free(); /* free memory */ +struct xobject *t1_Unique(); /* make a unique temporary copy of an object */ +struct xobject *t1_ArgErr(); /* handle argument errors */ +struct xobject *t1_TypeErr(); /* handle 'bad type' argument errors */ +void t1_Consume(); /* consume a variable number of arguments */ +struct xobject *t1_Copy(); /* make a new copy, not reference bump PNM */ + +/*END SHARED*/ +/*SHARED*/ + +#define ON (~0) /* all bits on */ +#ifndef FALSE +#define FALSE 0 /* handy zero value */ +#endif +#ifndef TRUE +#define TRUE 1 /* handy non-zero value */ +#endif + +#ifndef NULL +#define NULL 0 +/* +The NULL pointer is system specific. (Most systems, however, use 0.) +TYPE1IMAGER could have its own NULL, independent of the rest of the system, +were it not for malloc(). The system call malloc() returns NULL when +out of memory. +:i1/portibility assumptions/ +*/ +#endif + +#define TYPE1_MIN(a,b) (((a)<(b)) ? a : b) +#define TYPE1_MAX(a,b) (((a)>(b)) ? a : b) +#define TYPE1_ABS(a) (((a)>=0)?(a):-(a)) + +/*END SHARED*/ +/*SHARED*/ + +struct xobject { + char type; /* encoded type of object */ + unsigned char flag; /* flag byte for temporary object characteristics */ + short references; /* count of pointers to this object + (plus 1 for permanent objects) PNM */ +} ; + +/*END SHARED*/ +/*SHARED*/ + +#define XOBJ_COMMON char type; unsigned char flag; short references; + +/*END SHARED*/ +/*SHARED*/ + + +#define INVALIDTYPE 0 +#define FONTTYPE 1 +#define REGIONTYPE 3 +#define PICTURETYPE 4 +#define SPACETYPE 5 +#define LINESTYLETYPE 6 +#define EDGETYPE 7 +#define STROKEPATHTYPE 8 +#define CLUTTYPE 9 + +#define ISPATHTYPE(type) ((type)&0x10) /* all path segments have this bit on */ +#define LINETYPE (0+ISPATHTYPE(ON)) +#define CONICTYPE (1+ISPATHTYPE(ON)) +#define BEZIERTYPE (2+ISPATHTYPE(ON)) +#define HINTTYPE (3+ISPATHTYPE(ON)) + +#define MOVETYPE (5+ISPATHTYPE(ON)) +#define TEXTTYPE (6+ISPATHTYPE(ON)) + +/*END SHARED*/ +/*SHARED*/ + +#define ISPERMANENT(flag) ((flag)&0x01) +#define ISIMMORTAL(flag) ((flag)&0x02) + +/*END SHARED*/ +/*SHARED*/ + +#define PRESERVE(obj) if (!ISPERMANENT((obj)->flag)) \ + (obj)->references++; + +/*END SHARED*/ +/*SHARED*/ + +#define LONGCOPY(dest,source,bytes) { \ + register LONG *p1 = (LONG *)dest; register LONG *p2 = (LONG *)source; \ + register int count = (bytes) / sizeof(LONG); \ + while (--count >= 0) *p1++ = *p2++; } + + +/*END SHARED*/ +/*SHARED*/ + +#define FOLLOWING(p) ((p)+1) + +/*END SHARED*/ +/*SHARED*/ + +#define TYPECHECK(name, obj, expect, whenBAD, consumables, rettype) { \ + if (obj->type != expect) { \ + (Consume)consumables; \ + return((rettype)TypeErr(name, obj, expect, whenBAD)); \ + } \ +} + +/*END SHARED*/ +/*SHARED*/ + +#define ARGCHECK(test,msg,obj,whenBAD,consumables,rettype) { \ + if (test) { \ + (Consume)consumables; \ + return((rettype)ArgErr(msg, obj, whenBAD)); \ + } \ +} + +/*END SHARED*/ +/*SHARED*/ + +/* Changed use of Dup() below to Temporary(Copy()) because Dup() does not + necessarily return a Unique Copy anymore! 3-26-91 */ +#define TYPENULLCHECK(name, obj, expect, whenBAD, consumables,rettype) \ + if (obj == NULL) { \ + (Consume)consumables; \ + if (whenBAD != NULL && ISPERMANENT(whenBAD->flag)) \ + return((rettype)Temporary(Copy(whenBAD))); \ + else return((rettype)whenBAD); \ + } else { \ + if (obj->type != expect) { \ + (Consume)consumables; \ + return((rettype)TypeErr(name, obj, expect, whenBAD)); \ + } \ + } +/*END SHARED*/ +/*SHARED*/ + +#define MAKECONSUME(obj,stmt) { if (!ISPERMANENT(obj->flag)) stmt; } + +/*END SHARED*/ +/*SHARED*/ + +#define MAKEUNIQUE(obj,stmt) ( ( (obj)->references > 1 ) ? stmt : obj ) + +/*END SHARED*/ +/*SHARED*/ +/* NDW: personally, I want to see status and error messages! */ +#define IfTrace0(condition,model) \ + {if (condition) printf(model);} +#define IfTrace1(condition,model,arg0) \ + {if (condition) printf(model,arg0);} +#define IfTrace2(condition,model,arg0,arg1) \ + {if (condition) printf(model,arg0,arg1);} +#define IfTrace3(condition,model,arg0,arg1,arg2) \ + {if (condition) printf(model,arg0,arg1,arg2);} +#define IfTrace4(condition,model,arg0,arg1,arg2,arg3) \ + {if (condition) printf(model,arg0,arg1,arg2,arg3);} +#define IfTrace5(condition,model,arg0,arg1,arg2,arg3,arg4) \ + {if (condition) printf(model,arg0,arg1,arg2,arg3,arg4);} +#define IfTrace6(condition,model,arg0,arg1,arg2,arg3,arg4,arg5) \ + {if (condition) printf(model,arg0,arg1,arg2,arg3,arg4,arg5);} +/* NDW: patch ends */ + +void Trace0(); +char *Trace1(),*Trace2(),*Trace3(),*Trace4(),*Trace5(),*Trace6(); + +#ifdef GLOBALS + +#define extern +#define INITIALIZED(value) = value + +#else + +#define INITIALIZED(value) + +#endif + +extern char MustCheckArgs INITIALIZED(TRUE); +extern char MustTraceCalls INITIALIZED(FALSE); +extern char MustCrash INITIALIZED(TRUE); +extern char InternalTrace INITIALIZED(TRUE); +extern char LineIOTrace INITIALIZED(TRUE); + +extern char ProcessHints INITIALIZED(TRUE); + +extern char SaveFontPaths INITIALIZED(TRUE); + +extern short CRASTERCompressionType INITIALIZED(1); + +extern char ConicDebug INITIALIZED(0); +extern char LineDebug INITIALIZED(0); +extern char RegionDebug INITIALIZED(0); +extern char PathDebug INITIALIZED(0); +extern char FontDebug INITIALIZED(0); +extern char SpaceDebug INITIALIZED(0); +extern char StrokeDebug INITIALIZED(0); +extern char MemoryDebug INITIALIZED(0); +extern char HintDebug INITIALIZED(0); +extern char ImageDebug INITIALIZED(0); +extern char OffPageDebug INITIALIZED(0); + +extern short CachedChars INITIALIZED(0x7FFF); +extern short CachedFonts INITIALIZED(0x7FFF); +extern int CacheBLimit INITIALIZED(12500); +extern char Continuity INITIALIZED(2); + +#ifdef extern +#undef extern +#endif + +/* +We define other routines formatting parameters +*/ +#define DumpArea(area) t1_DumpArea(area) +#define DumpText(text) t1_DumpText(text) +/* #define DumpPath(path) t1_DumpPath(path) */ /* commented by RMz, 1999-06-10 */ +#define DumpSpace(space) t1_DumpSpace(space) +#define DumpEdges(e) t1_DumpEdges(e) +#define FormatFP(s,p) t1_FormatFP(s,p) + +void t1_DumpArea(); /* dump a region structure */ +void t1_DumpText(); /* dump a textpath structure */ +void t1_DumpPath(); /* dump a path list */ +void t1_DumpSpace(); /* dump a coordinate space structure */ +void t1_DumpEdges(); /* dump a region's edge list */ +void t1_FormatFP(); /* dump a format a "fractpel" coordinate */ + +/*END SHARED*/ diff -Naur xdvik-22.40l/libs/type1/paths.c xdvik-22.40n/libs/type1/paths.c --- xdvik-22.40l/libs/type1/paths.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/paths.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1514 @@ +/* $XConsortium: paths.c,v 1.4 91/10/10 11:18:40 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + /* PATHS CWEB V0021 ******** */ +/* +:h1 id=paths.PATHS Module - Path Operator Handler + +This is the module that is responsible for building and transforming +path lists. + +&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) + + +:h3.Include Files + +The included files are: +*/ + +#include +#include + /* after the system includes (dsr) */ +#include "types.h" +#include "objects.h" +#include "spaces.h" +#include "paths.h" +#include "regions.h" /* understands about Union */ +#include "fonts.h" /* understands about TEXTTYPEs */ +#include "pictures.h" /* understands about handles */ +#include "strokes.h" /* understands how to coerce stroke paths */ +#include "trig.h" +static int UnClose(); + +/* +:h3.Routines Available to the TYPE1IMAGER User + +The PATHS routines that are made available to the outside user are: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Functions Provided to Other Modules + +The path routines that are made available to other TYPE1IMAGER modules +are defined here: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +NOTE: because of the casts put in the macros for Loc, ArcCA, Conic, +RoundConic, PathSegment, and JoinSegment, we cannot use the macro names +when the functions are actually defined. We have to use the unique +names with their unique first two characters. Thus, if anyone in the +future ever decided to change the first two characters, it would not be +enough just to change the macro (as it would for most other functions). +He would have to also change the function definition. +*/ +/* +:h3.Macros Provided to Other Modules + +The CONCAT macro is defined here and used in the STROKES module. See +:hdref refid=pathmac.. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h2.Path Segment Structures + +A path is represented as a linked list of the following structure: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +When 'link' is NULL, we are at the last segment in the path (surprise!). + +'last' is only non-NULL on the first segment of a path, +for all the other segments 'last' == NULL. We test for a non-NULL +'last' (ISPATHANCHOR predicate) when we are given an alleged path +to make sure the user is not trying to pull a fast one on us. + +A path may be a collection of disjoint paths. Every break in the +disjoint path is represented by a MOVETYPE segment. + +Closed paths are discussed in :hdref refid=close.. + +:h3.CopyPath() - Physically Duplicating a Path + +This simple function illustrates moving through the path linked list. +Duplicating a segment just involves making a copy of it, except for +text, which has some auxilliary things involved. We don't feel +competent to duplicate text in this module, so we call someone who +knows how (in the FONTS module). +*/ +struct segment *CopyPath(p0) + register struct segment *p0; /* path to duplicate */ +{ + register struct segment *p,*n=NULL,*last=NULL,*anchor; + + for (p = p0, anchor = NULL; p != NULL; p = p->link) { + + ARGCHECK((!ISPATHTYPE(p->type) || (p != p0 && p->last != NULL)), + "CopyPath: invalid segment", p, NULL, (0), struct segment *); + + if (p->type == TEXTTYPE) + n = (struct segment *) CopyText(p); + else + n = (struct segment *)Allocate(p->size, p, 0); + n->last = NULL; + if (anchor == NULL) + anchor = n; + else + last->link = n; + last = n; + } +/* +At this point we have a chain of newly allocated segments hanging off +'anchor'. We need to make sure the first segment points to the last: +*/ + if (anchor != NULL) { + n->link = NULL; + anchor->last = n; + } + + return(anchor); +} +/* +:h3.KillPath() - Destroying a Path + +Destroying a path is simply a matter of freeing each segment in the +linked list. Again, we let the experts handle text. +*/ +void KillPath(p) + register struct segment *p; /* path to destroy */ +{ + register struct segment *linkp; /* temp register holding next segment*/ + + /* return conditional based on reference count 3-26-91 PNM */ + if ( (--(p->references) > 1) || + ( (p->references == 1) && !ISPERMANENT(p->flag) ) ) + return; + + while (p != NULL) { + if (!ISPATHTYPE(p->type)) { + ArgErr("KillPath: bad segment", p, NULL); + return; + } + linkp = p->link; + if (p->type == TEXTTYPE) + KillText(p); + else + Free(p); + p = linkp; + } +} + +/* +:h2 id=location."location" Objects + +The TYPE1IMAGER user creates and destroys objects of type "location". These +objects locate points for the primitive path operators. We play a trick +here and store these objects in the same "segment" structure used for +paths, with a type field == MOVETYPE. + +This allows the Line() operator, for example, to be very trivial: +It merely stamps its input structure as a LINETYPE and returns it to the +caller--assuming, of course, the input structure was not permanent (as +it usually isn't). + +:h3.The "movesegment" Template Structure + +This template is used as a generic segment structure for Allocate: +*/ + +/* added reference field 1 to temporary template below 3-26-91 PNM */ +static struct segment movetemplate = { MOVETYPE, 0, 1, sizeof(struct segment), 0, + NULL, NULL, {0, 0} }; +/* +:h3.Loc() - Create an "Invisible Line" Between (0,0) and a Point + +*/ + +struct segment *t1_Loc(S, x, y) + register struct XYspace *S; /* coordinate space to interpret X,Y */ + DOUBLE x,y; /* destination point */ +{ + register struct segment *r; + + + IfTrace3((MustTraceCalls),"..Loc(S=%p, x=%f, y=%f)\n", S, x, y); + + r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0); + TYPECHECK("Loc", S, SPACETYPE, r, (0), struct segment *); + + r->last = r; + r->context = S->context; + (*S->convert)(&r->dest, S, x, y); + ConsumeSpace(S); + return(r); +} +/* +:h3.ILoc() - Loc() With Integer Arguments + +*/ +struct segment *ILoc(S, x, y) + register struct XYspace *S; /* coordinate space to interpret X,Y */ + register int x,y; /* destination point */ +{ + register struct segment *r; + + IfTrace3((MustTraceCalls),"..ILoc(S=%p, x=%d, y=%d)\n", + S, (LONG) x, (LONG) y); + r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0); + TYPECHECK("Loc", S, SPACETYPE, r, (0), struct segment *); + + r->last = r; + r->context = S->context; + (*S->iconvert)(&r->dest, S, (LONG) x, (LONG) y); + ConsumeSpace(S); + return(r); +} + +/* +:h3.SubLoc() - Vector Subtraction of Two Locition Objects + +This user operator subtracts two location objects, yielding a new +location object that is the result. + +The symmetrical function AddLoc() is totally redundent with Join(), +so it is not provided. +*/ + +struct segment *SubLoc(p1, p2) + register struct segment *p1; + register struct segment *p2; +{ + IfTrace2((MustTraceCalls),"SubLoc(%p, %p)\n", p1, p2); + + ARGCHECK(!ISLOCATION(p1), "SubLoc: bad first arg", p1, NULL, (0), struct segment *); + ARGCHECK(!ISLOCATION(p2), "SubLoc: bad second arg", p2, NULL, (0), struct segment *); + p1 = UniquePath(p1); + p1->dest.x -= p2->dest.x; + p1->dest.y -= p2->dest.y; + ConsumePath(p2); + return(p1); +} + +/* +:h2.Straight Line Segments + +:h3.PathSegment() - Create a Generic Path Segment + +Many routines need a LINETYPE or MOVETYPE path segment, but do not +want to go through the external user's interface, because, for example, +they already know the "fractpel" destination of the segment and the +conversion is unnecessary. PathSegment() is an internal routine +provided to the rest of TYPE1IMAGER for handling these cases. +*/ + +struct segment *t1_PathSegment(type, x, y) + int type; /* LINETYPE or MOVETYPE */ + fractpel x,y; /* where to go to, if known */ +{ + register struct segment *r; /* newly created segment */ + + r = (struct segment *)Allocate(sizeof(struct segment), &movetemplate, 0); + r->type = type; + r->last = r; /* last points to itself for singleton */ + r->dest.x = x; + r->dest.y = y; + return(r); +} +/* +:h3.Line() - Create a Line Segment Between (0,0) and a Point P + +This involves just creating and filling out a segment structure: +*/ +struct segment *Line(P) + register struct segment *P; /* relevant coordinate space */ +{ + + IfTrace1((MustTraceCalls),"..Line(%p)\n", P); + ARGCHECK(!ISLOCATION(P), "Line: arg not a location", P, NULL, (0), struct segment *); + + P = UniquePath(P); + P->type = LINETYPE; + return(P); +} +/* +:h2.Curved Path Segments + +We need more points to describe curves. So, the structures for curved +path segments are slightly different. The first part is identical; +the curved structures are larger with the extra points on the end. + +:h3.Bezier Segment Structure + +We support third order Bezier curves. They are specified with four +control points A, B, C, and D. The curve starts at A with slope AB +and ends at D with slope CD. The curvature at the point A is inversely +related to the length |AB|, and the curvature at the point D is +inversely related to the length |CD|. Point A is always point (0,0). + +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Bezier() - Generate a Bezier Segment + +This is just a simple matter of filling out a 'beziersegment' structure: +*/ + +struct beziersegment *Bezier(B, C, D) + register struct segment *B; /* second control point */ + register struct segment *C; /* third control point */ + register struct segment *D; /* fourth control point (ending point) */ +{ +/* added reference field of 1 to temporary template below 3-26-91 PNM */ + static struct beziersegment template = + { BEZIERTYPE, 0, 1, sizeof(struct beziersegment), 0, + NULL, NULL, { 0, 0 }, { 0, 0 }, { 0, 0 } }; + + register struct beziersegment *r; /* output segment */ + + IfTrace3((MustTraceCalls),"..Bezier(%p, %p, %p)\n", B, C, D); + ARGCHECK(!ISLOCATION(B), "Bezier: bad B", B, NULL, (2,C,D), struct beziersegment *); + ARGCHECK(!ISLOCATION(C), "Bezier: bad C", C, NULL, (2,B,D), struct beziersegment *); + ARGCHECK(!ISLOCATION(D), "Bezier: bad D", D, NULL, (2,B,C), struct beziersegment *); + + r = (struct beziersegment *)Allocate(sizeof(struct beziersegment), &template, 0); + r->last = (struct segment *) r; + r->dest.x = D->dest.x; + r->dest.y = D->dest.y; + r->B.x = B->dest.x; + r->B.y = B->dest.y; + r->C.x = C->dest.x; + r->C.y = C->dest.y; + + ConsumePath(B); + ConsumePath(C); + ConsumePath(D); + return(r); +} + +/* +:h2.Font "Hint" Segments + +:h3.Hint() - A Font 'Hint' Segment + +This is temporary code while we experiment with hints. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +struct hintsegment *Hint(S, ref, width, orientation, hinttype, adjusttype, direction, label) + struct XYspace *S; + float ref; + float width; + char orientation; + char hinttype; + char adjusttype; + char direction; + int label; +{ +/* added reference field of 1 to hintsegment template below 3-26-91 PNM */ + static struct hintsegment template = { HINTTYPE, 0, 1, sizeof(struct hintsegment), 0, + NULL, NULL, { 0, 0 }, { 0, 0 }, { 0, 0 }, + ' ', ' ', ' ', ' ', 0}; + + register struct hintsegment *r; + + r = (struct hintsegment *)Allocate(sizeof(struct hintsegment), &template, 0); + + r->orientation = orientation; + if (width == 0.0) width = 1.0; + + if (orientation == 'h') { + (*S->convert)(&r->ref, S, 0.0, ref); + (*S->convert)(&r->width, S, 0.0, width); + } + else if (orientation == 'v') { + (*S->convert)(&r->ref, S, ref, 0.0); + (*S->convert)(&r->width, S, width, 0.0); + } + else + return((struct hintsegment *)ArgErr("Hint: orient not 'h' or 'v'", NULL, NULL)); + if (r->width.x < 0) r->width.x = - r->width.x; + if (r->width.y < 0) r->width.y = - r->width.y; + r->hinttype = hinttype; + r->adjusttype = adjusttype; + r->direction = direction; + r->label = label; + r->last = (struct segment *) r; + ConsumeSpace(S); + return(r); +} + +/* +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +POP removes the first segment in a path 'p' and Frees it. 'p' is left +pointing to the end of the path: +*/ +#define POP(p) \ + { register struct segment *linkp; \ + linkp = p->link; \ + if (linkp != NULL) \ + linkp->last = p->last; \ + Free(p); \ + p = linkp; } +/* +INSERT inserts a single segment in the middle of a chain. 'b' is +the segment before, 'p' the segment to be inserted, and 'a' the +segment after. +*/ +#define INSERT(b,p,a) b->link=p; p->link=a; p->last=NULL + +/* +:h3.Join() - Join Two Objects Together + +If these are paths, this operator simply invokes the CONCAT macro. +Why so much code then, you ask? Well we have to check for object +types other than paths, and also check for certain path consistency +rules. +*/ + +struct segment *Join(p1, p2) + register struct segment *p1,*p2; +{ + IfTrace2((MustTraceCalls && PathDebug > 1),"..Join(%p, %p)\n", p1, p2); + IfTrace2((MustTraceCalls && PathDebug <=1),"..Join(%p, %p)\n", p1, p2); +/* +We start with a whole bunch of very straightforward argument tests: +*/ + if (p2 != NULL) { + if (!ISPATHTYPE(p2->type)) { + + if (p1 == NULL) + return((struct segment *)Unique(p2)); + + switch (p1->type) { + + case REGIONTYPE: + + case STROKEPATHTYPE: + p1 = CoercePath(p1); + break; + + default: + return((struct segment *)BegHandle(p1, p2)); + } + } + + ARGCHECK((p2->last == NULL), "Join: right arg not anchor", p2, NULL, (1,p1), struct segment *); + p2 = UniquePath(p2); + +/* +In certain circumstances, we don't have to duplicate a permanent +location. (We would just end up destroying it anyway). These cases +are when 'p2' begins with a move-type segment: +*/ + if (p2->type == TEXTTYPE || p2->type == MOVETYPE) { + if (p1 == NULL) + return(p2); + if (ISLOCATION(p1)) { + p2->dest.x += p1->dest.x; + p2->dest.y += p1->dest.y; + ConsumePath(p1); + return(p2); + } + } + } + else + return((struct segment *)Unique(p1)); + + if (p1 != NULL) { + if (!ISPATHTYPE(p1->type)) + + switch (p2->type) { + + case REGIONTYPE: + + case STROKEPATHTYPE: + p2 = CoercePath(p2); + break; + + default: + return((struct segment *)EndHandle(p1, p2)); + } + + ARGCHECK((p1->last == NULL), "Join: left arg not anchor", p1, NULL, (1,p2), struct segment *); + p1 = UniquePath(p1); + } + else + return(p2); + +/* +At this point all the checking is done. We have two temporary non-null +path types in 'p1' and 'p2'. If p1 ends with a MOVE, and p2 begins with +a MOVE, we collapse the two MOVEs into one. We enforce the rule that +there may not be two MOVEs in a row: +*/ + + if (p1->last->type == MOVETYPE && p2->type == MOVETYPE) { + p1->last->flag |= p2->flag; + p1->last->dest.x += p2->dest.x; + p1->last->dest.y += p2->dest.y; + POP(p2); + if (p2 == NULL) + return(p1); + } +/* +Now we check for another silly rule. If a path has any TEXTTYPEs, +then it must have only TEXTTYPEs and MOVETYPEs, and furthermore, +it must begin with a TEXTTYPE. This rule makes it easy to check +for the special case of text. If necessary, we will coerce +TEXTTYPEs into paths so we don't mix TEXTTYPEs with normal paths. +*/ + if (p1->type == TEXTTYPE) { + if (p2->type != TEXTTYPE && !ISLOCATION(p2)) + p1 = CoerceText(p1); + } + else { + if (p2->type == TEXTTYPE) { + if (ISLOCATION(p1)) { + p2->dest.x += p1->dest.x; + p2->dest.y += p1->dest.y; + Free(p1); + return(p2); + } + else + p2 = CoerceText(p2); + } + } +/* +Thank God! Finally! It's hard to believe, but we are now able to +actually do the join. This is just invoking the CONCAT macro: +*/ + CONCAT(p1, p2); + + return(p1); +} + +/* +:h3.JoinSegment() - Create a Path Segment and Join It to a Known Path + +This internal function is quicker than a full-fledged join because +it can do much less checking. +*/ + +struct segment *t1_JoinSegment(before, type, x, y, after) + register struct segment *before; /* path to join before new segment */ + int type; /* type of new segment (MOVETYPE or LINETYPE) */ + fractpel x,y; /* x,y of new segment */ + register struct segment *after; /* path to join after new segment */ +{ + register struct segment *r; /* returned path built here */ + + r = PathSegment(type, x, y); + if (before != NULL) { + CONCAT(before, r); + r = before; + } + else + r->context = after->context; + if (after != NULL) + CONCAT(r, after); + return(r); +} + +/* +:h2.Other Path Functions + +*/ + + +struct segment *t1_ClosePath(p0,lastonly) + register struct segment *p0; /* path to close */ + register int lastonly; /* flag deciding to close all subpaths or... */ +{ + register struct segment *p,*last=NULL,*start; /* used in looping through path */ + register fractpel x,y; /* current position in path */ + register fractpel firstx=0,firsty=0; /* start position of sub path */ + register struct segment *lastnonhint=NULL; /* last non-hint segment in path */ + + IfTrace1((MustTraceCalls),"ClosePath(%p)\n", p0); + if (p0 != NULL && p0->type == TEXTTYPE) + return(UniquePath(p0)); + if (p0->type == STROKEPATHTYPE) + return((struct segment *)Unique(p0)); + /* + * NOTE: a null closed path is different from a null open path + * and is denoted by a closed (0,0) move segment. We make + * sure this path begins and ends with a MOVETYPE: + */ + if (p0 == NULL || p0->type != MOVETYPE) + p0 = JoinSegment(NULL, MOVETYPE, 0, 0, p0); + TYPECHECK("ClosePath", p0, MOVETYPE, NULL, (0), struct segment *); + if (p0->last->type != MOVETYPE) + p0 = JoinSegment(p0, MOVETYPE, 0, 0, NULL); + + p0 = UniquePath(p0); + +/* +We now begin a loop through the path, +incrementing current 'x' and 'y'. We are searching +for MOVETYPE segments (breaks in the path) that are not already closed. +At each break, we insert a close segment. +*/ + for (p = p0, x = y = 0, start = NULL; + p != NULL; + x += p->dest.x, y += p->dest.y, last = p, p = p->link) + { + + if (p->type == MOVETYPE) { + if (start != NULL && (lastonly?p->link==NULL:TRUE) && + !(ISCLOSED(start->flag) && LASTCLOSED(last->flag))) { + register struct segment *r; /* newly created */ + + start->flag |= ISCLOSED(ON); + r = PathSegment(LINETYPE, firstx - x, + firsty - y); + INSERT(last, r, p); + r->flag |= LASTCLOSED(ON); + /*< adjust 'last' if possible for a 0,0 close >*/ +{ + +#define CLOSEFUDGE 3 /* if we are this close, let's change last segment */ + + if (r->dest.x != 0 || r->dest.y != 0) { + if (r->dest.x <= CLOSEFUDGE && r->dest.x >= -CLOSEFUDGE + && r->dest.y <= CLOSEFUDGE && r->dest.y >= -CLOSEFUDGE) { + IfTrace2((PathDebug), + "ClosePath forced closed by (%d,%d)\n", + r->dest.x, r->dest.y); + lastnonhint->dest.x += r->dest.x; + lastnonhint->dest.y += r->dest.y; + r->dest.x = r->dest.y = 0; + } + } +} + if (p->link != NULL) { + p->dest.x += x - firstx; + p->dest.y += y - firsty; + x = firstx; + y = firsty; + } + } + start = p; + firstx = x + p->dest.x; + firsty = y + p->dest.y; + } + else if (p->type != HINTTYPE) + lastnonhint = p; + } + return(p0); +} +/* +*/ +/* +:h2.Reversing the Direction of a Path + +This turned out to be more difficult than I thought at first. The +trickiness was due to the fact that closed paths must remain closed, +etc. + +We need three subroutines: +*/ + +static struct segment *SplitPath(); /* break a path at any point */ +static struct segment *DropSubPath(); /* breaks a path after first sub-path */ +static struct segment *ReverseSubPath(); /* reverses a single sub-path */ + +/* +:h3.Reverse() - User Operator to Reverse a Path + +This operator reverses the entire path. +*/ + +struct segment *Reverse(p) + register struct segment *p; /* full path to reverse */ +{ + register struct segment *r; /* output path built here */ + register struct segment *nextp; /* contains next sub-path */ + + IfTrace1((MustTraceCalls),"Reverse(%p)\n", p); + + if (p == NULL) + return(NULL); + + ARGCHECK(!ISPATHANCHOR(p), "Reverse: invalid path", p, NULL, (0), struct segment *); + + if (p->type == TEXTTYPE) + p = CoerceText(p); + p = UniquePath(p); + + r = NULL; + + do { + nextp = DropSubPath(p); + p = ReverseSubPath(p); + r = Join(p, r); + p = nextp; + + } while (p != NULL); + + return(r); +} + +/* +:h4.ReverseSubPath() - Subroutine to Reverse a Single Sub-Path +*/ + +static struct segment *ReverseSubPath(p) + register struct segment *p; /* input path */ +{ + register struct segment *r; /* reversed path will be created here */ + register struct segment *nextp; /* temporary variable used in loop */ + register int wasclosed; /* flag, path was closed */ + + if (p == NULL) + return(NULL); + + wasclosed = ISCLOSED(p->flag); + r = NULL; + + do { +/* +First we reverse the direction of this segment and clean up its flags: +*/ + p->dest.x = - p->dest.x; p->dest.y = - p->dest.y; + p->flag &= ~(ISCLOSED(ON) | LASTCLOSED(ON)); + + switch (p->type) { + + case LINETYPE: + case MOVETYPE: + break; + + case CONICTYPE: + { +/* +The logic of this is that the new M point (stored relative to the new +beginning) is (M - C). However, C ("dest") has already been reversed +So, we add "dest" instead of subtracting it: +*/ + register struct conicsegment *cp = (struct conicsegment *) p; + + cp->M.x += p->dest.x; cp->M.y += p->dest.y; + } + break; + + case BEZIERTYPE: + { + register struct beziersegment *bp = (struct beziersegment *) p; + + bp->B.x += p->dest.x; bp->B.y += p->dest.y; + bp->C.x += p->dest.x; bp->C.y += p->dest.y; + } + break; + + case HINTTYPE: + { + register struct hintsegment *hp = (struct hintsegment *) p; + + hp->ref.x = -hp->ref.x; hp->ref.y = -hp->ref.y; + } + break; + + default: + abort("Reverse: bad path segment", 23); + } +/* +We need to reverse the order of segments too, so we break this segment +off of the input path, and tack it on the front of the growing path +in 'r': +*/ + nextp = p->link; + p->link = NULL; + p->last = p; + if (r != NULL) + CONCAT(p,r); /* leaves result in 'p'... not what we want */ + r = p; + p = nextp; /* advance to next segment in input path */ + + } while (p != NULL); + + if (wasclosed) + r = ClosePath(r); + + return(r); +} + +/* +:h4.DropSubPath() - Drops the First Sub-Path Off a Path + +This subroutine returns the remaining sub-path(s). While doing so, it +breaks the input path after the first sub-path so that a pointer to +the original path now contains the first sub-path only. +*/ + +static struct segment *DropSubPath(p0) + register struct segment *p0; /* original path */ +{ + register struct segment *p; /* returned remainder here */ + + for (p = p0; p->link != NULL; p = p->link) { + if (p->link->type == MOVETYPE) + break; + } + + return(SplitPath(p0, p)); +} + +static struct segment *SplitPath(anchor, before) + register struct segment *anchor; + register struct segment *before; +{ + register struct segment *r; + + if (before == anchor->last) + return(NULL); + + r = before->link; + r->last = anchor->last; + anchor->last = before; + before->link = NULL; + + return(r); +} + + +/* +:h3.ReverseSubPaths() - Reverse the Direction of Sub-paths Within a Path + +This user operator reverses the sub-paths in a path, but leaves the +'move' segments unchanged. It builds on top of the subroutines +already established. +*/ + +struct segment *ReverseSubPaths(p) + register struct segment *p; /* input path */ +{ + register struct segment *r; /* reversed path will be created here */ + register struct segment *nextp; /* temporary variable used in loop */ + int wasclosed; /* flag; subpath was closed */ + register struct segment *nomove; /* the part of sub-path without move segment */ + struct fractpoint delta; + + IfTrace1((MustTraceCalls),"ReverseSubPaths(%p)\n", p); + + if (p == NULL) + return(NULL); + + ARGCHECK(!ISPATHANCHOR(p), "ReverseSubPaths: invalid path", p, NULL, (0), struct segment *); + + if (p->type == TEXTTYPE) + p = CoerceText(p); + if (p->type != MOVETYPE) + p = JoinSegment(NULL, MOVETYPE, 0, 0, p); + + p = UniquePath(p); + + r = NULL; + + for (; p != NULL;) { + nextp = DropSubPath(p); + wasclosed = ISCLOSED(p->flag); + if (wasclosed) + UnClose(p); + + nomove = SplitPath(p, p); + r = Join(r, p); + + PathDelta(nomove, &delta); + + nomove = ReverseSubPath(nomove); + p->dest.x += delta.x; + p->dest.y += delta.y; + if (nextp != NULL) { + nextp->dest.x += delta.x; + nextp->dest.y += delta.y; + } + if (wasclosed) { + nomove = ClosePath(nomove); + nextp->dest.x -= delta.x; + nextp->dest.y -= delta.y; + } + r = Join(r, nomove); + p = nextp; + + } + + return(r); +} + +static int UnClose(p0) + register struct segment *p0; +{ + register struct segment *p; + + for (p=p0; p->link->link != NULL; p=p->link) { ; } + + if (!LASTCLOSED(p->link->flag)) + abort("UnClose: no LASTCLOSED", 24); + + Free(SplitPath(p0, p)); + p0->flag &= ~ISCLOSED(ON); + return(0); + +} + +/* +:h2.Transforming and Putting Handles on Paths + +:h3.PathTransform() - Transform a Path + +Transforming a path involves transforming all the points. In order +that closed paths do not become "unclosed" when their relative +positions are slightly changed due to loss of arithmetic precision, +all point transformations are in absolute coordinates. + +(It might be better to reset the "absolute" coordinates every time a +move segment is encountered. This would mean that we could accumulate +error from subpath to subpath, but we would be less likely to make +the "big error" where our fixed point arithmetic "wraps". However, I +think I'll keep it this way until something happens to convince me +otherwise.) + +The transform is described as a "space", that way we can use our +old friend the "iconvert" function, which should be very efficient. +*/ + +struct segment *PathTransform(p0, S) + register struct segment *p0; /* path to transform */ + register struct XYspace *S; /* pseudo space to transform in */ +{ + register struct segment *p; /* to loop through path with */ + register fractpel newx,newy; /* current transformed position in path */ + register fractpel oldx,oldy; /* current untransformed position in path */ + register fractpel savex,savey; /* save path delta x,y */ + + p0 = UniquePath(p0); + + newx = newy = oldx = oldy = 0; + + for (p=p0; p != NULL; p=p->link) { + + savex = p->dest.x; savey = p->dest.y; + + (*S->iconvert)(&p->dest, S, p->dest.x + oldx, p->dest.y + oldy); + p->dest.x -= newx; + p->dest.y -= newy; + + switch (p->type) { + + case LINETYPE: + case MOVETYPE: + break; + + case CONICTYPE: + { + register struct conicsegment *cp = (struct conicsegment *) p; + + (*S->iconvert)(&cp->M, S, cp->M.x + oldx, cp->M.y + oldy); + cp->M.x -= newx; + cp->M.y -= newy; + /* + * Note roundness doesn't change... linear transform + */ + break; + } + + + case BEZIERTYPE: + { + register struct beziersegment *bp = (struct beziersegment *) p; + + (*S->iconvert)(&bp->B, S, bp->B.x + oldx, bp->B.y + oldy); + bp->B.x -= newx; + bp->B.y -= newy; + (*S->iconvert)(&bp->C, S, bp->C.x + oldx, bp->C.y + oldy); + bp->C.x -= newx; + bp->C.y -= newy; + break; + } + + case HINTTYPE: + { + register struct hintsegment *hp = (struct hintsegment *) p; + + (*S->iconvert)(&hp->ref, S, hp->ref.x + oldx, hp->ref.y + oldy); + hp->ref.x -= newx; + hp->ref.y -= newy; + (*S->iconvert)(&hp->width, S, hp->width.x, hp->width.y); + /* Note: width is not relative to origin */ + break; + } + + case TEXTTYPE: + { + XformText(p,S); + break; + } + + default: + IfTrace1(TRUE,"path = %p\n", p); + abort("PathTransform: invalid segment", 25); + } + oldx += savex; + oldy += savey; + newx += p->dest.x; + newy += p->dest.y; + } + return(p0); +} + +/* +:h3.PathDelta() - Return a Path's Ending Point +*/ + +void PathDelta(p, pt) + register struct segment *p; /* input path */ + register struct fractpoint *pt; /* pointer to x,y to set */ +{ + struct fractpoint mypoint; /* I pass this to TextDelta */ + register fractpel x,y; /* working variables for path current point */ + + for (x=y=0; p != NULL; p=p->link) { + x += p->dest.x; + y += p->dest.y; + if (p->type == TEXTTYPE) { + TextDelta(p, &mypoint); + x += mypoint.x; + y += mypoint.y; + } + } + + pt->x = x; + pt->y = y; +} + +/* +:h3.BoundingBox() - Produce a Bounding Box Path + +This function is called by image code, when we know the size of the +image in pels, and need to get a bounding box path that surrounds it. +The starting/ending handle is in the lower right hand corner. +*/ +struct segment *BoundingBox(h, w) + register pel h,w; /* size of box */ +{ + register struct segment *path; + + path = PathSegment(LINETYPE, -TOFRACTPEL(w), 0); + path = JoinSegment(NULL, LINETYPE, 0, -TOFRACTPEL(h), path); + path = JoinSegment(NULL, LINETYPE, TOFRACTPEL(w), 0, path); + path = ClosePath(path); + + return(path); +} + +/* +:h2.Querying Locations and Paths + +:h3.QueryLoc() - Return the X,Y of a Locition +*/ + +void QueryLoc(P, S, xP, yP) + register struct segment *P; /* location to query, not consumed */ + register struct XYspace *S; /* XY space to return coordinates in */ + register DOUBLE *xP,*yP; /* coordinates returned here */ +{ + IfTrace4((MustTraceCalls),"QueryLoc(P=%p, S=%p, (%f, %f))\n", + P, S, *xP, *yP); + if (!ISLOCATION(P)) { + ArgErr("QueryLoc: first arg not a location", P, NULL); + return; + } + if (S->type != SPACETYPE) { + ArgErr("QueryLoc: second arg not a space", S, NULL); + return; + } + UnConvert(S, &P->dest, xP, yP); +} +/* +:h3.QueryPath() - Find Out the Type of Segment at the Head of a Path + +This is a very simple routine that looks at the first segment of a +path and tells the caller what it is, as well as returning the control +point(s) of the path segment. Different path segments have different +number of control points. If the caller knows that the segment is +a move segment, for example, he only needs to pass pointers to return +one control point. +*/ + +void QueryPath(path, typeP, Bp, Cp, Dp, fP) + register struct segment *path; /* path to check */ + register int *typeP; /* return the type of path here */ + register struct segment **Bp; /* return location of first point */ + register struct segment **Cp; /* return location of second point */ + register struct segment **Dp; /* return location of third point */ + register DOUBLE *fP; /* return Conic sharpness */ +{ + register int coerced = FALSE; /* did I coerce a text path? */ + + IfTrace3((MustTraceCalls), "QueryPath(%p, %p, %p, ...)\n", + path, typeP, Bp); + if (path == NULL) { + *typeP = -1; + return; + } + if (!ISPATHANCHOR(path)) { + ArgErr("QueryPath: arg not a valid path", path, NULL); + } + if (path->type == TEXTTYPE) { + path = CoerceText(path); + coerced = TRUE; + } + + switch (path->type) { + + case MOVETYPE: + *typeP = 0; + *Bp = PathSegment(MOVETYPE, path->dest.x, path->dest.y); + break; + + case LINETYPE: + *typeP = (LASTCLOSED(path->flag)) ? 4 : 1; + *Bp = PathSegment(MOVETYPE, path->dest.x, path->dest.y); + break; + + case CONICTYPE: + { + register struct conicsegment *cp = (struct conicsegment *) path; + + *typeP = 2; + *Bp = PathSegment(MOVETYPE, cp->M.x, cp->M.y); + *Cp = PathSegment(MOVETYPE, cp->dest.x, cp->dest.y); + *fP = cp->roundness; + } + break; + + case BEZIERTYPE: + { + register struct beziersegment *bp = (struct beziersegment *) path; + + *typeP = 3; + *Bp = PathSegment(MOVETYPE, bp->B.x, bp->B.y); + *Cp = PathSegment(MOVETYPE, bp->C.x, bp->C.y); + *Dp = PathSegment(MOVETYPE, bp->dest.x, bp->dest.y); + } + break; + + case HINTTYPE: + *typeP = 5; + break; + + default: + abort("QueryPath: unknown segment", 26); + } + if (coerced) + KillPath(path); +} +/* +:h3.QueryBounds() - Return the Bounding Box of a Path + +Returns the bounding box by setting the user's variables. +*/ + +void QueryBounds(p0, S, xminP, yminP, xmaxP, ymaxP) + register struct segment *p0; /* object to check for bound */ + struct XYspace *S; /* coordinate space of returned values */ + DOUBLE *xminP,*yminP; /* lower left hand corner (set by routine) */ + DOUBLE *xmaxP,*ymaxP; /* upper right hand corner (set by routine) */ +{ + register struct segment *path; /* loop variable for path segments */ + register fractpel lastx,lasty; /* loop variables: previous endingpoint */ + register fractpel x,y; /* loop variables: current ending point */ + struct fractpoint min; /* registers to keep lower left hand corner */ + struct fractpoint max; /* registers to keep upper right hand corner */ + int coerced = FALSE; /* we have coerced the path from another object */ + DOUBLE x1,y1,x2,y2,x3,y3,x4,y4; /* corners of rectangle in space X */ + + IfTrace2((MustTraceCalls), "QueryBounds(%p, %p,", p0, S); + IfTrace4((MustTraceCalls), " %p, %p, %p, %p)\n", + xminP, yminP, xmaxP, ymaxP); + if (S->type != SPACETYPE) { + ArgErr("QueryBounds: bad XYspace", S, NULL); + return; + } + + min.x = min.y = max.x = max.y = 0; + if (p0 != NULL) { + if (!ISPATHANCHOR(p0)) { + switch(p0->type) { + case STROKEPATHTYPE: + /* replaced DupStrokePath() with Dup() 3-26-91 PNM */ + p0 = (struct segment *) DoStroke(Dup(p0)); + /* no break here, we have a region in p0 */ + case REGIONTYPE: + p0 = RegionBounds(p0); + break; + + case PICTURETYPE: + p0 = PictureBounds(p0); + break; + + default: + ArgErr("QueryBounds: bad object", p0, NULL); + return; + } + coerced = TRUE; + } + if (p0->type == TEXTTYPE) { + /* replaced CopyPath() with Dup() 3-26-91 PNM */ + p0 = (struct segment *)CoerceText(Dup(p0)); /* there are faster ways */ + coerced = TRUE; + } + if (p0->type == MOVETYPE) { + min.x = max.x = p0->dest.x; + min.y = max.y = p0->dest.y; + } + } + lastx = lasty = 0; + + for (path = p0; path != NULL; path = path->link) { + + x = lastx + path->dest.x; + y = lasty + path->dest.y; + + switch (path->type) { + + case LINETYPE: + break; + + case CONICTYPE: + { + register struct conicsegment *cp = (struct conicsegment *) path; + register fractpel Mx = lastx + cp->M.x; + register fractpel My = lasty + cp->M.y; + register fractpel deltax = 0.5 * cp->roundness * cp->dest.x; + register fractpel deltay = 0.5 * cp->roundness * cp->dest.y; + register fractpel Px = Mx - deltax; + register fractpel Py = My - deltay; + register fractpel Qx = Mx + deltax; + register fractpel Qy = My + deltay; + + + if (Mx < min.x) min.x = Mx; + else if (Mx > max.x) max.x = Mx; + if (My < min.y) min.y = My; + else if (My > max.y) max.y = My; + + if (Px < min.x) min.x = Px; + else if (Px > max.x) max.x = Px; + if (Py < min.y) min.y = Py; + else if (Py > max.y) max.y = Py; + + if (Qx < min.x) min.x = Qx; + else if (Qx > max.x) max.x = Qx; + if (Qy < min.y) min.y = Qy; + else if (Qy > max.y) max.y = Qy; + } + break; + + + case MOVETYPE: + /* + * We can't risk adding trailing Moves to the + * bounding box: + */ + if (path->link == NULL) + goto done; /* God forgive me */ + break; + + case BEZIERTYPE: + { + register struct beziersegment *bp = (struct beziersegment *) path; + register fractpel Bx = lastx + bp->B.x; + register fractpel By = lasty + bp->B.y; + register fractpel Cx = lastx + bp->C.x; + register fractpel Cy = lasty + bp->C.y; + + if (Bx < min.x) min.x = Bx; + else if (Bx > max.x) max.x = Bx; + if (By < min.y) min.y = By; + else if (By > max.y) max.y = By; + + if (Cx < min.x) min.x = Cx; + else if (Cx > max.x) max.x = Cx; + if (Cy < min.y) min.y = Cy; + else if (Cy > max.y) max.y = Cy; + } + break; + + case HINTTYPE: + break; + default: + abort("QueryBounds: unknown type", 27); + } + + if (x < min.x) min.x = x; + else if (x > max.x) max.x = x; + if (y < min.y) min.y = y; + else if (y > max.y) max.y = y; + + lastx = x; lasty = y; + } +done: + UnConvert(S, &min, &x1, &y1); + UnConvert(S, &max, &x4, &y4); + x = min.x; min.x = max.x; max.x = x; + UnConvert(S, &min, &x2, &y2); + UnConvert(S, &max, &x3, &y3); + + *xminP = *xmaxP = x1; + if (x2 < *xminP) *xminP = x2; + else if (x2 > *xmaxP) *xmaxP = x2; + if (x3 < *xminP) *xminP = x3; + else if (x3 > *xmaxP) *xmaxP = x3; + if (x4 < *xminP) *xminP = x4; + else if (x4 > *xmaxP) *xmaxP = x4; + + *yminP = *ymaxP = y1; + if (y2 < *yminP) *yminP = y2; + else if (y2 > *ymaxP) *ymaxP = y2; + if (y3 < *yminP) *yminP = y3; + else if (y3 > *ymaxP) *ymaxP = y3; + if (y4 < *yminP) *yminP = y4; + else if (y4 > *ymaxP) *ymaxP = y4; + + if (coerced) + Destroy(p0); +} +/* +:h3.BoxPath() +*/ +struct segment *BoxPath(S, h, w) + struct XYspace *S; + int h,w; +{ + struct segment *path; + + path = Join( Line(ILoc(S, w, 0)), Line(ILoc(S, 0, h)) ); + path = JoinSegment(path, LINETYPE, -path->dest.x, -path->dest.y, NULL); + return(ClosePath(path)); +} + +/* +:h3.DropSegment() - Drop the First Segment in a Path + +This routine takes the path and returns a new path that is one segment +shorter. It can be used in conjunction with QueryPath(), for example, +to ask about an entire path. +*/ + +struct segment *DropSegment(path) + register struct segment *path; +{ + IfTrace1((MustTraceCalls),"DropSegment(%p)\n", path); + if (path != NULL && path->type == STROKEPATHTYPE) + path = CoercePath(path); + ARGCHECK((path == NULL || !ISPATHANCHOR(path)), + "DropSegment: arg not a non-null path", path, path, (0), struct segment *); + if (path->type == TEXTTYPE) + path = CoerceText(path); + path = UniquePath(path); + + POP(path); + return(path); +} +/* +:h3.HeadSegment() - Return the First Segment in a Path + +This routine takes the path and returns a new path consists of the +first segment only. +*/ + +struct segment *HeadSegment(path) + register struct segment *path; /* input path */ +{ + IfTrace1((MustTraceCalls),"HeadSegment(%p)\n", path); + if (path == NULL) + return(NULL); + if (path->type == STROKEPATHTYPE) + path = CoercePath(path); + ARGCHECK(!ISPATHANCHOR(path), "HeadSegment: arg not a path", path, path, (0), struct segment *); + if (path->type == TEXTTYPE) + path = CoerceText(path); + path = UniquePath(path); + + if (path->link != NULL) + KillPath(path->link); + path->link = NULL; + path->last = path; + return(path); +} + +/* +:h2.Path Debug Routines + +:h3.DumpPath() - Display a Path on the Trace File + removed by RMz, 1999-06-07 +*/ + +/* +void DumpPath(p) + register struct segment *p; +{ + register fractpel x,y; + register fractpel lastx,lasty; + DOUBLE roundness; + + IfTrace1(TRUE,"Dumping path, anchor=%p:\n", p); + lastx = lasty = 0; + + for (;p != NULL; p=p->link) { + + IfTrace0(TRUE,". "); + x = p->dest.x; + y = p->dest.y; + switch (p->type) { + + case LINETYPE: + IfTrace1(TRUE,". line<%x> to", (LONG) p->flag); + IfTrace4(TRUE," (%d,%d), delta=(%d,%d)", + x + lastx, y + lasty, x, y); + break; + + case MOVETYPE: + IfTrace1(TRUE,"MOVE<%x> to", (LONG) p->flag); + IfTrace4(TRUE,"(%d,%d), delta=(%d,%d)", + x + lastx, y + lasty, x, y); + break; + + case CONICTYPE: + { + register struct conicsegment *cp = (struct conicsegment *) p; + + roundness = cp->roundness; + IfTrace2(TRUE, ". conic to (%d,%d),", + x + lastx, y + lasty); + IfTrace3(TRUE," M=(%d,%d), r=%p", cp->M.x + lastx, + cp->M.y + lasty, &roundness); + } + break; + + case BEZIERTYPE: + { + register struct beziersegment *bp = (struct beziersegment *) p; + + IfTrace4(TRUE,". bezier to (%d,%d), B=(%d,%d)", + x + lastx, y + lasty, + bp->B.x + lastx, bp->B.y + lasty); + IfTrace2(TRUE, ", C=(%d,%d)", + bp->C.x + lastx, bp->C.y + lasty); + } + break; + + case HINTTYPE: + { + register struct hintsegment *hp = (struct hintsegment *) p; + + IfTrace4(TRUE,". hint ref=(%d,%d), width=(%d,%d)", + hp->ref.x + lastx, hp->ref.y + lasty, + hp->width.x, hp->width.y); + IfTrace4(TRUE, ", %c %c %c %c", + hp->orientation, hp->hinttype, + hp->adjusttype, hp->direction); + IfTrace1(TRUE, ", %d", (LONG) hp->label); + } + break; + + case TEXTTYPE: + DumpText(p); + break; + + default: + IfTrace0(TRUE, "bad path segment?"); + } + IfTrace1(TRUE," at %p\n", p); + lastx += x; + lasty += y; + } +} + +*/ diff -Naur xdvik-22.40l/libs/type1/paths.h xdvik-22.40n/libs/type1/paths.h --- xdvik-22.40l/libs/type1/paths.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/paths.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,199 @@ +/* $XConsortium: paths.h,v 1.2 91/10/10 11:18:50 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + +#include "types.h" + +#define Loc(S,x,y) t1_Loc(S,(DOUBLE)x,(DOUBLE)y) +#define ILoc(S,x,y) t1_ILoc(S,x,y) +#define Line(P) t1_Line(P) +#define Join(p1,p2) t1_Join(p1,p2) +#define ClosePath(p) t1_ClosePath(p,0) +#define CloseLastSubPath(p) t1_ClosePath(p,1) +#define Conic(B,C,s) t1_Conic(B,C,(DOUBLE)s) +#define RoundConic(M,C,r) t1_RoundConic(M,C,(DOUBLE)r) +#define ArcP3(S,P2,P3) t1_ArcP3(S,P2,P3) +#define ArcCA(S,C,d) t1_ArcCA(S,C,(DOUBLE)d) +#define Bezier(B,C,D) t1_Bezier(B,C,D) +#define Hint(S,r,w,o,h,a,d,l) t1_Hint(S,r,w,o,h,a,d,l) +#define Reverse(p) t1_Reverse(p) +#define ReverseSubPaths(p) t1_ReverseSubPaths(p) +#define AddLoc(p1,p2) t1_Join(p1,p2) +#define SubLoc(p1,p2) t1_SubLoc(p1,p2) +#define DropSegment(p) t1_DropSegment(p) +#define HeadSegment(p) t1_HeadSegment(p) +#define QueryLoc(P,S,x,y) t1_QueryLoc(P,S,x,y) +#define QueryPath(p,t,B,C,D,r) t1_QueryPath(p,t,B,C,D,r) +#define QueryBounds(p,S,x1,y1,x2,y2) t1_QueryBounds(p,S,x1,y1,x2,y2) + + +struct segment *t1_Loc(); /* create a location object (or "move" segment) */ +struct segment *t1_ILoc(); /* integer argument version of same */ +struct segment *t1_Line(); /* straight line path segment */ +struct segment *t1_Join(); /* join two paths or regions together */ +struct segment *t1_ClosePath(); /* close a path or path set */ +struct conicsegment *t1_Conic(); /* conic curve path segment */ +struct conicsegment *t1_RoundConic(); /* ditto, specified another way */ +struct conicsegment *t1_ArcP3(); /* circular path segment with three points */ +struct conicsegment *t1_ArcCA(); /* ditto, with center point and angle */ +struct beziersegment *t1_Bezier(); /* Bezier third order curve path segment */ +struct hintsegment *t1_Hint(); /* produce a font 'hint' path segment */ +struct segment *t1_Reverse(); /* reverse the complete order of paths */ +struct segment *t1_ReverseSubPaths(); /* reverse only sub-paths; moves unchanged */ +struct segment *t1_SubLoc(); /* subtract two location objects */ +struct segment *t1_DropSegment(); /* Drop the first segment in a path */ +struct segment *t1_HeadSegment(); /* return the first segment in a path */ +void t1_QueryLoc(); /* Query location; return its (x,y) */ +void t1_QueryPath(); /* Query segment at head of a path */ +void t1_QueryBounds(); /* Query the bounding box of a path */ + +/*END SHARED*/ +/*SHARED*/ + +#define CopyPath(p) t1_CopyPath(p) +#define KillPath(p) t1_KillPath(p) +#define PathTransform(p,m) t1_PathXform(p,m) +#define PathDelta(p,pt) t1_PathDelta(p,pt) +#define BoundingBox(h,w) t1_BoundingBox(h,w) +#define PathSegment(t,x,y) t1_PathSegment(t,(fractpel)x,(fractpel)y) +#define JoinSegment(b,t,x,y,a) t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a) +#define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy) +#define BoxPath(S,h,w) t1_BoxPath(S,h,w) + +struct segment *t1_CopyPath(); /* duplicate a path */ +void t1_KillPath(); /* destroy a path */ +struct segment *t1_PathXform(); /* transform a path arbitrarily */ +void t1_PathDelta(); /* calculate the ending point of a path */ +struct segment *t1_PathSegment(); /* produce a MOVE or LINE segment */ +struct segment *t1_JoinSegment(); /* join a MOVE or LINE segment to a path */ +DOUBLE t1_Hypoteneuse(); /* returns the length of a line */ +struct segment *t1_BoxPath(); /* returns a rectangular path */ + +/*END SHARED*/ +/*SHARED*/ + +#define ConsumePath(p) MAKECONSUME(p,KillPath(p)) +#define UniquePath(p) MAKEUNIQUE(p,CopyPath(p)) + +/*END SHARED*/ +/*SHARED*/ + +struct segment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + unsigned char size; /* size of the structure */ + unsigned char context; /* index to device context */ + struct segment *link; /* pointer to next structure in linked list */ + struct segment *last; /* pointer to last structure in list */ + struct fractpoint dest; /* relative ending location of path segment */ +} ; + +#define ISCLOSED(flag) ((flag)&0x80) /* subpath is closed */ +#define LASTCLOSED(flag) ((flag)&0x40) /* last segment in closed subpath */ + +/* +NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the +subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE) +in the subpath + +We define the ISPATHANCHOR predicate to test that a path handle +passed by the user is valid: +*/ + +#define ISPATHANCHOR(p) (ISPATHTYPE(p->type)&&p->last!=NULL) + +/* +For performance reasons, a user's "location" object is identical to +a path whose only segment is a move segment. We define a predicate +to test for this case. See also :hdref refid=location.. +*/ + +#define ISLOCATION(p) ((p)->type == MOVETYPE && (p)->link == NULL) + +/*END SHARED*/ +/*SHARED*/ + +struct conicsegment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = CONICTYPE */ + unsigned char size; /* as with any 'segment' type */ + unsigned char context; /* as with any 'segment' type */ + struct segment *link; /* as with any 'segment' type */ + struct segment *last; /* as with any 'segment' type */ + struct fractpoint dest; /* Ending point (C point) */ + struct fractpoint M; /* "midpoint" of conic explained above */ + float roundness; /* explained above */ +} ; +/*END SHARED*/ +/*SHARED*/ + +struct beziersegment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = BEZIERTYPE */ + unsigned char size; /* as with any 'segment' type */ + unsigned char context; /* as with any 'segment' type */ + struct segment *link; /* as with any 'segment' type */ + struct segment *last; /* as with any 'segment' type */ + struct fractpoint dest; /* ending point (D) */ + struct fractpoint B; /* control point B */ + struct fractpoint C; /* control point C */ +} ; + +/*END SHARED*/ +/*SHARED*/ + +struct hintsegment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = HINTTYPE */ + unsigned char size; /* size of the structure */ + unsigned char context; /* device context */ + struct segment *link; /* pointer to next structure in linked list */ + struct segment *last; /* pointer to last structure in list */ + struct fractpoint dest; /* ALWAYS 0,0 */ + struct fractpoint ref; + struct fractpoint width; + char orientation; + char hinttype; + char adjusttype; + char direction; + int label; +} ; + +/*END SHARED*/ +/*SHARED*/ + +/* +CONCAT links the 'p2' path chain on the end of the 'p1' chain. (This macro +is also used by the STROKES module.) +*/ +#define CONCAT(p1, p2) { \ + p1->last->link = p2; /* link p2 on end of p1 */ \ + p1->last = p2->last; /* last of new is last of p2 */ \ + p2->last = NULL; } /* only first segment has non-NULL "last" */ + +/*END SHARED*/ diff -Naur xdvik-22.40l/libs/type1/paths_rmz.h xdvik-22.40n/libs/type1/paths_rmz.h --- xdvik-22.40l/libs/type1/paths_rmz.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/paths_rmz.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,210 @@ +/* $XConsortium: paths.h,v 1.2 91/10/10 11:18:50 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + +#include "types.h" + + +#define XOBJ_COMMON char type; unsigned char flag; short references; +#include "spaces_rmz.h" + + + +/* + +#define Loc(S,x,y) t1_Loc(S,(DOUBLE)x,(DOUBLE)y) +#define ILoc(S,x,y) t1_ILoc(S,x,y) +#define Line(P) t1_Line(P) +#define Join(p1,p2) t1_Join(p1,p2) +#define ClosePath(p) t1_ClosePath(p,0) +#define CloseLastSubPath(p) t1_ClosePath(p,1) +#define Conic(B,C,s) t1_Conic(B,C,(DOUBLE)s) +#define RoundConic(M,C,r) t1_RoundConic(M,C,(DOUBLE)r) +#define ArcP3(S,P2,P3) t1_ArcP3(S,P2,P3) +#define ArcCA(S,C,d) t1_ArcCA(S,C,(DOUBLE)d) +#define Bezier(B,C,D) t1_Bezier(B,C,D) +#define Hint(S,r,w,o,h,a,d,l) t1_Hint(S,r,w,o,h,a,d,l) +#define Reverse(p) t1_Reverse(p) +#define ReverseSubPaths(p) t1_ReverseSubPaths(p) +#define AddLoc(p1,p2) t1_Join(p1,p2) +#define SubLoc(p1,p2) t1_SubLoc(p1,p2) +#define DropSegment(p) t1_DropSegment(p) +#define HeadSegment(p) t1_HeadSegment(p) +#define QueryLoc(P,S,x,y) t1_QueryLoc(P,S,x,y) +#define QueryPath(p,t,B,C,D,r) t1_QueryPath(p,t,B,C,D,r) +#define QueryBounds(p,S,x1,y1,x2,y2) t1_QueryBounds(p,S,x1,y1,x2,y2) + +*/ + +/* +struct segment *t1_Loc(); +struct segment *t1_ILoc(); +struct segment *t1_Line(); +struct segment *t1_Join(); +struct segment *t1_ClosePath(); +struct conicsegment *t1_Conic(); +struct conicsegment *t1_RoundConic(); +struct conicsegment *t1_ArcP3(); +struct conicsegment *t1_ArcCA(); +struct beziersegment *t1_Bezier(); +struct hintsegment *t1_Hint(); +struct segment *t1_Reverse(); +struct segment *t1_ReverseSubPaths(); +struct segment *t1_SubLoc(); +struct segment *t1_DropSegment(); +struct segment *t1_HeadSegment(); +void t1_QueryLoc(); +void t1_QueryPath(); +void t1_QueryBounds(); + +*/ +/*END SHARED*/ +/*SHARED*/ + +#define CopyPath(p) t1_CopyPath(p) +#define KillPath(p) t1_KillPath(p) +#define PathTransform(p,m) t1_PathXform(p,m) +#define PathDelta(p,pt) t1_PathDelta(p,pt) +#define BoundingBox(h,w) t1_BoundingBox(h,w) +#define PathSegment(t,x,y) t1_PathSegment(t,(fractpel)x,(fractpel)y) +#define JoinSegment(b,t,x,y,a) t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a) +#define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy) +#define BoxPath(S,h,w) t1_BoxPath(S,h,w) + +struct segment *t1_CopyPath(); /* duplicate a path */ +void t1_KillPath(); /* destroy a path */ +struct segment *t1_PathXform(); /* transform a path arbitrarily */ +void t1_PathDelta(); /* calculate the ending point of a path */ +struct segment *t1_PathSegment(); /* produce a MOVE or LINE segment */ +struct segment *t1_JoinSegment(); /* join a MOVE or LINE segment to a path */ +DOUBLE t1_Hypoteneuse(); /* returns the length of a line */ +struct segment *t1_BoxPath(); /* returns a rectangular path */ + +/*END SHARED*/ +/*SHARED*/ + +#define ConsumePath(p) MAKECONSUME(p,KillPath(p)) +#define UniquePath(p) MAKEUNIQUE(p,CopyPath(p)) + +/*END SHARED*/ +/*SHARED*/ + +struct segment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + unsigned char size; /* size of the structure */ + unsigned char context; /* index to device context */ + struct segment *link; /* pointer to next structure in linked list */ + struct segment *last; /* pointer to last structure in list */ + struct fractpoint dest; /* relative ending location of path segment */ +} ; + +#define ISCLOSED(flag) ((flag)&0x80) /* subpath is closed */ +#define LASTCLOSED(flag) ((flag)&0x40) /* last segment in closed subpath */ + +/* +NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the +subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE) +in the subpath + +We define the ISPATHANCHOR predicate to test that a path handle +passed by the user is valid: +*/ + +#define ISPATHANCHOR(p) (ISPATHTYPE(p->type)&&p->last!=NULL) + +/* +For performance reasons, a user's "location" object is identical to +a path whose only segment is a move segment. We define a predicate +to test for this case. See also :hdref refid=location.. +*/ + +#define ISLOCATION(p) ((p)->type == MOVETYPE && (p)->link == NULL) + +/*END SHARED*/ +/*SHARED*/ + +struct conicsegment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = CONICTYPE */ + unsigned char size; /* as with any 'segment' type */ + unsigned char context; /* as with any 'segment' type */ + struct segment *link; /* as with any 'segment' type */ + struct segment *last; /* as with any 'segment' type */ + struct fractpoint dest; /* Ending point (C point) */ + struct fractpoint M; /* "midpoint" of conic explained above */ + float roundness; /* explained above */ +} ; +/*END SHARED*/ +/*SHARED*/ + +struct beziersegment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = BEZIERTYPE */ + unsigned char size; /* as with any 'segment' type */ + unsigned char context; /* as with any 'segment' type */ + struct segment *link; /* as with any 'segment' type */ + struct segment *last; /* as with any 'segment' type */ + struct fractpoint dest; /* ending point (D) */ + struct fractpoint B; /* control point B */ + struct fractpoint C; /* control point C */ +} ; + +/*END SHARED*/ +/*SHARED*/ + +struct hintsegment { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = HINTTYPE */ + unsigned char size; /* size of the structure */ + unsigned char context; /* device context */ + struct segment *link; /* pointer to next structure in linked list */ + struct segment *last; /* pointer to last structure in list */ + struct fractpoint dest; /* ALWAYS 0,0 */ + struct fractpoint ref; + struct fractpoint width; + char orientation; + char hinttype; + char adjusttype; + char direction; + int label; +} ; + +/*END SHARED*/ +/*SHARED*/ + +/* +CONCAT links the 'p2' path chain on the end of the 'p1' chain. (This macro +is also used by the STROKES module.) +*/ +#define CONCAT(p1, p2) { \ + (struct segment *)(p1)->last->link = (struct segment *)p2; \ + (struct segment *)(p1)->last = p2->last; \ + (struct segment *)(p2)->last = NULL; } + +/*END SHARED*/ diff -Naur xdvik-22.40l/libs/type1/pictures.h xdvik-22.40n/libs/type1/pictures.h --- xdvik-22.40l/libs/type1/pictures.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/pictures.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,48 @@ +/* $XConsortium: pictures.h,v 1.2 91/10/10 11:18:53 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* STUB */ + +#define CopyPicture(p) p +#define UniquePicture(p) p +/* #define KillPicture(p) */ +#define BegHandle(o,m) o +#define EndHandle(o,m) o +#define PictureBounds(P) P + +struct picture { + struct fractpoint origin; + struct fractpoint ending; +}; + +#define Phantom(o) t1_Phantom(o) +#define Snap(o) t1_Snap(o) + +struct segment *t1_Phantom(); +struct segment *t1_Snap(); diff -Naur xdvik-22.40l/libs/type1/regions.c xdvik-22.40n/libs/type1/regions.c --- xdvik-22.40l/libs/type1/regions.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/regions.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1780 @@ +/* $XConsortium: regions.c,v 1.4 91/10/10 11:18:57 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + /* REGIONS CWEB V0023 LOTS */ +/* +:h1 id=regions.REGIONS Module - Regions Operator Handler + +This module is responsible for creating and manipulating regions. + +&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) + + +:h3.Include Files + +The included files are: +*/ + +#include +#include + +#include "types.h" +#include "objects.h" +#include "spaces.h" +#include "regions.h" +#include "paths.h" +#include "curves.h" +#include "lines.h" +#include "pictures.h" +#include "fonts.h" +#include "hints.h" +#include "strokes.h" /* to pick up 'DoStroke' */ +static int Unwind(); +static int newfilledge(); +static struct edgelist *splitedge(); +static int vertjoin(); +static int touches(); +static int crosses(); +static int edgemin(); +static int edgemax(); +static int discard(); +static int edgecheck(); +static struct edgelist *NewEdge(); +struct edgelist *swathxsort(); /* 'SortSwath' function */ +extern struct XYspace *IDENTITY; + +/* +:h3.Functions Provided to the TYPE1IMAGER User + +This module provides the following TYPE1IMAGER entry points: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Functions Provided to Other Modules + +This module provides the following entry points to other modules: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Macros Provided to Other Modules + +:h4.GOING_TO() - Macro Predicate Needed for Changing Direction, Etc. + +The actual generation of run end lists (edge boundaries) is left +to the low level rasterizing modules, LINES and CURVES. There +are some global region-type +questions that occur when doing a low-level +rasterization: +:ol. +:li.Did we just change direction in Y and therefore need to start +a new edge? +:li.Did we run out of allocated edge space? +:li.Do the minimum or maximum X values for the current edge need +updating? +:eol. +In general the REGIONS is not smart enough to answer those questions +itself. (For example, determining if and when a curve changes direction +may need detailed curve knowledge.) Yet, this must be done efficiently. +We provide a macro "GOING_TO" where the invoker tells us where it is +heading for (x2,y2), plus where it is now (x1,y1), plus the current +region under construction, and the macro answers the questions above. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h2.Data Structures Used to Represent Regions + +:h3.The "region" Structure + +The region structure is an anchor for a linked list of "edgelist" +structures (see :hdref refid=edgelist..). It also summarizes the +information in the edgelist structures (for example, the bounding +box of the region). And, it contains scratch areas used during +the creation of a region. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +The ISOPTIMIZED flag tells us if we've put a permanent region in +'optimal' form. +*/ +#define ISOPTIMIZED(flag) ((flag)&0x10) + +/* +The ISRECTANGULAR flag tells us if a region is a rectangle. We don't +always notice rectangles--if this flag is set, the region definitely +is a rectangle, but some rectangular regions will not have the flag +set. The flag is used to optimize some paths. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h4."INFINITY" - A Constant Region Structure of Infinite Extent + +Infinity is the complement of a null area: +Note - removed the refcount = 1 init, replaced with references = 2 3-26-91 PNM +*/ +static struct region infinity = { REGIONTYPE, + ISCOMPLEMENT(ON)+ISINFINITE(ON)+ISPERMANENT(ON)+ISIMMORTAL(ON), 2, + {0, 0}, {0, 0}, + 0, 0, 0, 0, + NULL, NULL, + 0, 0, 0, 0, 0, NULL, NULL, + NULL, 0, NULL, NULL }; +/* we rename INFINITY to T1_INFINITY. Anyhow it is currently not used */ +struct region *T1_INFINITY = &infinity; + +/* +:h4."EmptyRegion" - A Region Structure with Zero Area + +This structure is used to initialize the region to be built in +Interior(): +Note - replaced refcount = 1 init with references = 2 3-26-91 PNM +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +struct region EmptyRegion = { REGIONTYPE, + ISPERMANENT(ON)+ISIMMORTAL(ON), 2, + {0, 0}, {0, 0}, + MAXPEL, MAXPEL, MINPEL, MINPEL, + NULL, NULL, + 0, 0, 0, 0, 0, NULL, NULL, + NULL, 0, NULL, NULL }; + +/* +:h3 id=edgelist.The "edgelist" Structure + +Regions are represented by a linked list of 'edgelist' structures. +When a region is complete, the structures are paired, one for the +left and one for the right edge. While a region is being built, +this rule may be violated temporarily. + +An 'edgelist' structure contains the X values for a given span +of Y values. The (X,Y) pairs define an edge. We use the crack +and edge coordinate system, so that integer values of X and Y +go between pels. The edge is defined between the minimum Y and +maximum Y. + +The linked list is kept sorted from top to bottom, that is, in +increasing y. Also, if 'e1' is an edgelist structure and 'e2' is the +next one in the list, they must have exactly the same ymin,ymax values +or be totally disjoint. These two requirements mean that if e2's ymin +is less than e1's ymax, it must be exactly equal to e1's ymin. A +sublist of structures with identical ymin and ymax values is called a +'swath'. + +In addition, edgelist structures are separately linked together based +on what subpath originally created them; each subpath is kept as a +separate circular linked list. This information is ignored unless +continuity checking is invoked. See :hdref refid=subpath. for a +complete description of this. +*/ + + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +The "edgelist" structure follows the convention of TYPE1IMAGER user +objects, having a type field and a flag field as the first two +elements. However, the user never sees "edgelist" structures +directly; he is given handles to "region" structures only. + +By having a type field, we can use the "copy" feature of Allocate() +to duplicate edge lists quickly. + +We also define two flag bits for this structure. The ISDOWN bit is set +if the edge is going in the direction of increasing Y. The ISAMBIGUOUS +bit is set if the edge is identical to its neighbor (edge->link); such +edges may be "left" when they should be "right", or vice versa, +unnecessarily confusing the continuity checking logic. The FixSubPaths() +routine in HINTS will swap ambiguous edges if that avoids crossing edges; +see :hdref refid=fixsubp.. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h3.KillRegion() - Destroys a Region + +KillRegion nominally just decrements the reference count to that region. +If the reference count becomes 0, all memory associated with it is +freed. We just follow the linked list, freeing as we go, then kill any +associated (thresholded) picture. +Note - added conditional return based on references 3-26-91 PNM +*/ + +void KillRegion(area) + register struct region *area; /* area to free */ +{ + register struct edgelist *p; /* loop variable */ + register struct edgelist *next; /* loop variable */ + + if (area->references < 0) + abort("KillRegion: negative reference count", 28); + if ( (--(area->references) > 1) || + ( (area->references == 1) && !ISPERMANENT(area->flag) ) ) + return; + + for (p=area->anchor; p != NULL; p=next) { + next = p->link; + Free(p); + } + /* KillPicture-macro removed from sources (RMz, 2001-04-01) + if (area->thresholded != NULL) + KillPicture(area->thresholded); + */ + Free(area); +} +/* +:h3.CopyRegion() - Makes a Copy of a Region +*/ +struct region *CopyRegion(area) + register struct region *area; /* region to duplicate */ +{ + register struct region *r; /* output region built here */ + register struct edgelist *last=NULL; /* loop variable */ + register struct edgelist *p,*newp; /* loop variables */ + + r = (struct region *)Allocate(sizeof(struct region), area, 0); + r->anchor = NULL; + + for (p=area->anchor; VALIDEDGE(p); p=p->link) { + + newp = NewEdge(p->xmin, p->xmax, p->ymin, p->ymax, p->xvalues, ISDOWN(p->flag)); + if (r->anchor == NULL) + r->anchor = last = newp; + else + last->link = newp; + + last = newp; + } + if (area->thresholded != NULL) + /* replaced DupPicture with Dup() 3-26-91 PNM */ + r->thresholded = (struct picture *)Dup(area->thresholded); + return(r); +} +/* +:h4.NewEdge() - Allocates and Returns a New "edgelist" Structure + +We allocate space for the X values contiguously with the 'edgelist' +structure that locates them. That way, we only have to free the +edgelist structure to free all memory associated with it. Damn +clever, huh? +*/ + +static struct edgelist *NewEdge(xmin, xmax, ymin, ymax, xvalues, isdown) + pel xmin,xmax; /* X extent of edge */ + pel ymin,ymax; /* Y extent of edge */ + pel *xvalues; /* list of X values for entire edge */ + int isdown; /* flag: TRUE means edge progresses downward */ +{ + static struct edgelist template = { + EDGETYPE, 0, 1, NULL, NULL, + 0, 0, 0, 0, NULL }; + + register struct edgelist *r; /* returned structure */ + register int iy; /* ymin adjusted for 'long' alignment purposes */ + + IfTrace2((RegionDebug),"....new edge: ymin=%d, ymax=%d ", + (LONG)ymin, (LONG) ymax); + if (ymin >= ymax) + abort("newedge: height not positive", 29); +/* +We are going to copy the xvalues into a newly allocated area. It +helps performance if the values are all "long" aligned. We can test +if the xvalues are long aligned by ANDing the address with the +(sizeof(long) - 1)--if non zero, the xvalues are not aligned well. We +set 'iy' to the ymin value that would give us good alignment: +*/ + iy = ymin - (((unsigned long) xvalues) & (sizeof(LONG) - 1)) / sizeof(pel); + + r = (struct edgelist *)Allocate(sizeof(struct edgelist), &template, + (ymax - iy) * sizeof(pel)); + + if (isdown) r->flag = ISDOWN(ON); + r->xmin = xmin; + r->xmax = xmax; + r->ymin = ymin; + r->ymax = ymax; + + r->xvalues = (pel *) FOLLOWING(r); + if (ymin != iy) { + r->xvalues += ymin - iy; + xvalues -= ymin - iy; + } + +/* +We must round up (ymax - iy) so we get the ceiling of the number of +longs. The destination must be able to hold these extra bytes because +Allocate() makes everything it allocates be in multiples of longs. +*/ + LONGCOPY(&r[1], xvalues, (ymax - iy) * sizeof(pel) + sizeof(LONG) - 1); + + IfTrace1((RegionDebug),"result=%p\n", r); + return(r); +} + +/* +:h2.Building Regions + +:h3.Interior() - Iterate Through a Path, Building a Region + +This routine is the workhorse driver routine that iterates through a +path, calling the appropriate stepping routines to actually produce the +run end "edgelist" structures. + +:ol. +:li."Interior" calls StepLine or StepConic or StepBezier as appropriate +to produce run ends. +:li.Occasionally these routines will notice a change in Y direction +and will call ChangeDirection (through the GOING_TO macro); this is +a call back to the REGIONS module. +:li.ChangeDirection will call whatever function is in the region +structure; for Interior, this function is 'newfilledge'. +:li.Newfilledge will call NewEdge to create a new edgelist structure, +then, call SortSwath to sort it onto the linked list being built at +the region "anchor". +:eol. + +By making the function called by ChangeDirection be a parameter of the +region, we allow the same ChangeDirection logic to be used by stroking. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +struct region *Interior(p, fillrule) + register struct segment *p; /* take interior of this path */ + register int fillrule; /* rule to follow if path crosses itself */ +{ + register fractpel x,y; /* keeps ending point of path segment */ + fractpel lastx,lasty; /* previous x,y from path segment before */ + register struct region *R; /* region I will build */ + register struct segment *nextP; /* next segment of path */ + struct fractpoint hint; /* accumulated hint value */ + char tempflag; /* flag; is path temporary? */ + char Cflag; /* flag; should we apply continuity? */ + + IfTrace2((MustTraceCalls),". INTERIOR(%p, %d)\n", p, (LONG) fillrule); + + if (p == NULL) + return(NULL); +/* +Establish the 'Cflag' continuity flag based on user's fill rule and +our own 'Continuity' pragmatic (0: never do continuity, 1: do what +user asked, >1: do it regardless). +*/ + if (fillrule > 0) { + Cflag = Continuity > 0; + fillrule -= CONTINUITY; + } + else + Cflag = Continuity > 1; + + ARGCHECK((fillrule != WINDINGRULE && fillrule != EVENODDRULE), + "Interior: bad fill rule", NULL, NULL, (1,p), struct region *); + + if (p->type == TEXTTYPE) +/* if (fillrule != EVENODDRULE) + else */ + return((struct region *)UniquePath(p)); + if (p->type == STROKEPATHTYPE){ + if (fillrule == WINDINGRULE) + return((struct region *)DoStroke(p)); + else + p = CoercePath(p); + } + + + R = (struct region *)Allocate(sizeof(struct region), &EmptyRegion, 0); + + ARGCHECK(!ISPATHANCHOR(p), "Interior: bad path", p, R, (0), struct region *); + ARGCHECK((p->type != MOVETYPE), "Interior: path not closed", p, R, (0), struct region *); + + +/* changed definition from !ISPERMANENT to references <= 1 3-26-91 PNM */ + tempflag = (p->references <= 1); /* only first segment in path is so marked */ + if (!ISPERMANENT(p->flag)) p->references -= 1; + + R->newedgefcn = newfilledge; +/* +Believe it or not, "R" is now completely initialized. We are counting +on the copy of template to get other fields the way we want them, +namely +:ol. +:li.anchor = NULL +:li.xmin, ymin, xmax, ymax, to minimum and maximum values respectively. +:eol. +Anchor = NULL is very +important to ChangeDirection. +See :hdref refid=CD.. + +To minimize problems of "wrapping" in our pel arithmetic, we keep an +origin of the region which is the first move. Hopefully, that keeps +numbers within plus or minus 32K pels. +*/ + R->origin.x = 0/*TOFRACTPEL(NEARESTPEL(p->dest.x))*/; + R->origin.y = 0/*TOFRACTPEL(NEARESTPEL(p->dest.y))*/; + lastx = - R->origin.x; + lasty = - R->origin.y; +/* +ChangeDirection initializes other important fields in R, such as +lastdy, edge, edgeYstop, edgexmin, and edgexmax. The first segment +is a MOVETYPE, so it will be called first. +*/ +/* +The hints data structure must be initialized once for each path. +*/ + + if (ProcessHints) + InitHints(); /* initialize hint data structure */ + + while (p != NULL) { + + x = lastx + p->dest.x; + y = lasty + p->dest.y; + + IfTrace2((HintDebug > 0),"Ending point = (%d,%d)\n", + x, + y); + + nextP = p->link; + +/* +Here we start the hints processing by initializing the hint value to +zero. If ProcessHints is FALSE, the value will remain zero. +Otherwise, hint accumulates the computed hint values. +*/ + + hint.x = hint.y = 0; + +/* +If we are processing hints, and this is a MOVE segment (other than +the first on the path), we need to close (reverse) any open hints. +*/ + + if (ProcessHints) + if ((p->type == MOVETYPE) && (p->last == NULL)) { + CloseHints(&hint); + IfTrace2((HintDebug>0),"Closed point= (%d,%d)\n", + x+hint.x, + y+hint.y); + } + +/* +Next we run through all the hint segments (if any) attached to this +segment. If ProcessHints is TRUE, we will accumulate computed hint +values. In either case, nextP will be advanced to the first non-HINT +segment (or NULL), and each hint segment will be freed if necessary. +*/ + + while ((nextP != NULL) && (nextP->type == HINTTYPE)) { + if (ProcessHints) + ProcessHint(nextP, x + hint.x, y + hint.y, &hint); + + { + register struct segment *saveP = nextP; + + nextP = nextP->link; + if (tempflag) + Free(saveP); + } + } + +/* +We now apply the full hint value to the ending point of the path segment. +*/ + /* printf("Applying hints (x=%d,y=%d)\n", hint.x, hint.y);*/ + + x += hint.x; + y += hint.y; + + IfTrace2((HintDebug>0),"Hinted ending point = (%d,%d)\n", + x, y); + + switch(p->type) { + + case LINETYPE: + StepLine(R, lastx, lasty, x, y); + break; + + case CONICTYPE: + { + +/* +For a conic curve, we apply half the hint value to the conic midpoint. +*/ + + } + break; + + case BEZIERTYPE: + { + register struct beziersegment *bp = (struct beziersegment *) p; + +/* +For a Bezier curve, we apply the full hint value to the Bezier C point. +*/ + + StepBezier(R, lastx, lasty, + lastx + bp->B.x, lasty + bp->B.y, + lastx + bp->C.x + hint.x, + lasty + bp->C.y + hint.y, + x, y); + } + break; + + case MOVETYPE: +/* +At this point we have encountered a MOVE segment. This breaks the +path, making it disjoint. +*/ + if (p->last == NULL) /* i.e., not first in path */ + ChangeDirection(CD_LAST, R, lastx, lasty, (fractpel) 0); + + ChangeDirection(CD_FIRST, R, x, y, (fractpel) 0); +/* +We'll just double check for closure here. We forgive an appended +MOVETYPE at the end of the path, if it isn't closed: +*/ + if (!ISCLOSED(p->flag) && p->link != NULL) + return((struct region *)ArgErr("Fill: sub-path not closed", p, NULL)); + break; + + default: + abort("Interior: path type error", 30); + } +/* +We're done with this segment. Advance to the next path segment in +the list, freeing this one if necessary: +*/ + lastx = x; lasty = y; + + if (tempflag) + Free(p); + p = nextP; + } + ChangeDirection(CD_LAST, R, lastx, lasty, (fractpel) 0); + R->ending.x = lastx; + R->ending.y = lasty; +/* +Finally, clean up the region's based on the user's 'fillrule' request: +*/ + if (Cflag) + ApplyContinuity(R); + if (fillrule == WINDINGRULE) + Unwind(R->anchor); + return(R); +} +/* +:h4.Unwind() - Discards Edges That Fail the Winding Rule Test + +The winding rule says that upward going edges should be paired with +downward going edges only, and vice versa. So, if two upward edges +or two downward edges are nominally left/right pairs, Unwind() should +discard the second one. Everything should balance; we should discard +an even number of edges; of course, we abort if we don't. +*/ +static int Unwind(area) + register struct edgelist *area; /* input area modified in place */ +{ + register struct edgelist *last=NULL,*next; /* struct before and after current one */ + register int y; /* ymin of current swath */ + register int count,newcount; /* winding count registers */ + + IfTrace1((RegionDebug>0),"...Unwind(%p)\n", area); + + while (VALIDEDGE(area)) { + + count = 0; + y = area->ymin; + + do { + next = area->link; + + if (ISDOWN(area->flag)) + newcount = count + 1; + else + newcount = count - 1; + + if (count == 0 || newcount == 0) + last = area; + else + discard(last, next); + + count = newcount; + area = next; + + } while (area != NULL && area->ymin == y); + + if (count != 0) + abort("Unwind: uneven edges", 31); + } + /* We retunr a value for ANSI-C-compiler */ + return(0); + +} +/* +:h3."workedge" Array + +This is a statically allocated array where edges are built +before being copied into more permanent storage by NewEdge(). +*/ + +#ifndef MAXEDGE +#define MAXEDGE 1000 +#endif + +static pel workedge[MAXEDGE]; +static pel *currentworkarea = workedge; +static pel currentsize = MAXEDGE; + +/* +:h3 id=cd.ChangeDirection() - Called When Y Direction Changes + +The rasterizing routines call this entry point when they detect +a change in Y. We then build the current edge and sort it into +emerging edgelist at 'anchor' by calling whatever "newedgefcn" +is appropriate. +*/ + +void ChangeDirection(type, R, x, y, dy) + int type; /* CD_FIRST, CD_CONTINUE, or CD_LAST */ + register struct region *R; /* region in which we are changing direction */ + fractpel x,y; /* current beginning x,y */ + fractpel dy; /* direction and magnitude of change in y */ +{ + register fractpel ymin,ymax; /* minimum and maximum Y since last call */ + register fractpel x_at_ymin,x_at_ymax; /* their respective X's */ + register pel iy; /* nearest integer pel to 'y' */ + register pel idy; /* nearest integer pel to 'dy' */ + register int ydiff; /* allowed Y difference in 'currentworkarea' */ + + IfTrace4((RegionDebug>0),"Change Y direction (%d) from (%d,%d), dy=%d\n", + (LONG) type, x, y, dy); + + if (type != CD_FIRST) { + + if (R->lastdy > 0) { + ymin = R->firsty; + x_at_ymin = R->firstx; + ymax = y; + x_at_ymax = x; + } + else { + ymin = y; + x_at_ymin = x; + ymax = R->firsty; + x_at_ymax = R->firstx; + } + + if (ymax < ymin) + abort("negative sized edge?", 32); + + + (*R->newedgefcn)(R, R->edgexmin, R->edgexmax, ymin, ymax, + R->lastdy > 0, x_at_ymin, x_at_ymax); + + } + + R->firsty = y; + R->firstx = x; + R->lastdy = dy; + + iy = NEARESTPEL(y); + idy = NEARESTPEL(dy); + if (currentworkarea != workedge && idy < MAXEDGE && idy > -MAXEDGE) { + NonObjectFree(currentworkarea); + currentworkarea = workedge; + currentsize = MAXEDGE; + } + ydiff = currentsize - 1; + if (dy > 0) { + R->edge = ¤tworkarea[-iy]; + R->edgeYstop = TOFRACTPEL(ydiff + iy) + FPHALF; + } + else { + R->edge = ¤tworkarea[ydiff - iy]; + R->edgeYstop = TOFRACTPEL(iy - ydiff) - FPHALF; + } + R->edgexmax = R->edgexmin = x; +/* +If this is the end of a subpath, we complete the subpath circular +chain: +*/ + if (type == CD_LAST && R->lastedge != NULL) { + register struct edgelist *e = R->firstedge; + + while (e->subpath != NULL) + e = e->subpath; + e->subpath = R->lastedge; + R->lastedge = R->firstedge = NULL; + } +} +/* +:h3 id=newfill.newfilledge() - Called When We Have a New Edge While Filling + +This is the prototypical "newedge" function passed to "Rasterize" and +stored in "newedgefcn" in the region being built. + +If the edge is non-null, we sort it onto the list of edges we are +building at "anchor". + +This function also has to keep the bounding box of the region +up to date. +*/ + +static int newfilledge(R, xmin, xmax, ymin, ymax, isdown) + register struct region *R; /* region being built */ + fractpel xmin,xmax; /* X range of this edge */ + fractpel ymin,ymax; /* Y range of this edge */ + int isdown; /* flag: TRUE means edge goes down, else up */ +{ + + register pel pelxmin,pelymin,pelxmax,pelymax; /* pel versions of bounds */ + register struct edgelist *edge; /* newly created edge */ + + pelymin = NEARESTPEL(ymin); + pelymax = NEARESTPEL(ymax); + if (pelymin == pelymax) + return(0); + + pelxmin = NEARESTPEL(xmin); + pelxmax = NEARESTPEL(xmax); + + if (pelxmin < R->xmin) R->xmin = pelxmin; + if (pelxmax > R->xmax) R->xmax = pelxmax; + if (pelymin < R->ymin) R->ymin = pelymin; + if (pelymax > R->ymax) R->ymax = pelymax; + + edge = NewEdge(pelxmin, pelxmax, pelymin, pelymax, &R->edge[pelymin], isdown); + edge->subpath = R->lastedge; + R->lastedge = edge; + if (R->firstedge == NULL) + R->firstedge = edge; + + R->anchor = SortSwath(R->anchor, edge, swathxsort); + return(0); +} + +/* +:h2.Sorting Edges + +:h3.SortSwath() - Vertically Sort an Edge into a Region + +This routine sorts an edge or a pair of edges into a growing region, +so that the region maintains its top-to-bottom, left-to-right form. +The rules for sorting horizontally may vary depending on what you +are doing, but the rules for vertical sorting are always the same. +This routine is passed an argument that is a function that will +perform the horizontal sort on demand (for example, swathxsort() or +SwathUnion()). + +This is a recursive routine. A new edge (or edge pair) may overlap +the list I am building in strange and wonderful ways. Edges may +cross. When this happens, my strategy is to split the incoming edge +(or the growing list) in two at that point, execute the actual sort on +the top part of the split, and recursively call myself to figure out +exactly where the bottom part belongs. +*/ + +#define TOP(e) ((e)->ymin) /* the top of an edge (for readability */ +#define BOTTOM(e) ((e)->ymax) /* the bottom of an edge (for readability */ + +struct edgelist *SortSwath(anchor, edge, swathfcn) + struct edgelist *anchor; /* list being built */ + register struct edgelist *edge; /* incoming edge or pair of edges */ + struct edgelist *(*swathfcn)(); /* horizontal sorter */ +{ + register struct edgelist *before,*after; + struct edgelist base; + + if (RegionDebug > 0) { + if (RegionDebug > 2) { + IfTrace3(TRUE,"SortSwath(anchor=%p, edge=%p, fcn=%p)\n", + anchor, edge, swathfcn); + } + else { + IfTrace3(TRUE,"SortSwath(anchor=%p, edge=%p, fcn=%p)\n", + anchor, edge, swathfcn); + } + } + if (anchor == NULL) + return(edge); + + before = &base; + before->ymin = before->ymax = MINPEL; + before->link = after = anchor; + +/* +If the incoming edge is above the current list, we connect the current +list to the bottom of the incoming edge. One slight complication is +if the incoming edge overlaps into the current list. Then, we +first split the incoming edge in two at the point of overlap and recursively +call ourselves to sort the bottom of the split into the current list: +*/ + if (TOP(edge) < TOP(after)) { + if (BOTTOM(edge) > TOP(after)) { + + after = SortSwath(after, splitedge(edge, TOP(after)), swathfcn); + } + vertjoin(edge, after); + return(edge); + } +/* +At this point the top of edge is not higher than the top of the list, +which we keep in 'after'. We move the 'after' point down the list, +until the top of the edge occurs in the swath beginning with 'after'. + +If the bottom of 'after' is below the bottom of the edge, we have to +split the 'after' swath into two parts, at the bottom of the edge. +If the bottom of 'after' is above the bottom of the swath, +*/ + + while (VALIDEDGE(after)) { + + if (TOP(after) == TOP(edge)) { + if (BOTTOM(after) > BOTTOM(edge)) + vertjoin(after, splitedge(after, BOTTOM(edge))); + else if (BOTTOM(after) < BOTTOM(edge)) { + after = SortSwath(after, + splitedge(edge, BOTTOM(after)), swathfcn); + } + break; + } + else if (TOP(after) > TOP(edge)) { + IfTrace0((BOTTOM(edge) < TOP(after) && RegionDebug > 0), + "SortSwath: disjoint edges\n"); + if (BOTTOM(edge) > TOP(after)) { + after = SortSwath(after, + splitedge(edge, TOP(after)), swathfcn); + } + break; + } + else if (BOTTOM(after) > TOP(edge)) + vertjoin(after, splitedge(after, TOP(edge))); + + before = after; + after = after->link; + } + +/* +At this point 'edge' exactly corresponds in height to the current +swath pointed to by 'after'. +*/ + if (after != NULL && TOP(after) == TOP(edge)) { + before = (*swathfcn)(before, edge); + after = before->link; + } +/* +At this point 'after' contains all the edges after 'edge', and 'before' +contains all the edges before. Whew! A simple matter now of adding +'edge' to the linked list in its rightful place: +*/ + before->link = edge; + if (RegionDebug > 1) { + IfTrace3(TRUE,"SortSwath: in between %p and %p are %p", + before, after, edge); + while (edge->link != NULL) { + edge = edge->link; + IfTrace1(TRUE," and %p", edge); + } + IfTrace0(TRUE,"\n"); + } + else + for (; edge->link != NULL; edge = edge->link) { ; } + + edge->link = after; + return(base.link); +} + +/* +:h3.splitedge() - Split an Edge or Swath in Two at a Given Y Value + +This function returns the edge or swath beginning at the Y value, and +is guaranteed not to change the address of the old swath while splitting +it. +*/ + +static struct edgelist *splitedge(list, y) + struct edgelist *list; /* area to split */ + register pel y; /* Y value to split list at */ +{ + register struct edgelist *new; /* anchor for newly built list */ + register struct edgelist *last=NULL; /* end of newly built list */ + register struct edgelist *r; /* temp pointer to new structure */ + register struct edgelist *lastlist; /* temp pointer to last 'list' value */ + + IfTrace2((RegionDebug > 1),"splitedge of %p at %d ", list, (LONG) y); + + lastlist = new = NULL; + + while (list != NULL) { + if (y < list->ymin) + break; + if (y >= list->ymax) + abort("splitedge: above top of list", 33); + if (y == list->ymin) + abort("splitedge: would be null", 34); + + r = (struct edgelist *)Allocate(sizeof(struct edgelist), list, 0); +/* +At this point 'r' points to a copy of the single structure at 'list'. +We will make 'r' be the new split 'edgelist'--the lower half. +We don't bother to correct 'xmin' and 'xmax', we'll take the +the pessimistic answer that results from using the old values. +*/ + r->ymin = y; + r->xvalues = list->xvalues + (y - list->ymin); +/* +Note that we do not need to allocate new memory for the X values, +they can remain with the old "edgelist" structure. We do have to +update that old structure so it is not as high: +*/ + list->ymax = y; +/* +Insert 'r' in the subpath chain: +*/ + r->subpath = list->subpath; + list->subpath = r; +/* +Now attach 'r' to the list we are building at 'new', and advance +'list' to point to the next element in the old list: +*/ + if (new == NULL) + new = r; + else + last->link = r; + last = r; + lastlist = list; + list = list->link; + } +/* +At this point we have a new list built at 'new'. We break the old +list at 'lastlist', and add the broken off part to the end of 'new'. +Then, we return the caller a pointer to 'new': +*/ + if (new == NULL) + abort("null splitedge", 35); + lastlist->link = NULL; + last->link = list; + IfTrace1((RegionDebug > 1),"yields %p\n", new); + return(new); +} + +/* +:h3.vertjoin() - Join Two Disjoint Edge Lists Vertically + +The two edges must be disjoint vertically. +*/ +static int vertjoin(top, bottom) + register struct edgelist *top; /* uppermost region */ + register struct edgelist *bottom; /* bottommost region */ +{ + if (BOTTOM(top) > TOP(bottom)) + abort("vertjoin not disjoint", 36); + + for (; top->link != NULL; top=top->link) { ; } + + top->link = bottom; + return(0); +} + +/* +:h3.swathxsort() - Sorting by X Values + +We need to sort 'edge' into its rightful +place in the swath by X value, taking care that we do not accidentally +advance to the next swath while searching for the correct X value. Like +all swath functions, this function returns a pointer to the edge +BEFORE the given edge in the sort. +*/ + +struct edgelist *swathxsort(before0, edge) + register struct edgelist *before0; /* edge before this swath */ + register struct edgelist *edge; /* input edge */ +{ + register struct edgelist *before; + register struct edgelist *after; + register pel y=0; + + before = before0; + after = before->link; + + while (after != NULL && TOP(after) == TOP(edge)) { + + register pel *x1,*x2; + + y = TOP(edge); + x1 = after->xvalues; + x2 = edge->xvalues; + + while (y < BOTTOM(edge) && *x1 == *x2) { + x1++; x2++; y++; + } + if (y >= BOTTOM(edge)) { + edge->flag |= ISAMBIGUOUS(ON); + after->flag |= ISAMBIGUOUS(ON); + break; + } + + if (*x1 >= *x2) + break; + + before = after; + after = after->link; + } + +/* +At this point, 'edge' is between 'before' and 'after'. If 'edge' didn't +cross either of those other edges, we would be done. We check for +crossing. If it does cross, we split the problem up by calling SortSwath +recursively with the part of the edge that is below the crossing point: +*/ +{ + register int h0,h; /* height of edge--number of scans */ + + h0 = h = BOTTOM(edge) - y; + y -= TOP(edge); + + if (h0 <= 0) { + IfTrace0((RegionDebug>0),"swathxsort: exactly equal edges\n"); + return(before); + } + + if (TOP(before) == TOP(edge)) + h -= crosses(h, &before->xvalues[y], &edge->xvalues[y]); + if (after != NULL && TOP(after) == TOP(edge)) + h -= crosses(h, &edge->xvalues[y], &after->xvalues[y]); + + if (h < h0) { + SortSwath(before0->link, + splitedge(edge, TOP(edge) + y + h), + swathxsort); + + } +} + + return(before); +} +/* +:h3.SwathUnion() - Union Two Edges by X Value + +We have a left and right edge that must be unioned into a growing +swath. If they are totally disjoint, they are just added in. The +fun comes in they overlap the existing edges. Then some edges +will disappear. +*/ + +struct edgelist *SwathUnion(before0, edge) + register struct edgelist *before0; /* edge before the swath */ + register struct edgelist *edge; /* list of two edges to be unioned */ +{ + register int h; /* saves height of edge */ + register struct edgelist *rightedge; /* saves right edge of 'edge' */ + register struct edgelist *before,*after; /* edge before and after */ + int h0; /* saves initial height */ + + IfTrace2((RegionDebug > 1),"SwathUnion entered, before=%p, edge=%p\n", + before0, edge); + + h0 = h = edge->ymax - edge->ymin; + if (h <= 0) + abort("SwathUnion: 0 height swath?", 37); + + before = before0; + after = before->link; + + while (after != NULL && TOP(after) == TOP(edge)) { + register struct edgelist *right; + + right = after->link; + if (right->xvalues[0] >= edge->xvalues[0]) + break; + before = right; + after = before->link; + } +/* +This is the picture at this point. 'L' indicates a left hand edge, +'R' indicates the right hand edge. +'<--->' indicates the degree of uncertainty as to its placement +relative to other edges: +:xmp atomic. + before after + R <---L----> R L R L R + <---L---> <------R--------------------------> + edge +:exmp. +In case the left of 'edge' touches 'before', we need to reduce +the height by that amount. +*/ + if (TOP(before) == TOP(edge)) + h -= touches(h, before->xvalues, edge->xvalues); + + rightedge = edge->link; + + if (after == NULL || TOP(after) != TOP(edge) || + after->xvalues[0] > rightedge->xvalues[0]) { + IfTrace2((RegionDebug > 1), + "SwathUnion starts disjoint: before=%p after=%p\n", + before, after); +/* +On this side of the the above 'if', the new edge is disjoint from the +existing edges in the swath. This is the picture: +:xmp atomic. + before after + R L R L R L R + L R + edge +:exmp. +We will verify it remains disjoint for the entire height. If the +situation changes somewhere down the edge, we split the edge at that +point and recursively call ourselves (through 'SortSwath') to figure +out the new situation: +*/ + if (after != NULL && TOP(after) == TOP(edge)) + h -= touches(h, rightedge->xvalues, after->xvalues); + if (h < h0) + SortSwath(before0->link, splitedge(edge, edge->ymin + h), t1_SwathUnion); + /* go to "return" this edge pair; it is totally disjoint */ + } + else { +/* +At this point, at the 'else', we know that the +new edge overlaps one or more pairs in the existing swath. Here is +a picture of our knowledge and uncertainties: +:xmp atomic. + before after + R L R L R L R + <---L---> <---R-------------------> + edge +:exmp. +We need to move 'after' along until it is to the right of the +right of 'edge'. ('After' should always point to a left edge of a pair:) +*/ + register struct edgelist *left; /* variable to keep left edge in */ + + do { + left = after; + after = (after->link)->link; + + } while (after != NULL && TOP(after) == TOP(edge) + && after->xvalues[0] <= rightedge->xvalues[0]); +/* +At this point this is the picture: +:xmp atomic. + before left after + R L R L R L R + <---L---> <---R---> + edge +:exmp. +We need to verify that the situation stays like this all the way +down the edge. Again, if the +situation changes somewhere down the edge, we split the edge at that +point and recursively call ourselves (through 'SortSwath') to figure +out the new situation: +*/ + + h -= crosses(h, left->xvalues, rightedge->xvalues); + h -= crosses(h, edge->xvalues, ((before->link)->link)->xvalues); + + if (after != NULL && TOP(after) == TOP(edge)) + + h -= touches(h, rightedge->xvalues, after->xvalues); + + IfTrace3((RegionDebug > 1), + "SwathUnion is overlapped until %d: before=%p after=%p\n", + (LONG) TOP(edge) + h, before, after); +/* +OK, if we touched either of our neighbors we need to split at that point +and recursively sort the split edge onto the list. One tricky part +is that when we recursively sort, 'after' will change if it was not +in our current swath: +*/ + if (h < h0) { + SortSwath(before0->link, + splitedge(edge, edge->ymin + h), + t1_SwathUnion); + + if (after == NULL || TOP(after) != TOP(edge)) + for (after = before0->link; + TOP(after) == TOP(edge); + after = after->link) { ; } + } +/* +Now we need to augment 'edge' by the left and right of the overlapped +swath, and to discard all edges between before and after, because they +were overlapped and have been combined with the new incoming 'edge': +*/ + edge->xmin = TYPE1_MIN(edge->xmin, (before->link)->xmin); + edge->xmax = TYPE1_MIN(edge->xmax, (before->link)->xmax); + edgemin(h, edge->xvalues, (before->link)->xvalues); + rightedge->xmin = TYPE1_MAX(rightedge->xmin, (left->link)->xmin); + rightedge->xmax = TYPE1_MAX(rightedge->xmax, (left->link)->xmax); + edgemax(h, rightedge->xvalues, (left->link)->xvalues); + discard(before, after); + } + return(before); +} +/* +:h3.swathrightmost() - Simply Sorts New Edge to Rightmost of Swath + +Like all swath functions, this function returns a pointer to the edge +BEFORE the given edge in the sort. +*/ + +struct edgelist *swathrightmost(before, edge) + register struct edgelist *before; /* edge before this swath */ + register struct edgelist *edge; /* input edge */ +{ + register struct edgelist *after; + + after = before->link; + + while (after != NULL && TOP(after) == TOP(edge)) { + before = after; + after = after->link; + } + + return(before); + +} +/* +:h3.touches() - Returns the Remaining Height When Two Edges Touch + +So, it will return 0 if they never touch. Allows incredibly(?) mnemonic +if (touches(...)) construct. +*/ + +static int touches(h, left, right) + register int h; + register pel *left,*right; +{ + for (; h > 0; h--) + if (*left++ >= *right++) + break; + return(h); +} +/* +:h3.crosses() - Returns the Remaining Height When Two Edges Cross + +So, it will return 0 if they never cross. +*/ + +static int crosses(h, left, right) + register int h; + register pel *left,*right; +{ + for (; h > 0; h--) + if (*left++ > *right++) + break; + return(h); +} +/* +:h3.cedgemin() - Stores the Mininum of an Edge and an X Value +*/ + +static int cedgemin(h, e1, x) + register int h; + register pel *e1; + register pel x; +{ + for (; --h >= 0; e1++) + if (*e1 > x) + *e1 = x; + return(0); + +} +/* +:h3.cedgemax() - Stores the Maximum of an Edge and an X Value +*/ + +static int cedgemax(h, e1, x) + register int h; + register pel *e1; + register pel x; +{ + for (; --h >= 0; e1++) + if (*e1 < x) + *e1 = x; + return(0); + +} +/* +:h3.edgemin() - Stores the Mininum of Two Edges in First Edge +*/ + +static int edgemin(h, e1, e2) + register int h; + register pel *e1,*e2; +{ + for (; --h >= 0; e1++,e2++) + if (*e1 > *e2) + *e1 = *e2; + return(0); + +} +/* +:h3.edgemax() - Stores the Maximum of Two Edges in First Edge +*/ + +static int edgemax(h, e1, e2) + register int h; + register pel *e1,*e2; +{ + for (; --h >= 0; e1++,e2++) + if (*e1 < *e2) + *e1 = *e2; + return(0); + +} +/* +:h3 id=discard.discard() - Discard All Edges Between Two Edges + +At first glance it would seem that we could discard an edgelist +structure merely by unlinking it from the list and freeing it. You are +wrong, region-breath! For performance, the X values associated with an +edge are allocated contiguously with it. So, we free the X values when +we free a structure. However, once an edge has been split, we are no +longer sure which control block actually is part of the memory block +that contains the edges. Rather than trying to decide, we play it safe +and never free part of a region. + +So, to mark a 'edgelist' structure as discarded, we move it to the end +of the list and set ymin=ymax. +*/ + +static int discard(left, right) + register struct edgelist *left,*right; /* all edges between here exclusive */ + /* should be discarded */ +{ + register struct edgelist *beg,*end,*p; + + IfTrace2((RegionDebug > 0),"discard: l=%p, r=%p\n", left, right); + + beg = left->link; + if (beg == right) + return(0); + + for (p = beg; p != right; p = p->link) { + if (p->link == NULL && right != NULL) + abort("discard(): ran off end", 38); + IfTrace1((RegionDebug > 0),"discarding %p\n", p); + p->ymin = p->ymax = 32767; + end = p; + } + /* + * now put the chain beg/end at the end of right, if it is not + * already there: + */ + if (right != NULL) { + left->link = right; + while (right->link != NULL) + right = right->link; + right->link = beg; + } + end->link = NULL; + return(0); + +} + +/* +:h2.Changing the Representation of Regions + +For convenience and/or performance, we sometimes like to change the way +regions are represented. This does not change the object itself, just +the representation, so these transformations can be made on a permanent +region. + +*/ + +void MoveEdges(R, dx, dy) + register struct region *R; /* region to modify */ + register fractpel dx,dy; /* delta X and Y to move edge list by */ +{ + register struct edgelist *edge; /* for looping through edges */ + + R->origin.x += dx; + R->origin.y += dy; + R->ending.x += dx; + R->ending.y += dy; + if (R->thresholded != NULL) { + R->thresholded->origin.x -= dx; + R->thresholded->origin.y -= dy; + } +/* +From now on we will deal with dx and dy as integer pel values: +*/ + dx = NEARESTPEL(dx); + dy = NEARESTPEL(dy); + if (dx == 0 && dy == 0) + return; + + R->xmin += dx; + R->xmax += dx; + R->ymin += dy; + R->ymax += dy; + + for (edge = R->anchor; VALIDEDGE(edge); edge = edge->link) { + edge->ymin += dy; + edge->ymax += dy; + if (dx != 0) { + register int h; /* loop index; height of edge */ + register pel *Xp; /* loop pointer to X values */ + + edge->xmin += dx; + edge->xmax += dx; + for (Xp = edge->xvalues, h = edge->ymax - edge->ymin; + --h >= 0; ) + *Xp++ += dx; + } + } +} + +/* +:h3.UnJumble() - Sort a Region Top to Bottom + +It is an open question whether it pays in general to do this. +*/ + +void UnJumble(region) + struct region *region; /* region to sort */ +{ + register struct edgelist *anchor; /* new lists built here */ + register struct edgelist *edge; /* edge pointer for loop */ + register struct edgelist *next; /* ditto */ + + anchor = NULL; + + for (edge=region->anchor; VALIDEDGE(edge); edge=next) { + if (edge->link == NULL) + abort("UnJumble: unpaired edge?", 39); + next = edge->link->link; + edge->link->link = NULL; + anchor = SortSwath(anchor, edge, t1_SwathUnion); + } + + if (edge != NULL) + vertjoin(anchor, edge); + + region->anchor = anchor; + region->flag &= ~ISJUMBLED(ON); +} + +/* +*/ + +#undef NEED_OPTIMZEREGION +#ifdef NEED_OPTIMZEREGION +static int OptimizeRegion(R) + struct region *R; /* region to optimize */ +{ + register pel *xP; /* pel pointer for inner loop */ + register int x; /* holds X value */ + register int xmin,xmax; /* holds X range */ + register int h; /* loop counter */ + register struct edgelist *e; /* edgelist pointer for loop */ + + R->flag |= ISRECTANGULAR(ON); + + for (e = R->anchor; VALIDEDGE(e); e=e->link) { + xmin = MAXPEL; + xmax = MINPEL; + for (h = e->ymax - e->ymin, xP = e->xvalues; --h >= 0;) { + x = *xP++; + if (x < xmin) xmin = x; + if (x > xmax) xmax = x; + } + if (xmin != xmax || (xmin != R->xmin && xmax != R->xmax)) + R->flag &= ~ISRECTANGULAR(ON); + if (xmin < e->xmin || xmax > e->xmax) + abort("Tighten: existing edge bound was bad", 40); + if (xmin < R->xmin || xmax > R->xmax) + abort("Tighten: existing region bound was bad", 41); + e->xmin = xmin; + e->xmax = xmax; + } + R->flag |= ISOPTIMIZED(ON); + return(0); + +} + +#endif /* This function is not used */ + +/* +:h2.Miscelaneous Routines + +:h3.MoreWorkArea() - Allocate New Space for "edge" + +Our strategy is to temporarily allocate an array to hold this +unexpectedly large edge. ChangeDirection frees this array any time +it gets a shorter 'dy'. +*/ + +/*ARGSUSED*/ +void MoreWorkArea(R, x1, y1, x2, y2) + struct region *R; /* region we are generating */ + fractpel x1,y1; /* starting point of line */ + fractpel x2,y2; /* ending point of line */ +{ + register int idy; /* integer dy of line */ + + idy = NEARESTPEL(y1) - NEARESTPEL(y2); + if (idy < 0) idy = - idy; + + /* + * we must add one to the delta for the number of run ends we + * need to store: + */ + if (++idy > currentsize) { + IfTrace1((RegionDebug > 0),"Allocating edge of %d pels\n", idy); + if (currentworkarea != workedge) + NonObjectFree(currentworkarea); + currentworkarea = (pel *)Allocate(0, NULL, idy * sizeof(pel)); + currentsize = idy; + } + ChangeDirection(CD_CONTINUE, R, x1, y1, y2 - y1); +} + +/* +:h3.BoxClip() - Clip a Region to a Rectangle + +BoxClip also duplicates the region if it is permanent. Note the +clipping box is specified in REGION coordinates, that is, in +coordinates relative to the region (0,0) point +*/ + +struct region *BoxClip(R, xmin, ymin, xmax, ymax) + register struct region *R; /* region to clip */ + register pel xmin,ymin; /* upper left hand corner of rectangle */ + register pel xmax,ymax; /* lower right hand corner */ +{ + struct edgelist anchor; /* pretend edgelist to facilitate discards */ + register struct edgelist *e,*laste; + + IfTrace1((OffPageDebug),"BoxClip of %p:\n", R); + + R = UniqueRegion(R); + + if (xmin > R->xmin) { + IfTrace2((OffPageDebug),"BoxClip: left clip old %d new %d\n", + (LONG) R->xmin, (LONG) xmin); + R->xmin = xmin; + } + if (xmax < R->xmax) { + IfTrace2((OffPageDebug),"BoxClip: right clip old %d new %d\n", + (LONG) R->xmax, (LONG) xmax); + R->xmax = xmax; + } + + if (ymin > R->ymin) { + IfTrace2((OffPageDebug),"BoxClip: top clip old %d new %d\n", + (LONG) R->ymin, (LONG) ymin); + R->ymin = ymin; + } + if (ymax < R->ymax) { + IfTrace2((OffPageDebug),"BoxClip: bottom clip old %d new %d\n", + (LONG) R->ymax, (LONG) ymax); + R->ymax = ymax; + } + + + laste = &anchor; + anchor.link = R->anchor; + + for (e = R->anchor; VALIDEDGE(e); e = e->link) { + if (TOP(e) < ymin) { + e->xvalues += ymin - e->ymin; + e->ymin = ymin; + } + if (BOTTOM(e) > ymax) + e->ymax = ymax; + if (TOP(e) >= BOTTOM(e)) { + discard(laste, e->link->link); + e = laste; + continue; + } + if (e->xmin < xmin) { + cedgemax(BOTTOM(e) - TOP(e), e->xvalues, xmin); + e->xmin = xmin; + e->xmax = TYPE1_MAX(e->xmax, xmin); + } + if (e->xmax > xmax) { + cedgemin(BOTTOM(e) - TOP(e), e->xvalues, xmax); + e->xmin = TYPE1_MIN(e->xmin, xmax); + e->xmax = xmax; + } + laste = e; + } + + R->anchor = anchor.link; + + return(R); +} + +#ifdef notdef +/* +:h3.CoerceRegion() - Force a TextPath Structure to Become a Region + +We also save the newly created region in the textpath structure, if the +structure was permanent. Then we don't have to do this again. Why not +save it all the time? Well, we certainly could, but I suspect it +wouldn't pay. We would have to make this region permanent (because we +couldn't have it be consumed) and this would probably require +unnecessary CopyRegions in most cases. +*/ + +struct region *CoerceRegion(tp) + register struct textpath *tp; /* input TEXTTYPE */ +{ + struct segment *path; /* temporary character path */ + struct region *R; /* returned region */ + + + R = Interior(path, EVENODDRULE); + return(R); +} +#endif + +/* +:h3.RegionBounds() - Returns Bounding Box of a Region +*/ + +struct segment *RegionBounds(R) + register struct region *R; +{ + + register struct segment *path; /* returned path */ + + path = BoxPath(IDENTITY, R->ymax - R->ymin, R->xmax - R->xmin); + path = Join(PathSegment(MOVETYPE, R->origin.x + TOFRACTPEL(R->xmin), + R->origin.y + TOFRACTPEL(R->ymin) ), + path); + return(path); +} + +/* +:h2.Formatting/Dump Routines for Debug + +:h3.DumpArea() - Display a Region +*/ +void DumpArea(area) + register struct region *area; +{ + IfTrace1(TRUE,"Dumping area %p,", area); + IfTrace4(TRUE," X %d:%d Y %d:%d;", (LONG) area->xmin, + (LONG) area->xmax, (LONG) area->ymin,(LONG) area->ymax); + IfTrace4(TRUE," origin=(%d,%d), ending=(%d,%d)\n", + area->origin.x, area->origin.y, area->ending.x, area->ending.y); + DumpEdges(area->anchor); +} + +#define INSWATH(p, y0, y1) (p != NULL && p->ymin == y0 && p->ymax == y1) +/* +:h3.DumpEdges() - Display Run End Lists (Edge Lists) +*/ + +static pel RegionDebugYMin = MINPEL; +static pel RegionDebugYMax = MAXPEL; + +void DumpEdges(edges) + register struct edgelist *edges; +{ + register struct edgelist *p,*p2; + register pel ymin = MINPEL; + register pel ymax = MINPEL; + register int y; + + if (edges == NULL) { + IfTrace0(TRUE," NULL area.\n"); + return; + } + if (RegionDebug <= 1) { + for (p=edges; p != NULL; p = p->link) { + edgecheck(p, ymin, ymax); + ymin = p->ymin; ymax = p->ymax; + IfTrace3(TRUE,". at %p type=%d flag=%x", + p, (LONG) p->type,(LONG) p->flag); + IfTrace4(TRUE," bounding box HxW is %dx%d at (%d,%d)\n", + (LONG) ymax - ymin, (LONG) p->xmax - p->xmin, + (LONG) p->xmin, (LONG) ymin); + } + } + else { + + for (p2=edges; p2 != NULL; ) { + + edgecheck(p2, ymin, ymax); + ymin = p2->ymin; + ymax = p2->ymax; + + if (RegionDebug > 3 || (ymax > RegionDebugYMin + && ymin < RegionDebugYMax)) { + IfTrace2 (TRUE,". Swath from %d to %d:\n", + ymin, ymax); + for (p=p2; INSWATH(p,ymin,ymax); p = p->link) { + IfTrace4(TRUE,". . at %p[%x] range %d:%d, ", + p, (LONG) p->flag, + (LONG) p->xmin, (LONG)p->xmax); + IfTrace1(TRUE, "subpath=%p,\n", p->subpath); + } + } + for (y=TYPE1_MAX(ymin,RegionDebugYMin); y < TYPE1_MIN(ymax, RegionDebugYMax); y++) { + IfTrace1(TRUE,". . . Y[%5d] ", (LONG) y); + for (p=p2; INSWATH(p,ymin,ymax); p = p->link) + IfTrace1(TRUE,"%5d ", + (LONG) p->xvalues[y - ymin]); + IfTrace0(TRUE,"\n"); + } + while (INSWATH(p2, ymin, ymax)) + p2 = p2->link; + } + } +} + +/* +:h3.edgecheck() - For Debug, Verify that an Edge Obeys the Rules +*/ + +/*ARGSUSED*/ +static int edgecheck(edge, oldmin, oldmax) + struct edgelist *edge; + int oldmin,oldmax; +{ + if (edge->type != EDGETYPE) + abort("EDGE ERROR: non EDGETYPE in list", 42); +/* +The following check is not valid if the region is jumbled so I took it +out: +*/ +/* if (edge->ymin < oldmax && edge->ymin != oldmin) + abort("EDGE ERROR: overlapping swaths", 43); */ + return(0); + +} diff -Naur xdvik-22.40l/libs/type1/regions.h xdvik-22.40n/libs/type1/regions.h --- xdvik-22.40l/libs/type1/regions.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/regions.h Sat Sep 14 00:24:47 2002 @@ -0,0 +1,203 @@ +/* $XConsortium: regions.h,v 1.2 91/10/10 11:19:06 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + + +#define Interior(p,rule) t1_Interior(p,rule) +#define Union(a1,a2) t1_Union(a1,a2) +#define Intersect(a1,a2) t1_Intersect(a1,a2) +#define Complement(area) t1_Complement(area) +#define Overlap(a1,a2) t1_OverLap(a1,a2) + +struct region *t1_Interior(); /* returns the interior of a closed path */ +struct region *t1_Union(); /* set union of paths or regions */ +struct region *t1_Intersect(); /* set intersection of regions */ +struct region *t1_Complement(); /* complement of a region */ +int t1_Overlap(); /* returns a Boolean; TRUE if regions overlap */ + + +/*END SHARED*/ +/*SHARED*/ + +#define ChangeDirection(type,R,x,y,dy) t1_ChangeDirection(type,R,x,y,dy) + +void t1_ChangeDirection(); /* called when we change direction in Y */ +#define CD_FIRST -1 /* enumeration of ChangeDirection type */ +#define CD_CONTINUE 0 /* enumeration of ChangeDirection type */ +#define CD_LAST 1 /* enumeration of ChangeDirection type */ + +#define MoreWorkArea(R,x1,y1,x2,y2) t1_MoreWorkArea(R,x1,y1,x2,y2) +#define KillRegion(area) t1_KillRegion(area) +#define CopyRegion(area) t1_CopyRegion(area) +#define BoxClip(R,xmin,ymin,xmax,ymax) t1_BoxClip(R,xmin,ymin,xmax,ymax) +#define SortSwath(a,p,f) t1_SortSwath(a,p,f) +#define SwathUnion(b,e) t1_SwathUnion(b,e) +#define RegionBounds(r) t1_RegionBounds(r) +#define CoerceRegion(p) t1_CoerceRegion(p) +#define MoveEdges(R,dx,dy) t1_MoveEdges(R,dx,dy) +#define UnJumble(R) t1_UnJumble(R) + +void t1_MoreWorkArea(); /* get longer edge list for stepping */ +struct region *t1_CopyRegion(); /* duplicate a region */ +void t1_KillRegion(); /* destroy a region */ +struct region *t1_BoxClip(); /* clip a region to a rectangle */ +struct edgelist *t1_SortSwath(); /* sort edges onto growing edge list */ +struct edgelist *t1_SwathUnion(); /* 'union' two edges into a swath */ +struct segment *t1_RegionBounds(); /* returns bounding box of a region */ +struct region *t1_CoerceRegion(); /* force text to become a true region */ +void t1_MoveEdges(); /* moves the edge values in a region */ +void t1_UnJumble(); /* sort the edges and reset the jumbled flag */ + +/*END SHARED*/ +/*SHARED*/ + +#define GOING_TO(R, x1, y1, x2, y2, dy) { \ + if (dy < 0) { \ + if (R->lastdy >= 0) \ + ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ + if (y2 < R->edgeYstop) \ + MoreWorkArea(R, x1, y1, x2, y2); \ + } \ + else if (dy > 0) { \ + if (R->lastdy <= 0) \ + ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ + if (y2 > R->edgeYstop) \ + MoreWorkArea(R, x1, y1, x2, y2); \ + } \ + else /* dy == 0 */ ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \ + if (x2 < R->edgexmin) R->edgexmin = x2; \ + else if (x2 > R->edgexmax) R->edgexmax = x2; \ +} + + +#define MINPEL (-1<<(8*sizeof(pel)-1)) /* smallest value fitting in a pel */ +#define MAXPEL ((1<<(8*sizeof(pel)-1))-1)/* largest value fitting in a pel */ + +/* +The "Unique"-type macro is different (unique?) for regions, because some +regions structures are shared among several objects, and might have +to be made unique for that reason (i.e., references > 1). +*/ + +#define ConsumeRegion(R) MAKECONSUME(R,KillRegion(R)) +#define UniqueRegion(R) MAKEUNIQUE(R,CopyRegion(R)) + + +/*END SHARED*/ +/*SHARED*/ + +struct region { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = REGIONTYPE */ + struct fractpoint origin; /* beginning handle: X,Y origin of region */ + struct fractpoint ending; /* ending handle: X,Y change after painting region */ + pel xmin,ymin; /* minimum X,Y of region */ + pel xmax,ymax; /* mat1_mum X,Y of region */ + struct edgelist *anchor; /* list of edges that bound the region */ + struct picture *thresholded; /* region defined by thresholded picture*/ +/* +Note that the ending handle and the bounding box values are stored +relative to 'origin'. + +The above elements describe a region. The following elements are +scratchpad areas used while the region is being built: +*/ + fractpel lastdy; /* direction of last segment */ + fractpel firstx,firsty; /* starting point of current edge */ + fractpel edgexmin,edgexmax; /* x extent of current edge */ + struct edgelist *lastedge,*firstedge; /* last and first edges in subpath */ + pel *edge; /* pointer to array of X values for edge */ + fractpel edgeYstop; /* Y value where 'edges' array ends */ + int (*newedgefcn)(); /* function to use when building a new edge */ + struct strokeinfo *strokeinfo; /* scratchpad info during stroking only */ +} ; +/* +The ISCOMPLEMENT flag indicates the region is reversed--it is the +"outside" of the nominal region. +*/ +#define ISCOMPLEMENT(flag) ((flag)&0x80) +/* +The ISJUMBLED flag indicates the region is not sorted top-to-bottom. +*/ +#define ISJUMBLED(flag) ((flag)&0x40) +/* +The ISINFINITE flag allows a quick check for an INFINITE region, which +is frequently intersected. +*/ +#define ISINFINITE(flag) ((flag)&0x20) + +/*END SHARED*/ +/*SHARED*/ + +#define ISRECTANGULAR(flag) ((flag)&0x08) + +/*END SHARED*/ +/*SHARED*/ + +#define EmptyRegion t1_EmptyRegion + +/*END SHARED*/ +/*SHARED*/ + +struct edgelist { + XOBJ_COMMON /* xobject common data define 3-26-91 PNM */ + /* type = EDGETYPE */ + struct edgelist *link; /* pointer to next in linked list */ + struct edgelist *subpath; /* informational link for "same subpath" */ + pel xmin,xmax; /* range of edge in X */ + pel ymin,ymax; /* range of edge in Y */ + pel *xvalues; /* pointer to ymax-ymin X values */ +} ; +/* +The end of the list is marked by either "link" being NULL, or by +ymin == ymax. See :hdref refid=discard.. We define the VALIDEDGE +predicate to test for the opposite of these conditions: +*/ + +#define VALIDEDGE(p) ((p)!=NULL&&(p)->ymin<(p)->ymax) + +/*END SHARED*/ +/*SHARED*/ + +#define ISDOWN(f) ((f)&0x80) + +#define ISAMBIGUOUS(f) ((f)&0x40) + +/*END SHARED*/ +/*SHARED*/ + +/* +Interior() rule enumerations: +*/ +#define WINDINGRULE -2 +#define EVENODDRULE -3 + +#define CONTINUITY 0x80 /* can be added to above rules; e.g. WINDINGRULE+CONTINUITY */ + +/*END SHARED*/ diff -Naur xdvik-22.40l/libs/type1/scanfont.c xdvik-22.40n/libs/type1/scanfont.c --- xdvik-22.40l/libs/type1/scanfont.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/scanfont.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1365 @@ +/* $XConsortium: scanfont.c,v 1.9 92/07/07 17:14:56 gildea Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */ + +#include +#include "t1stdio.h" +#include "util.h" +#include "token.h" +#include "fontfcn.h" +#include "blues.h" + + +/* #define DEBUG_SCANFONT */ + + +static int rc; +static boolean InPrivateDict; +static boolean WantFontInfo; +static boolean TwoSubrs; +static psobj inputFile; +static psobj filterFile; +static psobj *inputP; + + +extern int T1Getc(F_FILE * ); +extern int T1Ungetc( int,F_FILE *); +extern int SearchDictName( psdict *dictP, psobj *keyP); +extern void T1io_setblocklen( long len); + + +/* functions from util.c */ +extern void objFormatInteger(psobj *objP, int value); +extern void objFormatReal(psobj *objP, float value); +extern void objFormatBoolean(psobj *objP, boolean value); +extern void objFormatEncoding( psobj *objP, int length, psobj *valueP); +extern void objFormatArray( psobj *objP, int length, psobj *valueP); +extern void objFormatString( psobj *objP, int length, char *valueP); +extern void objFormatName( psobj *objP, int length, char *valueP); +extern void objFormatFile( psobj *objP, FILE *valueP); + + +/**********************************************************************/ +/* Init_BuiltInEncoding() */ +/* */ +/* Initializes the StandardEncoding. */ +/* */ +/**********************************************************************/ +typedef struct /* Builtin Standard Encoding */ +{ + int index; + char *name; +} EncodingTable; + + +char not_def[]=".notdef"; + + +static EncodingTable StdEnc[] = { + {040 , "space"}, + {041 , "exclam"}, + {042 , "quotedbl"}, + {043 , "numbersign"}, + {044 , "dollar"}, + {045 , "percent"}, + {046 , "ampersand"}, + {047 , "quoteright"}, + {050 , "parenleft"}, + {051 , "parenright"}, + {052 , "asterisk"}, + {053 , "plus"}, + {054 , "comma"}, + {055 , "hyphen"}, + {056 , "period"}, + {057 , "slash"}, + {060 , "zero"}, + {061 , "one"}, + {062 , "two"}, + {063 , "three"}, + {064 , "four"}, + {065 , "five"}, + {066 , "six"}, + {067 , "seven"}, + {070 , "eight"}, + {071 , "nine"}, + {072 , "colon"}, + {073 , "semicolon"}, + {074 , "less"}, + {075 , "equal"}, + {076 , "greater"}, + {077 , "question"}, + {0100 , "at"}, + {0101 , "A"}, + {0102 , "B"}, + {0103 , "C"}, + {0104 , "D"}, + {0105 , "E"}, + {0106 , "F"}, + {0107 , "G"}, + {0110 , "H"}, + {0111 , "I"}, + {0112 , "J"}, + {0113 , "K"}, + {0114 , "L"}, + {0115 , "M"}, + {0116 , "N"}, + {0117 , "O"}, + {0120 , "P"}, + {0121 , "Q"}, + {0122 , "R"}, + {0123 , "S"}, + {0124 , "T"}, + {0125 , "U"}, + {0126 , "V"}, + {0127 , "W"}, + {0130 , "X"}, + {0131 , "Y"}, + {0132 , "Z"}, + {0133 , "bracketleft"}, + {0134 , "backslash"}, + {0135 , "bracketright"}, + {0136 , "asciicircum"}, + {0137 , "underscore"}, + {0140 , "quoteleft"}, + {0141 , "a"}, + {0142 , "b"}, + {0143 , "c"}, + {0144 , "d"}, + {0145 , "e"}, + {0146 , "f"}, + {0147 , "g"}, + {0150 , "h"}, + {0151 , "i"}, + {0152 , "j"}, + {0153 , "k"}, + {0154 , "l"}, + {0155 , "m"}, + {0156 , "n"}, + {0157 , "o"}, + {0160 , "p"}, + {0161 , "q"}, + {0162 , "r"}, + {0163 , "s"}, + {0164 , "t"}, + {0165 , "u"}, + {0166 , "v"}, + {0167 , "w"}, + {0170 , "x"}, + {0171 , "y"}, + {0172 , "z"}, + {0173 , "braceleft"}, + {0174 , "bar"}, + {0175 , "braceright"}, + {0176 , "asciitilde"}, + {0241 , "exclamdown"}, + {0242 , "cent"}, + {0243 , "sterling"}, + {0244 , "fraction"}, + {0245 , "yen"}, + {0246 , "florin"}, + {0247 , "section"}, + {0250 , "currency"}, + {0251 , "quotesingle"}, + {0252 , "quotedblleft"}, + {0253 , "guillemotleft"}, + {0254 , "guilsinglleft"}, + {0255 , "guilsinglright"}, + {0256 , "fi"}, + {0257 , "fl"}, + {0261 , "endash"}, + {0262 , "dagger"}, + {0263 , "daggerdbl"}, + {0264 , "periodcentered"}, + {0266 , "paragraph"}, + {0267 , "bullet"}, + {0270 , "quotesinglbase"}, + {0271 , "quotedblbase"}, + {0272 , "quotedblright"}, + {0273 , "guillemotright"}, + {0274 , "ellipsis"}, + {0275 , "perthousand"}, + {0277 , "questiondown"}, + {0301 , "grave"}, + {0302 , "acute"}, + {0303 , "circumflex"}, + {0304 , "tilde"}, + {0305 , "macron"}, + {0306 , "breve"}, + {0307 , "dotaccent"}, + {0310 , "dieresis"}, + {0312 , "ring"}, + {0313 , "cedilla"}, + {0315 , "hungarumlaut"}, + {0316 , "ogonek"}, + {0317 , "caron"}, + {0320 , "emdash"}, + {0341 , "AE"}, + {0343 , "ordfeminine"}, + {0350 , "Lslash"}, + {0351 , "Oslash"}, + {0352 , "OE"}, + {0353 , "ordmasculine"}, + {0361 , "ae"}, + {0365 , "dotlessi"}, + {0370 , "lslash"}, + {0371 , "oslash"}, + {0372 , "oe"}, + {0373 , "germandbls"}, + { 0, 0 } +}; + + +/* Encodings changed from static to global since they must be accessible + by T1_LoadFont() when reallocating memory. */ +psobj *StdEncArrayP = NULL; + + +static psobj *MakeEncodingArrayP(encodingTable) + EncodingTable *encodingTable; +{ + int i; + psobj *encodingArrayP; + + encodingArrayP = (psobj *)vm_alloc(256*(sizeof(psobj))); + if (!encodingArrayP) + return NULL; + + /* initialize everything to .notdef */ + for (i=0; i<256;i++) + objFormatName(&(encodingArrayP[i]),7, not_def); + + for (i=0; encodingTable[i].name; i++) + { + objFormatName(&(encodingArrayP[encodingTable[i].index]), + strlen(encodingTable[i].name), + encodingTable[i].name); + } + + return(encodingArrayP); +} + +boolean Init_BuiltInEncoding() +{ + StdEncArrayP = MakeEncodingArrayP(StdEnc); + if (StdEncArrayP==NULL) + return( FALSE); + else + return( TRUE); +} + +/********************************************************************/ +/***================================================================***/ +static int getNextValue(valueType) + int valueType; +{ + scan_token(inputP); + if (tokenType != valueType) { + return(SCAN_ERROR); + } + return(SCAN_OK); + +} +/***================================================================***/ +/* This routine will set the global rc if there is an error */ +/***================================================================***/ +static int getInt() +{ + scan_token(inputP); + if (tokenType != TOKEN_INTEGER) { + rc = SCAN_ERROR; + return(0); + } + else { + return( tokenValue.integer); + } + +} +/***================================================================***/ +/* + * See Sec 10.3 of ``Adobe Type 1 Font Format'' v1.1, + * for parsing Encoding. + */ +static int getEncoding(arrayP) + psobj *arrayP; +{ + + scan_token(inputP); + if ((tokenType == TOKEN_NAME) && + ((tokenLength==16) && (!strncmp(tokenStartP,"StandardEncoding",16))) + ) + { + /* Adobe Standard Encoding */ + + if (tokenLength == 16) + arrayP->data.valueP = (char *) StdEncArrayP; + else + return(SCAN_ERROR); + + + arrayP->len = 256; + return(SCAN_OK); + } + else if ( (tokenType == TOKEN_LEFT_BRACE) || + (tokenType == TOKEN_LEFT_BRACKET) ) + { + /* Array of literal names */ + + psobj *objP; + int i; + + objP = (psobj *)vm_alloc(256*(sizeof(psobj))); + if (!(objP)) return(SCAN_OUT_OF_MEMORY); + + arrayP->data.valueP = (char *) objP; + arrayP->len = 256; + + for (i=0; i<256; i++, objP++) + { + scan_token(inputP); + + if (tokenType != TOKEN_LITERAL_NAME) + return(SCAN_ERROR); + + if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY); + objFormatName(objP,tokenLength,tokenStartP); + } + + scan_token(inputP); + if ( (tokenType == TOKEN_RIGHT_BRACE) || + (tokenType == TOKEN_RIGHT_BRACKET) ) + return(SCAN_OK); + } + else + { + /* Must be sequences of ``dup put" */ + + psobj *objP; + int i; + + objP = (psobj *)vm_alloc(256*(sizeof(psobj))); + if (!(objP)) return(SCAN_OUT_OF_MEMORY); + + arrayP->data.valueP = (char *) objP; + arrayP->len = 256; + + for (i=0; i<256; i++) + objFormatName(objP + i, 7, not_def); + + while (TRUE) + { + scan_token(inputP); + + switch (tokenType) + { + case TOKEN_NAME: + if (tokenLength == 3) + { + if (strncmp(tokenStartP,"dup",3) == 0) + { + /* get */ + scan_token(inputP); + if (tokenType != TOKEN_INTEGER || + tokenValue.integer < 0 || + tokenValue.integer > 255) + return (SCAN_ERROR); + i = tokenValue.integer; + + /* get */ + scan_token(inputP); + if (tokenType != TOKEN_LITERAL_NAME) + return(SCAN_ERROR); + + if (!(vm_alloc(tokenLength)) ) + return(SCAN_OUT_OF_MEMORY); + objFormatName(objP + i,tokenLength,tokenStartP); + + /* get "put" */ + scan_token(inputP); + if (tokenType != TOKEN_NAME) + return(SCAN_ERROR); + } + else if (strncmp(tokenStartP,"def",3) == 0) + return (SCAN_OK); + } + break; + case TOKEN_EOF: + case TOKEN_NONE: + case TOKEN_INVALID: + return (SCAN_ERROR); + } + } + } + + return (SCAN_ERROR); +} +/***================================================================***/ +static int getArray(arrayP) + psobj *arrayP; +{ + int N; /* count the items in the array */ + psobj *objP; + + + scan_token(inputP); + if ( (tokenType != TOKEN_LEFT_BRACE) && + (tokenType != TOKEN_LEFT_BRACKET) ) { + return(SCAN_ERROR); + } + /* format the array in memory, save pointer to the beginning */ + arrayP->data.valueP = tokenStartP; + /* loop, picking up next object, until right BRACE or BRACKET */ + N = 0; + do { + scan_token(inputP); + if ( (tokenType == TOKEN_RIGHT_BRACE) || + (tokenType == TOKEN_RIGHT_BRACKET) ) { + /* save then number of items in the array */ + arrayP->len = N; + return(SCAN_OK); + } + /* allocate the space for the object */ + objP = (psobj *)vm_alloc(sizeof(psobj)); + if (!(objP)) return(SCAN_OUT_OF_MEMORY); + + /* array is an array of numbers, (real or integer) */ + if (tokenType == TOKEN_REAL) { + objFormatReal(objP, tokenValue.real); + } + else + if (tokenType == TOKEN_INTEGER) { + objFormatInteger(objP, tokenValue.integer); + } + else return(SCAN_ERROR); + N++; + } while ( 1>0 ); + /* NOTREACHED*/ +} +/***================================================================***/ +/* is not needed */ +/* + static int getName(nameP) + char *nameP; + { + do { + scan_token(inputP); + if (tokenType <= TOKEN_NONE) { + if (tokenTooLong) return(SCAN_OUT_OF_MEMORY); + return(SCAN_ERROR); + } + } while ((tokenType != TOKEN_NAME) || + (0 != strncmp(tokenStartP,nameP,strlen(nameP))) ); + + return(SCAN_OK); + } +*/ + +/***================================================================***/ +static int getNbytes(N) + int N; +{ + int I; + + if (N > vm_free_bytes()) { + if (!vm_init()) return(SCAN_OUT_OF_MEMORY); + } + tokenStartP = vm_next_byte(); + I = fread(tokenStartP,1,N,inputP->data.fileP); + if ( I != N ) return(SCAN_FILE_EOF); + return(SCAN_OK); +} + +/***================================================================***/ +/* getLiteralName(nameObjP) */ +/* scan for next literal. */ +/* if we encounter the name 'end' then terminate and say ok. */ +/* It means that the CharStrings does not have as many characters */ +/* as the dictionary said it would and that is ok. */ +/***================================================================***/ +static int getLiteralName(nameObjP) + psobj *nameObjP; +{ + do { + scan_token(inputP); + if (tokenType <= TOKEN_NONE) { + if (tokenTooLong) return(SCAN_OUT_OF_MEMORY); + return(SCAN_ERROR); + } + if (tokenType == TOKEN_NAME) { + if (0 == strncmp(tokenStartP,"end",3) ) { + return(SCAN_END); + } + } + } while (tokenType != TOKEN_LITERAL_NAME) ; + nameObjP->len = tokenLength; + /* allocate all the names in the CharStrings Structure */ + if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY); + nameObjP->data.valueP = tokenStartP; + /* found */ + return(SCAN_OK); +} + +/***================================================================***/ +/* + * BuildSubrs routine + */ +/***================================================================***/ + +static int BuildSubrs(FontP) + psfont *FontP; +{ + int N; /* number of values in Subrs */ + int I; /* index into Subrs */ + int i; /* loop thru Subrs */ + int J; /* length of Subrs entry */ + psobj *arrayP; + + /* next token should be a positive int */ + /* note: rc is set by getInt. */ + N = getInt(); + if (rc) return(rc); + if (N < 0 ) return(SCAN_ERROR); + /* if we already have a Subrs, then skip the second one */ + /* The second one is for hiresolution devices. */ + if (FontP->Subrs.data.arrayP != NULL) { + TwoSubrs = TRUE; + /* process all the Subrs, but do not update anything */ + /* can not just skip them because of the binary data */ + for (i=0;iSubrs.len = N; + FontP->Subrs.data.arrayP = arrayP; + /* get N values for Subrs */ + for (i=0;iCharStringsP = dictP; + dictP[0].key.len = N; + /* get N values for CharStrings */ + for (i=1;i<=N;i++) { + /* look for next literal name */ + rc = getLiteralName(&(dictP[i].key)); + /* If rc=SCAN_END, the end of file has been reached. This means + there were less than N charstrings. This is perfectly valid. */ + if (rc) return(rc); + /* get 1 integer */ + J = getInt(); + if (rc) return(rc); /* if next token was not an Int */ + if (J<0) return (SCAN_ERROR); + dictP[i].value.len = J; + /* get the next token, it should be RD or -|, either is ok */ + rc = getNextValue(TOKEN_NAME); + if ( rc != SCAN_OK ) return(rc); + rc = getNbytes(J); + if (rc == SCAN_OK) { + dictP[i].value.data.valueP = tokenStartP; + if ( !(vm_alloc(J)) ) return(SCAN_OUT_OF_MEMORY); + } + else { + return(rc); + } + + } + return(SCAN_OK); + +} +/***================================================================***/ +/***================================================================***/ +/* + * BuildFontInfo Dictionary + */ +/***================================================================***/ +static int BuildFontInfo(fontP) + psfont *fontP; +{ + psdict *dictP; + + /* allocate the private dictionary */ + dictP = (psdict *)vm_alloc(20*sizeof(psdict)); + if (!(dictP)) return(SCAN_OUT_OF_MEMORY); + + fontP->fontInfoP = dictP; + fontP->fontInfoP[0].key.len = 17; /* number of actual entries */ + objFormatName(&(dictP[FONTNAME].key),8,"FontName"); + objFormatName(&(dictP[FONTNAME].value),0,NULL); + objFormatName(&(dictP[PAINTTYPE].key),9,"PaintType"); + objFormatInteger(&(dictP[PAINTTYPE].value),0); + objFormatName(&(dictP[FONTTYPENUM].key),8,"FontType"); + objFormatInteger(&(dictP[FONTTYPENUM].value),0); + objFormatName(&(dictP[FONTMATRIX].key),10,"FontMatrix"); + objFormatArray(&(dictP[FONTMATRIX].value),0,NULL); + objFormatName(&(dictP[FONTBBOX].key),8,"FontBBox"); + objFormatArray(&(dictP[FONTBBOX].value),0,NULL); + objFormatName(&(dictP[ENCODING].key),8,"Encoding"); + objFormatEncoding(&(dictP[ENCODING].value),0,NULL); + objFormatName(&(dictP[UNIQUEID].key),8,"UniqueID"); + objFormatInteger(&(dictP[UNIQUEID].value),0); + objFormatName(&(dictP[STROKEWIDTH].key),11,"StrokeWidth"); + objFormatReal(&(dictP[STROKEWIDTH].value),0.0); + objFormatName(&(dictP[VERSION].key),7,"version"); + objFormatString(&(dictP[VERSION].value),0,NULL); + objFormatName(&(dictP[NOTICE].key),6,"Notice"); + objFormatString(&(dictP[NOTICE].value),0,NULL); + objFormatName(&(dictP[FULLNAME].key),8,"FullName"); + objFormatString(&(dictP[FULLNAME].value),0,NULL); + objFormatName(&(dictP[FAMILYNAME].key),10,"FamilyName"); + objFormatString(&(dictP[FAMILYNAME].value),0,NULL); + objFormatName(&(dictP[WEIGHT].key),6,"Weight"); + objFormatString(&(dictP[WEIGHT].value),0,NULL); + objFormatName(&(dictP[ITALICANGLE].key),11,"ItalicAngle"); + objFormatReal(&(dictP[ITALICANGLE].value),0.0); + objFormatName(&(dictP[ISFIXEDPITCH].key),12,"isFixedPitch"); + objFormatBoolean(&(dictP[ISFIXEDPITCH].value),FALSE); + objFormatName(&(dictP[UNDERLINEPOSITION].key),17,"UnderlinePosition"); + objFormatReal(&(dictP[UNDERLINEPOSITION].value),0.0); + objFormatName(&(dictP[UNDERLINETHICKNESS].key),18,"UnderlineThickness"); + objFormatReal(&(dictP[UNDERLINETHICKNESS].value),0.0); + return(SCAN_OK); +} +/***================================================================***/ +/* + * BuildPrivate Dictionary + */ +/* "LenIV" corrected to be "lenIV", otherwise fonts with some specific + lenIV value could not be decrypted. (RMz, Author of t1lib, 06/03/1998)*/ +/***================================================================***/ +static int BuildPrivate(fontP) + psfont *fontP; +{ + psdict *Private; + + /* allocate the private dictionary */ + Private = (psdict *)vm_alloc(20*sizeof(psdict)); + + if (!(Private)) return(SCAN_OUT_OF_MEMORY); + + fontP->Private = Private; + fontP->Private[0].key.len = 16; /* number of actual entries */ + + objFormatName(&(Private[BLUEVALUES].key),10,"BlueValues"); + objFormatArray(&(Private[BLUEVALUES].value),0,NULL); + objFormatName(&(Private[OTHERBLUES].key),10,"OtherBlues"); + objFormatArray(&(Private[OTHERBLUES].value),0,NULL); + objFormatName(&(Private[FAMILYBLUES].key),11,"FamilyBlues"); + objFormatArray(&(Private[FAMILYBLUES].value),0,NULL); + objFormatName(&(Private[FAMILYOTHERBLUES].key),16,"FamilyOtherBlues"); + objFormatArray(&(Private[FAMILYOTHERBLUES].value),0,NULL); + objFormatName(&(Private[BLUESCALE].key),9,"BlueScale"); + objFormatReal(&(Private[BLUESCALE].value),DEFAULTBLUESCALE); + objFormatName(&(Private[BLUESHIFT].key),9,"BlueShift"); + objFormatInteger(&(Private[BLUESHIFT].value),DEFAULTBLUESHIFT); + objFormatName(&(Private[BLUEFUZZ].key),8,"BlueFuzz"); + objFormatInteger(&(Private[BLUEFUZZ].value),DEFAULTBLUEFUZZ); + objFormatName(&(Private[STDHW].key),5,"StdHW"); + objFormatArray(&(Private[STDHW].value),0,NULL); + objFormatName(&(Private[STDVW].key),5,"StdVW"); + objFormatArray(&(Private[STDVW].value),0,NULL); + objFormatName(&(Private[STEMSNAPH].key),9,"StemSnapH"); + objFormatArray(&(Private[STEMSNAPH].value),0,NULL); + objFormatName(&(Private[STEMSNAPV].key),9,"StemSnapV"); + objFormatArray(&(Private[STEMSNAPV].value),0,NULL); + objFormatName(&(Private[FORCEBOLD].key),9,"ForceBold"); + objFormatBoolean(&(Private[FORCEBOLD].value),DEFAULTFORCEBOLD); + objFormatName(&(Private[LANGUAGEGROUP].key),13,"LanguageGroup"); + objFormatInteger(&(Private[LANGUAGEGROUP].value),DEFAULTLANGUAGEGROUP); + objFormatName(&(Private[LENIV].key),5,"lenIV"); + objFormatInteger(&(Private[LENIV].value),DEFAULTLENIV); + objFormatName(&(Private[RNDSTEMUP].key),9,"RndStemUp"); + objFormatBoolean(&(Private[RNDSTEMUP].value),DEFAULTRNDSTEMUP); + objFormatName(&(Private[EXPANSIONFACTOR].key),9,"ExpansionFactor"); + objFormatReal(&(Private[EXPANSIONFACTOR].value), + DEFAULTEXPANSIONFACTOR); + return(SCAN_OK); +} +/***================================================================***/ +/**********************************************************************/ +/* GetType1Blues(fontP) */ +/* */ +/* Routine to support font-level hints. */ +/* */ +/* Gets all the Blues information from the Private dictionary */ +/* for the font. */ +/* */ +/* */ +/**********************************************************************/ +static int GetType1Blues(fontP) + psfont *fontP; +{ + psdict *PrivateDictP; /* the Private dict relating to hints */ + struct blues_struct *blues; /* ptr for the blues struct we will allocate */ + int i; + psobj *HintEntryP; + + + + /* get the Private dictionary pointer */ + PrivateDictP = fontP->Private; + + /* allocate the memory for the blues structure */ + blues = (struct blues_struct *) vm_alloc(sizeof(struct blues_struct)); + + if (!blues) return(SCAN_OUT_OF_MEMORY); + + /* Make fontP's blues ptr point to this newly allocated structure. */ + fontP->BluesP = blues; + + /* fill in the BlueValues array */ + HintEntryP = &(PrivateDictP[BLUEVALUES].value); + /* check to see if the entry exists and if it's an array */ + if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) + blues->numBlueValues = 0; + else { + /* get the number of values in the array */ + if (HintEntryP->len > NUMBLUEVALUES) { + blues->numBlueValues = NUMBLUEVALUES; + } else + blues->numBlueValues = HintEntryP->len; + for (i = 0; i<= blues->numBlueValues-1; ++i) { + if (objPIsInteger(&HintEntryP->data.arrayP[i])) + blues->BlueValues[i] = + HintEntryP->data.arrayP[i].data.integer; + else if (objPIsReal(&HintEntryP->data.arrayP[i])) + blues->BlueValues[i] = + HintEntryP->data.arrayP[i].data.real; + else + blues->BlueValues[i] = 0; + } + } + + /* fill in the OtherBlues array */ + HintEntryP = &(PrivateDictP[OTHERBLUES].value); + /* check to see if the entry exists and if it's an array */ + if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) + blues->numOtherBlues = 0; + else { + /* get the number of values in the array */ + if (HintEntryP->len > NUMOTHERBLUES) { + blues->numOtherBlues = NUMOTHERBLUES; + } else + blues->numOtherBlues = HintEntryP->len; + for (i = 0; i<= blues->numOtherBlues-1; ++i) { + if (objPIsInteger(&HintEntryP->data.arrayP[i])) + blues->OtherBlues[i] = + HintEntryP->data.arrayP[i].data.integer; + else if (objPIsReal(&HintEntryP->data.arrayP[i])) + blues->OtherBlues[i] = + HintEntryP->data.arrayP[i].data.real; + else + blues->OtherBlues[i] = 0; + } + } + + /* fill in the FamilyBlues array */ + HintEntryP = &(PrivateDictP[FAMILYBLUES].value); + /* check to see if the entry exists and if it's an array */ + if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) + blues->numFamilyBlues = 0; + else { + /* get the number of values in the array */ + if (HintEntryP->len > NUMFAMILYBLUES) { + blues->numFamilyBlues = NUMFAMILYBLUES; + } else + blues->numFamilyBlues = HintEntryP->len; + for (i = 0; i<= blues->numFamilyBlues-1; ++i) { + if (objPIsInteger(&HintEntryP->data.arrayP[i])) + blues->FamilyBlues[i] = + HintEntryP->data.arrayP[i].data.integer; + else if (objPIsReal(&HintEntryP->data.arrayP[i])) + blues->FamilyBlues[i] = + HintEntryP->data.arrayP[i].data.real; + else + blues->FamilyBlues[i] = 0; + } + } + + /* fill in the FamilyOtherBlues array */ + HintEntryP = &(PrivateDictP[FAMILYOTHERBLUES].value); + /* check to see if the entry exists and if it's an array */ + if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) + blues->numFamilyOtherBlues = 0; + else { + /* get the number of values in the array */ + if (HintEntryP->len > NUMFAMILYOTHERBLUES) { + blues->numFamilyOtherBlues = NUMFAMILYOTHERBLUES; + } else + blues->numFamilyOtherBlues = HintEntryP->len; + for (i = 0; i<= blues->numFamilyOtherBlues-1; ++i) { + if (objPIsInteger(&HintEntryP->data.arrayP[i])) + blues->FamilyOtherBlues[i] = + HintEntryP->data.arrayP[i].data.integer; + else if (objPIsReal(&HintEntryP->data.arrayP[i])) + blues->FamilyOtherBlues[i] = + HintEntryP->data.arrayP[i].data.real; + else + blues->FamilyOtherBlues[i] = 0; + } + } + + /* fill in the StemSnapH array */ + HintEntryP = &(PrivateDictP[STEMSNAPH].value); + /* check to see if the entry exists and if it's an array */ + if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) + blues->numStemSnapH = 0; + else { + /* get the number of values in the array */ + if (HintEntryP->len > NUMSTEMSNAPH) { + blues->numStemSnapH = NUMSTEMSNAPH; + } else + blues->numStemSnapH = HintEntryP->len; + for (i = 0; i<= blues->numStemSnapH-1; ++i) { + if (objPIsInteger(&HintEntryP->data.arrayP[i])) + blues->StemSnapH[i] = + HintEntryP->data.arrayP[i].data.integer; + else if (objPIsReal(&HintEntryP->data.arrayP[i])) + blues->StemSnapH[i] = + HintEntryP->data.arrayP[i].data.real; + else + blues->StemSnapH[i] = 0; + } + } + + /* fill in the StemSnapV array */ + HintEntryP = &(PrivateDictP[STEMSNAPV].value); + /* check to see if the entry exists and if it's an array */ + if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) + blues->numStemSnapV = 0; + else { + /* get the number of values in the array */ + if (HintEntryP->len > NUMSTEMSNAPV) { + blues->numStemSnapV = NUMSTEMSNAPV; + } else + blues->numStemSnapV = HintEntryP->len; + for (i = 0; i<= blues->numStemSnapV-1; ++i) { + if (objPIsInteger(&HintEntryP->data.arrayP[i])) + blues->StemSnapV[i] = + HintEntryP->data.arrayP[i].data.integer; + else if (objPIsReal(&HintEntryP->data.arrayP[i])) + blues->StemSnapV[i] = + HintEntryP->data.arrayP[i].data.real; + else + blues->StemSnapV[i] = 0; + } + } + + /* fill in the StdVW array */ + HintEntryP = &(PrivateDictP[STDVW].value); + /* check to see if the entry exists and if it's an array */ + if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) + /* a value of zero signifies no entry */ + blues->StdVW = 0.0; + else { + if (HintEntryP->len > NUMSTDVW) { + } + if (objPIsInteger(&HintEntryP->data.arrayP[0])) + blues->StdVW = HintEntryP->data.arrayP[0].data.integer; + else if (objPIsReal(&HintEntryP->data.arrayP[0])) + blues->StdVW = HintEntryP->data.arrayP[0].data.real; + else + blues->StdVW = 0.0; + } + + /* fill in the StdHW array */ + HintEntryP = &(PrivateDictP[STDHW].value); + /* check to see if the entry exists and if it's an array */ + if ( !objPIsArray(HintEntryP) || (HintEntryP->len == 0 )) + /* a value of zero signifies no entry */ + blues->StdHW = 0; + else { + if (HintEntryP->len > NUMSTDHW) { + } + if (objPIsInteger(&HintEntryP->data.arrayP[0])) + blues->StdHW = HintEntryP->data.arrayP[0].data.integer; + else if (objPIsReal(&HintEntryP->data.arrayP[0])) + blues->StdHW = HintEntryP->data.arrayP[0].data.real; + else + blues->StdHW = 0; + } + + + /* get the ptr to the BlueScale entry */ + HintEntryP = &(PrivateDictP[BLUESCALE].value); + /* put the BlueScale in the blues structure */ + if (objPIsInteger(HintEntryP)) /* Must be integer! */ + blues->BlueScale = HintEntryP->data.integer; + else if (objPIsReal(HintEntryP)) /* Error? */ + blues->BlueScale = HintEntryP->data.real; + else + blues->BlueScale = DEFAULTBLUESCALE; + + /* get the ptr to the BlueShift entry */ + HintEntryP = &(PrivateDictP[BLUESHIFT].value); + if (objPIsInteger(HintEntryP)) /* Must be integer! */ + blues->BlueShift = HintEntryP->data.integer; + else if (objPIsReal(HintEntryP)) /* Error? */ + blues->BlueShift = HintEntryP->data.real; + else + blues->BlueShift = DEFAULTBLUESHIFT; + + /* get the ptr to the BlueFuzz entry */ + HintEntryP = &(PrivateDictP[BLUEFUZZ].value); + if (objPIsInteger(HintEntryP)) /* Must be integer! */ + blues->BlueFuzz = HintEntryP->data.integer; + else if (objPIsReal(HintEntryP)) /* Error? */ + blues->BlueFuzz = HintEntryP->data.real; + else + blues->BlueFuzz = DEFAULTBLUEFUZZ; + + /* get the ptr to the ForceBold entry */ + HintEntryP = &(PrivateDictP[FORCEBOLD].value); + if (objPIsBoolean(HintEntryP)) /* Must be integer! */ + blues->ForceBold = HintEntryP->data.boolean; + else + blues->ForceBold = DEFAULTFORCEBOLD; + + /* get the ptr to the LanguageGroup entry */ + HintEntryP = &(PrivateDictP[LANGUAGEGROUP].value); + if (objPIsInteger(HintEntryP)) /* Must be integer! */ + blues->LanguageGroup = HintEntryP->data.integer; + else + blues->LanguageGroup = DEFAULTLANGUAGEGROUP; + + /* get the ptr to the RndStemUp entry */ + HintEntryP = &(PrivateDictP[RNDSTEMUP].value); + if (objPIsBoolean(HintEntryP)) /* Must be integer! */ + blues->RndStemUp = HintEntryP->data.boolean; + else + blues->RndStemUp = DEFAULTRNDSTEMUP; + + /* get the ptr to the lenIV entry */ + HintEntryP = &(PrivateDictP[LENIV].value); + if (objPIsInteger(HintEntryP)) {/* Must be integer! */ + blues->lenIV = HintEntryP->data.integer; + } + else{ + blues->lenIV = DEFAULTLENIV; + } + + + /* get the ptr to the ExpansionFactor entry */ + HintEntryP = &(PrivateDictP[EXPANSIONFACTOR].value); + if (objPIsInteger(HintEntryP)) + blues->ExpansionFactor = HintEntryP->data.integer; + else if (objPIsReal(HintEntryP)) + blues->ExpansionFactor = HintEntryP->data.real; + else + blues->ExpansionFactor = DEFAULTEXPANSIONFACTOR; + return(SCAN_OK); +} +/**********************************************************************/ +/* GetType1CharString(fontP,code) */ +/* */ +/* Look up code in the standard encoding vector and return */ +/* the charstring associated with the character name. */ +/* */ +/* fontP is the psfont structure. */ +/* */ +/* Returns a psobj (string) */ +/**********************************************************************/ +psobj *GetType1CharString(fontP, code) +psfont *fontP; +unsigned char code; +{ + int N; /* the 'Nth' entry in the CharStrings */ + psobj *charnameP; /* points to psobj that is name of character*/ + + psdict *CharStringsDictP; /* dictionary with char strings */ + psobj *theStringP; /* the definition for the code */ + + + if (StdEncArrayP == NULL) { + return(NULL); + } + /* use the code to index into the standard encoding vector */ + charnameP = &(StdEncArrayP[code]); + + /* test if the encoding array points to a name */ + if (!(objPIsName(charnameP)) ) { + return(NULL); + } + + /* Now that we have the character name out of the standardencoding */ + /* get the character definition out of the current font */ + CharStringsDictP = fontP->CharStringsP; + + /* search the chars string for this charname as key */ + N = SearchDictName(CharStringsDictP,charnameP); + if (N<=0) { + return(NULL); + } + + /* OK, the nth item is the psobj that is the string for this char */ + theStringP = &(CharStringsDictP[N].value); + + return(theStringP); +} + +/***================================================================***/ +/* + * FindDictValue + */ +/***================================================================***/ + +static int FindDictValue(dictP) + psdict *dictP; +{ + psobj LitName; + int N; + int V; + + /* we have just scanned a token and it is a literal name */ + /* need to check if that name is in Private dictionary */ + objFormatName(&LitName,tokenLength,tokenStartP); + /* is it in the dictP */ + N = SearchDictName(dictP,&LitName); + /* if found */ + if ( N > 0 ) { + /* what type */ + switch (dictP[N].value.type) { + case OBJ_ENCODING: + V = getEncoding(&(dictP[N].value)); + if ( V != SCAN_OK ) return(V); + break; + case OBJ_ARRAY: + V = getArray(&(dictP[N].value)); + if ( V != SCAN_OK ) return(V); + break; + case OBJ_INTEGER: + /* next value in integer */ + dictP[N].value.data.integer = getInt(); + if (rc) return(rc); /* if next token was not an Int */ + break; + case OBJ_REAL: + /* next value must be real or int, store as a real */ + scan_token(inputP); + if (tokenType == TOKEN_REAL) { + dictP[N].value.data.real = tokenValue.real; + } + else + if (tokenType == TOKEN_INTEGER) { + dictP[N].value.data.real = tokenValue.integer; + } + else return(SCAN_ERROR); + break; + case OBJ_NAME: + V = getNextValue(TOKEN_LITERAL_NAME); + if ( V != SCAN_OK ) return(V); + if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY); + objFormatName(&(dictP[N].value),tokenLength,tokenStartP); + break; + case OBJ_STRING: + V = getNextValue(TOKEN_STRING); + if ( V != SCAN_OK ) return(V); + if (!(vm_alloc(tokenLength)) ) return(SCAN_OUT_OF_MEMORY); + objFormatString(&(dictP[N].value),tokenLength,tokenStartP); + break; + case OBJ_BOOLEAN: + scan_token(inputP); + if (tokenType != TOKEN_NAME) { + return(SCAN_ERROR); + } + if (0 == strncmp(tokenStartP,"true",4) ) { + dictP[N].value.data.boolean =TRUE; + } + else + if (0 == strncmp(tokenStartP,"false",5) ) { + dictP[N].value.data.boolean =FALSE; + } + else return(SCAN_ERROR); + break; + + default: + return(SCAN_ERROR); + break; + } + } + /* Name is not in dictionary. That is ok. */ + return(SCAN_OK); + +} +/***================================================================***/ + +/* + * ------------------------------------------------------------------- + * Scan the next token and convert it into an object + * Result is placed on the Operand Stack as next object + * ------------------------------------------------------------------- + */ +int scan_font(FontP) + psfont *FontP; +{ + + + char filename[128]; + char filetype[3]; + FILE *fileP; + char *nameP; + int namelen; + + filetype[0] = 'r'; + filetype[1] = 'b'; + filetype[2] = '\0'; + /* copy the filename and remove leading or trailing blanks */ + /* point to name and search for leading blanks */ + nameP= FontP->FontFileName.data.nameP; + namelen = FontP->FontFileName.len; + while (nameP[0] == ' ') { + nameP++; + namelen--; + } + /* now remove any trailing blanks */ + while ((namelen>0) && ( nameP[namelen-1] == ' ')) { + namelen--; + } + strncpy(filename,nameP,namelen); + filename[namelen] = '\0'; + /* file name is now constructed */ + inputFile.data.fileP = NULL; + filterFile.data.fileP = NULL; + + inputP = &inputFile; + if ((fileP = fopen(filename,filetype))!=NULL) { + objFormatFile(inputP,fileP); + } + else { + return(SCAN_FILE_OPEN_ERROR); + }; + + WantFontInfo = TRUE; + InPrivateDict = FALSE; + TwoSubrs = FALSE; + rc = BuildFontInfo(FontP); +#ifdef DEBUG_SCANFONT + printf("BuildFontInfo(): retval=%d\n", rc); +#endif + if (rc != 0) return(rc); + + /* Assume everything will be OK */ + rc = 0; + + /* Loop until complete font is read */ + do { + /* Scan the next token */ + scan_token(inputP); + + /* ==> tokenLength, tokenTooLong, tokenType, and tokenValue are */ + /* now set */ + + switch (tokenType) { + case TOKEN_EOF: + case TOKEN_NONE: + case TOKEN_INVALID: + /* in this case we are done */ + if (tokenTooLong) return(SCAN_OUT_OF_MEMORY); + rc = SCAN_ERROR; + break; + case TOKEN_LITERAL_NAME: + /* Look up the name */ + tokenStartP[tokenLength] = '\0'; + /* At this point we check for the font not being a + Multiple Master Font. If it is, we return an error. + (RMz, 01/29/1999) */ + if (strncmp(tokenStartP, "BlendAxisTypes", 14)==0){ + rc=SCAN_MMFONT; + break; + } + if (InPrivateDict ) { + if (0== strncmp(tokenStartP,"Subrs",5) ) { + rc = BuildSubrs(FontP); +#ifdef DEBUG_SCANFONT + printf("BuildSubrs(): retval=%d\n", rc); +#endif + break; + } + if (0== strncmp(tokenStartP,"CharStrings",11) ) { + rc = BuildCharStrings(FontP); +#ifdef DEBUG_SCANFONT + printf("BuildCharstrings(): retval=%d\n", rc); +#endif + if ( (rc == SCAN_OK) ||(rc == SCAN_END) ) { + fclose(inputP->data.fileP); + /* Build the Blues Structure */ + rc = GetType1Blues(FontP); +#ifdef DEBUG_SCANFONT + printf("GetType1Blues(): retval=%d\n", rc); +#endif + /* whatever the return code, return it */ + /* all the work is done. This is the normal exit.*/ + return(rc); + } + break; + } + rc = FindDictValue(FontP->Private); + /* we are not going to report errors */ + /* Sometimes the font file may test a value such as */ + /* testing to see if the font is alreadly loaded with */ + /* same UniqueID. We would faile on /UniqueID get */ + /* because we are expecting a int to follow UniqueID*/ + /* If the correct object type does not follow a Name*/ + /* then we will skip over it without reporting error*/ + rc = SCAN_OK; + break; + } /* end of reading Private dictionary */ + else + if (0== strncmp(tokenStartP,"Private",7) ) { + InPrivateDict = TRUE; + rc = BuildPrivate(FontP); + break; + } + else + if (WantFontInfo) { + rc = FindDictValue(FontP->fontInfoP); + /* we are not going to report errors */ + rc = SCAN_OK; + break; + } + break; + case TOKEN_NAME: + if (0 == strncmp(tokenStartP,"eexec",5) ) { + /* We check for the pfb-headers in I/O-module */ + filterFile.data.fileP = T1eexec(inputP->data.fileP); + if (filterFile.data.fileP == NULL) { + fclose(inputFile.data.fileP); + return(SCAN_FILE_OPEN_ERROR); + } + inputP = &filterFile; + + WantFontInfo = FALSE; + } + break; + } + + } + while (rc ==0); + fclose(inputP->data.fileP); + if (tokenTooLong) return(SCAN_OUT_OF_MEMORY); + return(rc); +} + diff -Naur xdvik-22.40l/libs/type1/spaces.c xdvik-22.40n/libs/type1/spaces.c --- xdvik-22.40l/libs/type1/spaces.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/spaces.c Sat Sep 14 00:24:47 2002 @@ -0,0 +1,1016 @@ +/* $XConsortium: spaces.c,v 1.4 91/10/10 11:19:16 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ + /* SPACES CWEB V0021 ******** */ +/* +:h1 id=spaces.SPACES Module - Handles Coordinate Spaces + +This module is responsible for handling the TYPE1IMAGER "XYspace" object. + +&author. Jeffrey B. Lotspiech (lotspiech@almaden.ibm.com) + + +:h3.Include Files +*/ + +#include +#include +#include + +#include "types.h" +#include "objects.h" +#include "spaces.h" +#include "paths.h" +#include "pictures.h" +#include "fonts.h" +#include "arith.h" +#include "trig.h" + +static int FindFfcn(); +static int FindIfcn(); +/* +:h3.Entry Points Provided to the TYPE1IMAGER User +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h3.Entry Points Provided to Other Modules +*/ + +/* +In addition, other modules call the SPACES module through function +vectors in the "XYspace" structure. The entry points accessed that +way are "FConvert()", "IConvert()", and "ForceFloat()". +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h3.Macros and Typedefs Provided to Other Modules + +:h4.Duplicating and Killing Spaces + +Destroying XYspaces is so simple we can do it with a +macro: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +On the other hand, duplicating XYspaces is slightly more difficult +because of the need to keep a unique ID in the space, see +:hdref refid=dupspace.. + +:h4.Fixed Point Pel Representation + +We represent pel positions with fixed point numbers. This does NOT +mean integer, but truly means fixed point, with a certain number +of binary digits (FRACTBITS) representing the fractional part of the +pel. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +/* +:h2.Data Structures for Coordinate Spaces and Points +*/ +/* +:h3 id=matrix.Matrices + +TYPE1IMAGER uses 2x2 transformation matrices. We'll use C notation for +such a matrix (M[2][2]), the first index being rows, the second columns. +*/ + +/* +:h3.The "doublematrix" Structure + +We frequently find it desirable to store both a matrix and its +inverse. We store these in a "doublematrix" structure. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h3.The "XYspace" Structure + +The XYspace structure represents the XYspace object. +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ +#define RESERVED 10 /* 'n' IDs are reserved for invalid & immortal spaces */ +/* +*/ +#define NEXTID ((SpaceID < RESERVED) ? (SpaceID = RESERVED) : ++SpaceID) + +static unsigned int SpaceID = 1; + +struct XYspace *CopySpace(S) + register struct XYspace *S; +{ + S = (struct XYspace *)Allocate(sizeof(struct XYspace), S, 0); + S->ID = NEXTID; + return(S); +} +/* +:h3.The "fractpoint" Structure + +A fractional point is just a "fractpel" x and y: +*/ + +/*SHARED LINE(S) ORIGINATED HERE*/ + +/* +:h3.Lazy Evaluation of Matrix Inverses + +Calculating the inverse of a matrix is somewhat involved, and we usually +do not need them. So, we flag whether or not the space has the inverse +already calculated: +*/ + +#define HASINVERSE(flag) ((flag)&0x80) + +/* +The following macro forces a space to have an inverse: +*/ + +#define CoerceInverse(S) if (!HASINVERSE((S)->flag)) { \ + MatrixInvert((S)->tofract.normal, (S)->tofract.inverse); (S)->flag |= HASINVERSE(ON); } +/* +:h3.IDENTITY Space + +IDENTITY space is (logically) the space corresponding to the identity +transformation matrix. However, since all our transformation matrices +have a common FRACTFLOAT scale factor to convert to 'fractpel's, that +is actually what we store in 'tofract' matrix of IDENTITY: +*/ + +static struct XYspace identity = { SPACETYPE, ISPERMANENT(ON) + ISIMMORTAL(ON) + + HASINVERSE(ON), 2, /* added 3-26-91 PNM */ + NULL, NULL, + NULL, NULL, NULL, NULL, + INVALIDID + 1, 0, + {{{FRACTFLOAT, 0.0}, {0.0, FRACTFLOAT}}, + {{1.0/FRACTFLOAT, 0.0}, {0.0, 1.0/FRACTFLOAT}}}, + {{0, 0}, {0, 0}} }; +struct XYspace *IDENTITY = &identity; + +/* +*/ +#define MAXCONTEXTS 16 + +static struct doublematrix contexts[MAXCONTEXTS]; + +#ifdef notdef + +static int nextcontext = 1; + +/*SHARED LINE(S) ORIGINATED HERE*/ + +#if __STDC__ +#define pointer void * +#else +#define pointer char * +#endif + +/* +:h3.FindDeviceContext() - Find the Context Given a Device + +This routine, given a device, returns the index of the device's +transformation matrix in the context array. If it cannot find it, +it will allocate a new array entry and fill it out. +*/ + +static int FindDeviceContext(device) + pointer device; /* device token */ +{ + DOUBLE M[2][2]; /* temporary matrix */ + float Xres,Yres; /* device resolution */ + int orient = -1; /* device orientation */ + int rc = -1; /* return code for QueryDeviceState */ + + if (rc != 0) /* we only bother with this check once */ + abort("Context: QueryDeviceState didn't work", 44); + + M[0][0] = M[1][0] = M[0][1] = M[1][1] = 0.0; + + switch (orient) { + case 0: + M[0][0] = Xres; M[1][1] = -Yres; + break; + case 1: + M[1][0] = Yres; M[0][1] = Xres; + break; + case 2: + M[0][0] = -Xres; M[1][1] = Yres; + break; + case 3: + M[1][0] = -Yres; M[0][1] = -Xres; + break; + default: + abort("QueryDeviceState returned invalid orientation", 45); + } + return(FindContext(M)); +} + +/* +:h3.FindContext() - Find the Context Given a Matrix + +This routine, given a matrix, returns the index of that matrix matrix in +the context array. If it cannot find it, it will allocate a new array +entry and fill it out. +*/ + +int FindContext(M) + DOUBLE M[2][2]; /* array to search for */ +{ + register int i; /* loop variable for search */ + for (i=0; i < nextcontext; i++) + if (M[0][0] == contexts[i].normal[0][0] && M[1][0] == contexts[i].normal[1][0] + && M[0][1] == contexts[i].normal[0][1] && M[1][1] == contexts[i].normal[1][1]) + break; + + if (i >= nextcontext) { + if (i >= MAXCONTEXTS) + abort("Context: out of them", 46); + LONGCOPY(contexts[i].normal, M, sizeof(contexts[i].normal)); + MatrixInvert(M, contexts[i].inverse); + nextcontext++; + } + + return(i); +} + +/* +:h3.Context() - Create a Coordinate Space for a Device + +This user operator is implemented by first finding the device context +array index, then transforming IDENTITY space to create an appropriate +cooridnate space. +*/ + +struct XYspace *Context(device, units) + pointer device; /* device token */ + DOUBLE units; /* multiples of one inch */ +{ + DOUBLE M[2][2]; /* device transformation matrix */ + register int n; /* will hold device context number */ + register struct XYspace *S; /* XYspace constructed */ + + IfTrace2((MustTraceCalls),"Context(%x, %f)\n", device, &units); + + ARGCHECK((device == NULL), "Context of NULLDEVICE not allowed", + NULL, IDENTITY, (0), struct XYspace *); + ARGCHECK((units == 0.0), "Context: bad units", NULL, IDENTITY, (0), struct XYspace *); + + n = FindDeviceContext(device); + + LONGCOPY(M, contexts[n].normal, sizeof(M)); + + M[0][0] *= units; + M[0][1] *= units; + M[1][0] *= units; + M[1][1] *= units; + + S = (struct XYspace *)Xform(IDENTITY, M); + + S->context = n; + return(S); +} +#endif + +/* +:h3.ConsiderContext() - Adjust a Matrix to Take Out Device Transform + +Remember, we have :f/x times U times D/ and :f/M/ and and we want :f/x +times U times M times D/. An easy way to do this is to calculate +:f/D sup <-1> times M times D/, because: +:formula. +x times U times D times D sup <-1> times M times D = x times U times M times D +:formula. +So this subroutine, given an :f/M/and an object, finds the :f/D/ for that +object and modifies :f/M/ so it is :f/D sup <-1> times M times D/. +*/ + +static void ConsiderContext(obj, M) + register struct xobject *obj; /* object to be transformed */ + register DOUBLE M[2][2]; /* matrix (may be changed) */ +{ + register int context=0; /* index in contexts array */ + + if (obj == NULL) return; + + if (ISPATHTYPE(obj->type)) { + struct segment *path = (struct segment *) obj; + + context = path->context; + } + else if (obj->type == SPACETYPE) { + struct XYspace *S = (struct XYspace *) obj; + + context = S->context; + } + else if (obj->type == PICTURETYPE) { + + } + else + context = NULLCONTEXT; + + if (context != NULLCONTEXT) { + MatrixMultiply(contexts[context].inverse, M, M); + MatrixMultiply(M, contexts[context].normal, M); + } +} + +/* +:h2.Conversion from User's X,Y to "fractpel" X,Y + +When the user is building paths (lines, moves, curves, etc.) he passes +the control points (x,y) for the paths together with an XYspace. We +must convert from the user's (x,y) to our internal representation +which is in pels (fractpels, actually). This involves transforming +the user's (x,y) under the coordinate space transformation. It is +important that we do this quickly. So, we store pointers to different +conversion functions right in the XYspace structure. This allows us +to have simpler special case functions for the more commonly +encountered types of transformations. + +:h3.Convert(), IConvert(), and ForceFloat() - Called Through "XYspace" Structure + +These are functions that fit in the "convert" and "iconvert" function +pointers in the XYspace structure. They call the "xconvert", "yconvert", +"ixconvert", and "iyconvert" as appropriate to actually do the work. +These secondary routines come in many flavors to handle different +special cases as quickly as possible. +*/ + +int FXYConvert(pt, S, x, y) + register struct fractpoint *pt; /* point to set */ + register struct XYspace *S; /* relevant coordinate space */ + register DOUBLE x,y; /* user's coordinates of point */ +{ + pt->x = (*S->xconvert)(S->tofract.normal[0][0], S->tofract.normal[1][0], x, y); + pt->y = (*S->yconvert)(S->tofract.normal[0][1], S->tofract.normal[1][1], x, y); + return(0); + +} + +int IXYConvert(pt, S, x, y) + register struct fractpoint *pt; /* point to set */ + register struct XYspace *S; /* relevant coordinate space */ + register LONG x,y; /* user's coordinates of point */ +{ + pt->x = (*S->ixconvert)(S->itofract[0][0], S->itofract[1][0], x, y); + pt->y = (*S->iyconvert)(S->itofract[0][1], S->itofract[1][1], x, y); + return(0); + +} + +/* +ForceFloat is a substitute for IConvert(), when we just do not have +enough significant digits in the coefficients to get high enough +precision in the answer with fixed point arithmetic. So, we force the +integers to floats, and do the arithmetic all with floats: +*/ + +int ForceFloat(pt, S, x, y) + register struct fractpoint *pt; /* point to set */ + register struct XYspace *S; /* relevant coordinate space */ + register LONG x,y; /* user's coordinates of point */ +{ + (*S->convert)(pt, S, (DOUBLE) x, (DOUBLE) y); + return(0); + +} + +/* +:h3.FXYboth(), FXonly(), FYonly() - Floating Point Conversion + +These are the routines we use when the user has given us floating +point numbers for x and y. FXYboth() is the general purpose routine; +FXonly() and FYonly() are special cases when one of the coefficients +is 0.0. +*/ + +fractpel FXYboth(cx, cy, x, y) + register DOUBLE cx,cy; /* x and y coefficients */ + register DOUBLE x,y; /* user x,y */ +{ + register DOUBLE r; /* temporary float */ + + r = x * cx + y * cy; + return((fractpel) r); +} + +/*ARGSUSED*/ +fractpel FXonly(cx, cy, x, y) + register DOUBLE cx,cy; /* x and y coefficients */ + register DOUBLE x,y; /* user x,y */ +{ + register DOUBLE r; /* temporary float */ + + r = x * cx; + return((fractpel) r); +} + +/*ARGSUSED*/ +fractpel FYonly(cx, cy, x, y) + register DOUBLE cx,cy; /* x and y coefficients */ + register DOUBLE x,y; /* user x,y */ +{ + register DOUBLE r; /* temporary float */ + + r = y * cy; + return((fractpel) r); +} + +/* +:h3.IXYboth(), IXonly(), IYonly() - Simple Integer Conversion + +These are the routines we use when the user has given us integers for +x and y, and the coefficients have enough significant digits to +provide precise answers with only "long" (32 bit?) multiplication. +IXYboth() is the general purpose routine; IXonly() and IYonly() are +special cases when one of the coefficients is 0. +*/ + +fractpel IXYboth(cx, cy, x, y) + register fractpel cx,cy; /* x and y coefficients */ + register LONG x,y; /* user x,y */ +{ + return(x * cx + y * cy); +} + +/*ARGSUSED*/ +fractpel IXonly(cx, cy, x, y) + register fractpel cx,cy; /* x and y coefficients */ + register LONG x,y; /* user x,y */ +{ + return(x * cx); +} + +/*ARGSUSED*/ +fractpel IYonly(cx, cy, x, y) + register fractpel cx,cy; /* x and y coefficients */ + register LONG x,y; /* user x,y */ +{ + return(y * cy); +} + + +/* +:h3.FPXYboth(), FPXonly(), FPYonly() - More Involved Integer Conversion + +These are the routines we use when the user has given us integers for +x and y, but the coefficients do not have enough significant digits to +provide precise answers with only "long" (32 bit?) multiplication. +We have increased the number of significant bits in the coefficients +by FRACTBITS; therefore we must use "double long" (64 bit?) +multiplication by calling FPmult(). FPXYboth() is the general purpose +routine; FPXonly() and FPYonly() are special cases when one of the +coefficients is 0. + +Note that it is perfectly possible for us to calculate X with the +"FP" method and Y with the "I" method, or vice versa. It all depends +on how the functions in the XYspace structure are filled out. +*/ + +fractpel FPXYboth(cx, cy, x, y) + register fractpel cx,cy; /* x and y coefficients */ + register LONG x,y; /* user x,y */ +{ + return( FPmult(x, cx) + FPmult(y, cy) ); +} + +/*ARGSUSED*/ +fractpel FPXonly(cx, cy, x, y) + register fractpel cx,cy; /* x and y coefficients */ + register LONG x,y; /* user x,y */ +{ + return( FPmult(x, cx) ); +} + +/*ARGSUSED*/ +fractpel FPYonly(cx, cy, x, y) + register fractpel cx,cy; /* x and y coefficients */ + register LONG x,y; /* user x,y */ +{ + return( FPmult(y, cy) ); +} + + + +/* +:h3.FillOutFcns() - Determine the Appropriate Functions to Use for Conversion + +This function fills out the "convert" and "iconvert" function pointers +in an XYspace structure, and also fills the "helper" +functions that actually do the work. +*/ + +static void FillOutFcns(S) + register struct XYspace *S; /* functions will be set in this structure */ +{ + S->convert = FXYConvert; + S->iconvert = IXYConvert; + + FindFfcn(S->tofract.normal[0][0], S->tofract.normal[1][0], &S->xconvert); + FindFfcn(S->tofract.normal[0][1], S->tofract.normal[1][1], &S->yconvert); + FindIfcn(S->tofract.normal[0][0], S->tofract.normal[1][0], + &S->itofract[0][0], &S->itofract[1][0], &S->ixconvert); + FindIfcn(S->tofract.normal[0][1], S->tofract.normal[1][1], + &S->itofract[0][1], &S->itofract[1][1], &S->iyconvert); + + if (S->ixconvert == NULL || S->iyconvert == NULL) + S->iconvert = ForceFloat; +} + +/* +:h4.FindFfcn() - Subroutine of FillOutFcns() to Fill Out Floating Functions + +This function tests for the special case of one of the coefficients +being zero: +*/ + +static int FindFfcn(cx, cy, fcnP) + register DOUBLE cx,cy; /* x and y coefficients */ + register fractpel (**fcnP)(); /* pointer to function to set */ +{ + if (cx == 0.0) + *fcnP = FYonly; + else if (cy == 0.0) + *fcnP = FXonly; + else + *fcnP = FXYboth; + return(0); + +} + +/* +:h4.FindIfcn() - Subroutine of FillOutFcns() to Fill Out Integer Functions + +There are two types of integer functions, the 'I' type and the 'FP' type. +We use the I type functions when we are satisfied with simple integer +arithmetic. We used the FP functions when we feel we need higher +precision (but still fixed point) arithmetic. If all else fails, +we store a NULL indicating that this we should do the conversion in +floating point. +*/ + +static int FindIfcn(cx, cy, icxP, icyP, fcnP) + register DOUBLE cx,cy; /* x and y coefficients */ + register fractpel *icxP,*icyP; /* fixed point coefficients to set */ + register fractpel (**fcnP)(); /* pointer to function to set */ +{ + register fractpel imax; /* maximum of cx and cy */ + + *icxP = cx; + *icyP = cy; + + if (cx != (float) (*icxP) || cy != (float) (*icyP)) { +/* +At this point we know our integer approximations of the coefficients +are not exact. However, we will still use them if the maximum +coefficient will not fit in a 'fractpel'. Of course, we have little +choice at that point, but we haven't lost that much precision by +staying with integer arithmetic. We have enough significant digits +so that +any error we introduce is less than one part in 2:sup/16/. +*/ + + imax = TYPE1_MAX(TYPE1_ABS(*icxP), TYPE1_ABS(*icyP)); + if (imax < (fractpel) (1<<(FRACTBITS-1)) ) { +/* +At this point we know our integer approximations just do not have +enough significant digits for accuracy. We will add FRACTBITS +significant digits to the coefficients (by multiplying them by +1<x; + y = pt->y; + *xp = S->tofract.inverse[0][0] * x + S->tofract.inverse[1][0] * y; + *yp = S->tofract.inverse[0][1] * x + S->tofract.inverse[1][1] * y; +} + +/* +:h2.Transformations +*/ +/* +:h3 id=xform.Xform() - Transform Object in X and Y + +TYPE1IMAGER wants transformations of objects like paths to be identical +to transformations of spaces. For example, if you scale a line(1,1) +by 10 it should yield the same result as generating the line(1,1) in +a coordinate space that has been scaled by 10. + +We handle fonts by storing the accumulated transform, for example, SR +(accumulating on the right). Then when we map the font through space TD, +for example, we multiply the accumulated font transform on the left by +the space transform on the right, yielding SRTD in this case. We will +get the same result if we did S, then R, then T on the space and mapping +an unmodified font through that space. +*/ + +struct xobject *t1_Xform(obj, M) + register struct xobject *obj; /* object to transform */ + register DOUBLE M[2][2]; /* transformation matrix */ +{ + if (obj == NULL) + return(NULL); + + if (obj->type == FONTTYPE) { + register struct font *F = (struct font *) obj; + + F = UniqueFont(F); + return((struct xobject*)F); + } + if (obj->type == PICTURETYPE) { +/* +In the case of a picture, we choose both to update the picture's +transformation matrix and keep the handles up to date. +*/ + register struct picture *P = (struct picture *) obj; + register struct segment *handles; /* temporary path to transform handles */ + + P = UniquePicture(P); + handles = PathSegment(LINETYPE, P->origin.x, P->origin.y); + handles = Join(handles, + PathSegment(LINETYPE, P->ending.x, P->ending.y) ); + handles = (struct segment *)Xform((struct xobject *) handles, M); + P->origin = handles->dest; + P->ending = handles->link->dest; + KillPath(handles); + return((struct xobject *)P); + } + + if (ISPATHTYPE(obj->type)) { + struct XYspace pseudo; /* local temporary space */ + PseudoSpace(&pseudo, M); + return((struct xobject *) PathTransform(obj, &pseudo)); + } + + + if (obj->type == SPACETYPE) { + register struct XYspace *S = (struct XYspace *) obj; + +/* replaced ISPERMANENT(S->flag) with S->references > 1 3-26-91 PNM */ + if (S->references > 1) + S = CopySpace(S); + else + S->ID = NEXTID; + + MatrixMultiply(S->tofract.normal, M, S->tofract.normal); + /* + * mark inverted matrix invalid: + */ + S->flag &= ~HASINVERSE(ON); + + FillOutFcns(S); + return((struct xobject *) S); + } + + return(ArgErr("Untransformable object", obj, obj)); +} + +/* +:h3.Transform() - Transform an Object + +This is the external user's entry point. +*/ +struct xobject *t1_Transform(obj, cxx, cyx, cxy, cyy) + struct xobject *obj; + DOUBLE cxx,cyx,cxy,cyy; /* 2x2 transform matrix elements in row order */ +{ + DOUBLE M[2][2]; + + IfTrace1((MustTraceCalls),"Transform(%p,", obj); + IfTrace4((MustTraceCalls)," %f %f %f %f)\n", cxx, cyx, cxy, cyy); + + M[0][0] = cxx; + M[0][1] = cyx; + M[1][0] = cxy; + M[1][1] = cyy; + ConsiderContext(obj, M); + return(Xform(obj, M)); +} +/* +:h3.Scale() - Special Case of Transform() + +This is a user operator. +*/ + +struct xobject *t1_Scale(obj, sx, sy) + struct xobject *obj; /* object to scale */ + DOUBLE sx,sy; /* scale factors in x and y */ +{ + DOUBLE M[2][2]; + IfTrace3((MustTraceCalls),"Scale(%p, %f, %f)\n", obj, sx, sy); + M[0][0] = sx; + M[1][1] = sy; + M[1][0] = M[0][1] = 0.0; + ConsiderContext(obj, M); + return(Xform(obj, M)); +} + +/* +:h3 id=rotate.Rotate() - Special Case of Transform() + +We special-case different settings of 'degrees' for performance +and accuracy within the DegreeSin() and DegreeCos() routines themselves. +*/ + +#ifdef notdef +struct xobject *xiRotate(obj, degrees) + struct xobject *obj; /* object to be transformed */ + DOUBLE degrees; /* degrees of COUNTER-clockwise rotation */ +{ + DOUBLE M[2][2]; + + + IfTrace2((MustTraceCalls),"Rotate(%z, %f)\n", obj, °rees); + + M[0][0] = M[1][1] = DegreeCos(degrees); + M[1][0] = - (M[0][1] = DegreeSin(degrees)); + ConsiderContext(obj, M); + return(Xform(obj, M)); +} +#endif + +/* +:h3.PseudoSpace() - Build a Coordinate Space from a Matrix + +Since we have built all this optimized code that, given an (x,y) and +a coordinate space, yield transformed (x,y), it seems a shame not to +use the same logic when we need to multiply an (x,y) by an arbitrary +matrix that is not (initially) part of a coordinate space. This +subroutine takes the arbitrary matrix and builds a coordinate +space, with all its nifty function pointers. +*/ + +void PseudoSpace(S, M) + struct XYspace *S; /* coordinate space structure to fill out */ + DOUBLE M[2][2]; /* matrix that will become 'tofract.normal' */ +{ + S->type = SPACETYPE; + S->flag = ISPERMANENT(ON) + ISIMMORTAL(ON); + S->references = 2; /* 3-26-91 added PNM */ + S->tofract.normal[0][0] = M[0][0]; + S->tofract.normal[1][0] = M[1][0]; + S->tofract.normal[0][1] = M[0][1]; + S->tofract.normal[1][1] = M[1][1]; + + FillOutFcns(S); +} + +/* +:h2 id=matrixa.Matrix Arithmetic + +Following the convention in Newman and Sproull, :hp1/Interactive +Computer Graphics/, +matrices are organized: +:xmp. + | cxx cyx | + | cxy cyy | +:exmp. +A point is horizontal, for example: +:xmp. + [ x y ] +:exmp. +This means that: +:formula/x prime = cxx times x + cxy times y/ +:formula/y prime = cyx times x + cyy times y/ +I've seen the other convention, where transform matrices are +transposed, equally often in the literature. +*/ + +/* +:h3.MatrixMultiply() - Implements Multiplication of Two Matrices + +Implements matrix multiplication, A * B = C. + +To remind myself, matrix multiplication goes rows of A times columns +of B. +The output matrix may be the same as one of the input matrices. +*/ +void MatrixMultiply(A, B, C) + register DOUBLE A[2][2],B[2][2]; /* input matrices */ + register DOUBLE C[2][2]; /* output matrix */ +{ + register DOUBLE txx,txy,tyx,tyy; + + txx = A[0][0] * B[0][0] + A[0][1] * B[1][0]; + txy = A[1][0] * B[0][0] + A[1][1] * B[1][0]; + tyx = A[0][0] * B[0][1] + A[0][1] * B[1][1]; + tyy = A[1][0] * B[0][1] + A[1][1] * B[1][1]; + + C[0][0] = txx; + C[1][0] = txy; + C[0][1] = tyx; + C[1][1] = tyy; +} +/* +:h3.MatrixInvert() - Invert a Matrix + +My reference for matrix inversion was :hp1/Elementary Linear Algebra/ +by Paul C. Shields, Worth Publishers, Inc., 1968. +*/ +void MatrixInvert(M, Mprime) + DOUBLE M[2][2]; /* input matrix */ + DOUBLE Mprime[2][2]; /* output inverted matrix */ +{ + register DOUBLE D; /* determinant of matrix M */ + register DOUBLE txx,txy,tyx,tyy; + + txx = M[0][0]; + txy = M[1][0]; + tyx = M[0][1]; + tyy = M[1][1]; + + D = M[1][1] * M[0][0] - M[1][0] * M[0][1]; + if (D == 0.0) + abort("MatrixInvert: can't", 47); + + Mprime[0][0] = tyy / D; + Mprime[1][0] = -txy / D; + Mprime[0][1] = -tyx / D; + Mprime[1][1] = txx / D; +} +/* +:h2.Initialization, Queries, and Debug +*/ +/* +:h3.InitSpaces() - Initialize Constant Spaces + +For compatibility, we initialize a coordinate space called USER which +maps 72nds of an inch to pels on the default device. +*/ + +struct XYspace *USER = &identity; + +void InitSpaces() +{ + /* extern char *DEFAULTDEVICE; */ + + IDENTITY->type = SPACETYPE; + FillOutFcns(IDENTITY); + + contexts[NULLCONTEXT].normal[1][0] + = contexts[NULLCONTEXT].normal[0][1] + = contexts[NULLCONTEXT].inverse[1][0] + = contexts[NULLCONTEXT].inverse[0][1] = 0.0; + contexts[NULLCONTEXT].normal[0][0] + = contexts[NULLCONTEXT].normal[1][1] + = contexts[NULLCONTEXT].inverse[0][0] + = contexts[NULLCONTEXT].inverse[1][1] = 1.0; + + USER->flag |= ISIMMORTAL(ON); + CoerceInverse(USER); +} +/* +:h3.QuerySpace() - Returns the Transformation Matrix of a Space + +Since the tofract matrix of an XYspace includes the scale factor +necessary to produce fractpel results (i.e., FRACTFLOAT), this +must be taken out before we return the matrix to the user. Fortunately, +this is simple: just multiply by the inverse of IDENTITY! +*/ + +void QuerySpace(S, cxxP, cyxP, cxyP, cyyP) + register struct XYspace *S; /* space asked about */ + register DOUBLE *cxxP,*cyxP,*cxyP,*cyyP; /* where to put answer */ +{ + DOUBLE M[2][2]; /* temp matrix to build user's answer */ + + if (S->type != SPACETYPE) { + ArgErr("QuerySpace: not a space", S, NULL); + return; + } + MatrixMultiply(S->tofract.normal, IDENTITY->tofract.inverse, M); + *cxxP = M[0][0]; + *cxyP = M[1][0]; + *cyxP = M[0][1]; + *cyyP = M[1][1]; +} + +/* +:h3.FormatFP() - Format a Fixed Point Pel + +We format the pel as "dddd.XXXX", where XX's are hexidecimal digits, +and the dd's are decimal digits. This might be a little confusing +mixing hexidecimal and decimal like that, but it is convenient +to use for debug. + +We make sure we have N (FRACTBITS/4) digits past the decimal point. +*/ +#define FRACTMASK ((1<> FRACTBITS, s); +} + +/* +:h3.DumpSpace() - Display a Coordinate Space +*/ +/*ARGSUSED*/ +void DumpSpace(S) + register struct XYspace *S; +{ + IfTrace4(TRUE,"--Coordinate space at %p,ID=%d,convert=%p,iconvert=%p\n", + S, S->ID, S->convert, S->iconvert); + IfTrace2(TRUE," | %12.3f %12.3f |", + S->tofract.normal[0][0], S->tofract.normal[0][1]); + IfTrace2(TRUE," [ %d %d ]\n", S->itofract[0][0], S->itofract[0][1]); + IfTrace2(TRUE," | %12.3f %12.3f |", + S->tofract.normal[1][0], S->tofract.normal[1][1]); + IfTrace2(TRUE," [ %d %d ]\n", S->itofract[1][0], S->itofract[1][1]); +} diff -Naur xdvik-22.40l/libs/type1/spaces.h xdvik-22.40n/libs/type1/spaces.h --- xdvik-22.40l/libs/type1/spaces.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/spaces.h Sat Sep 14 00:24:48 2002 @@ -0,0 +1,142 @@ +/* $XConsortium: spaces.h,v 1.3 91/10/10 11:19:22 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF + * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE + * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE + * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE + * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL + * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +/*SHARED*/ + +#include "types.h" + +#define USER t1_User +#define IDENTITY t1_Identity + +#define Context(d,u) t1_Context(d,u) +#define Transform(o,f1,f2,f3,f4) t1_Transform(o,f1,f2,f3,f4) +#define Rotate(o,d) t1_Rotate(o,d) +#define Scale(o,sx,sy) t1_Scale(o,sx,sy) +#define QuerySpace(S,f1,f2,f3,f4) t1_QuerySpace(S,f1,f2,f3,f4) +#define Warp(s1,o,s2) t1_Warp(s1,o,s2) + +struct XYspace *t1_Context(); /* creates a coordinate space for a device */ +struct xobject *t1_Transform(); /* transform an object */ +struct xobject *t1_Rotate(); /* rotate an object */ +struct xobject *t1_Scale(); /* scale an object */ +struct xobject *t1_Warp(); /* transform like delta of two spaces */ +void t1_QuerySpace(); /* returns coordinate space matrix */ + +/*END SHARED*/ +/*SHARED*/ + +#define DeviceResolution t1_DeviceResolution +#define InitSpaces() t1_InitSpaces() +#define CopySpace(s) t1_CopySpace(s) +#define Xform(o,M) t1_Xform(o,M) +#define UnConvert(S,pt,xp,yp) t1_UnConvert(S,pt,xp,yp) +#define MatrixMultiply(A,B,C) t1_MMultiply(A,B,C) +#define MatrixInvert(A,B) t1_MInvert(A,B) +#define PseudoSpace(S,M) t1_PseudoSpace(S,M) +#define FindContext(M) t1_FindContext(M) + +void t1_InitSpaces(); /* initialize pre-defined coordinate spaces */ +struct XYspace *t1_CopySpace(); /* duplicate a coordinate space */ +struct xobject *t1_Xform(); /* transform object by matrix */ +void t1_UnConvert(); /* return user coordinates from device coordinates */ +void t1_MMultiply(); /* multiply two matrices */ +void t1_MInvert(); /* invert a matrix */ +void t1_PseudoSpace(); /* force a coordinate space from a matrix */ +int t1_FindContext(); /* return the "context" represented by a matrix */ + +/*END SHARED*/ +/*SHARED*/ + +/* #define KillSpace(s) Free(s) +Note - redefined KillSpace() to check references ! +3-26-91 PNM */ + +#define KillSpace(s) if ( (--(s->references) == 0) ||\ + ( (s->references == 1) && ISPERMANENT(s->flag) ) )\ + Free(s) + +#define ConsumeSpace(s) MAKECONSUME(s,KillSpace(s)) +#define UniqueSpace(s) MAKEUNIQUE(s,CopySpace(s)) + +/*END SHARED*/ +/*SHARED*/ + +typedef SHORT pel; /* integer pel locations */ +typedef LONG fractpel; /* fractional pel locations */ + +#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ +/* +We define the following macros to convert from 'fractpel' to 'pel' and +vice versa: +*/ +#define TOFRACTPEL(p) (((fractpel)p)<>FRACTBITS) +#define FRACTFLOAT (DOUBLE)(1L<references) == 0) ||\ + ( (s->references == 1) && ISPERMANENT(s->flag) ) )\ + Free(s) + +#define ConsumeSpace(s) MAKECONSUME(s,KillSpace(s)) +#define UniqueSpace(s) MAKEUNIQUE(s,CopySpace(s)) + +/*END SHARED*/ +/*SHARED*/ + +typedef SHORT pel; /* integer pel locations */ +typedef LONG fractpel; /* fractional pel locations */ + +#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */ +/* +We define the following macros to convert from 'fractpel' to 'pel' and +vice versa: +*/ +#define TOFRACTPEL(p) (((fractpel)p)<>FRACTBITS) +#define FRACTFLOAT (DOUBLE)(1L< +# include +# include +#else +# include +#endif +#include +#include +#include +#include +#include + +#include "t1stdio.h" +#include "t1hdigit.h" + +/* we define this to switch to decrypt-debugging mode. The stream of + decrypted bytes will be written to stdout! This contains binary + charstring data */ +/* #define DEBUG_DECRYPTION */ +/* #define DEBUG_PFB_BLOCKS */ + +/* Constants and variables used in the decryption */ +#define c1 ((unsigned short)52845) +#define c2 ((unsigned short)22719) +static unsigned short r; +static int asc, Decrypt; +static int extrach; +static int haveextrach; + +static int starthex80=0; +static long pfbblocklen=0; +static long accu=0; +static unsigned long bytecnt=0; +static int eexec_startOK=0; +static int eexec_endOK=0; +static int in_eexec=0; + + +/* Our single FILE structure and buffer for this package */ +STATIC F_FILE TheFile; +STATIC unsigned char TheBuffer[F_BUFSIZ]; + +/* Our routines */ +F_FILE *T1Open(), *T1eexec(); +int T1Close(); +int T1Read(), T1Getc(), T1Ungetc(); +void T1io_reset(void); +STATIC int T1Decrypt(), T1Fill(); + +/* -------------------------------------------------------------- */ +/*ARGSUSED*/ +F_FILE *T1Open(fn, mode) + char *fn; /* Pointer to filename */ + char *mode; /* Pointer to open mode string */ +{ + F_FILE *of = &TheFile; + char c; + + + Decrypt = 0; + eexec_startOK=0; + eexec_endOK=0; + + /* We know we are only reading */ + /* cygwin32 also needs the binary flag to be set */ +#if defined(MSDOS) | defined(_WIN32) | defined (__EMX__) + if ((of->fd=open(fn, O_RDONLY | O_BINARY)) < 0) return NULL; +#else + if ((of->fd=open(fn, O_RDONLY)) < 0) return NULL; +#endif + + /* We check for pfa/pfb file */ + if (read( of->fd, &c, 1)!=1) { + close( of->fd); + return(NULL); + } + else + if (c==(char)0x80){ + starthex80=1; + } + lseek( of->fd, 0, SEEK_SET); + + /* Initialize the buffer information of our file descriptor */ + of->b_base = TheBuffer; + of->b_size = F_BUFSIZ; + of->b_ptr = NULL; + of->b_cnt = 0; + of->flags = 0; + of->error = 0; + haveextrach = 0; + return &TheFile; +} /* end Open */ + +/* -------------------------------------------------------------- */ +int T1Getc(f) /* Read one character */ + F_FILE *f; /* Stream descriptor */ +{ + if (f->b_base == NULL) return EOF; /* already closed */ + + if (f->flags & UNGOTTENC) { /* there is an ungotten c */ + f->flags &= ~UNGOTTENC; + return (int) f->ungotc; + } + + if (f->b_cnt == 0) /* Buffer needs to be (re)filled */ + f->b_cnt = T1Fill(f); + if (f->b_cnt > 0) return (f->b_cnt--, (int) *(f->b_ptr++)); + else { + f->flags |= FIOEOF; + return EOF; + } +} /* end Getc */ + +/* This function is added by RMz: + T1Gets(): Read a line of the file and save it to string. At most, + (size-1) bytes are read. The user *must* ensure (by making size large + enough) that "eexec" does not get split between two calls because + in this case, eexec-encryption does not set in. + ------------------------------------------------------------ */ +int T1Gets(char *string, + int size, + F_FILE *f) /* Read a line */ +{ + int i=0; + char *eexecP; + + if (string == NULL) { + return( i); + } + if (f->b_base == NULL) + return( i); /* already closed */ + if (size<2) /* no bytes to be read. For size = 1 we only had + room for the \0-character. */ + return( i); + + if (f->flags & UNGOTTENC) { /* there is an ungotten c */ + f->flags &= ~UNGOTTENC; + string[i++]=f->ungotc; + size--; + } + + size--; /* we have to leave room for one \0-character */ + + while ( size>0) { + if (f->b_cnt == 0) { /* Buffer needs to be (re)filled */ + f->b_cnt = T1Fill(f); + } + if (f->b_cnt == 0) { /* no more bytes available. Put \0-char + and return. */ + if ( i==0) { /* we did not already store one single char to string */ + f->flags |= FIOEOF; + return( i); + } + else { + f->flags |= FIOEOF; + string[i]='\0'; + return( i); + } + } + + /* do not skip white space as required by Adobe spec, because + if have found fonts where the first encrypted byte was of + white space type. */ + if ( (eexec_startOK==1) && (eexec_endOK==1)) { + T1eexec( f); + eexec_startOK=0; + eexec_endOK=0; + in_eexec=1; + /* we are now in the encrypted portion. */ + } + string[i]=*(f->b_ptr); + + /* Check whether eexec appears in the string just setup */ + if ( (Decrypt==0) && + ((eexecP=strstr( string, "eexec"))!=NULL) ) { + /* if eexec is an isolated token, start decryption */ + if ( (eexec_startOK==1) && + (isspace( (int)string[i])!=0) ) { + eexec_endOK=1; + } + if ( (eexec_startOK==0) && + (isspace( (int)string[i-5])!=0) ) { + eexec_startOK=1; + } + } + i++; + /* Under UNIX, '\n' is the accepted newline. For pfb-files it is also + common to use '\r' as the newline indicator. I have, however, never + seen a pfb-file which uses the sequence '\r''\n' as a newline + indicator, as known from DOS. So we don't take care for this case + and simply map both single characters \r and \n into \n. Of course, + this can only be done in the ASCII section of the font. */ + if ( *(f->b_ptr)=='\n' || *(f->b_ptr)=='\r') { + if (in_eexec==0) + string[i-1]='\n'; + string[i]='\0'; + f->b_cnt--; + f->b_ptr++; + return( i); + } + + f->b_cnt--; + f->b_ptr++; + size--; + } /* end of while (size>0) */ + + string[i]='\0'; /* finish string */ + return( i); + +} /* end of T1Gets() */ + + + +int T1GetDecrypt( void) +{ + return( in_eexec); +} + + +/* Return the optional contents after the final cleartomark token. + There might appear some PostScript code which is not important + for t1lib, but which becomes important if subsetted fonts are + embedded in PostScript files. */ +int T1GetTrailer(char *string, + int size, + F_FILE *f) +{ + unsigned long off_save; + char *buf; + char *ctmP; + int i=0, j; + int datasize; + + datasize=size; + + off_save=lseek( f->fd, 0, SEEK_CUR); + if ((buf=(char *)malloc( size+1))==NULL ) { + return( -1); + } + lseek( f->fd, -size, SEEK_END); + read(f->fd, buf, size); + buf[size]='\0'; /* to be ablo perform a strstr() on this memory */ + + i=datasize; + j=datasize-11; /* length of "cleartomark" plus terminating white + space or newline */ + + while ((j--)>-1) { + if ((unsigned char)buf[i]==0x80) { + datasize=i; /* we skip the segment marker of pfb-files */ + } + if ((ctmP=strstr( &(buf[j]), "cleartomark"))!=NULL) { + memcpy( string, &(buf[i]), datasize-i); + string[datasize-i]='\0'; + lseek( f->fd, off_save, SEEK_SET); + free( buf); + return( datasize-i); + } + i--; + } + lseek( f->fd, off_save, SEEK_SET); + free( buf); + return( -1); +} + + + +unsigned long T1GetFileSize( F_FILE *f) +{ + unsigned long off_save; + unsigned long filesize; + + off_save=lseek( f->fd, 0, SEEK_CUR); + filesize=lseek( f->fd, 0, SEEK_END); + lseek( f->fd, off_save, SEEK_SET); + return( filesize); +} + + + +/* -------------------------------------------------------------- */ +int T1Ungetc(c, f) /* Put back one character */ + int c; + F_FILE *f; /* Stream descriptor */ +{ + if (c != EOF) { + f->ungotc = c; + f->flags |= UNGOTTENC; /* set flag */ + f->flags &= ~FIOEOF; /* reset EOF */ + } + return c; +} /* end Ungetc */ + +/* -------------------------------------------------------------- */ +int T1Read(buffP, size, n, f) /* Read n items into caller's buffer */ + char *buffP; /* Buffer to be filled */ + int size; /* Size of each item */ + int n; /* Number of items to read */ + F_FILE *f; /* Stream descriptor */ +{ + int bytelen, cnt, i; + F_char *p = (F_char *)buffP; + int icnt; /* Number of characters to read */ + + if (f->b_base == NULL) return 0; /* closed */ + icnt = (size!=1)?n*size:n; /* Number of bytes we want */ + + if (f->flags & UNGOTTENC) { /* there is an ungotten c */ + f->flags &= ~UNGOTTENC; + *(p++) = f->ungotc; + icnt--; bytelen = 1; + } + else bytelen = 0; + + while (icnt > 0) { + /* First use any bytes we have buffered in the stream buffer */ + if ((cnt=f->b_cnt) > 0) { + if (cnt > icnt) cnt = icnt; + for (i=0; ib_ptr++); + f->b_cnt -= cnt; + icnt -= cnt; + bytelen += cnt; + } + + if ((icnt == 0) || (f->flags & FIOEOF)) break; + + f->b_cnt = T1Fill(f); + } + return ((size!=1)?bytelen/size:bytelen); +} /* end Read */ + +/* -------------------------------------------------------------- */ +int T1Close(f) /* Close the file */ + F_FILE *f; /* Stream descriptor */ +{ + if (f->b_base == NULL) return 0; /* already closed */ + f->b_base = NULL; /* no valid stream */ + return close(f->fd); +} /* end Close */ + + +/* -------------------------------------------------------------- */ +F_FILE *T1eexec(f) /* Initialization */ + F_FILE *f; /* Stream descriptor */ +{ + int i; + int H; + + unsigned char *p; + unsigned char randomP[8]; + + r = 55665; /* initial key */ + asc = 1; /* indicate ASCII form */ + +#ifdef DEBUG_DECRYPTION + printf("T1eexec(1): first 20 bytes=%.20s, b_cnt=%d\n", f->b_ptr, f->b_cnt); +#endif + + /* Consume the 4 random bytes, determining if we are also to + ASCIIDecodeHex as we process our input. (See pages 63-64 + of the Adobe Type 1 Font Format book.) */ + + /* Skipping over initial white space chars has been removed since + it could lead to unprocessable pfb-fonts if accindentally the + first cipher text byte was of the class HWHITE_SPACE. + Instead, we just read ahead, this should suffice for any + Type 1 font program. (RMz, 08/02/1998) */ + + /* If ASCII, the next 7 chars are guaranteed consecutive */ + randomP[0] = getc(f); /* store first non white space char */ + fread(randomP+1, 1, 3, f); /* read 3 more, for a total of 4 */ + /* store first four chars */ + for (i=0,p=randomP; i<4; i++) { /* Check 4 valid ASCIIEncode chars */ + if (HighHexP[*p++] > LAST_HDIGIT) { /* non-ASCII byte */ + asc = 0; + break; + } + } + if (asc) { /* ASCII form, convert first eight bytes to binary */ + fread(randomP+4, 1, 4, f); /* Need four more */ + for (i=0,p=randomP; i<4; i++) { /* Convert */ + H = HighHexP[*p++]; + randomP[i] = H | LowHexP[*p++]; + } + } + + /* Adjust our key */ + for (i=0,p=randomP; i<4; i++) { + r = (*p++ + r) * c1 + c2; + } + + /* Decrypt the remaining buffered bytes */ + f->b_cnt = T1Decrypt(f->b_ptr, f->b_cnt); + Decrypt = 1; + +#ifdef DEBUG_DECRYPTION + printf("T1eexec(2): first 120 bytes=%.120s, b_cnt=%d\n", f->b_ptr, f->b_cnt); +#endif + + return (feof(f))?NULL:f; +} /* end eexec */ + +/* -------------------------------------------------------------- */ +STATIC int T1Decrypt(p, len) + unsigned char *p; + int len; +{ + int n; + int H=0, L=0; + unsigned char *inp = p; + unsigned char *tblP; + +#ifdef DEBUG_DECRYPTION + printf("T1_Decrypt(): called with len=%d\n",len); +#endif + if (asc) { + if (haveextrach) { + H = extrach; + tblP = LowHexP; + } + else tblP = HighHexP; + for (n=0; len>0; len--) { + L = tblP[*inp++]; +#ifdef DEBUG_DECRYPTION + printf("L=0x%X, %d, inp=%c (%d)\n", L,L, *(inp-1), *(inp-1)); +#endif + if (L == HWHITE_SPACE) { +#ifdef DEBUG_DECRYPTION + printf("continue\n"); +#endif + continue; + } + if (L > LAST_HDIGIT) { +#ifdef DEBUG_DECRYPTION + printf("L=0x%X, --> break\n", L); +#endif + break; + } + + if (tblP == HighHexP) { /* Got first hexit value */ + H = L; + tblP = LowHexP; + } else { /* Got second hexit value; compute value and store it */ + n++; + tblP = HighHexP; + H |= L; + /* H is an int, 0 <= H <= 255, so all of this will work */ + *p++ = H ^ (r >> 8); + r = (H + r) * c1 + c2; + } + } + if (tblP != HighHexP) { /* We had an odd number of hexits */ + extrach = H; + haveextrach = 1; + } else haveextrach = 0; +#ifdef DEBUG_DECRYPTION + printf("T1_Decrypt(): Decrypted %d bytes\n",n); +#endif + return n; + } else { + for (n = len; n>0; n--) { + H = *inp++; + *p++ = H ^ (r >> 8); + r = (H + r) * c1 + c2; + } + return len; + } +} /* end Decrypt */ + +/* -------------------------------------------------------------- */ +/* This function has been adapted to support pfb-files with multiple + data segments */ +STATIC int T1Fill(f) /* Refill stream buffer */ + F_FILE *f; /* Stream descriptor */ +{ + int rc,i; + static unsigned char hdr_buf[6]; + + if (starthex80){ /* we have a pfb-file -> be aware of pfb-blocks */ + if ( pfbblocklen-accu >= F_BUFSIZ){ + /* fill the buffer */ + rc = read(f->fd, f->b_base, F_BUFSIZ); + bytecnt+=rc; + accu +=rc; + } + else{ + if (pfbblocklen-accu>0){ + /* read the remaining of the pfb-block ... */ + rc = read(f->fd, f->b_base, pfbblocklen-accu); + bytecnt +=rc; + accu +=rc; + /* ... and examine the next header */ + i=read(f->fd, hdr_buf, 6); + bytecnt +=i; + pfbblocklen=0; + pfbblocklen += hdr_buf[2]&0xFF ; + pfbblocklen += (hdr_buf[3] & 0xFF) <<8; + pfbblocklen += (hdr_buf[4] & 0xFF) <<16; + pfbblocklen += (hdr_buf[5] & 0xFF) <<24; +#ifdef DEBUG_PFB_BLOCKS + printf("t1io: New segment, length=%d, type=%d\n", + pfbblocklen, hdr_buf[1]); +#endif + accu=0; + } + else{ + /* We are at the beginning of a new block -> + examine header */ + i=read(f->fd, hdr_buf, 6); + pfbblocklen=0; + pfbblocklen += hdr_buf[2]&0xFF ; + pfbblocklen += (hdr_buf[3] & 0xFF) <<8; + pfbblocklen += (hdr_buf[4] & 0xFF) <<16; + pfbblocklen += (hdr_buf[5] & 0xFF) <<24; +#ifdef DEBUG_PFB_BLOCKS + printf("t1io: New segment, length=%d, type=%d\n", + pfbblocklen, hdr_buf[1]); +#endif + accu=0; + /* header read, now fill the buffer */ + if (pfbblocklen-accu >= F_BUFSIZ){ + rc = read(f->fd, f->b_base, F_BUFSIZ); + accu +=rc; + } + else{ + /* we have the unusual case that the pfb-block size is + shorter than F_BUFSIZ -> Read this block only */ + rc = read(f->fd, f->b_base, pfbblocklen); + accu +=rc; + } + } + } + } + else{ + /* We have a pfa-file -> read straight ahead and fill buffer */ + rc = read(f->fd, f->b_base, F_BUFSIZ); + } + + /* propagate any error or eof to current file */ + if (rc <= 0) { + if (rc == 0) /* means EOF */ + f->flags |= FIOEOF; + else { + f->error = (short)-rc; + f->flags |= FIOERROR; + rc = 0; + } + } + + f->b_ptr = f->b_base; +#ifdef DEBUG_DECRYPTION + printf("T1_Fill(): read %d bytes\n", rc); +#endif + + if (Decrypt){ + rc = T1Decrypt(f->b_base, rc); +#ifdef DEBUG_DECRYPTION + printf("T1_Fill(): decrypted %d bytes\n", rc); +#endif + } + + return rc; +} /* end Fill */ + + +void T1io_reset(void) +{ + pfbblocklen=0; + accu=0; + starthex80=0; + eexec_startOK=0; + eexec_endOK=0; + in_eexec=0; +} + + + diff -Naur xdvik-22.40l/libs/type1/t1snap.c xdvik-22.40n/libs/type1/t1snap.c --- xdvik-22.40l/libs/type1/t1snap.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/t1snap.c Sat Sep 14 00:24:48 2002 @@ -0,0 +1,79 @@ +/* $XConsortium: t1snap.c,v 1.3 91/10/10 11:19:47 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include "objects.h" +#include "spaces.h" +#include "paths.h" + +/* +:h2.Handle Functions + +:h3.Phantom() - Returns a Move Segment Equivalent to Handles + +This is a user operator. Its new name is QueryHandle. +*/ + +struct segment *t1_Phantom(obj) + register struct xobject *obj; /* object to take the Phantom of */ +{ + struct fractpoint pt; /* handle size will built here */ + + if (obj == NULL) + pt.x = pt.y = 0; + else + PathDelta(obj, &pt); + + return(PathSegment(MOVETYPE, pt.x, pt.y)); +} + +/* +:h3.Snap() - Force Ending Handle of Object to Origin + +This is a user operator. +*/ + +struct xobject *t1_Snap(p) + register struct segment *p; /* path to snap */ +{ + struct fractpoint pt; /* for finding length of path */ + + if (p == NULL) + return(NULL); + p = UniquePath(p); + + PathDelta(p, &pt); + if (p->last->type == MOVETYPE) { + p->last->dest.x -= pt.x; + p->last->dest.y -= pt.y; + } + else + p = JoinSegment(p, MOVETYPE, -pt.x, -pt.y, NULL); + return((struct xobject *)p); +} diff -Naur xdvik-22.40l/libs/type1/t1stdio.h xdvik-22.40n/libs/type1/t1stdio.h --- xdvik-22.40l/libs/type1/t1stdio.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/t1stdio.h Sat Sep 14 00:24:48 2002 @@ -0,0 +1,85 @@ +/* $XConsortium: t1stdio.h,v 1.4 91/10/10 11:19:49 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* T1IO FILE structure and related stuff */ + +#include "types.h" + +#undef getc +#undef fclose +#undef ungetc +#undef fgetc +#undef fread +#undef feof +#undef ferror +#undef FILE + +#define FILE F_FILE +typedef unsigned char F_char; + +typedef struct F_FILE { + F_char *b_base; /* Pointer to beginning of buffer */ + LONG b_size; /* Size of the buffer */ + F_char *b_ptr; /* Pointer to next char in buffer */ + LONG b_cnt; /* Number of chars remaining in buffer */ + F_char flags; /* other flags; != 0 means getc must call fgetc */ + F_char ungotc; /* Place for ungotten char; flag set if present */ + short error; /* error status */ + int fd; /* underlying file descriptor */ +} F_FILE; + + +/* defines for flags */ +#define UNGOTTENC (0x01) +#define FIOEOF (0x80) +#define FIOERROR (0x40) + +#ifndef NULL +#define NULL 0 /* null pointer */ +#endif +#define EOF (-1) /* end of file */ +#define F_BUFSIZ (512) + +#define getc(f) \ + ( \ + ( ((f)->b_cnt > 0) && ((f)->flags == 0) ) ? \ + ( (f)->b_cnt--, (unsigned int)*( (f)->b_ptr++ ) ) : \ + T1Getc(f) \ + ) + +extern FILE *T1Open(), *T1eexec(); +extern int T1Close(), T1Ungetc(), T1Read(); + +#define fclose(f) T1Close(f) +#define fopen(name,mode) T1Open(name,mode) +#define ungetc(c,f) T1Ungetc(c,f) +#define fgetc(f) T1Getc(f) +#define fread(bufP,size,n,f) T1Read(bufP,size,n,f) +#define feof(f) (((f)->flags & FIOEOF) && ((f)->b_cnt==0)) +#define ferror(f) (((f)->flags & FIOERROR)?(f)->error:0) diff -Naur xdvik-22.40l/libs/type1/t1stub.c xdvik-22.40n/libs/type1/t1stub.c --- xdvik-22.40l/libs/type1/t1stub.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/t1stub.c Sat Sep 14 00:24:48 2002 @@ -0,0 +1,47 @@ +/* $XConsortium: t1stub.c,v 1.3 92/03/20 15:58:40 eswu Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include + +#include "objects.h" /* get #define for abort() */ + +int xiStub( void) +{ + printf("xiStub called\n"); + abort("xiStub called", 48); + return(0); + +} + +void t1_DumpText( void) +{ + xiStub(); + +} diff -Naur xdvik-22.40l/libs/type1/token.c xdvik-22.40n/libs/type1/token.c --- xdvik-22.40l/libs/type1/token.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/token.c Sat Sep 14 00:24:48 2002 @@ -0,0 +1,1208 @@ +/* $XConsortium: token.c,v 1.2 91/10/10 11:19:55 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* Authors: Sig Nin & Carol Thompson IBM Almaden Research Laboratory */ +#include "types.h" +#include "t1stdio.h" +#include "util.h" +#include "digit.h" +#include "token.h" +#include "tokst.h" +#include "hdigit.h" + +/* + * ------------------------------------------------------------------- + * Globals + * ------------------------------------------------------------------- + */ + +extern int T1Getc(F_FILE * ), T1Ungetc( int,F_FILE *); + +/* These variables are set by the caller */ +char *tokenStartP; /* Pointer to token buffer in VM */ +char *tokenMaxP; /* Pointer to last byte in buffer + 1 */ + +/* These variables are set by TOKEN */ +int tokenLength; /* Characters in token */ +boolean tokenTooLong; /* Token too long for buffer */ +int tokenType; /* Type of token identified */ +psvalue tokenValue; /* Token value */ + +/* + * ------------------------------------------------------------------- + * Private variables + * ------------------------------------------------------------------- + */ + +static FILE *inputFileP; /* Current input file */ + + +/* Token */ +static char *tokenCharP; /* Pointer to next character in token */ + +/* + * ------------------------------------------------------------------- + * Private routines for manipulating numbers + * ------------------------------------------------------------------- + */ + +#define Exp10(e) \ +((e) == 0\ + ? (DOUBLE)(1.0)\ + : (-64 <= (e) && (e) <= 63\ + ? Exp10T[(e)+64]\ + : P10(e)\ + )\ +) + +static DOUBLE Exp10T[128] = { + 1e-64, 1e-63, 1e-62, 1e-61, 1e-60, 1e-59, 1e-58, 1e-57, + 1e-56, 1e-55, 1e-54, 1e-53, 1e-52, 1e-51, 1e-50, 1e-49, + 1e-48, 1e-47, 1e-46, 1e-45, 1e-44, 1e-43, 1e-42, 1e-41, + 1e-40, 1e-39, 1e-38, 1e-37, 1e-36, 1e-35, 1e-34, 1e-33, + 1e-32, 1e-31, 1e-30, 1e-29, 1e-28, 1e-27, 1e-26, 1e-25, + 1e-24, 1e-23, 1e-22, 1e-21, 1e-20, 1e-19, 1e-18, 1e-17, + 1e-16, 1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9, + 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, + 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, + 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22, 1e23, + 1e24, 1e25, 1e26, 1e27, 1e28, 1e29, 1e30, 1e31, + 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39, + 1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, + 1e48, 1e49, 1e50, 1e51, 1e52, 1e53, 1e54, 1e55, + 1e56, 1e57, 1e58, 1e59, 1e60, 1e61, 1e62, 1e63 +}; + +static DOUBLE P10(exponent) + LONG exponent; +{ + DOUBLE value, power; + + if (exponent < 0) { + power = 0.1; + value = (exponent & 1 ? power : 1.0); + exponent = -((exponent+1) >> 1); /* portable C for -(exponent/2) */ + } + else { + power = 10.0; + value = (exponent & 1 ? power : 1.0); + exponent = exponent >> 1; + } + + while(exponent > 0) { + power *= power; + if (exponent & 1) + value *= power; + exponent >>= 1; + } + + return(value); +} + +/* + * ------------------------------------------------------------------- + * Private routines and macros for manipulating the input + * ------------------------------------------------------------------- + */ + +/* Get next character from the input -- + * + */ +#define next_ch() (getc(inputFileP)) + +/* Push a character back into the input -- + * + * Ungetc of EOF will fail, but that's ok: the next getc will + * return EOF. + * + * NOTE: These macros are presently written to return the character + * pushed, or EOF if none was pushed. However, they are not + * required to return anything in particular, and callers should + * not rely on the returned value. + */ +#define back_ch(ch) (ungetc(ch, inputFileP)) + +/* Push a character back into the input if it was not white space. + * If it is a carriage return (\r) then check next char for + * linefeed and consume them both, otherwise put next char back. + * + */ +#define back_ch_not_white(ch) \ +(\ +isWHITE_SPACE(ch)\ + ? ((ch == '\r')\ + ? (((ch = next_ch()) == '\n')\ + ? EOF\ + : back_ch(ch)\ + )\ + : EOF\ + )\ + : back_ch(ch)\ +) + +/* + * ------------------------------------------------------------------- + * Private routines and macros for manipulating the token buffer + * ------------------------------------------------------------------- + */ + +/* Add a character to the token + * ---- use ONLY when you KNOW that this character will + * be stored within the token buffer. + */ +#define save_unsafe_ch(ch) (*tokenCharP++ = ch) + +/* Add a character to the token, if not too long to fit */ +#define save_ch(ch) \ +((tokenCharP < tokenMaxP)\ + ? save_unsafe_ch(ch)\ + : (tokenTooLong = TRUE)\ +) + +/* + * ------------------------------------------------------------------- + * Action Routines + * + * These routines all + * -- take int ch as a parameter + * -- return int ch if no token was recognized, DONE otherwise + * -- leave the next character in the input, if returning DONE + * ------------------------------------------------------------------- + */ + +#define DONE (256) + +/* Get the next input character */ +static int next_char(ch) + int ch; +{ + return(next_ch()); +} + +/* Add character to token */ +static int add_char(ch) + int ch; +{ + save_ch(ch); + return(next_ch()); +} + + +/* ------------------------------------------------------------------- + * Skip white space and comments + */ + +/* Skip white space */ +static int skip_space(ch) + int ch; +{ + do { + ch = next_ch(); + } while(isWHITE_SPACE(ch)); + return(ch); +} + +/* Skip comments */ +static int skip_comment(ch) + int ch; +{ + do { + ch = next_ch(); + } while(isCOMMENT(ch)); + return(ch); +} + +/* ------------------------------------------------------------------- + * Collect value elements for a number + */ + +/* decimal integer or real number mantissa */ +static int m_sign; +static LONG m_value; +static LONG m_scale; + +/* real number exponent */ +static int e_sign; +static LONG e_value; +static LONG e_scale; + +/* radix number */ +static LONG r_base; +static LONG r_value; +static LONG r_scale; + +static int add_sign(ch) + int ch; +{ + m_sign = ch; + save_unsafe_ch(ch); + return(next_ch()); +} + +static int add_1st_digits(ch) + int ch; +{ + m_sign = '+'; + return(add_digits(ch)); +} + +static int add_digits(ch) + int ch; +{ + LONG value, p_value, scale; + int digit; + + /* On entry, expect m_sign to be set to '+' or '-'; + * ch is a decimal digit. + * Expect at most one character saved at this point, + * a sign. This routine will save up to 10 more + * characters without checking the buffer boundary. + */ + + value = ch - '0'; + save_unsafe_ch(ch); + ch = next_ch(); + + while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) { + value = (value << 3) + (value << 1) + (ch - '0'); + save_unsafe_ch(ch); + ch = next_ch(); + } + + /* Quick exit for small integers -- + * |x| <= 10*((MAX_INTEGER/10)-1)+9 + * |x| <= 2,147,483,639 for 32 bit integers + */ + if (isNUMBER_ENDER(ch)) { + back_ch_not_white(ch); + tokenValue.integer = (m_sign == '-' ? -value : value); + tokenType = TOKEN_INTEGER; + return(DONE); + } + + /* Handle additional digits. Beyond the boundary case, + * 10*(MAX_INTEGER/10) <= |number| <= MAX_INTEGER + * just count the digits: the number is too large to + * represent as an integer and will be returned as a real. + * The mantissa of a real holds fewer bits than an integer. + */ + p_value = value; + value = (m_sign == '-' ? -value : value); + scale = 0; + + if (isDECIMAL_DIGIT(ch)) { + + /* Handle the boundary case */ + if (p_value == (MAX_INTEGER/10)) { + digit = ch - '0'; + + /* Must handle positive and negative values separately */ + /* for 2's complement arithmetic */ + if (value > 0) { + if (digit <= MAX_INTEGER%10) + value = (value << 3) + (value << 1) + digit; + else + ++scale; /* Too big, just count it */ + } + else { + /* Use positive % operands for portability */ + if (digit <= -(MIN_INTEGER+10)%10) + value = (value << 3) + (value << 1) - digit; + else + ++scale; /* Too big, just count it */ + } + } + else + ++scale; /* Not boundary case, just count digit */ + + save_unsafe_ch(ch); + ch = next_ch(); + + /* Continue scanning digits, but can't store them */ + while(isDECIMAL_DIGIT(ch)) { + ++scale; + save_ch(ch); + ch = next_ch(); + } + } + + /* Continue from here scanning radix integer or real */ + m_value = value; + m_scale = scale; + + /* Initialize for possible real */ + e_sign = '+'; + e_value = 0; + e_scale = 0; + + return(ch); +} + +static int add_1st_decpt(ch) + int ch; +{ + m_sign = '+'; + return(add_decpt(ch)); +} + +static int add_decpt(ch) + int ch; +{ + /* On entry, expect m_sign to be set to '+' or '-' */ + m_value = 0; + m_scale = 0; + save_unsafe_ch(ch); + return(next_ch()); +} + +static int add_fraction(ch) + int ch; +{ + LONG value, scale; + int digit; + + /* On entry, expect m_value and m_scale to be initialized, + * and m_sign to be set to '+' or '-'. Expect m_value and m_sign + * to be consistent (this is not checked). + */ + value = m_value; + scale = m_scale; + + /* Scan leading zeroes */ + if (value == 0) { + while(ch == '0') { + --scale; + save_ch(ch); + ch = next_ch(); + } + + /* Scan first significant digit */ + if (isDECIMAL_DIGIT(ch)) { + --scale; + value = ch - '0'; + value = (m_sign == '-' ? -value : value); + save_ch(ch); + ch = next_ch(); + } + else + /* no significant digits -- number is zero */ + scale = 0; + } + /* value != 0 || value == 0 && !isDECIMAL_DIGIT(ch) */ + + /* Scan additional significant digits */ + if (isDECIMAL_DIGIT(ch)) { + if (value > 0) { + while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) { + --scale; + value = (value << 3) + (value << 1) + (ch - '0'); + save_ch(ch); + ch = next_ch(); + } + /* Check boundary case */ + if (isDECIMAL_DIGIT(ch) && value == (MAX_INTEGER/10)) { + digit = ch - '0'; + if (digit <= MAX_INTEGER%10) { + --scale; + value = (value << 3) + (value << 1) + digit; + save_ch(ch); + ch = next_ch(); + } + } + } + else { + /* value < 0 */ + while(isDECIMAL_DIGIT(ch) && value > -(-(MIN_INTEGER+10)/10+1)) { + /* Use positive / operands for portability */ + --scale; + value = (value << 3) + (value << 1) - (ch - '0'); + save_ch(ch); + ch = next_ch(); + } + /* Check boundary case */ + if (isDECIMAL_DIGIT(ch) + && value == -(-(MIN_INTEGER+10)/10+1)) { + digit = ch - '0'; + if (digit <= -(MIN_INTEGER+10)%10) { + /* Use positive % operands for portability */ + --scale; + value = (value << 3) + (value << 1) - digit; + save_ch(ch); + ch = next_ch(); + } + } + } + + /* Additional digits can be discarded */ + while(isDECIMAL_DIGIT(ch)) { + save_ch(ch); + ch = next_ch(); + } + } + + /* Store results */ + m_value = value; + m_scale = scale; + + /* Initialize for possible real */ + e_sign = '+'; + e_value = 0; + e_scale = 0; + + return(ch); +} + +static int add_e_sign(ch) + int ch; +{ + e_sign = ch; + save_ch(ch); + return(next_ch()); +} + +static int add_exponent(ch) + int ch; +{ + LONG value, p_value; + LONG scale = 0; + int digit; + + /* On entry, expect e_sign to be set to '+' or '-' */ + + value = ch - '0'; + save_ch(ch); + ch = next_ch(); + + while(isDECIMAL_DIGIT(ch) && value < (MAX_INTEGER/10)) { + value = (value << 3) + (value << 1) + (ch - '0'); + save_ch(ch); + ch = next_ch(); + } + + p_value = value; + value = (e_sign == '-' ? -value : value); + + /* Handle additional digits. Beyond the boundary case, + * 10*(MAX_INTEGER/10) <= |number| <= MAX_INTEGER + * just count the digits: the number is too large to + * represent as an integer. + */ + if (isDECIMAL_DIGIT(ch)) { + + /* Examine boundary case */ + if (p_value == (MAX_INTEGER/10)) { + digit = ch - '0'; + + /* Must handle positive and negative values separately */ + /* for 2's complement arithmetic */ + if (value > 0) { + if (digit <= MAX_INTEGER%10) + value = (value << 3) + (value << 1) + digit; + else + ++scale; /* Too big, just count it */ + } + else { + /* Use positive % operands for portability */ + if (digit <= -(MIN_INTEGER+10)%10) + value = (value << 3) + (value << 1) - digit; + else + ++scale; /* Too big, just count it */ + } + } + else + ++scale; /* Not boundary case, just count digit */ + + save_ch(ch); + ch = next_ch(); + + /* Continue scanning digits, but can't store any more */ + while(isDECIMAL_DIGIT(ch)) { + ++scale; + save_ch(ch); + ch = next_ch(); + } + } + + /* Store results */ + e_value = value; + e_scale = scale; + + return(ch); +} + +static int add_radix(ch) + int ch; +{ + if (2 <= m_value && m_value <= 36 && m_scale == 0) { + r_base = m_value; + save_ch(ch); + return(next_ch()); + } + else { + /* Radix invalid, complete a name token */ + return(AAH_NAME(ch)); + } +} + +static int add_r_digits(ch) + int ch; +{ + ULONG value; + LONG radix, scale; + int digit; + + /* NOTE: The syntax of a radix number allows only for + * values of zero or more. The value will be stored as + * a 32 bit integer, which PostScript then interprets + * as signed. This means, for example, that the numbers: + * + * 8#37777777777 + * 10#4294967295 + * 16#FFFFFFFF + * 36#1Z141Z3 + * + * are all interpreted as -1. This routine implements this + * idea explicitly: it accumulates the number's value + * as unsigned, then casts it to signed when done. + */ + + /* Expect r_base to be initialized */ + radix = r_base; + value = 0; + scale = 0; + + /* Scan leading zeroes */ + while(ch == '0') { + save_ch(ch); + ch = next_ch(); + } + + /* Handle first non-zero digit */ + if ((digit=digit_value[ch]) < radix) { + value = digit; + save_ch(ch); + ch = next_ch(); + + /* Add digits until boundary case reached */ + while((digit=digit_value[ch]) < radix + && value < (MAX_ULONG / radix)) { + value = value * radix + digit; + save_ch(ch); + ch = next_ch(); + }; + + /* Scan remaining digits */ + if ((digit=digit_value[ch]) < radix) { + + /* Examine boundary case --- + * radix*(MAX_ULONG/radix) <= number <= MAX_ULONG + */ + if (value == (MAX_ULONG/radix) && digit <= MAX_ULONG%radix) + value = value * radix + digit; + else + ++scale; + + /* Continue scanning digits, but can't store them */ + save_ch(ch); + ch = next_ch(); + while(digit_value[ch] < radix) { + ++scale; + save_ch(ch); + ch = next_ch(); + } + } + } + + /* Store result */ + r_value = (LONG) value; /* result is signed */ + r_scale = scale; + + return(ch); +} + +/* ------------------------------------------------------------------- + * Complete a number; set token type and done flag. + * Put current input character back, if it is not white space. + */ + +/* Done: Radix Number */ +static int RADIX_NUMBER(ch) + int ch; +{ + back_ch_not_white(ch); + if (r_scale == 0) { + tokenValue.integer = r_value; + tokenType = TOKEN_INTEGER; + } + else { + tokenType = TOKEN_NAME; + } + return(DONE); +} + +/* Done: Integer */ +static int INTEGER(ch) + int ch; +{ + back_ch_not_white(ch); + if (m_scale == 0) { + tokenValue.integer = m_value; + tokenType = TOKEN_INTEGER; + } + else { + tokenValue.real = (DOUBLE)(m_value) * Exp10(m_scale); + tokenType = TOKEN_REAL; + } + return(DONE); +} + +/* Done: Real */ +static int REAL(ch) + int ch; +{ + DOUBLE temp; + + back_ch_not_white(ch); + + /* NOTE: ignore e_scale, since e_value alone will cause + * exponent overflow if e_scale > 0. + */ + + /* HAZARD: exponent overflow of intermediate result + * (e.g., in 370 floating point); this should not be a problem + * with IEEE floating point. Reduce exponent overflow hazard by + * combining m_scale and e_value first, if they have different signs, + * or multiplying m_value and one of the other factors, if both + * m_scale and e_value are negative. + */ + if ((m_scale >= 0 && e_value <= 0) + || (m_scale <= 0 && e_value >= 0)) { + tokenValue.real = (DOUBLE)(m_value) * Exp10(m_scale + e_value); + } + else { + temp = (DOUBLE)(m_value) * Exp10(m_scale); + tokenValue.real = temp * Exp10(e_value); + } + + tokenType = TOKEN_REAL; + return(DONE); +} + + +/* ------------------------------------------------------------------- + * Assemble a hex string; set token type and done flag. + */ + +/* Done: Hex String */ +static int HEX_STRING(ch) + int ch; +{ + int value; + + while(TRUE) { + + /* Process odd digit */ + ch = next_ch(); + if (!isHEX_DIGIT(ch)) { + + /* Skip white space */ + while(isWHITE_SPACE(ch)) + ch = next_ch(); + + /* Check for terminator */ + if (!isHEX_DIGIT(ch)) { + break; + } + } + value = digit_value[ch] << 4; + + /* Process even digit */ + ch = next_ch(); + if (!isHEX_DIGIT(ch)) { + + /* Skip white space */ + while(isWHITE_SPACE(ch)) + ch = next_ch(); + + /* Check for terminator */ + if (!isHEX_DIGIT(ch)) { + save_ch(value); + break; + } + } + save_ch(value + digit_value[ch]); + } + + /* Classify result, based on why loop ended */ + if (ch == '>') + tokenType = TOKEN_HEX_STRING; + else { + /* save the invalid character for error reporting */ + save_ch(ch); + tokenType = TOKEN_INVALID; + } + + return(DONE); +} + +/* ------------------------------------------------------------------- + * Assemble a string; set token type and done flag + */ + +/* Save a backslash-coded character in a string -- + * + * Store the proper character for special cases + * "\b", "\f", "\n", "\r", and "\t". + * + * Decode and store octal-coded character, up to + * three octal digits, "\o", "\oo", and "\ooo". + * + * The sequence "\" is a line continuation, + * so consume both without storing anything. + * + * The sequence "\" is an error; exit without + * storing anything and let the caller handle it. + * + * For other characters, including the sequences + * "\\", "\(", and "\)", simply store the second + * character. + */ +static void save_digraph(ch) + int ch; +{ + int value; + + switch (ch) { + + case 'b': /* backspace */ + ch = '\b'; + break; + + case 'f': /* formfeed */ + ch = '\f'; + break; + + case 'n': /* newline */ + ch = '\n'; + break; + + case 'r': /* carriage return */ + ch = '\r'; + break; + + case 't': /* horizontal tab */ + ch = '\t'; + break; + + case '\n': /* line continuation -- consume it */ + return; + + case '\r': /* carriage return -- consume it */ + ch = next_ch(); /* look at next character, is it \n? */ + if (ch == '\n') return; + back_ch(ch); /* if not a line feed, then return it */ + return; + + case EOF: /* end of file -- forget it */ + return; + + default: + /* scan up to three octal digits to get value */ + if (isOCTAL_DIGIT(ch)) { + value = digit_value[ch]; + ch = next_ch(); + if (isOCTAL_DIGIT(ch)) { + value = (value << 3) + digit_value[ch]; + ch = next_ch(); + if (isOCTAL_DIGIT(ch)) + value = (value << 3) + digit_value[ch]; + else + back_ch(ch); + } + else + back_ch(ch); + ch = value; + } + } + + /* Found a character to save */ + save_ch(ch); +} + +/* Done: String */ +static int STRING(ch) + int ch; +{ + int nest_level = 1; + + tokenType = TOKEN_STRING; + + do { + + ch = next_ch(); + while(!isSTRING_SPECIAL(ch)) { + save_ch(ch); + ch = next_ch(); + }; + + switch (ch) { + + case '(': + ++nest_level; + save_ch(ch); + break; + + case ')': + if (--nest_level > 0) + save_ch(ch); + break; + + case '\\': + save_digraph(next_ch()); + break; + + case '\r': + /* All carriage returns (\r) are turned into linefeeds (\n)*/ + ch = next_ch(); /* get the next one, is it \n? */ + if (ch != '\n') { /* if not, then put it back. */ + back_ch(ch); + } + save_ch('\n'); /* in either case, save a linefeed */ + break; + + + case EOF: + tokenType = TOKEN_INVALID; /* Unterminated string */ + nest_level = 0; + break; + } + + } while(nest_level > 0); + + return(DONE); +} + + +/* ------------------------------------------------------------------- + * Assemble a name; set token type and done flag. + * Put current input character back, if it is not white space. + */ + +/* Done: Name + * (Safe version used to complete name tokens that + * start out looking like something else). + */ + +static int AAH_NAME(ch) + int ch; +{ + do { + save_ch(ch); + ch = next_ch(); + } while(isNAME(ch)); + + back_ch_not_white(ch); + tokenType = TOKEN_NAME; + return(DONE); +} + +/* Done: Name */ +static int NAME(ch) + int ch; +{ + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + while(isNAME(ch)) { + save_ch(ch); + ch = next_ch(); + } + } + } + } + } + } + } + + back_ch_not_white(ch); + tokenType = TOKEN_NAME; + return(DONE); +} + +/* Done: Literal Name */ +static int LITERAL_NAME(ch) + int ch; +{ + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + while(isNAME(ch)) { + save_ch(ch); + ch = next_ch(); + } + } + } + } + } + } + } + + back_ch_not_white(ch); + tokenType = TOKEN_LITERAL_NAME; + return(DONE); +} + +/* Done: immediate Name */ +static int IMMED_NAME(ch) + int ch; +{ + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + if (isNAME(ch)) { + save_unsafe_ch(ch); + ch = next_ch(); + while(isNAME(ch)) { + save_ch(ch); + ch = next_ch(); + } + } + } + } + } + } + } + + back_ch_not_white(ch); + tokenType = TOKEN_IMMED_NAME; + return(DONE); +} + +/* Done: Name found while looking for something else */ +static int OOPS_NAME(ch) + int ch; +{ + back_ch_not_white(ch); + tokenType = TOKEN_NAME; + return(DONE); +} + + +/* ------------------------------------------------------------------- + * Complete a miscellaneous token; set token type and done flag. + */ + +/* Done: Unmatched Right Angle-Bracket */ +static int RIGHT_ANGLE(ch) + int ch; +{ + tokenType = TOKEN_RIGHT_ANGLE; + return(DONE); +} + +/* Done: Unmatched Right Parenthesis */ +static int RIGHT_PAREN(ch) + int ch; +{ + tokenType = TOKEN_RIGHT_PAREN; + return(DONE); +} + +/* Done: Left Brace */ +static int LEFT_BRACE(ch) + int ch; +{ + tokenType = TOKEN_LEFT_BRACE; + return(DONE); +} + +/* Done: Right Brace */ +static int RIGHT_BRACE(ch) + int ch; +{ + tokenType = TOKEN_RIGHT_BRACE; + return(DONE); +} + +/* Done: Left Bracket */ +static int LEFT_BRACKET(ch) + int ch; +{ + save_unsafe_ch(ch); + tokenType = TOKEN_LEFT_BRACKET; + return(DONE); +} + +/* Done: Right Bracket */ +static int RIGHT_BRACKET(ch) + int ch; +{ + save_unsafe_ch(ch); + tokenType = TOKEN_RIGHT_BRACKET; + return(DONE); +} + +/* Done: Break */ +static int BREAK_SIGNAL(ch) + int ch; +{ + tokenType = TOKEN_BREAK; + return(DONE); +} + +/* Done: No Token Found */ +static int NO_TOKEN(ch) + int ch; +{ + tokenType = TOKEN_EOF; + return(DONE); +} + + +/* + * ------------------------------------------------------------------- + * scan_token -- scan one token from the input. It uses a simple + * finite state machine to recognize token classes. + * + * The input is from a file. + * + * On entry -- + * + * inputP -> input PostScript object, a file. + * tokenStartP -> buffer in VM for accumulating the token. + * tokenMaxP -> last character in the token buffer + * + * On exit -- + * + * tokenLength = number of characters in the token + * tokenTooLong = TRUE if the token did not fit in the buffer + * tokenType = code for the type of token parsed. + * tokenValue = converted value of a numeric token. + * + * + * ------------------------------------------------------------------- + */ +void scan_token(inputP) + psobj *inputP; +{ + int ch; + unsigned char *stateP = s0; + unsigned char entry; + int (*actionP)(); + + /* Define input source */ + inputFileP = inputP->data.fileP; + if (inputFileP == NULL) { + tokenType = TOKEN_EOF; + return; + } + + /* Ensure enough space for most cases + * (so we don't have to keep checking) + * The length needs to cover the maximum number + * of save_unsafe_ch() calls that might be executed. + * That number is 11 (a sign and 10 decimal digits, e.g., + * when scanning -2147483648), but use MAX_NAME_LEN + * in case someone changes that without checking. + */ + if (vm_free_bytes() < (MAX_NAME_LEN)) { + if (!(vm_init())) { + tokenLength = 0; + tokenTooLong = TRUE; + tokenType = TOKEN_NONE; + tokenValue.integer = 0; + return; + } + } + + tokenStartP = vm_next_byte(); + + /* Reset token */ + tokenCharP = tokenStartP; + tokenTooLong = FALSE; + + /* Scan one token */ + ch = next_ch(); + do { + entry = stateP[ch]; + stateP = classActionTable[entry].nextStateP; + actionP = classActionTable[entry].actionRoutineP; + ch = (*actionP)(ch); + } while(ch != DONE); + + + /* Return results */ + tokenLength = tokenCharP - tokenStartP; +} diff -Naur xdvik-22.40l/libs/type1/token.h xdvik-22.40n/libs/type1/token.h --- xdvik-22.40l/libs/type1/token.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/token.h Sat Sep 14 00:24:48 2002 @@ -0,0 +1,77 @@ +/* $XConsortium: token.h,v 1.2 91/10/10 11:19:58 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +#ifndef TOKEN_H +#define TOKEN_H + +/* Special characters */ +#define CONTROL_C (3) + +/* Token type codes */ +#define TOKEN_INVALID (-3) +#define TOKEN_BREAK (-2) +#define TOKEN_EOF (-1) +#define TOKEN_NONE (0) +#define TOKEN_LEFT_PAREN (1) +#define TOKEN_RIGHT_PAREN (2) +#define TOKEN_LEFT_ANGLE (3) +#define TOKEN_RIGHT_ANGLE (4) +#define TOKEN_LEFT_BRACE (5) +#define TOKEN_RIGHT_BRACE (6) +#define TOKEN_LEFT_BRACKET (7) +#define TOKEN_RIGHT_BRACKET (8) +#define TOKEN_NAME (9) +#define TOKEN_LITERAL_NAME (10) +#define TOKEN_INTEGER (11) +#define TOKEN_REAL (12) +#define TOKEN_RADIX_NUMBER (13) +#define TOKEN_HEX_STRING (14) +#define TOKEN_STRING (15) +#define TOKEN_IMMED_NAME (16) + +/* Token routines */ +extern void scan_token(); + +/* + * ------------------------------------------------------------------------- + * Globals shared -- (everyone else KEEP YOUR MITTS OFF THEM!) + * ------------------------------------------------------------------------- + */ + +/* These variables are set by the caller */ +extern char *tokenStartP; /* Pointer to token buffer in VM */ +extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */ + +/* These variables are set by P_TOKEN */ +extern int tokenLength; /* Characters in token */ +extern boolean tokenTooLong; /* Token too long for space available */ +extern int tokenType; /* Type of token identified */ +extern psvalue tokenValue; /* Token value */ + +#endif /* TOKEN_H */ diff -Naur xdvik-22.40l/libs/type1/tokst.h xdvik-22.40n/libs/type1/tokst.h --- xdvik-22.40l/libs/type1/tokst.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/tokst.h Sat Sep 14 00:24:48 2002 @@ -0,0 +1,508 @@ +/* $XConsortium: tokst.h,v 1.2 91/10/10 11:20:00 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* -------------------------------------- */ +/* --- MACHINE GENERATED, DO NOT EDIT --- */ +/* -------------------------------------- */ + +#ifndef TOKST +#define TOKST 1 + +/* + * State Index Tables -- + * + * These tables map the input character to the + * proper entry in the Class Action Table. + * There is one table for each state. + * + */ +#define s0 (si0+2) +static unsigned char si0[258] = { 0x10,0x11, + 0x02,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x02,0x02,0x0F,0x0F,0x02,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, + 0x02,0x0F,0x0F,0x0F,0x0F,0x03,0x0F,0x0F,0x05,0x0B,0x0F,0x0D,0x0F,0x0D,0x0E,0x04, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x0F,0x0F,0x08,0x0F,0x0C,0x0F, + 0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x0F,0x0A,0x0F,0x0F, + 0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x0F,0x09,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, + 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F +}; + +#define s1 (si1+2) +static unsigned char si1[258] = { 0x14,0x15, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x12, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13, + 0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13 +}; + +#define s2 (si2+2) +static unsigned char si2[258] = { 0x1B,0x1C, + 0x16,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x16,0x16,0x1A,0x1A,0x16,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x16,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x1A,0x17,0x17,0x1A,0x1A,0x1A,0x1A,0x19,0x17, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1A,0x1A,0x17,0x1A,0x17,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x17,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x17,0x1A,0x17,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A, + 0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A +}; + +#define s3 (si3+2) +static unsigned char si3[258] = { 0x23,0x24, + 0x1D,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1D,0x1D,0x22,0x22,0x1D,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x1D,0x22,0x22,0x20,0x22,0x1E,0x22,0x22,0x1E,0x1E,0x22,0x22,0x22,0x22,0x1F,0x1E, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22, + 0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x21,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x1E,0x22,0x1E,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, + 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22 +}; + +#define s4 (si4+2) +static unsigned char si4[258] = { 0x29,0x2A, + 0x25,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x25,0x25,0x28,0x28,0x25,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x25,0x28,0x28,0x28,0x28,0x26,0x28,0x28,0x26,0x26,0x28,0x28,0x28,0x28,0x28,0x26, + 0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x27,0x28,0x28,0x26,0x28,0x26,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x26,0x28,0x26,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x26,0x28,0x26,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, + 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28 +}; + +#define s5 (si5+2) +static unsigned char si5[258] = { 0x30,0x31, + 0x2B,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2B,0x2B,0x2F,0x2F,0x2B,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2B,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2F,0x2C,0x2C,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C, + 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2D,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2D,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2C,0x2F,0x2C,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F, + 0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F,0x2F +}; + +#define s6 (si6+2) +static unsigned char si6[258] = { 0x36,0x37, + 0x32,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x32,0x32,0x35,0x35,0x32,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x32,0x35,0x35,0x35,0x35,0x33,0x35,0x35,0x33,0x33,0x35,0x35,0x35,0x35,0x35,0x33, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35, + 0x35,0x35,0x35,0x35,0x35,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x34,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x33,0x35,0x33,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35, + 0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35,0x35 +}; + +#define s7 (si7+2) +static unsigned char si7[258] = { 0x3D,0x3E, + 0x38,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x38,0x38,0x3C,0x3C,0x38,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x38,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x3C,0x39,0x39,0x3C,0x3A,0x3C,0x3A,0x3C,0x39, + 0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3B,0x3C,0x3C,0x39,0x3C,0x39,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x39,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x39,0x3C,0x39,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C, + 0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C,0x3C +}; + +#define s8 (si8+2) +static unsigned char si8[258] = { 0x43,0x44, + 0x3F,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3F,0x3F,0x42,0x42,0x3F,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x3F,0x42,0x42,0x42,0x42,0x40,0x42,0x42,0x40,0x40,0x42,0x42,0x42,0x42,0x42,0x40, + 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x42,0x42,0x40,0x42,0x40,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x40,0x42,0x40,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x40,0x42,0x40,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42, + 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42 +}; + +#define s9 (si9+2) +static unsigned char si9[258] = { 0x48,0x49, + 0x45,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x45,0x45,0x47,0x47,0x45,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x45,0x47,0x47,0x47,0x47,0x46,0x47,0x47,0x46,0x46,0x47,0x47,0x47,0x47,0x47,0x46, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x46,0x47,0x46,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47, + 0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47,0x47 +}; + +#define s10 (si10+2) +static unsigned char si10[258] = { 0x4E,0x4F, + 0x4A,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4A,0x4A,0x4D,0x4D,0x4A,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, + 0x4A,0x4D,0x4D,0x4D,0x4D,0x4B,0x4D,0x4D,0x4B,0x4B,0x4D,0x4D,0x4D,0x4D,0x4D,0x4B, + 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4D,0x4D,0x4B,0x4D,0x4B,0x4D, + 0x4D,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C, + 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4B,0x4D,0x4B,0x4D,0x4D, + 0x4D,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C, + 0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4C,0x4B,0x4D,0x4B,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D, + 0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D,0x4D +}; + +#define s11 (si11+2) +static unsigned char si11[258] = { 0x53,0x54, + 0x50,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x50,0x50,0x52,0x52,0x50,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x50,0x52,0x52,0x52,0x52,0x51,0x52,0x52,0x51,0x51,0x52,0x52,0x52,0x52,0x52,0x51, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x51,0x52,0x51,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52, + 0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52 +}; + +/* + * Class Action Table -- + * + * The entries in the Class Action Table indicate the + * action routine to be called, and the next state to + * enter, for each relevant character class in each. + * state. There are several entries for each state. + * + */ +static int AAH_NAME(); +static int BREAK_SIGNAL(); +static int HEX_STRING(); +static int IMMED_NAME(); +static int INTEGER(); +static int LEFT_BRACE(); +static int LEFT_BRACKET(); +static int LITERAL_NAME(); +static int NAME(); +static int NO_TOKEN(); +static int OOPS_NAME(); +static int RADIX_NUMBER(); +static int REAL(); +static int RIGHT_ANGLE(); +static int RIGHT_BRACE(); +static int RIGHT_BRACKET(); +static int RIGHT_PAREN(); +static int STRING(); +static int add_1st_decpt(); +static int add_1st_digits(); +static int add_char(); +static int add_decpt(); +static int add_digits(); +static int add_e_sign(); +static int add_exponent(); +static int add_fraction(); +static int add_r_digits(); +static int add_radix(); +static int add_sign(); +static int next_char(); +static int skip_comment(); +static int skip_space(); + +static struct cat { + int (*actionRoutineP)(); + unsigned char *nextStateP; +} classActionTable[] = { + + /* s0: Classify initial character */ + /* 00 ALPHA */ {NAME, s0}, /* executable name */ + /* 01 DIGIT */ {add_1st_digits, s3}, /* number? */ + /* 02 WHITE_SPACE */ {skip_space, s0}, /* skip white space */ + /* 03 PERCENT */ {skip_comment, s0}, /* comment? */ + /* 04 SLASH */ {next_char, s1}, /* literal or imm name */ + /* 05 LEFT_PAREN */ {STRING, s0}, /* string */ + /* 06 LEFT_BRACE */ {LEFT_BRACE, s0}, /* begin procedure body */ + /* 07 LEFT_BRACKET */ {LEFT_BRACKET, s0}, /* begin array */ + /* 08 LEFT_ANGLE */ {HEX_STRING, s0}, /* hex string? */ + /* 09 RIGHT_BRACE */ {RIGHT_BRACE, s0}, /* end procedure body */ + /* 0A RIGHT_BRACKET */ {RIGHT_BRACKET, s0}, /* end array */ + /* 0B RIGHT_PAREN */ {RIGHT_PAREN, s0}, /* unmatched right paren */ + /* 0C RIGHT_ANGLE */ {RIGHT_ANGLE, s0}, /* unmatched right angle */ + /* 0D SIGN */ {add_sign, s2}, /* signed number? */ + /* 0E DECIMAL_POINT */ {add_1st_decpt, s4}, /* real number? */ + /* 0F ANY */ {NAME, s0}, /* executable name */ + /* 10 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 11 EOF */ {NO_TOKEN, s0}, /* no token found */ + + /* s1: Further classify a '/' */ + /* 12 SLASH */ {IMMED_NAME, s0}, /* immediate name */ + /* 13 ANY */ {LITERAL_NAME, s0}, /* literal name */ + /* 14 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 15 EOF */ {OOPS_NAME, s0}, /* isolated sign */ + + /* s2: sign */ + /* 16 WHITE_SPACE */ {OOPS_NAME, s0}, /* isolated sign */ + /* 17 SPECIAL */ {OOPS_NAME, s0}, /* isolated sign */ + /* 18 DIGIT */ {add_digits, s3}, /* number? */ + /* 19 DECIMAL_POINT */ {add_decpt, s4}, /* real number? */ + /* 1A ANY */ {NAME, s0}, /* executable name */ + /* 1B BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 1C EOF */ {OOPS_NAME, s0}, /* isolated sign */ + + /* s3: sign? digit+ */ + /* 1D WHITE_SPACE */ {INTEGER, s0}, /* n-digit integer */ + /* 1E SPECIAL */ {INTEGER, s0}, /* n-digit integer */ + /* 1F DECIMAL_POINT */ {add_char, s5}, /* real number? */ + /* 20 POUND */ {add_radix, s10}, /* radix number? */ + /* 21 eE */ {add_char, s7}, /* real with exponent? */ + /* 22 ANY */ {AAH_NAME, s0}, /* executable name */ + /* 23 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 24 EOF */ {INTEGER, s0}, /* n-digit integer */ + + /* s4: sign? . */ + /* 25 WHITE_SPACE */ {OOPS_NAME, s0}, /* isolated +. or -. */ + /* 26 SPECIAL */ {OOPS_NAME, s0}, /* isolated +. or -. */ + /* 27 DIGIT */ {add_fraction, s6}, /* number? */ + /* 28 ANY */ {NAME, s0}, /* executable name */ + /* 29 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 2A EOF */ {OOPS_NAME, s0}, /* isolated +. or -. */ + + /* s5: sign? digit+ . */ + /* 2B WHITE_SPACE */ {REAL, s0}, /* real with fraction */ + /* 2C SPECIAL */ {REAL, s0}, /* real with fraction */ + /* 2D eE */ {add_char, s7}, /* real with exponent? */ + /* 2E DIGIT */ {add_fraction, s6}, /* number? */ + /* 2F ANY */ {AAH_NAME, s0}, /* executable name */ + /* 30 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 31 EOF */ {REAL, s0}, /* real with fraction */ + + /* s6: sign? (digit+ . digit+) | (. digit+) */ + /* 32 WHITE_SPACE */ {REAL, s0}, /* real with fraction */ + /* 33 SPECIAL */ {REAL, s0}, /* real with fraction */ + /* 34 eE */ {add_char, s7}, /* real with exponent? */ + /* 35 ANY */ {AAH_NAME, s0}, /* executable name */ + /* 36 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 37 EOF */ {REAL, s0}, /* real with fraction */ + + /* s7: sign? ((digit+ (. digit*)?) | (. digit+)) Ee */ + /* 38 WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid real number */ + /* 39 SPECIAL */ {OOPS_NAME, s0}, /* invalid real number */ + /* 3A SIGN */ {add_e_sign, s8}, /* real w signed exponent? */ + /* 3B DIGIT */ {add_exponent, s9}, /* real w exponent ? */ + /* 3C ANY */ {AAH_NAME, s0}, /* executable name */ + /* 3D BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 3E EOF */ {OOPS_NAME, s0}, /* invalid real number */ + + /* s8: sign? (digit+ (. digit*)? | (digit* . digit+) Ee sign */ + /* 3F WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid real number */ + /* 40 SPECIAL */ {OOPS_NAME, s0}, /* invalid real number */ + /* 41 DIGIT */ {add_exponent, s9}, /* real w exponent? */ + /* 42 ANY */ {AAH_NAME, s0}, /* executable name */ + /* 43 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 44 EOF */ {OOPS_NAME, s0}, /* invalid real number */ + + /* s9: sign? (digit+ (. digit*)? | (digit* . digit+) Ee sign? digit+ */ + /* 45 WHITE_SPACE */ {REAL, s0}, /* real w exponent */ + /* 46 SPECIAL */ {REAL, s0}, /* real w exponent */ + /* 47 ANY */ {AAH_NAME, s0}, /* executable name */ + /* 48 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 49 EOF */ {REAL, s0}, /* real w exponent */ + + /* s10: digit+ # */ + /* 4A WHITE_SPACE */ {OOPS_NAME, s0}, /* invalid radix number */ + /* 4B SPECIAL */ {OOPS_NAME, s0}, /* invalid radix number */ + /* 4C R_DIGIT */ {add_r_digits, s11}, /* radix number? */ + /* 4D ANY */ {AAH_NAME, s0}, /* executable name */ + /* 4E BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 4F EOF */ {OOPS_NAME, s0}, /* invalid radix number */ + + /* s11: digit+ # r_digit+ */ + /* 50 WHITE_SPACE */ {RADIX_NUMBER, s0}, /* radix number */ + /* 51 SPECIAL */ {RADIX_NUMBER, s0}, /* radix number */ + /* 52 ANY */ {AAH_NAME, s0}, /* executable name */ + /* 53 BREAK */ {BREAK_SIGNAL, s0}, /* break signalled */ + /* 54 EOF */ {RADIX_NUMBER, s0} /* radix number */ +}; + +/* + * Character Classification Tables -- + * + * The entries in the Character Classification Tables + * map character codes to character classes. The + * tables contains one entry per code. The bits in + * each entry indicate which classes the character + * code belongs to. + * + * The macros 'isInCLASS(ch)' generate code to test + * whether 'ch' is a character in 'CLASS'. + * + */ +/* Membership macros for classes defined in table 1 ... */ +#define isRADIX_DIGIT(c) ((isInP1[c] & 0x80) != 0) +#define isHEX_DIGIT(c) ((isInP1[c] & 0x40) != 0) +#define isDECIMAL_DIGIT(c) ((isInP1[c] & 0x10) != 0) +#define isOCTAL_DIGIT(c) ((isInP1[c] & 0x20) != 0) + +/* Membership macros for classes defined in table 2 ... */ +#define isWHITE_SPACE(c) ((isInP2[c] & 0x80) != 0) +#define isCOMMENT(c) ((isInP2[c] & 0x40) != 0) +#define isNAME(c) ((isInP2[c] & 0x20) != 0) +#define isSTRING_SPECIAL(c) ((isInP2[c] & 0x10) != 0) +#define isNUMBER_ENDER(c) ((isInP2[c] & 0x08) != 0) + +#define isInP1 (isInT1+2) +static unsigned char isInT1[258] = { 0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xD0,0xD0,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00, + 0x00,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +#define isInP2 (isInT2+2) +static unsigned char isInT2[258] = { 0x18,0x18, + 0xC8,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xC8,0x88,0x60,0x60,0x98,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0xC8,0x60,0x60,0x60,0x60,0x48,0x60,0x60,0x58,0x58,0x60,0x60,0x60,0x60,0x60,0x48, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x60,0x48,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x70,0x48,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x48,0x60,0x48,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60, + 0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60 +}; + +#endif diff -Naur xdvik-22.40l/libs/type1/trig.h xdvik-22.40n/libs/type1/trig.h --- xdvik-22.40l/libs/type1/trig.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/trig.h Sat Sep 14 00:24:48 2002 @@ -0,0 +1,35 @@ +/* $XConsortium: trig.h,v 1.2 91/10/10 11:20:04 rws Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/*SHARED*/ + +#define DegreeCos(d) xiStub() +#define DegreeSin(d) xiStub() +#define sqrt(d) xiStub() + diff -Naur xdvik-22.40l/libs/type1/type1.c xdvik-22.40n/libs/type1/type1.c --- xdvik-22.40l/libs/type1/type1.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/type1.c Sat Sep 14 00:24:48 2002 @@ -0,0 +1,2085 @@ +/* $XConsortium: type1.c,v 1.5 91/10/10 11:20:06 rws Exp $ */ +/* Copyright International Business Machines, Corp. 1991 + * All Rights Reserved + * Copyright Lexmark International, Inc. 1991 + * All Rights Reserved + * Portions Copyright (c) 1990 Adobe Systems Incorporated. + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of IBM or Lexmark or Adobe + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. + * + * IBM, LEXMARK, AND ADOBE PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY + * WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE + * ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING + * ANY DUTY TO SUPPORT OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY + * PORTION OF THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM, + * LEXMARK, OR ADOBE) ASSUMES THE ENTIRE COST OF ALL SERVICING, REPAIR AND + * CORRECTION. IN NO EVENT SHALL IBM, LEXMARK, OR ADOBE BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/*********************************************************************/ +/* */ +/* Type 1 module - Converting fonts in Adobe Type 1 Font Format */ +/* to scaled and hinted paths for rasterization. */ +/* Files: type1.c, type1.h, and blues.h. */ +/* */ +/* Authors: Sten F. Andler, IBM Almaden Research Center */ +/* (Type 1 interpreter, stem & flex hints) */ +/* */ +/* Patrick A. Casey, Lexmark International, Inc. */ +/* (Font level hints & stem hints) */ +/* */ +/*********************************************************************/ + +/******************/ +/* Include Files: */ +/******************/ +#include "types.h" +#include /* a system-dependent include, usually */ +#include + +#include "objects.h" +#include "spaces.h" +#include "paths.h" +#include "fonts.h" /* understands about TEXTTYPEs */ +#include "pictures.h" /* understands about handles */ + +typedef struct xobject xobject; +#include "util.h" /* PostScript objects */ +#include "fontfcn.h" +#include "blues.h" /* Blues structure for font-level hints */ + +/**********************************/ +/* Type1 Constants and Structures */ +/**********************************/ +#define MAXSTACK 24 /* Adobe Type1 limit */ +#define MAXCALLSTACK 10 /* Adobe Type1 limit */ +#define MAXPSFAKESTACK 32 /* Max depth of fake PostScript stack (local) */ +#define MAXSTRLEN 512 /* Max length of a Type 1 string (local) */ +#define MAXLABEL 256 /* Maximum number of new hints */ +#define MAXSTEMS 512 /* Maximum number of VSTEM and HSTEM hints */ +#define EPS 0.001 /* Small number for comparisons */ + +/************************************/ +/* Adobe Type 1 CharString commands */ +/************************************/ +#define HSTEM 1 +#define VSTEM 3 +#define VMOVETO 4 +#define RLINETO 5 +#define HLINETO 6 +#define VLINETO 7 +#define RRCURVETO 8 +#define CLOSEPATH 9 +#define CALLSUBR 10 +#define RETURN 11 +#define ESCAPE 12 +#define HSBW 13 +#define ENDCHAR 14 +#define RMOVETO 21 +#define HMOVETO 22 +#define VHCURVETO 30 +#define HVCURVETO 31 + +/* The following charstring code appears in some old Adobe font files + in space and .notdef character and does not seems to do anything + useful aside from taking two args from the stack. We allow this + command and ignore it. The source code of ghostscript states that + this command is obsolete *and* undocumented. + This code may also appear in an Escape-sequence! */ +#define UNKNOWN_15 15 + +/*******************************************/ +/* Adobe Type 1 CharString Escape commands */ +/*******************************************/ +#define DOTSECTION 0 +#define VSTEM3 1 +#define HSTEM3 2 +#define SEAC 6 +#define SBW 7 +#define DIV 12 +#define CALLOTHERSUBR 16 +#define POP 17 +#define SETCURRENTPOINT 33 + + +/* Note: We use routines from libm because in the original macro definitions, + the evaluation order of tmpx is undefined by C-standard! */ +#define USE_MATHLIB_ROUTINES + +#ifdef USE_MATHLIB_ROUTINES + +#define FABS(x) (fabs (x)) +#define CEIL(x) ((LONG) ceil (x)) +#define FLOOR(x) ((LONG) floor (x)) + +#else + +/*****************/ +/* Useful macros */ +/*****************/ +static DOUBLE tmpx; /* Store macro argument in tmpx to avoid re-evaluation */ +static LONG tmpi; /* Store converted value in tmpi to avoid re-evaluation */ +#define FABS(x) (((tmpx = (x)) < 0.0) ? -tmpx : tmpx) +#define CEIL(x) (((tmpi = (LONG) (tmpx = (x))) < tmpx) ? ++tmpi : tmpi) +#define FLOOR(x) (((tmpi = (LONG) (tmpx = (x))) > tmpx) ? --tmpi : tmpi) + +#endif + +#define ROUND(x) FLOOR((x) + 0.5) +#define ODD(x) (((int)(x)) & 01) + +#define CC IfTrace1(TRUE, "Char \"%s\": ", currentchar) + +/* To make some compiler happy we have to care about return types! */ +#define Errori {errflag = TRUE; return 0;} /* integer */ +#define Errord {errflag = TRUE; return 0.0;} /* double */ +#define Errorv {errflag = TRUE; return;} /* void */ + +#define Error0i(errmsg) { CC; IfTrace0(TRUE, errmsg); Errori;} +#define Error0d(errmsg) { CC; IfTrace0(TRUE, errmsg); Errord;} +#define Error0v(errmsg) { CC; IfTrace0(TRUE, errmsg); Errorv;} + +#define Error1i(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Errori;} +#define Error1d(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Errord;} +#define Error1v(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Errorv;} + +/********************/ +/* global variables */ +/********************/ +struct stem { /* representation of a STEM hint */ + int vertical; /* TRUE if vertical, FALSE otherwise */ + DOUBLE x, dx; /* interval of vertical stem */ + DOUBLE y, dy; /* interval of horizontal stem */ + struct segment *lbhint, *lbrevhint; /* left or bottom hint adjustment */ + struct segment *rthint, *rtrevhint; /* right or top hint adjustment */ +}; + +extern struct XYspace *IDENTITY; + +static DOUBLE escapementX, escapementY; +static DOUBLE sidebearingX, sidebearingY; +static DOUBLE accentoffsetX, accentoffsetY; + +static struct segment *path; +static int errflag; + +/*************************************************/ +/* Global variables to hold Type1Char parameters */ +/*************************************************/ +static char *Environment; +static char *currentchar; +static struct XYspace *CharSpace; +static psobj *CharStringP, *SubrsP, *OtherSubrsP; +static int *ModeP; + +/************************/ +/* Forward declarations */ +/************************/ +static DOUBLE Div(); +static DOUBLE PSFakePop(); +static int DoCommand(); +static int Escape(); +static int HStem(); +static int VStem(); +static int RLineTo(); +static int RRCurveTo(); +static int DoClosePath(); +static int CallSubr(); +static int Return(); +static int EndChar(); +static int RMoveTo(); +static int DotSection(); +static int Seac(); +static int Sbw(); +static int CallOtherSubr(); +static int SetCurrentPoint(); + +/*****************************************/ +/* statics for Flex procedures (FlxProc) */ +/*****************************************/ +static struct segment *FlxOldPath; /* save path before Flex feature */ + +/******************************************************/ +/* statics for Font level hints (Blues) (see blues.h) */ +/******************************************************/ +static struct blues_struct *blues; /* the blues structure */ +static struct alignmentzone alignmentzones[MAXALIGNMENTZONES]; +int numalignmentzones; /* total number of alignment zones */ + +/****************************************************************/ +/* Subroutines for the Font level hints (Alignment zones, etc.) */ +/****************************************************************/ + + + +/* Flags to control the rasterizer */ +#define T1_IGNORE_FORCEBOLD 0x0001 +#define T1_IGNORE_FAMILYALIGNMENT 0x0002 +#define T1_IGNORE_HINTING 0x0004 + +#define T1_DEBUG_LINE 0x0100 +#define T1_DEBUG_REGION 0x0200 +#define T1_DEBUG_PATH 0x0400 +#define T1_DEBUG_FONT 0x0800 +#define T1_DEBUG_HINT 0x1000 + +int T1_Type1OperatorFlags; /* for manipulation from t1lib */ + + +static void SetRasterFlags( void) +{ + + if (T1_Type1OperatorFlags & T1_IGNORE_HINTING) + ProcessHints=0; + else + ProcessHints=1; + + if ( T1_Type1OperatorFlags & T1_DEBUG_LINE) + LineDebug=1; + else + LineDebug=0; + if ( T1_Type1OperatorFlags & T1_DEBUG_REGION) + RegionDebug=1; + else + RegionDebug=0; + if ( T1_Type1OperatorFlags & T1_DEBUG_PATH) + PathDebug=1; + else + PathDebug=0; + if ( T1_Type1OperatorFlags & T1_DEBUG_FONT) + FontDebug=1; + else + FontDebug=0; + if ( T1_Type1OperatorFlags & T1_DEBUG_HINT) + HintDebug=1; + else + HintDebug=0; + return; + +} + + +/******************************************/ +/* Fill in the alignment zone structures. */ +/******************************************/ +static int ComputeAlignmentZones() +{ + int i; + DOUBLE dummy, bluezonepixels, familyzonepixels; + struct segment *p; + + numalignmentzones = 0; /* initialize total # of zones */ + + /* Remarks by RMz (Author of t1lib): The handling of substitution of + the BlueValues by the FamilyBlues and correspondingly for the + OtherBlues and FamilyOtherBlues is not clearly documented. + These are the problems: + + 1) Does the number of FamilyBlues entries need to be identical to + that of BlueValues? + + 2) Obviously, the order of the alignment zones in the BlueValues + and the FamilyBlues need not be same (see TimesBold.pfa) + + 3) Is it wise/recommended to make the substitution on a per + alignment-zone level or global, i.e., if once then for all + zones? + + 4) The principle found below, checking the delta-height of an + alignment-zone and making a decision based on this is incorrect. + The decision has to be done according to absolute pixel values + at which a feature would be rendered with the BlueValues and the + FamilyBlues respectively. + + To conclude, it seems better to disable the Family-feature until + these things are well-known/defined. + */ + + /* do the BlueValues zones */ + for (i = 0; i < blues->numBlueValues; i +=2, ++numalignmentzones) { + /* the 0th & 1st numbers in BlueValues are for a bottom zone */ + /* the rest are topzones */ + if (i == 0) /* bottom zone */ + alignmentzones[numalignmentzones].topzone = FALSE; + else /* top zone */ + alignmentzones[numalignmentzones].topzone = TRUE; + /* Check FamilyAlignment suppression */ + if ( (T1_Type1OperatorFlags & T1_IGNORE_FAMILYALIGNMENT)==0) { + if (i < blues->numFamilyBlues) { /* we must consider FamilyBlues */ + p = ILoc(CharSpace,0,blues->BlueValues[i] - blues->BlueValues[i+1]); + QueryLoc(p, IDENTITY, &dummy, &bluezonepixels); + Destroy(p); + p = ILoc(CharSpace,0,blues->FamilyBlues[i] - blues->FamilyBlues[i+1]); + QueryLoc(p, IDENTITY, &dummy, &familyzonepixels); + Destroy(p); + /* is the difference in size of the zones less than 1 pixel? */ + if (FABS(bluezonepixels - familyzonepixels) < 1.0) { + /* use the Family zones */ + alignmentzones[numalignmentzones].bottomy = + blues->FamilyBlues[i]; + alignmentzones[numalignmentzones].topy = + blues->FamilyBlues[i+1]; + continue; + } + } + } + /* use this font's Blue zones */ + alignmentzones[numalignmentzones].bottomy = blues->BlueValues[i]; + alignmentzones[numalignmentzones].topy = blues->BlueValues[i+1]; + } + + /* do the OtherBlues zones */ + for (i = 0; i < blues->numOtherBlues; i +=2, ++numalignmentzones) { + /* all of the OtherBlues zones are bottom zones */ + alignmentzones[numalignmentzones].topzone = FALSE; + /* Check FamilyAlignment suppression */ + if ( (T1_Type1OperatorFlags & T1_IGNORE_FAMILYALIGNMENT)==0) { + if (i < blues->numFamilyOtherBlues) {/* consider FamilyOtherBlues */ + p = ILoc(CharSpace,0,blues->OtherBlues[i] - blues->OtherBlues[i+1]); + QueryLoc(p, IDENTITY, &dummy, &bluezonepixels); + Destroy(p); + p = ILoc(CharSpace,0,blues->FamilyOtherBlues[i] - + blues->FamilyOtherBlues[i+1]); + QueryLoc(p, IDENTITY, &dummy, &familyzonepixels); + Destroy(p); + /* is the difference in size of the zones less than 1 pixel? */ + if (FABS(bluezonepixels - familyzonepixels) < 1.0) { + /* use the Family zones */ + alignmentzones[numalignmentzones].bottomy = + blues->FamilyOtherBlues[i]; + alignmentzones[numalignmentzones].topy = + blues->FamilyOtherBlues[i+1]; + continue; + } + } + } + /* use this font's Blue zones (as opposed to the Family Blues */ + alignmentzones[numalignmentzones].bottomy = blues->OtherBlues[i]; + alignmentzones[numalignmentzones].topy = blues->OtherBlues[i+1]; + } + return(0); + +} + +/**********************************************************************/ +/* Subroutines and statics for handling of the VSTEM and HSTEM hints. */ +/**********************************************************************/ +int InDotSection; /* DotSection flag */ +struct stem stems[MAXSTEMS]; /* All STEM hints */ +int numstems; /* Number of STEM hints */ +int currstartstem; /* The current starting stem. */ +int oldvert, oldhor; /* Remember hint in effect */ +int oldhorhalf, oldverthalf; /* Remember which half of the stem */ +DOUBLE wsoffsetX, wsoffsetY; /* White space offset - for VSTEM3,HSTEM3 */ +int wsset; /* Flag for whether we've set wsoffsetX,Y */ + +static int InitStems() /* Initialize the STEM hint data structures */ +{ + InDotSection = FALSE; + currstartstem = numstems = 0; + oldvert = oldhor = -1; + return(0); + +} + +static int FinitStems() /* Terminate the STEM hint data structures */ +{ + int i; + + for (i = 0; i < numstems; i++) { + Destroy(stems[i].lbhint); + Destroy(stems[i].lbrevhint); + Destroy(stems[i].rthint); + Destroy(stems[i].rtrevhint); + } + return(0); + +} + +/*******************************************************************/ +/* Compute the dislocation that a stemhint should cause for points */ +/* inside the stem. */ +/*******************************************************************/ +static int ComputeStem(stemno) +int stemno; +{ + int verticalondevice, idealwidth; + DOUBLE stemstart, stemwidth; + struct segment *p; + int i; + DOUBLE stembottom, stemtop, flatposition; + DOUBLE Xpixels, Ypixels; + DOUBLE unitpixels, onepixel; + int suppressovershoot, enforceovershoot; + DOUBLE stemshift, flatpospixels, overshoot; + DOUBLE widthdiff; /* Number of character space units to adjust width */ + DOUBLE lbhintvalue, rthintvalue; + DOUBLE cxx, cyx, cxy, cyy; /* Transformation matrix */ + int rotated; /* TRUE if character is on the side, FALSE if upright */ + + /************************************************/ + /* DETERMINE ORIENTATION OF CHARACTER ON DEVICE */ + /************************************************/ + + QuerySpace(CharSpace, &cxx, &cyx, &cxy, &cyy); /* Transformation matrix */ + + if (FABS(cxx) < 0.00001 || FABS(cyy) < 0.00001) + rotated = TRUE; /* Char is on side (90 or 270 degrees), possibly oblique. */ + else if (FABS(cyx) < 0.00001 || FABS(cxy) < 0.00001) + rotated = FALSE; /* Char is upright (0 or 180 degrees), possibly oblique. */ + else { + stems[stemno].lbhint = NULL; /* Char is at non-axial angle, ignore hints. */ + stems[stemno].lbrevhint = NULL; + stems[stemno].rthint = NULL; + stems[stemno].rtrevhint = NULL; + return(0); + } + + /* Determine orientation of stem */ + + if (stems[stemno].vertical) { + verticalondevice = !rotated; + stemstart = stems[stemno].x; + stemwidth = stems[stemno].dx; + } else { + verticalondevice = rotated; + stemstart = stems[stemno].y; + stemwidth = stems[stemno].dy; + } + + /* Determine how many pixels (non-negative) correspond to 1 character space + unit (unitpixels), and how many character space units (non-negative) + correspond to one pixel (onepixel). */ + + if (stems[stemno].vertical) + p = ILoc(CharSpace, 1, 0); + else + p = ILoc(CharSpace, 0, 1); + QueryLoc(p, IDENTITY, &Xpixels, &Ypixels); + Destroy(p); + if (verticalondevice) + unitpixels = FABS(Xpixels); + else + unitpixels = FABS(Ypixels); + + onepixel = 1.0 / unitpixels; + + /**********************/ + /* ADJUST STEM WIDTHS */ + /**********************/ + + widthdiff = 0.0; + + /* Find standard stem with smallest width difference from this stem */ + if (stems[stemno].vertical) { /* vertical stem */ + if (blues->StdVW != 0) /* there is an entry for StdVW */ + widthdiff = blues->StdVW - stemwidth; + for (i = 0; i < blues->numStemSnapV; ++i) { /* now look at StemSnapV */ + if (FABS(blues->StemSnapV[i] - stemwidth) < FABS(widthdiff)) + /* this standard width is the best match so far for this stem */ + widthdiff = blues->StemSnapV[i] - stemwidth; + } + } else { /* horizontal stem */ + if (blues->StdHW != 0) /* there is an entry for StdHW */ + widthdiff = blues->StdHW - stemwidth; + for (i = 0; i < blues->numStemSnapH; ++i) { /* now look at StemSnapH */ + if (FABS(blues->StemSnapH[i] - stemwidth) < FABS(widthdiff)) + /* this standard width is the best match so far for this stem */ + widthdiff = blues->StemSnapH[i] - stemwidth; + } + } + + /* Only expand or contract stems if they differ by less than 1 pixel from + the closest standard width, otherwise make the width difference = 0. */ + if (FABS(widthdiff) > onepixel) + widthdiff = 0.0; + + /* Expand or contract stem to the nearest integral number of pixels. */ + idealwidth = ROUND((stemwidth + widthdiff) * unitpixels); + /* Ensure that all stems are at least one pixel wide. */ + if (idealwidth == 0) + idealwidth = 1; + + /* Apply ForceBold to vertical stems. */ + if (blues->ForceBold && stems[stemno].vertical && + ((T1_Type1OperatorFlags & T1_IGNORE_FORCEBOLD)==0)) + /* Force this vertical stem to be at least DEFAULTBOLDSTEMWIDTH wide. */ + if (idealwidth < DEFAULTBOLDSTEMWIDTH) + idealwidth = DEFAULTBOLDSTEMWIDTH; + /* Now compute the number of character space units necessary */ + widthdiff = idealwidth * onepixel - stemwidth; + + /*********************************************************************/ + /* ALIGNMENT ZONES AND OVERSHOOT SUPPRESSION - HORIZONTAL STEMS ONLY */ + /*********************************************************************/ + + stemshift = 0.0; + + if (!stems[stemno].vertical) { + + /* Get bottom and top boundaries of the stem. */ + stembottom = stemstart; + stemtop = stemstart + stemwidth; + + /* Find out if this stem intersects an alignment zone (the BlueFuzz */ + /* entry in the Private dictionary specifies the number of character */ + /* units to extend (in both directions) the effect of an alignment */ + /* zone on a horizontal stem. The default value of BlueFuzz is 1. */ + for (i = 0; i < numalignmentzones; ++i) { + if (alignmentzones[i].topzone) { + if (stemtop >= alignmentzones[i].bottomy && + stemtop <= alignmentzones[i].topy + blues->BlueFuzz) { + break; /* We found a top-zone */ + } + } else { + if (stembottom <= alignmentzones[i].topy && + stembottom >= alignmentzones[i].bottomy - blues->BlueFuzz) { + break; /* We found a bottom-zone */ + } + } + } + + if (i < numalignmentzones) { /* We found an intersecting zone (number i). */ + suppressovershoot = FALSE; + enforceovershoot = FALSE; + + /* When 1 character space unit is rendered smaller than BlueScale + device units (pixels), we must SUPPRESS overshoots. Otherwise, + if the top (or bottom) of this stem is more than BlueShift character + space units away from the flat position, we must ENFORCE overshoot. */ + + if (unitpixels < blues->BlueScale){ + suppressovershoot = TRUE; + } + else{ + if (alignmentzones[i].topzone){ + if (stemtop >= alignmentzones[i].bottomy + blues->BlueShift){ + enforceovershoot = TRUE; + } + else + if (stembottom <= alignmentzones[i].topy - blues->BlueShift){ + enforceovershoot = TRUE; + } + } + } + + + /*************************************************/ + /* ALIGN THE FLAT POSITION OF THE ALIGNMENT ZONE */ + /*************************************************/ + + /* Compute the position of the alignment zone's flat position in + device space and the amount of shift needed to align it on a + pixel boundary. Move all stems this amount. */ + + if (alignmentzones[i].topzone) + flatposition = alignmentzones[i].bottomy; + else + flatposition = alignmentzones[i].topy; + + /* Find the flat position in pixels */ + flatpospixels = flatposition * unitpixels; + + /* Find the stem shift necessary to align the flat + position on a pixel boundary, and use this shift for all stems */ + stemshift = (ROUND(flatpospixels) - flatpospixels) * onepixel; + + /************************************************/ + /* HANDLE OVERSHOOT ENFORCEMENT AND SUPPRESSION */ + /************************************************/ + + /* Compute overshoot amount (non-negative) */ + if (alignmentzones[i].topzone) + overshoot = stemtop - flatposition; + else + overshoot = flatposition - stembottom; + + if (overshoot > 0.0) { + /* ENFORCE overshoot by shifting the entire stem (if necessary) so that + it falls at least one pixel beyond the flat position. */ + + if (enforceovershoot){ + if (overshoot < onepixel){ + if (alignmentzones[i].topzone) + stemshift += onepixel - overshoot; + else + stemshift -= onepixel - overshoot; + } + } + + + /* SUPPRESS overshoot by aligning the stem to the alignment zone's + flat position. */ + + if (suppressovershoot){ + if (alignmentzones[i].topzone) + stemshift -= overshoot; + else + stemshift += overshoot; + } + } + + /************************************************************/ + /* COMPUTE HINT VALUES FOR EACH SIDE OF THE HORIZONTAL STEM */ + /************************************************************/ + + /* If the stem was aligned by a topzone, we expand or contract the stem + only at the bottom - since the stem top was aligned by the zone. + If the stem was aligned by a bottomzone, we expand or contract the stem + only at the top - since the stem bottom was aligned by the zone. */ + if (alignmentzones[i].topzone) { + lbhintvalue = stemshift - widthdiff; /* bottom */ + rthintvalue = stemshift; /* top */ + } else { + lbhintvalue = stemshift; /* bottom */ + rthintvalue = stemshift + widthdiff; /* top */ + } + + stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, lbhintvalue)); + stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -lbhintvalue)); + stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, 0.0, rthintvalue)); + stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -rthintvalue)); + + return(0); + + } /* endif (i < numalignmentzones) */ + + /* We didn't find any alignment zones intersecting this stem, so + proceed with normal stem alignment below. */ + + } /* endif (!stems[stemno].vertical) */ + + /* Align stem with pixel boundaries on device */ + stemstart = stemstart - widthdiff / 2; + stemshift = ROUND(stemstart * unitpixels) * onepixel - stemstart; + + /* Adjust the boundaries of the stem */ + lbhintvalue = stemshift - widthdiff / 2; /* left or bottom */ + rthintvalue = stemshift + widthdiff / 2; /* right or top */ + + if (stems[stemno].vertical) { + stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, lbhintvalue, 0.0)); + stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, -lbhintvalue, 0.0)); + stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, rthintvalue, 0.0)); + stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, -rthintvalue, 0.0)); + } else { + stems[stemno].lbhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, lbhintvalue)); + stems[stemno].lbrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -lbhintvalue)); + stems[stemno].rthint = (struct segment *)Permanent(Loc(CharSpace, 0.0, rthintvalue)); + stems[stemno].rtrevhint = (struct segment *)Permanent(Loc(CharSpace, 0.0, -rthintvalue)); + } + return(0); + +} + +#define LEFT 1 +#define RIGHT 2 +#define BOTTOM 3 +#define TOP 4 + +/*********************************************************************/ +/* Adjust a point using the given stem hint. Use the left/bottom */ +/* hint value or the right/top hint value depending on where the */ +/* point lies in the stem. */ +/*********************************************************************/ +static struct segment *Applyhint(p, stemnumber, half) +struct segment *p; +int stemnumber, half; +{ + if (half == LEFT || half == BOTTOM) + return Join(p, stems[stemnumber].lbhint); /* left or bottom hint */ + else + return Join(p, stems[stemnumber].rthint); /* right or top hint */ +} + +/*********************************************************************/ +/* Adjust a point using the given reverse hint. Use the left/bottom */ +/* hint value or the right/top hint value depending on where the */ +/* point lies in the stem. */ +/*********************************************************************/ +static struct segment *Applyrevhint(p, stemnumber, half) +struct segment *p; +int stemnumber, half; +{ + if (half == LEFT || half == BOTTOM) + return Join(p, stems[stemnumber].lbrevhint); /* left or bottom hint */ + else + return Join(p, stems[stemnumber].rtrevhint); /* right or top hint */ +} + +/***********************************************************************/ +/* Find the vertical and horizontal stems that the current point */ +/* (x, y) may be involved in. At most one horizontal and one vertical */ +/* stem can apply to a single point, since there are no overlaps */ +/* allowed. */ +/* The actual hintvalue is returned as a location. */ +/* Hints are ignored inside a DotSection. */ +/***********************************************************************/ +static struct segment *FindStems(x, y, dx, dy) +DOUBLE x, y, dx, dy; +{ + int i; + int newvert, newhor; + struct segment *p; + int newhorhalf, newverthalf; + + if (InDotSection) return(NULL); + + newvert = newhor = -1; + newhorhalf = newverthalf = -1; + + for (i = currstartstem; i < numstems; i++) { + if (stems[i].vertical) { /* VSTEM hint */ + if ((x >= stems[i].x - EPS) && + (x <= stems[i].x+stems[i].dx + EPS)) { + newvert = i; + if (dy != 0.0) { + if (dy < 0) newverthalf = LEFT; + else newverthalf = RIGHT; + } else { + if (x < stems[i].x+stems[i].dx / 2) newverthalf = LEFT; + else newverthalf = RIGHT; + } + } + } else { /* HSTEM hint */ + if ((y >= stems[i].y - EPS) && + (y <= stems[i].y+stems[i].dy + EPS)) { + newhor = i; + if (dx != 0.0) { + if (dx < 0) newhorhalf = TOP; + else newhorhalf = BOTTOM; + } else { + if (y < stems[i].y+stems[i].dy / 2) newhorhalf = BOTTOM; + else newhorhalf = TOP; + } + } + } + } + + p = NULL; + + if (newvert == -1 && oldvert == -1) ; /* Outside of any hints */ + else if (newvert == oldvert && + newverthalf == oldverthalf); /* No hint change */ + else if (oldvert == -1) { /* New vertical hint in effect */ + p = Applyhint(p, newvert, newverthalf); + } else if (newvert == -1) { /* Old vertical hint no longer in effect */ + p = Applyrevhint(p, oldvert, oldverthalf); + } else { /* New vertical hint in effect, old hint no longer in effect */ + p = Applyrevhint(p, oldvert, oldverthalf); + p = Applyhint(p, newvert, newverthalf); + } + + if (newhor == -1 && oldhor == -1) ; /* Outside of any hints */ + else if (newhor == oldhor && + newhorhalf == oldhorhalf) ; /* No hint change */ + else if (oldhor == -1) { /* New horizontal hint in effect */ + p = Applyhint(p, newhor, newhorhalf); + } else if (newhor == -1) { /* Old horizontal hint no longer in effect */ + p = Applyrevhint(p, oldhor, oldhorhalf); + } + else { /* New horizontal hint in effect, old hint no longer in effect */ + p = Applyrevhint(p, oldhor, oldhorhalf); + p = Applyhint(p, newhor, newhorhalf); + } + + oldvert = newvert; oldverthalf = newverthalf; + oldhor = newhor; oldhorhalf = newhorhalf; + + return p; +} + +/******************************************************/ +/* Subroutines and statics for the Type1Char routines */ +/******************************************************/ + +static int strindex; /* index into PostScript string being interpreted */ +static DOUBLE currx, curry; /* accumulated x and y values for hints */ + +struct callstackentry { + psobj *currstrP; /* current CharStringP */ + int currindex; /* current strindex */ + unsigned short currkey; /* current decryption key */ + }; + +static DOUBLE Stack[MAXSTACK]; +static int Top; +static struct callstackentry CallStack[MAXCALLSTACK]; +static int CallTop; +static DOUBLE PSFakeStack[MAXPSFAKESTACK]; +static int PSFakeTop; + +static int ClearStack() +{ + Top = -1; + return(0); + +} + +static int Push(Num) + DOUBLE Num; +{ + if (++Top < MAXSTACK) Stack[Top] = Num; + else Error0i("Push: Stack full\n"); + return(0); + +} + +static int ClearCallStack() +{ + CallTop = -1; + return(0); +} + +static int PushCall(CurrStrP, CurrIndex, CurrKey) + psobj *CurrStrP; + int CurrIndex; + unsigned short CurrKey; +{ + if (++CallTop < MAXCALLSTACK) { + CallStack[CallTop].currstrP = CurrStrP; /* save CharString pointer */ + CallStack[CallTop].currindex = CurrIndex; /* save CharString index */ + CallStack[CallTop].currkey = CurrKey; /* save decryption key */ + } + else Error0i("PushCall: Stack full\n"); + return(0); +} + +static int PopCall(CurrStrPP, CurrIndexP, CurrKeyP) + psobj **CurrStrPP; + int *CurrIndexP; + unsigned short *CurrKeyP; +{ + if (CallTop >= 0) { + *CurrStrPP = CallStack[CallTop].currstrP; /* restore CharString pointer */ + *CurrIndexP = CallStack[CallTop].currindex; /* restore CharString index */ + *CurrKeyP = CallStack[CallTop--].currkey; /* restore decryption key */ + } + else Error0i("PopCall: Stack empty\n"); + return(0); +} + + +static int ClearPSFakeStack() +{ + PSFakeTop = -1; + return(0); +} + +/* PSFakePush: Pushes a number onto the fake PostScript stack */ +static int PSFakePush(Num) + DOUBLE Num; +{ + if (++PSFakeTop < MAXPSFAKESTACK) PSFakeStack[PSFakeTop] = Num; + else Error0i("PSFakePush: Stack full\n"); + return(0); +} + +/* PSFakePop: Removes a number from the top of the fake PostScript stack */ +static DOUBLE PSFakePop () +{ + if (PSFakeTop >= 0) return(PSFakeStack[PSFakeTop--]); + + else Error0d("PSFakePop : Stack empty\n"); + + /*NOTREACHED*/ +} + +/***********************************************************************/ +/* Center a stem on the pixel grid -- used by HStem3 and VStem3 */ +/***********************************************************************/ +static struct segment *CenterStem(edge1, edge2) + DOUBLE edge1; + DOUBLE edge2; +{ + int idealwidth, verticalondevice; + DOUBLE leftx, lefty, rightx, righty, center, width; + DOUBLE widthx, widthy; + DOUBLE shift, shiftx, shifty; + DOUBLE Xpixels, Ypixels; + struct segment *p; + + p = Loc(CharSpace, edge1, 0.0); + QueryLoc(p, IDENTITY, &leftx, &lefty); + + p = Join(p, Loc(CharSpace, edge2, 0.0)); + QueryLoc(p, IDENTITY, &rightx, &righty); + Destroy(p); + + widthx = FABS(rightx - leftx); + widthy = FABS(righty - lefty); + + if (widthy <= EPS) { /* verticalondevice hint */ + verticalondevice = TRUE; + center = (rightx + leftx) / 2.0; + width = widthx; + } + else if (widthx <= EPS) { /* horizontal hint */ + verticalondevice = FALSE; + center = (righty + lefty) / 2.0; + width = widthy; + } + else { /* neither horizontal nor verticalondevice and not oblique */ + return (NULL); + } + + idealwidth = ROUND(width); + if (idealwidth == 0) idealwidth = 1; + if (ODD(idealwidth)) { /* is ideal width odd? */ + /* center stem over pixel */ + shift = FLOOR(center) + 0.5 - center; + } + else { + /* align stem on pixel boundary */ + shift = ROUND(center) - center; + } + + if (verticalondevice) { + shiftx = shift; + shifty = 0.0; + } else { + shifty = shift; + shiftx = 0.0; + } + + p = Loc(IDENTITY, shiftx, shifty); + QueryLoc(p, CharSpace, &Xpixels, &Ypixels); + wsoffsetX = Xpixels; wsoffsetY = Ypixels; + currx += wsoffsetX; curry += wsoffsetY; + + return (p); +} + +/*----------------------------------------------------------------------- + Decrypt - From Adobe Type 1 book page 63, with some modifications +-----------------------------------------------------------------------*/ +#define KEY 4330 /* Initial key (seed) for CharStrings decryption */ +#define C1 52845 /* Multiplier for pseudo-random number generator */ +#define C2 22719 /* Constant for pseudo-random number generator */ + +static unsigned short r; /* Pseudo-random sequence of keys */ + +static unsigned char Decrypt(cipher) +unsigned char cipher; +{ + unsigned char plain; + + plain = cipher ^ (r >> 8); + r = (cipher + r) * C1 + C2; + return plain; +} + +/* Get the next byte from the codestring being interpreted */ +static int DoRead(CodeP) + int *CodeP; +{ + if (strindex >= CharStringP->len) return(FALSE); /* end of string */ + /* We handle the non-documented Adobe convention to use lenIV=-1 to + suppress charstring encryption. */ + if (blues->lenIV==-1) { + *CodeP = (unsigned char) CharStringP->data.stringP[strindex++]; + } + else { + *CodeP = Decrypt((unsigned char) CharStringP->data.stringP[strindex++]); + } + + return(TRUE); +} + +/* Strip blues->lenIV bytes from CharString and update encryption key */ +/* (the lenIV entry in the Private dictionary specifies the number of */ +/* random bytes at the beginning of each CharString; default is 4) */ +static void StartDecrypt() +{ + int Code; + + r = KEY; /* Initial key (seed) for CharStrings decryption */ + for (strindex = 0; strindex < blues->lenIV;){ + if (!DoRead(&Code)) /* Read a byte and update decryption key */ + Error0v("StartDecrypt: Premature end of CharString\n"); + } + +} + +#undef DecodeDebug + +static int Decode(Code) + int Code; +{ + int Code1, Code2, Code3, Code4; + + if (Code <= 31){ /* Code is [0,31] */ +#ifdef DecodeDebug + fprintf(stderr, "Decode: Code=%d -> Command\n", Code); +#endif + DoCommand(Code); + } + else if (Code <= 246){ /* Code is [32,246] */ +#ifdef DecodeDebug + fprintf(stderr, "Decode: Code=%d -> number=%f\n", + Code, (DOUBLE)(Code-139)); +#endif + Push((DOUBLE)(Code - 139)); + } + else if (Code <= 250) { /* Code is [247,250] */ + if (!DoRead(&Code2)) goto ended; +#ifdef DecodeDebug + fprintf(stderr, "Decode: Code=%d next Code=%d -> number=%f\n", + Code, Code2, (DOUBLE)(((Code - 247) << 8) + Code2 + 108)); +#endif + Push((DOUBLE)(((Code - 247) << 8) + Code2 + 108)); + } + else if (Code <= 254) { /* Code is [251,254] */ + if (!DoRead(&Code2)) goto ended; +#ifdef DecodeDebug + fprintf(stderr, "Decode: Code=%d, next Code=%d -> number=%f\n", + Code, Code2, (DOUBLE)( -((Code - 251) << 8) - Code2 - 108)); +#endif + Push((DOUBLE)( -((Code - 251) << 8) - Code2 - 108)); + } + else { /* Code is 255 */ + if (!DoRead(&Code1)) goto ended; + if (!DoRead(&Code2)) goto ended; + if (!DoRead(&Code3)) goto ended; + if (!DoRead(&Code4)) goto ended; +#ifdef DecodeDebug + fprintf(stderr, "Decode: Code=255, Code1=%d, Code2=%d, Code3=%d, Code4=%d -> number=%f\n", + Code1, Code2, Code3, Code4, + (DOUBLE)((((((Code1<<8) + Code2)<<8) + Code3)<<8) + Code4)); +#endif + Push((DOUBLE)((((((Code1<<8) + Code2)<<8) + Code3)<<8) + Code4)); + } + return(0); + +ended: Error0i("Decode: Premature end of Type 1 CharString"); +} + +#undef DoCommandDebug + +/* Interpret a command code */ +static int DoCommand(Code) + int Code; +{ + switch(Code) { + case HSTEM: /* |- y dy HSTEM |- */ +#ifdef DoCommandDebug + printf("DoCommand: HStem\n"); +#endif + /* Vertical range of a horizontal stem zone */ + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + HStem(Stack[0], Stack[1]); + ClearStack(); + break; + case VSTEM: /* |- x dx VSTEM |- */ +#ifdef DoCommandDebug + printf("DoCommand: VStem\n"); +#endif + /* Horizontal range of a vertical stem zone */ + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + VStem(Stack[0], Stack[1]); + ClearStack(); + break; + case VMOVETO: /* |- dy VMOVETO |- */ +#ifdef DoCommandDebug + printf("DoCommand: VMoveto\n"); +#endif + /* Vertical MOVETO, equivalent to 0 dy RMOVETO */ + if (Top < 0) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RMoveTo(0.0, Stack[0]); + ClearStack(); + break; + case RLINETO: /* |- dx dy RLINETO |- */ +#ifdef DoCommandDebug + printf("DoCommand: RLineto\n"); +#endif + /* Like RLINETO in PostScript */ + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RLineTo(Stack[0], Stack[1]); + ClearStack(); + break; + case HLINETO: /* |- dx HLINETO |- */ +#ifdef DoCommandDebug + printf("DoCommand: HLineto\n"); +#endif + /* Horizontal LINETO, equivalent to dx 0 RLINETO */ + if (Top < 0) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RLineTo(Stack[0], 0.0); + ClearStack(); + break; + case VLINETO: /* |- dy VLINETO |- */ +#ifdef DoCommandDebug + printf("DoCommand: VLineto\n"); +#endif + /* Vertical LINETO, equivalent to 0 dy RLINETO */ + if (Top < 0) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RLineTo(0.0, Stack[0]); + ClearStack(); + break; + case RRCURVETO: +#ifdef DoCommandDebug + printf("DoCommand: RRCurveto\n"); +#endif + /* |- dx1 dy1 dx2 dy2 dx3 dy3 RRCURVETO |- */ + /* Relative RCURVETO, equivalent to dx1 dy1 */ + /* (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) */ + /* (dy1+dy2+dy3) RCURVETO in PostScript */ + if (Top < 5) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RRCurveTo(Stack[0], Stack[1], Stack[2], Stack[3], + Stack[4], Stack[5]); + ClearStack(); + break; + case CLOSEPATH: /* - CLOSEPATH |- */ +#ifdef DoCommandDebug + printf("DoCommand: ClosePath\n"); +#endif + /* Closes a subpath without repositioning the */ + /* current point */ + DoClosePath(); + ClearStack(); + break; + case CALLSUBR: /* subr# CALLSUBR - */ +#ifdef DoCommandDebug + printf("DoCommand: CallSubr\n"); +#endif + /* Calls a CharString subroutine with index */ + /* subr# from the Subrs array */ + if (Top < 0) Error1i("DoCommand: Stack low\n (Code=%d)", Code); + CallSubr((int)Stack[Top--]); + break; + case RETURN: /* - RETURN - */ +#ifdef DoCommandDebug + printf("DoCommand: Return\n"); +#endif + /* Returns from a Subrs array CharString */ + /* subroutine called with CALLSUBR */ + Return(); + break; + case ESCAPE: /* ESCAPE to two-byte command code */ +#ifdef DoCommandDebug + printf("DoCommand: Escape to 2 Byte Code (Code=%d)\n", Code); +#endif + if (!DoRead(&Code)) Error0i("DoCommand: ESCAPE is last byte\n"); + Escape(Code); + break; + case HSBW: /* |- sbx wx HSBW |- */ +#ifdef DoCommandDebug + printf("DoCommand: HSBW\n"); +#endif + /* Set the left sidebearing point to (sbx,0), */ + /* set the character width vector to (wx,0). */ + /* Equivalent to sbx 0 wx 0 SBW. Space */ + /* character should have sbx = 0 */ + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + Sbw(Stack[0], 0.0, Stack[1], 0.0); + ClearStack(); + break; + case ENDCHAR: /* - ENDCHAR |- */ +#ifdef DoCommandDebug + printf("DoCommand: EndChar\n"); +#endif + /* Finishes a CharString outline */ + EndChar(); + ClearStack(); + break; + case RMOVETO: /* |- dx dy RMOVETO |- */ +#ifdef DoCommandDebug + printf("DoCommand: RMoveto\n"); +#endif + /* Behaves like RMOVETO in PostScript */ + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RMoveTo(Stack[0], Stack[1]); + ClearStack(); + break; + case HMOVETO: /* |- dx HMOVETO |- */ +#ifdef DoCommandDebug + printf("DoCommand: HMovetoUnassigned\n"); +#endif + /* Horizontal MOVETO. Equivalent to dx 0 RMOVETO */ + if (Top < 0) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RMoveTo(Stack[0], 0.0); + ClearStack(); + break; + case VHCURVETO: /* |- dy1 dx2 dy2 dx3 VHCURVETO |- */ +#ifdef DoCommandDebug + printf("DoCommand: VHCurveto\n"); +#endif + /* Vertical-Horizontal CURVETO, equivalent to */ + /* 0 dy1 dx2 dy2 dx3 0 RRCURVETO */ + if (Top < 3) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RRCurveTo(0.0, Stack[0], Stack[1], Stack[2], + Stack[3], 0.0); + ClearStack(); + break; + case HVCURVETO: /* |- dx1 dx2 dy2 dy3 HVCURVETO |- */ +#ifdef DoCommandDebug + printf("DoCommand: HCurveto\n"); +#endif + /* Horizontal-Vertical CURVETO, equivalent to */ + /* dx1 0 dx2 dy2 0 dy3 RRCURVETO */ + if (Top < 3) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + RRCurveTo(Stack[0], 0.0, Stack[1], Stack[2], 0.0, Stack[3]); + ClearStack(); + break; + case UNKNOWN_15: + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + ClearStack(); + break; + default: /* Unassigned command code */ +#ifdef DoCommandDebug + printf("DoCommand: Unassigned\n"); +#endif + ClearStack(); + Error1i("DoCommand: Unassigned code %d\n", Code); + } + return(0); + +} + +static int Escape(Code) + int Code; +{ + int i, Num; + struct segment *p; + + switch(Code) { + case DOTSECTION: /* - DOTSECTION |- */ + /* Brackets an outline section for the dots in */ + /* letters such as "i", "j", and "!". */ + DotSection(); + ClearStack(); + break; + case VSTEM3: /* |- x0 dx0 x1 dx1 x2 dx2 VSTEM3 |- */ + /* Declares the horizontal ranges of three */ + /* vertical stem zones between x0 and x0+dx0, */ + /* x1 and x1+dx1, and x2 and x2+dx2. */ + if (Top < 5) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + if (!wsset && ProcessHints) { + /* Shift the whole character so that the middle stem is centered. */ + p = CenterStem(Stack[2] + sidebearingX, Stack[3]); + path = Join(path, p); + wsset = 1; + } + + VStem(Stack[0], Stack[1]); + VStem(Stack[2], Stack[3]); + VStem(Stack[4], Stack[5]); + ClearStack(); + break; + case HSTEM3: /* |- y0 dy0 y1 dy1 y2 dy2 HSTEM3 |- */ + /* Declares the vertical ranges of three hori- */ + /* zontal stem zones between y0 and y0+dy0, */ + /* y1 and y1+dy1, and y2 and y2+dy2. */ + if (Top < 5) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + HStem(Stack[0], Stack[1]); + HStem(Stack[2], Stack[3]); + HStem(Stack[4], Stack[5]); + ClearStack(); + break; + case SEAC: /* |- asb adx ady bchar achar SEAC |- */ + /* Standard Encoding Accented Character. */ + if (Top < 4) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + Seac(Stack[0], Stack[1], Stack[2], + (unsigned char) Stack[3], + (unsigned char) Stack[4]); + ClearStack(); + break; + case SBW: /* |- sbx sby wx wy SBW |- */ + /* Set the left sidebearing point to (sbx,sby), */ + /* set the character width vector to (wx,wy). */ + if (Top < 3) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + Sbw(Stack[0], Stack[1], Stack[2], Stack[3]); + ClearStack(); + break; + case DIV: /* num1 num2 DIV quotient */ + /* Behaves like DIV in the PostScript language */ + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + Stack[Top-1] = Div(Stack[Top-1], Stack[Top]); + Top--; + break; + case CALLOTHERSUBR: + /* arg1 ... argn n othersubr# CALLOTHERSUBR - */ + /* Make calls on the PostScript interpreter */ + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + Num = Stack[Top-1]; + if (Top < Num+1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + for (i = 0; i < Num; i++) PSFakePush(Stack[Top - i - 2]); + Top -= Num + 2; + CallOtherSubr((int)Stack[Top + Num + 2]); + break; + case POP: /* - POP number */ + /* Removes a number from the top of the */ + /* PostScript interpreter stack and pushes it */ + /* onto the Type 1 BuildChar operand stack */ + Push(PSFakePop()); + break; + case SETCURRENTPOINT: /* |- x y SETCURRENTPOINT |- */ + /* Sets the current point to (x,y) in absolute */ + /* character space coordinates without per- */ + /* forming a CharString MOVETO command */ + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + SetCurrentPoint(Stack[0], Stack[1]); + ClearStack(); + break; + case UNKNOWN_15: + if (Top < 1) Error1i("DoCommand: Stack low (Code=%d)\n", Code); + ClearStack(); + break; + default: /* Unassigned escape code command */ + ClearStack(); + Error1i("Escape: Unassigned code %d\n", Code); + } + return(0); + +} + +/* |- y dy HSTEM |- */ +/* Declares the vertical range of a horizontal stem zone */ +/* between coordinates y and y + dy */ +/* y is relative to the left sidebearing point */ +static int HStem(y, dy) + DOUBLE y, dy; +{ + IfTrace2((FontDebug), "Hstem %f %f\n", y, dy); + if (ProcessHints) { + if (numstems >= MAXSTEMS) Error0i("HStem: Too many hints\n"); + if (dy < 0.0) {y += dy; dy = -dy;} + stems[numstems].vertical = FALSE; + stems[numstems].x = 0.0; + stems[numstems].y = sidebearingY + y + wsoffsetY; + stems[numstems].dx = 0.0; + stems[numstems].dy = dy; + ComputeStem(numstems); + numstems++; + } + return(0); +} + +/* |- x dx VSTEM |- */ +/* Declares the horizontal range of a vertical stem zone */ +/* between coordinates x and x + dx */ +/* x is relative to the left sidebearing point */ +static int VStem(x, dx) + DOUBLE x, dx; +{ + IfTrace2((FontDebug), "Vstem %f %f\n", x, dx); + if (ProcessHints) { + if (numstems >= MAXSTEMS) Error0i("VStem: Too many hints\n"); + if (dx < 0.0) {x += dx; dx = -dx;} + stems[numstems].vertical = TRUE; + stems[numstems].x = sidebearingX + x + wsoffsetX; + stems[numstems].y = 0.0; + stems[numstems].dx = dx; + stems[numstems].dy = 0.0; + ComputeStem(numstems); + numstems++; + } + return(0); +} + +/* |- dx dy RLINETO |- */ +/* Behaves like RLINETO in PostScript */ +static int RLineTo(dx, dy) + DOUBLE dx, dy; +{ + struct segment *B; + + IfTrace2((FontDebug), "RLineTo %f %f\n", dx, dy); + + B = Loc(CharSpace, dx, dy); + + if (ProcessHints) { + currx += dx; + curry += dy; + /* B = Join(B, FindStems(currx, curry)); */ + B = Join(B, FindStems(currx, curry, dx, dy)); + } + + path = Join(path, Line(B)); + return(0); +} + +/* |- dx1 dy1 dx2 dy2 dx3 dy3 RRCURVETO |- */ +/* Relative RCURVETO, equivalent to dx1 dy1 */ +/* (dx1+dx2) (dy1+dy2) (dx1+dx2+dx3) */ +/* (dy1+dy2+dy3) RCURVETO in PostScript */ +static int RRCurveTo(dx1, dy1, dx2, dy2, dx3, dy3) + DOUBLE dx1, dy1, dx2, dy2, dx3, dy3; +{ + struct segment *B, *C, *D; + + IfTrace4((FontDebug), "RRCurveTo %f %f %f %f ", dx1, dy1, dx2, dy2); + IfTrace2((FontDebug), "%f %f\n", dx3, dy3); + + B = Loc(CharSpace, dx1, dy1); + C = Loc(CharSpace, dx2, dy2); + D = Loc(CharSpace, dx3, dy3); + + if (ProcessHints) { + /* For a Bezier curve, we apply the full hint value to + the Bezier C point (and thereby D point). */ + currx += dx1 + dx2 + dx3; + curry += dy1 + dy2 + dy3; + /* C = Join(C, FindStems(currx, curry)); */ + C = Join(C, FindStems(currx, curry, dx3, dy3)); + } + + /* Since XIMAGER is not completely relative, */ + /* we need to add up the delta values */ + + C = Join(C, Dup(B)); + D = Join(D, Dup(C)); + + path = Join(path, Bezier(B, C, D)); + return(0); +} + +/* - CLOSEPATH |- */ +/* Closes a subpath WITHOUT repositioning the */ +/* current point */ +static int DoClosePath() +{ + struct segment *CurrentPoint; + + IfTrace0((FontDebug), "DoClosePath\n"); + CurrentPoint = Phantom(path); + path = ClosePath(path); + path = Join(Snap(path), CurrentPoint); + return(0); +} + +/* subr# CALLSUBR - */ +/* Calls a CharString subroutine with index */ +/* subr# from the Subrs array */ +static int CallSubr(subrno) + int subrno; +{ + IfTrace1((FontDebug), "CallSubr %d\n", subrno); + if ((subrno < 0) || (subrno >= SubrsP->len)) + Error0i("CallSubr: subrno out of range\n"); + PushCall(CharStringP, strindex, r); + CharStringP = &SubrsP->data.arrayP[subrno]; + StartDecrypt(); + return(0); +} + +/* - RETURN - */ +/* Returns from a Subrs array CharString */ +/* subroutine called with CALLSUBR */ +static int Return() +{ + IfTrace0((FontDebug), "Return\n"); + PopCall(&CharStringP, &strindex, &r); + return(0); +} + +/* - ENDCHAR |- */ +/* Finishes a CharString outline */ +/* Executes SETCHACHEDEVICE using a bounding box */ +/* it computes directly from the character outline */ +/* and using the width information acquired from a previous */ +/* HSBW or SBW. It then calls a special version of FILL */ +/* or STROKE depending on the value of PaintType in the */ +/* font dictionary */ +static int EndChar() +{ + IfTrace0((FontDebug), "EndChar\n"); + + /* There is no need to compute and set bounding box for + the cache, since XIMAGER does that on the fly. */ + + /* Perform a Closepath just in case the command was left out */ + path = ClosePath(path); + + /* Set character width */ + path = Join(Snap(path), Loc(CharSpace, escapementX, escapementY)); + return(0); + +} + +/* |- dx dy RMOVETO |- */ +/* Behaves like RMOVETO in PostScript */ +static int RMoveTo(dx,dy) + DOUBLE dx,dy; +{ + struct segment *B; + + IfTrace2((FontDebug), "RMoveTo %f %f\n", dx, dy); + + B = Loc(CharSpace, dx, dy); + + if (ProcessHints) { + currx += dx; + curry += dy; + /* B = Join(B, FindStems(currx, curry)); */ + B = Join(B, FindStems(currx, curry, 0.0, 0.0)); + } + + path = Join(path, B); + return(0); +} + +/* - DOTSECTION |- */ +/* Brackets an outline section for the dots in */ +/* letters such as "i", "j", and "!". */ +static int DotSection() +{ + IfTrace0((FontDebug), "DotSection\n"); + InDotSection = !InDotSection; + return(0); +} + +/* |- asb adx ady bchar achar SEAC |- */ +/* Standard Encoding Accented Character. */ +static int Seac(asb, adx, ady, bchar, achar) + DOUBLE asb, adx, ady; + unsigned char bchar, achar; +{ + int Code; + struct segment *mypath; + + IfTrace4((FontDebug), "SEAC %f %f %f %d ", asb, adx, ady, bchar); + IfTrace1((FontDebug), "%d\n", achar); + + /* Move adx - asb, ady over and up from base char's sbpoint. */ + /* (We use adx - asb to counteract the accents sb shift.) */ + /* The variables accentoffsetX/Y modify sidebearingX/Y in Sbw(). */ + /* Note that these incorporate the base character's sidebearing shift by */ + /* using the current sidebearingX, Y values. */ + accentoffsetX = sidebearingX + adx - asb; + accentoffsetY = sidebearingY + ady; + + /* Set path = NULL to avoid complaints from Sbw(). */ + path = NULL; + + /* Go find the CharString for the accent's code via an upcall */ + CharStringP = GetType1CharString(Environment, achar); + if (CharStringP == NULL) { + Error1i("Invalid accent ('%03o) in SEAC\n", achar); + } + StartDecrypt(); + + ClearStack(); + ClearPSFakeStack(); + ClearCallStack(); + + for (;;) { + if (!DoRead(&Code)) break; + Decode(Code); + if (errflag) return(0); + } + /* Copy snapped path to mypath and set path to NULL as above. */ + mypath = Snap(path); + path = NULL; + + /* We must reset these to null now. */ + accentoffsetX = accentoffsetY = 0; + + /* go find the CharString for the base char's code via an upcall */ + CharStringP = GetType1CharString(Environment, bchar); + StartDecrypt(); + + ClearStack(); + ClearPSFakeStack(); + ClearCallStack(); + + FinitStems(); + InitStems(); + + for (;;) { + if (!DoRead(&Code)) break; + Decode(Code); + if (errflag) return(0); + } + path = Join(mypath, path); + return(0); +} + + +/* |- sbx sby wx wy SBW |- */ +/* Set the left sidebearing point to (sbx,sby), */ +/* set the character width vector to (wx,wy). */ +static int Sbw(sbx, sby, wx, wy) + DOUBLE sbx, sby, wx, wy; +{ + IfTrace4((FontDebug), "SBW %f %f %f %f\n", sbx, sby, wx, wy); + + escapementX = wx; /* Character width vector */ + escapementY = wy; + + /* Sidebearing values are sbx, sby args, plus accent offset from Seac(). */ + sidebearingX = sbx + accentoffsetX; + sidebearingY = sby + accentoffsetY; + + path = Join(path, Loc(CharSpace, sidebearingX, sidebearingY)); + if (ProcessHints) {currx = sidebearingX; curry = sidebearingY;} + return(0); +} + + /* num1 num2 DIV quotient */ +/* Behaves like DIV in the PostScript language */ +static DOUBLE Div(num1, num2) + DOUBLE num1, num2; +{ + IfTrace2((FontDebug), "Div %f %f\n", num1, num2); + return(num1 / num2); +} + +/* + The following four subroutines (FlxProc, FlxProc1, FlxProc2, and + HintReplace) are C versions of the OtherSubrs Programs, which were + were published in the Adobe Type 1 Font Format book. + + The Flex outline fragment is described by + c1: (x0, y0) = c3: (x0, yshrink(y0)) or (xshrink(x0), y0) + " (x1, y1) = " (x1, yshrink(y1)) or (xshrink(x1), y1) + " (x2, y2) - reference point + c2: (x0, y0) = c4: (x0, yshrink(y0)) or (xshrink(x0), y0) + " (x1, y1) = " (x1, yshrink(y1)) or (xshrink(x1), y1) + " (x2, y2) = " (x2, y2), rightmost endpoint + c3: (x0, y0) - control point, 1st Bezier curve + " (x1, y1) - control point, -"- + " (x2, y2) - end point, -"- + c4: (x0, y0) - control point, 2nd Bezier curve + " (x1, y1) - control point, -"- + " (x2, y2) - end point, -"- + ep: (epY, epX) - final endpoint (should be same as c4: (x2, y2)) + idmin - minimum Flex height (1/100 pixel) at which to render curves +*/ + +#define dtransform(dxusr,dyusr,dxdev,dydev) { \ + register struct segment *point = Loc(CharSpace, dxusr, dyusr); \ + QueryLoc(point, IDENTITY, dxdev, dydev); \ + Destroy(point); \ +} + +#define itransform(xdev,ydev,xusr,yusr) { \ + register struct segment *point = Loc(IDENTITY, xdev, ydev); \ + QueryLoc(point, CharSpace, xusr, yusr); \ + Destroy(point); \ +} + +#define transform(xusr,yusr,xdev,ydev) dtransform(xusr,yusr,xdev,ydev) + +#define PaintType (0) + +#define lineto(x,y) { \ + struct segment *CurrentPoint; \ + DOUBLE CurrentX, CurrentY; \ + CurrentPoint = Phantom(path); \ + QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); \ + Destroy(CurrentPoint); \ + RLineTo(x - CurrentX, y - CurrentY); \ +} + +#define curveto(x0,y0,x1,y1,x2,y2) { \ + struct segment *CurrentPoint; \ + DOUBLE CurrentX, CurrentY; \ + CurrentPoint = Phantom(path); \ + QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); \ + Destroy(CurrentPoint); \ + RRCurveTo(x0 - CurrentX, y0 - CurrentY, x1 - x0, y1 - y0, x2 - x1, y2 - y1); \ +} + +#define xshrink(x) ((x - c4x2) * shrink +c4x2) +#define yshrink(y) ((y - c4y2) * shrink +c4y2) + +#define PickCoords(flag) \ + if (flag) { /* Pick "shrunk" coordinates */ \ + x0 = c1x0; y0 = c1y0; \ + x1 = c1x1; y1 = c1y1; \ + x2 = c1x2; y2 = c1y2; \ + x3 = c2x0; y3 = c2y0; \ + x4 = c2x1; y4 = c2y1; \ + x5 = c2x2; y5 = c2y2; \ + } else { /* Pick original coordinates */ \ + x0 = c3x0; y0 = c3y0; \ + x1 = c3x1; y1 = c3y1; \ + x2 = c3x2; y2 = c3y2; \ + x3 = c4x0; y3 = c4y0; \ + x4 = c4x1; y4 = c4y1; \ + x5 = c4x2; y5 = c4y2; \ + } + +/* FlxProc() = OtherSubrs[0]; Main part of Flex */ +/* Calling sequence: 'idmin epX epY 3 0 callothersubr' */ +/* Computes Flex values, and renders the Flex path, */ +/* and returns (leaves) ending coordinates on stack */ +static void FlxProc(c1x2, c1y2, c3x0, c3y0, c3x1, c3y1, c3x2, c3y2, + c4x0, c4y0, c4x1, c4y1, c4x2, c4y2, epY, epX, idmin) + DOUBLE c1x2, c1y2; + DOUBLE c3x0, c3y0, c3x1, c3y1, c3x2, c3y2; + DOUBLE c4x0, c4y0, c4x1, c4y1, c4x2, c4y2; + DOUBLE epX, epY; + int idmin; +{ + DOUBLE dmin; + DOUBLE c1x0, c1y0, c1x1, c1y1; + DOUBLE c2x0, c2y0, c2x1, c2y1, c2x2, c2y2; + char yflag; + DOUBLE x0, y0, x1, y1, x2, y2, x3, y3, x4, y4, x5, y5; + DOUBLE cxx, cyx, cxy, cyy; /* Transformation matrix */ + int flipXY; + DOUBLE x, y; + DOUBLE erosion = 1; /* Device parameter */ + /* Erosion may have different value specified in 'internaldict' */ + DOUBLE shrink; + DOUBLE dX, dY; + char erode; + DOUBLE eShift; + DOUBLE cx, cy; + DOUBLE ex, ey; + + Destroy(path); + path = FlxOldPath; /* Restore previous path (stored in FlxProc1) */ + + if (ProcessHints) { + dmin = TYPE1_ABS(idmin) / 100.0; /* Minimum Flex height in pixels */ + + c2x2 = c4x2; c2y2 = c4y2; /* Point c2 = c4 */ + + yflag = FABS(c1y2 - c3y2) > FABS(c1x2 - c3x2); /* Flex horizontal? */ + + QuerySpace(CharSpace, &cxx, &cyx, &cxy, &cyy); /* Transformation matrix */ + + if (FABS(cxx) < 0.00001 || FABS(cyy) < 0.00001) + flipXY = -1; /* Char on side */ + else if (FABS(cyx) < 0.00001 || FABS(cxy) < 0.00001) + flipXY = 1; /* Char upright */ + else + flipXY = 0; /* Char at angle */ + + if (yflag) { /* Flex horizontal */ + if (flipXY == 0 || c3y2 == c4y2) { /* Char at angle or Flex height = 0 */ + PickCoords(FALSE); /* Pick original control points */ + } else { + shrink = FABS((c1y2 - c4y2) / (c3y2 - c4y2)); /* Slope */ + + c1x0 = c3x0; c1y0 = yshrink(c3y0); + c1x1 = c3x1; c1y1 = yshrink(c3y1); + c2x0 = c4x0; c2y0 = yshrink(c4y0); + c2x1 = c4x1; c2y1 = yshrink(c4y1); + + dtransform(0.0, ROUND(c3y2-c1y2), &x, &y); /* Flex height in pixels */ + dY = FABS((flipXY == 1) ? y : x); + PickCoords(dY < dmin); /* If Flex small, pick 'shrunk' control points */ + + if (FABS(y2 - c1y2) > 0.001) { /* Flex 'non-zero'? */ + transform(c1x2, c1y2, &x, &y); + + if (flipXY == 1) { + cx = x; cy = y; + } else { + cx = y; cy = x; + } + + dtransform(0.0, ROUND(y2-c1y2), &x, &y); + dY = (flipXY == 1) ? y : x; + if (ROUND(dY) != 0) + dY = ROUND(dY); + else + dY = (dY < 0) ? -1 : 1; + + erode = PaintType != 2 && erosion >= 0.5; + if (erode) + cy -= 0.5; + ey = cy + dY; + ey = CEIL(ey) - ey + FLOOR(ey); + if (erode) + ey += 0.5; + + if (flipXY == 1) { + itransform(cx, ey, &x, &y); + } else { + itransform(ey, cx, &x, &y); + } + + eShift = y - y2; + y1 += eShift; + y2 += eShift; + y3 += eShift; + } + } + } else { /* Flex vertical */ + if (flipXY == 0 || c3x2 == c4x2) { /* Char at angle or Flex height = 0 */ + PickCoords(FALSE); /* Pick original control points */ + } else { + shrink = FABS((c1x2 - c4x2) / (c3x2 - c4x2)); /* Slope */ + + c1x0 = xshrink(c3x0); c1y0 = c3y0; + c1x1 = xshrink(c3x1); c1y1 = c3y1; + c2x0 = xshrink(c4x0); c2y0 = c4y0; + c2x1 = xshrink(c4x1); c2y1 = c4y1; + + dtransform(ROUND(c3x2 - c1x2), 0.0, &x, &y); /* Flex height in pixels */ + dX = FABS((flipXY == -1) ? y : x); + PickCoords(dX < dmin); /* If Flex small, pick 'shrunk' control points */ + + if (FABS(x2 - c1x2) > 0.001) { + transform(c1x2, c1y2, &x, &y); + if (flipXY == -1) { + cx = y; cy = x; + } else { + cx = x; cy = y; + } + + dtransform(ROUND(x2-c1x2), 0.0, &x, &y); + dX = (flipXY == -1) ? y : x; + if (ROUND(dX) != 0) + dX = ROUND(dX); + else + dX = (dX < 0) ? -1 : 1; + + erode = PaintType != 2 && erosion >= 0.5; + if (erode) + cx -= 0.5; + ex = cx + dX; + ex = CEIL(ex) - ex + FLOOR(ex); + if (erode) + ex += 0.5; + + if (flipXY == -1) { + itransform(cy, ex, &x, &y); + } else { + itransform(ex, cy, &x, &y); + } + + eShift = x - x2; + x1 += eShift; + x2 += eShift; + x3 += eShift; + } + } + } + + if (x2 == x5 || y2 == y5) { + lineto(x5, y5); + } else { + curveto(x0, y0, x1, y1, x2, y2); + curveto(x3, y3, x4, y4, x5, y5); + } + } else { /* ProcessHints is off */ + PickCoords(FALSE); /* Pick original control points */ + curveto(x0, y0, x1, y1, x2, y2); + curveto(x3, y3, x4, y4, x5, y5); + } + + PSFakePush(epY); + PSFakePush(epX); +} + +/* FlxProc1() = OtherSubrs[1]; Part of Flex */ +/* Calling sequence: '0 1 callothersubr' */ +/* Saves and clears path, then restores currentpoint */ +static void FlxProc1() +{ + struct segment *CurrentPoint; + + CurrentPoint = Phantom(path); + + FlxOldPath = path; + path = CurrentPoint; +} + +/* FlxProc2() = OtherSubrs[2]; Part of Flex */ +/* Calling sequence: '0 2 callothersubr' */ +/* Returns currentpoint on stack */ +static void FlxProc2() +{ + struct segment *CurrentPoint; + DOUBLE CurrentX, CurrentY; + + CurrentPoint = Phantom(path); + QueryLoc(CurrentPoint, CharSpace, &CurrentX, &CurrentY); + Destroy(CurrentPoint); + + /* Push CurrentPoint on fake PostScript stack */ + PSFakePush(CurrentX); + PSFakePush(CurrentY); +} + +/* HintReplace() = OtherSubrs[3]; Hint Replacement */ +/* Calling sequence: 'subr# 1 3 callothersubr pop callsubr' */ +/* Reinitializes stem hint structure */ +static void HintReplace() +{ + /* Effectively retire the current stems, but keep them around for */ + /* revhint use in case we are in a stem when we replace hints. */ + currstartstem = numstems; + + /* 'subr#' is left on PostScript stack (for 'pop callsubr') */ +} + +/* arg1 ... argn n othersubr# CALLOTHERSUBR - */ +/* Make calls on the PostScript interpreter (or call equivalent C code) */ +/* NOTE: The n arguments have been pushed on the fake PostScript stack */ +static int CallOtherSubr(othersubrno) + int othersubrno; +{ + IfTrace1((FontDebug), "CallOtherSubr %d\n", othersubrno); + + switch(othersubrno) { + case 0: /* OtherSubrs[0]; Main part of Flex */ + if (PSFakeTop < 16) Error0i("CallOtherSubr: PSFakeStack low"); + ClearPSFakeStack(); + FlxProc( + PSFakeStack[0], PSFakeStack[1], PSFakeStack[2], PSFakeStack[3], + PSFakeStack[4], PSFakeStack[5], PSFakeStack[6], PSFakeStack[7], + PSFakeStack[8], PSFakeStack[9], PSFakeStack[10], PSFakeStack[11], + PSFakeStack[12], PSFakeStack[13], PSFakeStack[14], PSFakeStack[15], + (int) PSFakeStack[16] + ); + break; + case 1: /* OtherSubrs[1]; Part of Flex */ + FlxProc1(); + break; + case 2: /* OtherSubrs[2]; Part of Flex */ + FlxProc2(); + break; + case 3: /* OtherSubrs[3]; Hint Replacement */ + HintReplace(); + break; + case 12: /* OtherSubrs[12]: Counter Control Hinting */ + /* We do nothing, because later OtherSubrs[13] will + remove data from the PS-stack */ + break; + case 13: + /* We pop all elements from PSFakeStack. They may either have been left + from previous calls to OtherSubr #12 or have been pushed for this + call */ + ClearPSFakeStack(); + break; + default: { /* call OtherSubrs[4] or higher if PostScript is present */ + + } + } + return(0); +} + +/* |- x y SETCURRENTPOINT |- */ +/* Sets the current point to (x,y) in absolute */ +/* character space coordinates without per- */ +/* forming a CharString MOVETO command */ +static int SetCurrentPoint(x, y) + DOUBLE x, y; +{ + IfTrace2((FontDebug), "SetCurrentPoint %f %f\n", x, y); + + currx = x; + curry = y; + return(0); +} + +/* The Type1Char routine for use by PostScript. */ +/************************************************/ +struct xobject *Type1Char(psfont *env, struct XYspace *S, + psobj *charstrP, psobj *subrsP, + psobj *osubrsP, + struct blues_struct *bluesP, + int *modeP, char *charname) +{ + int Code; + + path = NULL; + errflag = FALSE; + + /* Make parameters available to all Type1 routines */ + currentchar=charname; + Environment = (char *)env; + CharSpace = S; /* used when creating path elements */ + CharStringP = charstrP; + SubrsP = subrsP; + OtherSubrsP = osubrsP; + ModeP = modeP; + + blues = bluesP; + + /* compute the alignment zones */ + SetRasterFlags(); + ComputeAlignmentZones(); + StartDecrypt(); + ClearStack(); + ClearPSFakeStack(); + ClearCallStack(); + InitStems(); + + currx = curry = 0; + escapementX = escapementY = 0; + sidebearingX = sidebearingY = 0; + accentoffsetX = accentoffsetY = 0; + wsoffsetX = wsoffsetY = 0; /* No shift to preserve whitspace. */ + wsset = 0; /* wsoffsetX,Y haven't been set yet. */ + + for (;;) { + if (!DoRead(&Code)) break; + Decode(Code); + if (errflag) break; + } + FinitStems(); + + /* Report a possible error: */ + *modeP=errflag; + + /* Clean up if an error has occurred */ + if (errflag) { + if (path != NULL) { + Destroy(path); /* Reclaim storage */ + path = NULL; /* Indicate that character could not be built */ + } + } + + return((struct xobject *) path); +} + + +/* We add a function to implement underlining in Type1-Routines. */ +struct xobject *Type1Line(psfont *env, struct XYspace *S, + float line_position, + float line_thickness, + float line_length) +{ + + path = NULL; + errflag = FALSE; + + /* Make parameters available to all Type1 routines */ + Environment = (char *)env; + CharSpace = S; /* used when creating path elements */ + + currx = curry = 0; + escapementX = escapementY = 0; + sidebearingX = sidebearingY = 0; + /* We have to initialize the stems-structures because + the lineto commands refer to them! */ + SetRasterFlags(); + InitStems(); + + /* Draw Character */ + Sbw(-1.0*line_length, 0.0, 0.0, 0.0); + RMoveTo( 0.0, (double) (line_position+0.5*line_thickness)); + RLineTo( 0.0, (double) -line_thickness); + RLineTo( (double) line_length, 0.0); + RLineTo( 0.0, (double) line_thickness); + DoClosePath(); + EndChar(); + + /* De-Initialize the stems (of course there have not been + defined any) */ + FinitStems(); + + return((struct xobject *)path); + +} + diff -Naur xdvik-22.40l/libs/type1/types.h xdvik-22.40n/libs/type1/types.h --- xdvik-22.40l/libs/type1/types.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/types.h Sat Sep 14 00:24:48 2002 @@ -0,0 +1,32 @@ +/* + * File: types.h + * Purpose: define basic types so that program is portable to non 32 bits + * platforms + * Version: 1.0 (Dec. 1993) + * Author: Piet Tutelaers + */ + +#ifndef __TYPES__ +#define __TYPES__ + +#if defined(WORD16) +typedef unsigned short USHORT; /* 16 bits */ +typedef short SHORT; /* 16 bits */ +typedef long LONG; /* 32 bits */ +typedef unsigned long ULONG; /* 32 bits */ +typedef double DOUBLE; /* 64 bits */ +#elif defined(WORD64) +typedef unsigned short USHORT; /* 16 bits */ +typedef short SHORT; /* 16 bits */ +typedef int LONG; /* 32 bits */ +typedef unsigned long ULONG; /* 32 bits */ +typedef double DOUBLE; /* 64 bits */ +#else /* default: WORD32 */ +typedef unsigned short USHORT; /* 16 bits */ +typedef short SHORT; /* 16 bits */ +typedef int LONG; /* 32 bits */ +typedef unsigned int ULONG; /* 32 bits */ +typedef double DOUBLE; /* 64 bits */ +#endif + +#endif /* __TYPES__ */ diff -Naur xdvik-22.40l/libs/type1/util.c xdvik-22.40n/libs/type1/util.c --- xdvik-22.40l/libs/type1/util.c Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/util.c Sat Sep 14 00:24:48 2002 @@ -0,0 +1,204 @@ +/* $XConsortium: util.c,v 1.6 92/03/26 16:42:26 eswu Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */ + +#include "types.h" +#include +#include +#include "util.h" +#include "fontmisc.h" + +static char *vm_base = NULL; /* Start of virtual memory area */ + char *vm_next = NULL; /* Pointer to first free byte */ + LONG vm_free = 0; /* Count of free bytes */ + LONG vm_size = 0; /* Total size of memory */ + +/* The following global variable is for detecting a trial to + allocate a second chunk---not to be done with the t1lib, since + a later reallocation would lead to segmentation faults! + */ +int vm_init_count; +/* This is the amount of VM, the font is tried to be loaded in. */ +int vm_init_amount; + + +/* + * Initialize memory. + */ + +extern char *tokenMaxP; /* Pointer to end of VM we may use + 1 */ + +boolean vm_init() +{ + /* Check whether it is the first piece of memory for the + current font or not. If so, simulate lacking memory to + indicate that the font should be tried to load with a + vitual memory twice as large! + */ + if (vm_init_count>0){ + vm_init_count++; + return(FALSE); + } + vm_init_count++; + + vm_next = vm_base = (char *) calloc( vm_init_amount, sizeof(char)); + + if (vm_base != NULL) { + vm_free = vm_init_amount; + vm_size = vm_init_amount; + tokenMaxP = vm_next_byte() + vm_init_amount; + return(TRUE); + } + else + return(FALSE); +} + +char *vm_alloc(bytes) + unsigned int bytes; +{ + char *answer; + + /* Align returned bytes to 64-bit boundary */ + bytes = (bytes + 7) & ~7; + + + /* take space from what is left otherwise allocate another CHUNK */ + if (bytes > vm_free){ + if (!vm_init()) return NULL; + } + else{ + answer = vm_next; + vm_free -= bytes; + vm_next += bytes; + return answer; + } + + /* Never reached, but compiler is happy: */ + return NULL; + +} + +/* + * Format an Integer object + */ +void objFormatInteger( psobj *objP, int value) +{ + if (objP != NULL) { + objP->type = OBJ_INTEGER; + objP->len = 0; + objP->data.integer = value; + } +} + +/* + * Format a Real object + */ +void objFormatReal(psobj *objP, float value) +{ + if (objP != NULL) { + objP->type = OBJ_REAL; + objP->len = 0; + objP->data.real = value; + } +} + +/* + * Format a Boolean object + */ +void objFormatBoolean(psobj *objP, boolean value) +{ + if (objP != NULL) { + objP->type = OBJ_BOOLEAN; + objP->len = 0; + objP->data.boolean = value; + } +} + +/* + * Format an Encoding object + */ +void objFormatEncoding(psobj *objP, int length, psobj *valueP) +{ + if (objP != NULL) { + objP->type = OBJ_ENCODING; + objP->len = length; + objP->data.arrayP = valueP; + } +} + +/* + * Format an Array object + */ +void objFormatArray(psobj *objP, int length, psobj *valueP) +{ + if (objP != NULL) { + objP->type = OBJ_ARRAY; + objP->len = length; + objP->data.arrayP = valueP; + } +} + + +/* + * Format a String object + */ +void objFormatString(psobj *objP, int length, char *valueP) +{ + if (objP != NULL) { + objP->type = OBJ_STRING; + objP->len = length; + objP->data.valueP = valueP; + } +} + +/* + * Format a Name object + */ +void objFormatName( psobj *objP, int length, char *valueP) +{ + if (objP != NULL) { + objP->type = OBJ_NAME; + objP->len = length; + objP->data.nameP = valueP; + } +} + +/* + * Format a File object + */ +void objFormatFile(psobj *objP, FILE *valueP) +{ + if (objP != NULL) { + objP->type = OBJ_FILE; + objP->len = 0; + objP->data.fileP = valueP; + } +} + diff -Naur xdvik-22.40l/libs/type1/util.h xdvik-22.40n/libs/type1/util.h --- xdvik-22.40l/libs/type1/util.h Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/libs/type1/util.h Sat Sep 14 00:24:48 2002 @@ -0,0 +1,182 @@ +/* $XConsortium: util.h,v 1.3 92/03/26 16:42:29 eswu Exp $ */ +/* Copyright International Business Machines,Corp. 1991 + * All Rights Reserved + * + * License to use, copy, modify, and distribute this software + * and its documentation for any purpose and without fee is + * hereby granted, provided that the above copyright notice + * appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, + * and that the name of IBM not be used in advertising or + * publicity pertaining to distribution of the software without + * specific, written prior permission. + * + * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES + * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT + * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND + * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT + * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF + * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES + * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN + * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING + * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +#ifndef UTIL_H +#define UTIL_H +#include "types.h" + +#ifndef boolean +typedef int boolean; +#endif + +#ifndef TRUE +#define TRUE (1) +#endif + +#ifndef FALSE +#define FALSE (0) +#endif + +/***================================================================***/ +/* Portable definitions for 2's complement machines. + * NOTE: These really should be based on PostScript types, + * for example, sizeof(ps_integer), or sizeof(ps_unsigned) + */ +#define MAX_ULONG (~(ULONG)(0)) +/* This code is portable, assuming K&R C and 2's complement arithmetic */ +#define MAX_INTEGER \ + ((LONG)((((ULONG) 1)<<(sizeof(ULONG)*8-1))-1)) +#define MIN_INTEGER ((-MAX_INTEGER)-1) + +#define MAX_ARRAY_CNT (65535) +#define MAX_DICT_CNT (65535) +#define MAX_STRING_LEN (65535) +#define MAX_NAME_LEN (128) + +/* this is the size of memory allocated for reading fonts */ + +#define VM_SIZE (50*1024) +/***================================================================***/ + +#ifndef TYPE1_MIN +#define TYPE1_MIN(a,b) (((a)<(b)) ? a : b ) +#endif + +/***================================================================***/ +/* Routines for managing virtual memory */ +/***================================================================***/ +extern boolean vm_init(); +extern LONG vm_free; +extern LONG vm_size; +extern char *vm_next; +extern char *vm_alloc(); +/***================================================================***/ +/* Macros for managing virtual memory */ +/***================================================================***/ +#define vm_next_byte() (vm_next) +#define vm_free_bytes() (vm_free) +#define vm_avail(B) (B <= vm_free) + + + +/***================================================================***/ +/* Types of PostScript objects */ +/***================================================================***/ +#define OBJ_INTEGER (0) +#define OBJ_REAL (1) +#define OBJ_BOOLEAN (2) +#define OBJ_ARRAY (3) +#define OBJ_STRING (4) +#define OBJ_NAME (5) +#define OBJ_FILE (6) +#define OBJ_ENCODING (7) + +/***================================================================***/ +/* Value of PostScript objects */ +/***================================================================***/ +typedef union ps_value { + char *valueP; /* value pointer for unspecified type */ + int value; /* value for unspecified type */ + int integer; /* when type is OBJ_INTEGER */ + float real; /* when type is OBJ_REAL */ + int boolean; /* when type is OBJ_BOOLEAN */ + struct ps_obj *arrayP; /* when type is OBJ_ARRAY */ + unsigned char *stringP; /* when type is OBJ_STRING */ + char *nameP; /* when type is OBJ_NAME */ + FILE *fileP; /* when type is OBJ_FILE */ +} psvalue; + +/***================================================================***/ +/* Definition of a PostScript object */ +/***================================================================***/ +typedef struct ps_obj { + char type; + char unused; + unsigned short len; + union ps_value data; +} psobj; + +/***================================================================***/ +/* Definition of a PostScript Dictionary Entry */ +/***================================================================***/ +typedef struct ps_dict { + psobj key; + psobj value; +} psdict; + +/***================================================================***/ +/* Macros for testing type of PostScript objects */ +/***================================================================***/ +#define objIsInteger(o) ((o).type == OBJ_INTEGER) +#define objIsReal(o) ((o).type == OBJ_REAL) +#define objIsBoolean(o) ((o).type == OBJ_BOOLEAN) +#define objIsArray(o) ((o).type == OBJ_ARRAY) +#define objIsString(o) ((o).type == OBJ_STRING) +#define objIsName(o) ((o).type == OBJ_NAME) +#define objIsFile(o) ((o).type == OBJ_FILE) + +/***================================================================***/ +/* Macros for setting type of PostScript objects */ +/***================================================================***/ +#define objSetInteger(o) ((o).type = OBJ_INTEGER) +#define objSetReal(o) ((o).type = OBJ_REAL) +#define objSetBoolean(o) ((o).type = OBJ_BOOLEAN) +#define objSetArray(o) ((o).type = OBJ_ARRAY) +#define objSetString(o) ((o).type = OBJ_STRING) +#define objSetName(o) ((o).type = OBJ_NAME) +#define objSetFile(o) ((o).type = OBJ_FILE) + +/***================================================================***/ +/* Macros for testing type of PostScript objects (pointer access) */ +/***================================================================***/ +#define objPIsInteger(o) ((o)->type == OBJ_INTEGER) +#define objPIsReal(o) ((o)->type == OBJ_REAL) +#define objPIsBoolean(o) ((o)->type == OBJ_BOOLEAN) +#define objPIsArray(o) ((o)->type == OBJ_ARRAY) +#define objPIsString(o) ((o)->type == OBJ_STRING) +#define objPIsName(o) ((o)->type == OBJ_NAME) +#define objPIsFile(o) ((o)->type == OBJ_FILE) + +/***================================================================***/ +/* Macros for setting type of PostScript objects (pointer access) */ +/***================================================================***/ +#define objPSetInteger(o) ((o)->type = OBJ_INTEGER) +#define objPSetReal(o) ((o)->type = OBJ_REAL) +#define objPSetBoolean(o) ((o)->type = OBJ_BOOLEAN) +#define objPSetArray(o) ((o)->type = OBJ_ARRAY) +#define objPSetString(o) ((o)->type = OBJ_STRING) +#define objPSetName(o) ((o)->type = OBJ_NAME) +#define objPSetFile(o) ((o)->type = OBJ_FILE) + +/***================================================================***/ +/* Entry point for Type1Char to get entry from CharStrings */ +/***================================================================***/ +extern psobj *GetType1CharString(); + +#endif diff -Naur xdvik-22.40l/tetex.ac xdvik-22.40n/tetex.ac --- xdvik-22.40l/tetex.ac Thu Jan 1 00:00:00 1970 +++ xdvik-22.40n/tetex.ac Fri Sep 13 00:23:45 2002 @@ -0,0 +1,41 @@ +: ${with_mkfmt_default=yes} +export with_mkfmt_default + +: ${with_cxx_runtime_hack=yes} +export with_cxx_runtime_hack + +: ${enable_multiplatform=yes} +if test "x$enable_multiplatform" = xyes \ + && test "x$bindir" = 'x${exec_prefix}/bin' +then + enable_multiplatform=yes; export enable_multiplatform + bindir="$bindir/$host"; +fi +test "${enable_nls+set}" = set || { enable_nls=no; export enable_nls; } + +AC_PREFIX_DEFAULT(/usr/local/teTeX) +if test "x$prefix" = xNONE; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix=$ac_default_prefix" +fi + +enable_ipc=yes +case "$target" in + *nextstep3*|*NEXTSTEP*) + with_xdvik=no; with_oxdvik=no + with_nextwin=yes; with_ps=dps; with_mfw=no + export with_xdvik with_oxdvik enable_ipc with_nextwin with_ps;; +esac + +: ${with_mfw=yes} +: ${with_x=yes} +export with_mfw with_x + +# for libwww, does not compile otherwise +: ${with_expat=no} +: ${with_wais=no} +: ${with_socks5=no} +: ${with_socks4=no} +: ${with_ssl=no} +: ${with_regex=no} +export with_expat with_wais with_socks5 with_socks4 with_ssl with_regex diff -Naur xdvik-22.40l/texk/CVS/Entries xdvik-22.40n/texk/CVS/Entries --- xdvik-22.40l/texk/CVS/Entries Sat Aug 31 22:51:24 2002 +++ xdvik-22.40n/texk/CVS/Entries Mon Sep 16 17:45:07 2002 @@ -16,7 +16,7 @@ /testfont.log/1.1.1.1/Wed Apr 18 14:24:17 2001//Txdvik_22_40_STABLE /testfont.ps/1.1.1.1/Wed Apr 18 14:24:18 2001//Txdvik_22_40_STABLE /unbackslsh.awk/1.1.1.1/Wed Apr 18 14:24:18 2001//Txdvik_22_40_STABLE -/withenable.ac/1.1.1.1/Wed Apr 18 14:24:18 2001//Txdvik_22_40_STABLE +/withenable.ac/1.1.1.1.8.1/Sun Sep 15 15:14:13 2002//Txdvik_22_40_STABLE D/contrib//// D/etc//// D/kpathsea//// diff -Naur xdvik-22.40l/texk/make/CVS/Entries xdvik-22.40n/texk/make/CVS/Entries --- xdvik-22.40l/texk/make/CVS/Entries Sat Aug 31 22:51:12 2002 +++ xdvik-22.40n/texk/make/CVS/Entries Mon Sep 16 17:45:03 2002 @@ -1,15 +1,15 @@ /ChangeLog/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE /README/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE /clean.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE -/common.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE -/config.mk/1.2/Sun May 20 22:19:03 2001//Txdvik_22_40_STABLE -/dist.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE -/library.mk/1.2/Thu Jun 21 13:13:45 2001//Txdvik_22_40_STABLE +/common.mk/1.1.1.1.8.1/Mon Sep 16 10:10:50 2002//Txdvik_22_40_STABLE +/config.mk/1.2.8.1/Mon Sep 16 10:10:50 2002//Txdvik_22_40_STABLE +/dist.mk/1.1.1.1.8.1/Mon Sep 16 10:10:50 2002//Txdvik_22_40_STABLE +/library.mk/1.2.6.2/Mon Sep 16 17:45:29 2002//Txdvik_22_40_STABLE /makevars.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE /man.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE /paths.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE /programs.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE -/rdepend.mk/1.3/Mon May 21 14:15:57 2001//Txdvik_22_40_STABLE -/texi.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE +/rdepend.mk/1.3.8.1/Mon Sep 16 10:10:50 2002//Txdvik_22_40_STABLE +/texi.mk/1.1.1.1.8.1/Mon Sep 16 10:10:50 2002//Txdvik_22_40_STABLE /tkpathsea.mk/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE D diff -Naur xdvik-22.40l/texk/make/common.mk xdvik-22.40n/texk/make/common.mk --- xdvik-22.40l/texk/make/common.mk Wed Apr 18 14:24:38 2001 +++ xdvik-22.40n/texk/make/common.mk Mon Sep 16 10:10:50 2002 @@ -16,8 +16,8 @@ # You can change [X]CPPFLAGS, [X]CFLAGS, or [X]DEFS, but # please don't change ALL_CPPFLAGS or ALL_CFLAGS. # prog_cflags is set by subdirectories of web2c. -ALL_CPPFLAGS = $(DEFS) -I. -I$(srcdir) $(prog_cflags) \ - -I$(kpathsea_parent) -I$(kpathsea_srcdir_parent) $(CPPFLAGS) +ALL_CPPFLAGS = $(DEFS) -I. -I$(srcdir) -I$(kpathsea_parent) \ + -I$(kpathsea_srcdir_parent) $(prog_cflags) $(CPPFLAGS) ALL_CFLAGS = $(ALL_CPPFLAGS) $(CFLAGS) -c compile = $(CC) $(ALL_CFLAGS) diff -Naur xdvik-22.40l/texk/make/config.mk xdvik-22.40n/texk/make/config.mk --- xdvik-22.40l/texk/make/config.mk Sun May 20 22:19:03 2001 +++ xdvik-22.40n/texk/make/config.mk Mon Sep 16 10:10:50 2002 @@ -24,10 +24,17 @@ @MAINT@enablemaintflag = --enable-maintainer-mode config.status: $(srcdir)/configure - $(SHELL) $(srcdir)/configure --no-create $(enablemaintflag) + $(SHELL) $@ --recheck -Makefile: $(srcdir)/Makefile.in config.status $(top_srcdir)/../make/*.mk - $(SHELL) config.status +Makefile: config.status $(srcdir)/Makefile.in $(top_srcdir)/../make/*.mk + $(SHELL) $< + +@MAINT@# autoheader reads acconfig.h (and c-auto.h.top) automatically. +@MAINT@$(srcdir)/c-auto.in: $(srcdir)/stamp-auto.in +@MAINT@$(srcdir)/stamp-auto.in: $(configure_in) $(autoheader) \ +@MAINT@ $(kpathsea_srcdir)/acconfig.h +@MAINT@ cd $(srcdir) && autoheader -m $(ac_dir) -l $(srcdir) +@MAINT@ date >$(srcdir)/stamp-auto.in # This rule isn't used for the top-level Makefile, but it doesn't hurt. # We don't depend on config.status because configure always rewrites @@ -37,12 +44,5 @@ stamp-auto: $(srcdir)/c-auto.in $(SHELL) config.status date >stamp-auto - -@MAINT@# autoheader reads acconfig.h (and c-auto.h.top) automatically. -@MAINT@$(srcdir)/c-auto.in: $(srcdir)/stamp-auto.in -@MAINT@$(srcdir)/stamp-auto.in: $(configure_in) $(autoheader) \ -@MAINT@ $(kpathsea_srcdir)/acconfig.h -@MAINT@ -cd $(srcdir) && autoheader -m $(ac_dir) -l $(kpathsea_srcdir) -@MAINT@ date >$(srcdir)/stamp-auto.in # End of config.mk. diff -Naur xdvik-22.40l/texk/make/dist.mk xdvik-22.40n/texk/make/dist.mk --- xdvik-22.40l/texk/make/dist.mk Wed Apr 18 14:24:38 2001 +++ xdvik-22.40n/texk/make/dist.mk Mon Sep 16 10:10:50 2002 @@ -1,10 +1,14 @@ # dist.mk -- making distribution tar files. @MAINT@top_distdir = $(distname)-$(version) -@MAINT@top_files = ChangeLog Makefile.in README configure.in configure \ +@MAINT@top_files = Makefile.in configure.in configure selfautofix +@MAINT@libs_distdir = $(top_distdir)/libs +@MAINT@libs_files = EXTRA.LIB configure.in configure +@MAINT@texk_distdir = $(top_distdir)/texk +@MAINT@texk_files = ChangeLog Makefile.in README configure.in configure \ @MAINT@ install.sh acklibtool.m4 config.guess config.sub klibtool \ @MAINT@ mkinstalldirs add-info-toc rename unbackslsh.awk withenable.ac -@MAINT@distdir = $(top_distdir)/$(distname) -@MAINT@kpathsea_distdir = ../$(distname)/$(top_distdir)/kpathsea +@MAINT@distdir = $(texk_distdir)/$(distname) +@MAINT@kpathsea_distdir = ../$(distname)/$(texk_distdir)/kpathsea @MAINT@ln_files = AUTHORS ChangeLog INSTALL NEWS README *.in *.h *.c \ @MAINT@ configure *.mk @MAINT@ @@ -12,26 +16,34 @@ @MAINT@dist: all depend pre-dist-$(distname) @MAINT@ rm -rf $(top_distdir)* @MAINT@ mkdir -p $(distdir) +@MAINT@ top_files="$(top_files)"; \ +@MAINT@ for f in $$top_files; do \ +@MAINT@ ln $(top_srcdir)/../../$$f $(top_distdir); done +@MAINT@ cp -pr $(top_srcdir)/../../config $(top_distdir) +@MAINT@ mkdir -p $(libs_distdir) +@MAINT@ libs_files="$(libs_files)"; \ +@MAINT@ for f in $$libs_files; do \ +@MAINT@ ln $(top_srcdir)/../../libs/$$f $(libs_distdir); done @MAINT@ cd .. && make Makefile ./configure -@MAINT@ cd .. && ln $(top_files) $(distname)/$(top_distdir) -@MAINT@ cp -p $(top_srcdir)/../dir $(top_distdir) +@MAINT@ cd .. && ln $(texk_files) $(distname)/$(texk_distdir) +@MAINT@ cp -p $(top_srcdir)/../dir $(texk_distdir) @MAINT@ -ln $(ln_files) $(distdir) @MAINT@ ln $(program_files) $(distdir) @MAINT@ cd $(kpathsea_dir); $(MAKE) distdir=$(kpathsea_distdir) \ @MAINT@ ln_files='$(ln_files)' distdir -@MAINT@ cp -pr ../make ../etc ../djgpp $(top_distdir) -@MAINT@ rm -rf $(top_distdir)/make/CVS -@MAINT@ rm -rf $(top_distdir)/etc/CVS -@MAINT@ rm -rf $(top_distdir)/etc/autoconf/CVS -@MAINT@ rm -rf $(top_distdir)/djgpp/CVS +@MAINT@ cp -pr ../make ../etc ../djgpp $(texk_distdir) +@MAINT@ rm -rf $(texk_distdir)/make/CVS +@MAINT@ rm -rf $(texk_distdir)/etc/CVS +@MAINT@ rm -rf $(texk_distdir)/etc/autoconf/CVS +@MAINT@ rm -rf $(texk_distdir)/djgpp/CVS @MAINT@# Remove the extra files our patterns got us. -@MAINT@ cd $(top_distdir); rm -f */c-auto.h +@MAINT@ cd $(texk_distdir); rm -f */c-auto.h @MAINT@ find $(top_distdir) \( $(dist_rm_predicate) \) -exec rm '{}' \; @MAINT@ find $(top_distdir) -name \.*texi -exec egrep -ni ' | ::|xx[^}]' \; @MAINT@# Now handle the contrib dir. -@MAINT@ mkdir -p $(top_distdir)/contrib && \ +@MAINT@ mkdir -p $(texk_distdir)/contrib && \ @MAINT@ cp -p ../contrib/{ChangeLog,INSTALL,Makefile,README,*.c,*.h} \ -@MAINT@ $(top_distdir)/contrib +@MAINT@ $(texk_distdir)/contrib @MAINT@ $(MAKE) post-dist-$(distname) @MAINT@ cd $(distdir); test ! -r *.info || touch *.info* @MAINT@ chmod -R a+rX,u+w $(top_distdir) diff -Naur xdvik-22.40l/texk/make/library.mk xdvik-22.40n/texk/make/library.mk --- xdvik-22.40l/texk/make/library.mk Thu Jun 21 13:13:45 2001 +++ xdvik-22.40n/texk/make/library.mk Mon Sep 16 17:45:29 2002 @@ -1,5 +1,5 @@ # library.mk -- stuff only useful for libraries. -AR = ar -ARFLAGS = cr +AR = @AR@ +ARFLAGS = @AR_OPTS@ RANLIB = @RANLIB@ # End of library.mk. diff -Naur xdvik-22.40l/texk/make/rdepend.mk xdvik-22.40n/texk/make/rdepend.mk --- xdvik-22.40l/texk/make/rdepend.mk Mon May 21 14:15:57 2001 +++ xdvik-22.40n/texk/make/rdepend.mk Mon Sep 16 10:10:50 2002 @@ -15,6 +15,8 @@ | sed -e 's,\(\.\./\)\+kpathsea/,$$(kpathsea_srcdir)/,g' \ -e 's,$$(kpathsea_srcdir)/c-auto.h,$$(kpathsea_dir)/c-auto.h,g' \ -e 's,$$(kpathsea_srcdir)/paths.h,$$(kpathsea_dir)/paths.h,g' \ + -e 's, /[^ ]*,,g' \ + -e 's, [^ ]*/\.\./libs/[^ ]*,,g' \ -e 's,dvi2xx.o,dvilj.o dvilj2p.o dvilj4.o dvilj4l.o,' \ -e 's,lex.yy,$$(LEX_OUTPUT_ROOT),g' \ | $(top_srcdir)/../unbackslsh.awk \ diff -Naur xdvik-22.40l/texk/make/texi.mk xdvik-22.40n/texk/make/texi.mk --- xdvik-22.40l/texk/make/texi.mk Wed Apr 18 14:24:38 2001 +++ xdvik-22.40n/texk/make/texi.mk Mon Sep 16 10:10:50 2002 @@ -1,25 +1,25 @@ # texi.mk -- making .dvi and .info from .texi. -MAKEINFO = makeinfo -MAKEINFO_FLAGS = --paragraph-indent=2 -I$(srcdir) +@MAINT@MAKEINFO = makeinfo +@MAINT@MAKEINFO_FLAGS = --paragraph-indent=2 -I$(srcdir) -TEXI2DVI = texi2dvi +@MAINT@TEXI2DVI = texi2dvi @MAINT@# To make sure that generation of the dvi files succeeds on the @MAINT@# maintainer's system. @MAINT@TEXI2DVI = TEXMFCNF=$(web2cdir) texi2dvi -TEXI2HTML = texi2html -TEXI2HTML_FLAGS = -expandinfo -number -menu -split_chapter +@MAINT@TEXI2HTML = texi2html +@MAINT@TEXI2HTML_FLAGS = -expandinfo -number -menu -split_chapter # If you prefer one big .html file instead of several, remove # -split-node or replace it by -split_chapter. # For making normal text files out of Texinfo source. -one_info = --no-headers --no-split --no-validate +@MAINT@one_info = --no-headers --no-split --no-validate -.SUFFIXES: .info .dvi .html .texi -.texi.info: - $(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@ -.texi.dvi: - $(TEXI2DVI) $(TEXI2DVI_FLAGS) $< -.texi.html: - $(TEXI2HTML) $(TEXI2HTML_FLAGS) $< +@MAINT@.SUFFIXES: .info .dvi .html .texi +@MAINT@.texi.info: +@MAINT@ $(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@ +@MAINT@.texi.dvi: +@MAINT@ $(TEXI2DVI) $(TEXI2DVI_FLAGS) $< +@MAINT@.texi.html: +@MAINT@ $(TEXI2HTML) $(TEXI2HTML_FLAGS) $< # End of texi.mk. diff -Naur xdvik-22.40l/texk/withenable.ac xdvik-22.40n/texk/withenable.ac --- xdvik-22.40l/texk/withenable.ac Wed Apr 18 14:24:18 2001 +++ xdvik-22.40n/texk/withenable.ac Sun Sep 15 15:14:13 2002 @@ -1,36 +1,38 @@ dnl withenable.ac: --with and --enable options. -AC_ARG_WITH(dtl, - [ --without-dtl do not build the dtl package]) -AC_ARG_WITH(dvidvi, - [ --without-dvidvi do not build the dvidvi package]) -AC_ARG_WITH(dviljk, - [ --without-dviljk do not build the dviljk package]) -AC_ARG_WITH(dvipdfm, - [ --without-dvipdfm do not build the dvipdfm package]) -AC_ARG_WITH(dvipsk, - [ --without-dvipsk do not build the dvipsk package]) -AC_ARG_WITH(gsftopk, - [ --without-gsftopk do not build the gsftopk package]) -AC_ARG_WITH(lacheck, - [ --without-lacheck do not build the lacheck package]) -AC_ARG_WITH(makeindexk, - [ --without-makeindexk do not build the makeindexk package]) -AC_ARG_WITH(musixflx, - [ --without-musixflx do not build the musixflx package]) -AC_ARG_WITH(odvipsk, - [ --without-odvipsk do not build the odvipsk package]) -AC_ARG_WITH(oxdvik, - [ --without-oxdvik do not build the oxdvik package]) -AC_ARG_WITH(ps2pkm, - [ --without-ps2pkm do not build the ps2pkm package]) -AC_ARG_WITH(seetexk, - [ --without-seetexk do not build the seetexk package]) -AC_ARG_WITH(tetex, - [ --without-tetex do not build the tetex package]) -AC_ARG_WITH(tex4htk, - [ --without-tex4htk do not build the tex4htk package]) -AC_ARG_WITH(tth, - [ --without-tth do not build the tth package]) -AC_ARG_WITH(xdvik, - [ --without-xdvik do not build the xdvik package]) +dnl All these are only applicable for teTeX, not for the xdvik module. + +dnl AC_ARG_WITH(dtl, +dnl [ --without-dtl do not build the dtl package]) +dnl AC_ARG_WITH(dvidvi, +dnl [ --without-dvidvi do not build the dvidvi package]) +dnl AC_ARG_WITH(dviljk, +dnl [ --without-dviljk do not build the dviljk package]) +dnl AC_ARG_WITH(dvipdfm, +dnl [ --without-dvipdfm do not build the dvipdfm package]) +dnl AC_ARG_WITH(dvipsk, +dnl [ --without-dvipsk do not build the dvipsk package]) +dnl AC_ARG_WITH(gsftopk, +dnl [ --without-gsftopk do not build the gsftopk package]) +dnl AC_ARG_WITH(lacheck, +dnl [ --without-lacheck do not build the lacheck package]) +dnl AC_ARG_WITH(makeindexk, +dnl [ --without-makeindexk do not build the makeindexk package]) +dnl AC_ARG_WITH(musixflx, +dnl [ --without-musixflx do not build the musixflx package]) +dnl AC_ARG_WITH(odvipsk, +dnl [ --without-odvipsk do not build the odvipsk package]) +dnl AC_ARG_WITH(oxdvik, +dnl [ --without-oxdvik do not build the oxdvik package]) +dnl AC_ARG_WITH(ps2pkm, +dnl [ --without-ps2pkm do not build the ps2pkm package]) +dnl AC_ARG_WITH(seetexk, +dnl [ --without-seetexk do not build the seetexk package]) +dnl AC_ARG_WITH(tetex, +dnl [ --without-tetex do not build the tetex package]) +dnl AC_ARG_WITH(tex4htk, +dnl [ --without-tex4htk do not build the tex4htk package]) +dnl AC_ARG_WITH(tth, +dnl [ --without-tth do not build the tth package]) +dnl AC_ARG_WITH(xdvik, +dnl [ --without-xdvik do not build the xdvik package]) diff -Naur xdvik-22.40l/texk/xdvik/CVS/Entries xdvik-22.40n/texk/xdvik/CVS/Entries --- xdvik-22.40l/texk/xdvik/CVS/Entries Sat Aug 31 23:06:37 2002 +++ xdvik-22.40n/texk/xdvik/CVS/Entries Mon Sep 16 17:45:07 2002 @@ -3,7 +3,7 @@ /BUGS/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE /FAQ/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE /MAKE-VMS.COM/1.1.1.1/Wed Apr 18 14:24:38 2001//Txdvik_22_40_STABLE -/Makefile.in/1.8.4.3/Mon Mar 4 20:03:40 2002//Txdvik_22_40_STABLE +/Makefile.in/1.8.4.5/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE /README.VMS/1.1.1.1/Wed Apr 18 14:24:39 2001//Txdvik_22_40_STABLE /README.src-specials/1.1.6.2/Thu Aug 1 23:40:08 2002//Txdvik_22_40_STABLE /README.t1fonts/1.2.4.5/Wed Aug 14 22:27:35 2002//Txdvik_22_40_STABLE @@ -16,15 +16,15 @@ /app-defaults-xdvik/1.1.1.1.6.2/Fri Aug 30 23:49:40 2002//Txdvik_22_40_STABLE /c-auto.in/1.6.4.4/Wed Apr 10 01:14:48 2002//Txdvik_22_40_STABLE /c-openmx.h/1.2/Mon May 21 14:19:25 2001//Txdvik_22_40_STABLE -/configure/1.6.4.8/Sun Aug 25 23:40:35 2002//Txdvik_22_40_STABLE -/configure.in/1.7.4.5/Wed Apr 10 01:14:49 2002//Txdvik_22_40_STABLE -/depend.mk/1.6.4.2/Mon Mar 4 20:03:41 2002//Txdvik_22_40_STABLE -/dvi-draw.c/1.33.4.26/Sat Aug 31 16:43:23 2002//Txdvik_22_40_STABLE +/configure/1.6.4.9/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/configure.in/1.7.4.6/Sat Sep 14 00:24:48 2002//Txdvik_22_40_STABLE +/depend.mk/1.6.4.4/Mon Sep 16 10:10:50 2002//Txdvik_22_40_STABLE +/dvi-draw.c/1.33.4.28/Sat Sep 14 23:18:43 2002//Txdvik_22_40_STABLE /dvi-init.c/1.22.4.10/Tue Aug 27 17:56:52 2002//Txdvik_22_40_STABLE /dvi.h/1.1.1.1/Wed Apr 18 14:24:42 2001//Txdvik_22_40_STABLE -/dvips.c/1.3.6.1/Sun Aug 25 23:40:36 2002//Txdvik_22_40_STABLE -/events.c/1.10.4.18/Thu Aug 29 22:51:20 2002//Txdvik_22_40_STABLE -/font-open.c/1.3.6.1/Mon Jan 7 13:52:15 2002//Txdvik_22_40_STABLE +/dvips.c/1.3.6.2/Sat Sep 14 23:18:43 2002//Txdvik_22_40_STABLE +/events.c/1.10.4.20/Sat Sep 14 23:18:43 2002//Txdvik_22_40_STABLE +/font-open.c/1.3.6.2/Sat Sep 14 23:18:44 2002//Txdvik_22_40_STABLE /gf.c/1.1.1.1/Wed Apr 18 14:24:43 2001//Txdvik_22_40_STABLE /gs/1.1.1.1/Wed Apr 18 14:24:43 2001//Txdvik_22_40_STABLE /help-window.c/1.10.4.3/Sat Aug 24 16:09:55 2002//Txdvik_22_40_STABLE @@ -46,7 +46,7 @@ /sfPath.c/1.2/Mon May 21 14:19:25 2001//Txdvik_22_40_STABLE /sfSelFile.c/1.2.6.1/Wed Apr 10 01:14:49 2002//Txdvik_22_40_STABLE /sfinternal.h/1.1.1.1/Wed Apr 18 14:24:45 2001//Txdvik_22_40_STABLE -/special.c/1.5.4.7/Sat Aug 31 16:43:23 2002//Txdvik_22_40_STABLE +/special.c/1.5.4.8/Sat Sep 14 23:18:44 2002//Txdvik_22_40_STABLE /squeeze.c/1.2/Mon May 21 14:19:25 2001//Txdvik_22_40_STABLE /stamp-auto.in/1.2/Sun May 20 22:19:03 2001//Txdvik_22_40_STABLE /startxdvi/1.1.6.2/Tue Aug 6 23:47:53 2002//Txdvik_22_40_STABLE @@ -56,17 +56,17 @@ /string-utils.h/1.2/Sat Jun 30 17:00:46 2001//Txdvik_22_40_STABLE /t1mapper/1.1.1.1.6.1/Wed Aug 14 22:50:17 2002//Txdvik_22_40_STABLE /t1mapper.1/1.1.2.3/Mon Mar 4 17:35:11 2002//Txdvik_22_40_STABLE -/tfmload.c/1.5/Mon Jun 4 23:07:34 2001//Txdvik_22_40_STABLE -/util.c/1.12.4.10/Sat Aug 31 16:43:23 2002//Txdvik_22_40_STABLE -/version.h/1.7.4.12/Sat Aug 31 17:14:20 2002//Txdvik_22_40_STABLE +/tfmload.c/1.5.4.1/Sat Sep 14 23:18:44 2002//Txdvik_22_40_STABLE +/util.c/1.12.4.11/Sat Sep 14 23:18:44 2002//Txdvik_22_40_STABLE +/version.h/1.7.4.17/Mon Sep 16 17:08:18 2002//Txdvik_22_40_STABLE /vf.c/1.1.1.1/Wed Apr 18 14:24:47 2001//Txdvik_22_40_STABLE /withenable.ac/1.4.4.3/Sat Aug 24 16:10:05 2002//Txdvik_22_40_STABLE -/wwwfetch.c/1.9.4.5/Sat Aug 31 16:43:23 2002//Txdvik_22_40_STABLE +/wwwfetch.c/1.9.4.7/Fri Sep 13 00:59:29 2002//Txdvik_22_40_STABLE /xdvi-config.h/1.3/Mon May 21 14:19:25 2001//Txdvik_22_40_STABLE -/xdvi-search.el/1.2.4.3/Tue Aug 6 23:47:53 2002//Txdvik_22_40_STABLE +/xdvi-search.el/1.2.4.4/Thu Sep 12 22:04:29 2002//Txdvik_22_40_STABLE /xdvi-sh/1.1.1.1.6.2/Mon Mar 4 20:03:41 2002//Txdvik_22_40_STABLE -/xdvi.c/1.19.4.20/Sat Aug 31 16:43:23 2002//Txdvik_22_40_STABLE -/xdvi.h/1.16.4.18/Sat Aug 31 16:43:23 2002//Txdvik_22_40_STABLE +/xdvi.c/1.19.4.21/Sat Sep 14 23:18:44 2002//Txdvik_22_40_STABLE +/xdvi.h/1.16.4.19/Sat Sep 14 23:18:44 2002//Txdvik_22_40_STABLE /xdvi.icon/1.1.1.1/Wed Apr 18 14:24:48 2001//Txdvik_22_40_STABLE /xdvi.man/1.5.4.21/Sat Aug 31 17:11:40 2002//Txdvik_22_40_STABLE D/texmf//// diff -Naur xdvik-22.40l/texk/xdvik/Makefile.in xdvik-22.40n/texk/xdvik/Makefile.in --- xdvik-22.40l/texk/xdvik/Makefile.in Mon Mar 4 20:03:40 2002 +++ xdvik-22.40n/texk/xdvik/Makefile.in Sat Sep 14 00:24:48 2002 @@ -18,7 +18,7 @@ x_ext_lib = @x_ext_lib@ # Follow the library order used in X11R6 itself: # -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 (some may not be present). -x_link = $(LDLIBWWW) $(LDT1LIB) $(x_ldflags) $(x_tool_libs) $(x_pre_libs) $(x_ext_lib) -lX11 $(x_extra_libs) +x_link = $(LDLIBWWW) $(LDLIBT1) $(x_ldflags) $(x_tool_libs) $(x_pre_libs) $(x_ext_lib) -lX11 $(x_extra_libs) LDLIBWWW=@LDLIBWWW@ LIBWWWCPPFLAGS=@LIBWWWCPPFLAGS@ @@ -26,12 +26,17 @@ LIBWWWDIR = ../../libs/libwww LIBWWWSRCDIR = $(srcdir)/../../libs/libwww -LDT1LIB=@LDT1LIB@ +LDLIBT1=@LDLIBT1@ +LIBT1CPPFLAGS=@LIBT1CPPFLAGS@ +LIBT1DEP=@LIBT1DEP@ +LIBT1DIR = ../../libs/t1lib +LIBTYPE1DIR = $(LIBT1DIR)/../type1 +LIBT1SRCDIR = $(srcdir)/$(LIBT1DIR) # Extra xdvi-specific compiler options. ## ps_def = @PS_DEF@ -DSRC ps_def = @PS_DEF@ -prog_cflags = $(LIBWWWCPPFLAGS) $(ps_def) -I../../libs/t1lib/lib/t1lib -I../kpathsea $(x_cppflags) +prog_cflags = $(LIBWWWCPPFLAGS) $(LIBT1CPPFLAGS) $(ps_def) -I../../libs/t1lib/lib/t1lib -I../kpathsea $(x_cppflags) # We don't use alloca ourselves, but the X library might, and this way # we avoid buggy versions in -lPW or -lucb. @@ -48,7 +53,7 @@ default all: $(program) $(perlprog) xdvi.1 t1mapper.1 -$(program): $(kpathsea) $(objects) $(LDLIBWWW) $(LDT1LIB) +$(program): $(kpathsea) $(objects) $(LIBWWWDEP) $(LIBT1DEP) $(kpathsea_link) $(objects) $(x_link) $(LOADLIBES) ## $(client): xdvi-client.o my-vsnprintf.o @@ -74,7 +79,7 @@ echo "/* alternative definitions if string concatenation is not available */" > krheader.h echo "#ifndef HAVE_CC_CONCAT" >> krheader.h for file in $(CC_CONCAT_FILES) ; do \ - $(CPP) $(prog_cflags) -DMAKING_HEADER $(srcdir)/$$file \ + $(CPP) $(ALL_CPPFLAGS) -DMAKING_HEADER $(srcdir)/$$file \ | sed -e '2,/XDVI_CC_CONCAT_BEGIN1/d' -e '/XDVI_CC_CONCAT_END1/,$$d' -e '/^ *$$/d' -e '/^#/d' \ | sed -e '2,$$s/^[ ]*"//' -e 's/"[ ]*$$/\\/' \ >> krheader.h; done @@ -95,16 +100,19 @@ install-exec: $(program) $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) - for p in $(program) $(perlprog); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done + for p in $(program); do $(INSTALL_LIBTOOL_PROG) $(bindir) $$p; done + $(INSTALL_SCRIPT) $(srcdir)/$(perlprog) $(scriptdir)/$(perlprog) $(INSTALL_SCRIPT) $(srcdir)/xdvi-sh $(scriptdir)/xdvi uninstall-exec: - for p in $(program) xdvi; do rm -f $(bindir)/$$p; done + for p in $(program) $(perlprog) xdvi; do rm -f $(bindir)/$$p; done ### //FIXME: add installation for encoding.map here!! (same place where psfonts.map is?) install-data: xdvi.1 t1mapper.1 - $(SHELL) $(top_srcdir)/../mkinstalldirs $(mandir) $(INSTALL_DATA) xdvi.1 $(mandir)/xdvi.$(manext) - $(INSTALL_DATA) t1mapper.1 $(mandir)/t1mapper.$(manext) + $(INSTALL_DATA) $(srcdir)/t1mapper.1 $(mandir)/t1mapper.$(manext) + # $(SHELL) $(top_srcdir)/../mkinstalldirs $(mandir) $(texmf)/xdvi + # $(INSTALL_DATA) $(srcdir)/texmf/xdvi.cfg $(texmf)/xdvi + # $(INSTALL_DATA) $(srcdir)/texmf/ps2pk.map $(texmf)/xdvi uninstall-data: rm -f $(mandir)/xdvi.$(manext) @@ -129,8 +137,26 @@ clean:: rm -f *.flc +clean:: + test -f $(LIBWWWDIR)/Makefile && { cd $(LIBWWWDIR); $(MAKE) clean; } || true + test -f $(LIBTYPE1DIR)/Makefile && { cd $(LIBTYPE1DIR); $(MAKE) clean; } || true + test -f $(LIBT1DIR)/Makefile && { cd $(LIBT1DIR); $(MAKE) clean; } || true + distclean:: rm -f psheader.c krheader.h sedscript xdvi.1 *.flc *~ + test -f $(LIBWWWDIR)/Makefile && { cd $(LIBWWWDIR); $(MAKE) distclean; } || true + test -f $(LIBTYPE1DIR)/Makefile && { cd $(LIBTYPE1DIR); $(MAKE) distclean; } || true + test -f $(LIBT1DIR)/Makefile && { cd $(LIBT1DIR); $(MAKE) distclean; } || true + +$(LIBWWWDIR)/libwww.a: + cd $(LIBWWWDIR); $(MAKE) $(makeargs) libwww.a + +$(LIBT1DIR)/libt1.a: + cd $(LIBT1DIR); $(MAKE) $(makeargs) libt1.a + +$(LIBTYPE1DIR)/libtype1.a: + cd $(LIBTYPE1DIR); $(MAKE) $(makeargs) libtype1.a + ac_include ../make/rdepend.mk ac_include depend.mk diff -Naur xdvik-22.40l/texk/xdvik/configure xdvik-22.40n/texk/xdvik/configure --- xdvik-22.40l/texk/xdvik/configure Sun Aug 25 23:40:35 2002 +++ xdvik-22.40n/texk/xdvik/configure Sat Sep 14 00:24:48 2002 @@ -55,6 +55,17 @@ ac_help="$ac_help --with-libwww-include=DIR Specify the libwww header files location." +ac_help="$ac_help + --with-libwww-config=PROG + Use PROG as libwww-config program." +ac_help="$ac_help + --with-system-t1lib use installed t1 library" +ac_help="$ac_help + --with-t1lib-libdir=DIR + Specify directory where the t1 library (libt1.a) resides." +ac_help="$ac_help + --with-t1lib-include=DIR + Specify the t1lib header files location." # Initialize some variables set by options. # The variables have the same names as the options, with @@ -570,7 +581,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:574: checking for $ac_word" >&5 +echo "configure:585: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -601,7 +612,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:605: checking for $ac_word" >&5 +echo "configure:616: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -653,7 +664,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:657: checking for $ac_word" >&5 +echo "configure:668: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -686,7 +697,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:690: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:701: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -697,12 +708,12 @@ cat > conftest.$ac_ext << EOF -#line 701 "configure" +#line 712 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -728,12 +739,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:732: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:743: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:737: checking whether we are using GNU C" >&5 +echo "configure:748: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -742,7 +753,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:746: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -761,7 +772,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:765: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:776: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -829,7 +840,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:833: checking for a BSD compatible install" >&5 +echo "configure:844: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -884,7 +895,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:888: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:899: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -911,7 +922,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:915: checking whether ln -s works" >&5 +echo "configure:926: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -936,7 +947,7 @@ echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:940: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:951: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -955,7 +966,7 @@ echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 -echo "configure:959: checking for loader (symbol LD)" >&5 +echo "configure:970: checking for loader (symbol LD)" >&5 if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -969,7 +980,7 @@ echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 -echo "configure:973: checking for archiver (symbol AR)" >&5 +echo "configure:984: checking for archiver (symbol AR)" >&5 if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -983,7 +994,7 @@ echo $ac_n "checking for archiver options (symbol AR_OPTS)""... $ac_c" 1>&6 -echo "configure:987: checking for archiver options (symbol AR_OPTS)" >&5 +echo "configure:998: checking for archiver options (symbol AR_OPTS)" >&5 if eval "test \"`echo '$''{'cf_cv_subst_AR_OPTS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1075,7 +1086,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1079: checking host system type" >&5 +echo "configure:1090: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1107,7 +1118,7 @@ echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 -echo "configure:1111: checking where the main texmf tree is located" >&5 +echo "configure:1122: checking where the main texmf tree is located" >&5 texmfmain= if test "x$datadir" != 'x${prefix}/share'; then # First case, datadir is defined... @@ -1155,7 +1166,7 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1159: checking how to run the C preprocessor" >&5 +echo "configure:1170: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1170,13 +1181,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1180: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1191: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1187,13 +1198,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1197: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1204,13 +1215,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1235,12 +1246,12 @@ echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1239: checking for ANSI C header files" >&5 +echo "configure:1250: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1248,7 +1259,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1265,7 +1276,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1283,7 +1294,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1304,7 +1315,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1315,7 +1326,7 @@ exit (0); } EOF -if { (eval echo configure:1319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1339,12 +1350,12 @@ fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1343: checking for pid_t" >&5 +echo "configure:1354: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1373,17 +1384,17 @@ ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:1377: checking for vfork.h" >&5 +echo "configure:1388: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1387: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1408,18 +1419,18 @@ fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:1412: checking for working vfork" >&5 +echo "configure:1423: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:1418: checking for vfork" >&5 +echo "configure:1429: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -1464,7 +1475,7 @@ ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < @@ -1559,7 +1570,7 @@ } } EOF -if { (eval echo configure:1563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -1582,12 +1593,12 @@ fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1586: checking for vprintf" >&5 +echo "configure:1597: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1634,12 +1645,12 @@ if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1638: checking for _doprnt" >&5 +echo "configure:1649: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -1688,12 +1699,12 @@ # begin additions SU, 2000/03/07 echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6 -echo "configure:1692: checking for vsnprintf" >&5 +echo "configure:1703: checking for vsnprintf" >&5 if eval "test \"`echo '$''{'xdvi_cv_vsnprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1701,7 +1712,7 @@ (void)vsnprintf((char *)NULL, 0, (char *)NULL, NULL); ; return 0; } EOF -if { (eval echo configure:1705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* xdvi_cv_vsnprintf=yes else @@ -1721,12 +1732,12 @@ fi echo $ac_n "checking for realpath""... $ac_c" 1>&6 -echo "configure:1725: checking for realpath" >&5 +echo "configure:1736: checking for realpath" >&5 if eval "test \"`echo '$''{'xdvi_cv_realpath'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1734,7 +1745,7 @@ (void)realpath((const char *)NULL, NULL); ; return 0; } EOF -if { (eval echo configure:1738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* xdvi_cv_realpath=yes else @@ -1756,19 +1767,19 @@ # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1760: checking for working alloca.h" >&5 +echo "configure:1771: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1789,12 +1800,12 @@ fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1793: checking for alloca" >&5 +echo "configure:1804: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1837: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1854,12 +1865,12 @@ echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1858: checking whether alloca needs Cray hooks" >&5 +echo "configure:1869: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:1888: checking for $ac_func" >&5 +echo "configure:1899: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1939,7 +1950,7 @@ fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1943: checking stack direction for C alloca" >&5 +echo "configure:1954: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1947,7 +1958,7 @@ ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1989,7 +2000,7 @@ # end additions SU echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:1993: checking for 8-bit clean memcmp" >&5 +echo "configure:2004: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1997,7 +2008,7 @@ ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -2025,12 +2036,12 @@ test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:2029: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2040: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2046,7 +2057,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2067,12 +2078,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2071: checking return type of signal handlers" >&5 +echo "configure:2082: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2089,7 +2100,7 @@ int i; ; return 0; } EOF -if { (eval echo configure:2093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2104: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2108,14 +2119,14 @@ echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:2112: checking whether byte ordering is bigendian" >&5 +echo "configure:2123: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -2126,11 +2137,11 @@ #endif ; return 0; } EOF -if { (eval echo configure:2130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -2141,7 +2152,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:2145: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -2161,7 +2172,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -2204,7 +2215,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:2208: checking for X" >&5 +echo "configure:2219: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -2266,12 +2277,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2275: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2286: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2340,14 +2351,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2455,17 +2466,17 @@ case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:2459: checking whether -R must be followed by a space" >&5 +echo "configure:2470: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -2481,14 +2492,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -2526,7 +2537,7 @@ # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:2530: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:2541: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2534,7 +2545,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2567,7 +2578,7 @@ if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:2571: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2582: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2575,7 +2586,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2615,12 +2626,12 @@ # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:2619: checking for gethostbyname" >&5 +echo "configure:2630: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -2664,7 +2675,7 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2668: checking for gethostbyname in -lnsl" >&5 +echo "configure:2679: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2672,7 +2683,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2713,12 +2724,12 @@ # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2717: checking for connect" >&5 +echo "configure:2728: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2762,7 +2773,7 @@ if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2766: checking for connect in -lsocket" >&5 +echo "configure:2777: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2770,7 +2781,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2805,12 +2816,12 @@ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:2809: checking for remove" >&5 +echo "configure:2820: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2848: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -2854,7 +2865,7 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:2858: checking for remove in -lposix" >&5 +echo "configure:2869: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2862,7 +2873,7 @@ ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2897,12 +2908,12 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:2901: checking for shmat" >&5 +echo "configure:2912: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2946,7 +2957,7 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2950: checking for shmat in -lipc" >&5 +echo "configure:2961: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2954,7 +2965,7 @@ ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2998,7 +3009,7 @@ # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:3002: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:3013: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3006,7 +3017,7 @@ ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3042,12 +3053,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3046: checking for size_t" >&5 +echo "configure:3057: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3077,12 +3088,12 @@ # XDVI checks by Paul Vojta echo $ac_n "checking whether C compiler supports string concatenation""... $ac_c" 1>&6 -echo "configure:3081: checking whether C compiler supports string concatenation" >&5 +echo "configure:3092: checking whether C compiler supports string concatenation" >&5 if eval "test \"`echo '$''{'xdvi_cc_concat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3091,7 +3102,7 @@ ; return 0; } EOF -if { (eval echo configure:3095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* xdvi_cc_concat=yes else @@ -3111,7 +3122,7 @@ fi echo $ac_n "checking for integer type to use in bitmaps""... $ac_c" 1>&6 -echo "configure:3115: checking for integer type to use in bitmaps" >&5 +echo "configure:3126: checking for integer type to use in bitmaps" >&5 if eval "test \"`echo '$''{'xdvi_cv_bitmap_type'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3119,7 +3130,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -3137,7 +3148,7 @@ exit(0); } EOF -if { (eval echo configure:3141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then xdvi_cv_bitmap_type="`cat conftestval`" else @@ -3162,12 +3173,12 @@ echo "$ac_t""unsigned $BMTYPE, size = $BMBYTES" 1>&6 echo $ac_n "checking for stropts.h and isastream()""... $ac_c" 1>&6 -echo "configure:3166: checking for stropts.h and isastream()" >&5 +echo "configure:3177: checking for stropts.h and isastream()" >&5 if eval "test \"`echo '$''{'xdvi_cv_sys_streams'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3179,7 +3190,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:3183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* xdvi_cv_sys_streams=yes else @@ -3199,7 +3210,7 @@ fi echo $ac_n "checking for SunOS 4""... $ac_c" 1>&6 -echo "configure:3203: checking for SunOS 4" >&5 +echo "configure:3214: checking for SunOS 4" >&5 if eval "test \"`echo '$''{'xdvi_cv_sys_sunos_4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3218,12 +3229,12 @@ fi echo $ac_n "checking for poll.h and poll()""... $ac_c" 1>&6 -echo "configure:3222: checking for poll.h and poll()" >&5 +echo "configure:3233: checking for poll.h and poll()" >&5 if eval "test \"`echo '$''{'xdvi_cv_func_poll'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3231,7 +3242,7 @@ poll((struct pollfd *) 0, 0, 0); ; return 0; } EOF -if { (eval echo configure:3235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* xdvi_cv_func_poll=yes else @@ -3254,17 +3265,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3258: checking for $ac_hdr" >&5 +echo "configure:3269: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3268: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3300,12 +3311,12 @@ for ac_func in mkstemp memcpy strerror waitpid sigaction strchr setenv ulltostr fchdir getcwd lstat do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3304: checking for $ac_func" >&5 +echo "configure:3315: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3358,17 +3369,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3362: checking for $ac_hdr" >&5 +echo "configure:3373: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3394,6 +3405,7 @@ fi done + # For the bitmap size. -- I think this is in XDVI_C_BITMAP_TYPE now -janl # AC_CHECK_SIZEOF(long) @@ -3540,7 +3552,7 @@ # Extract the first word of "pwd", so it can be a program name with args. set dummy pwd; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3545: checking for $ac_word" >&5 +echo "configure:3556: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BINPWD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3653,54 +3665,129 @@ fi -LibWWW_headers="WWWLib.h WWWApp.h WWWFile.h WWWHTTP.h WWWMIME.h WWWNews.h WWWTrans.h" -LibWWW_config_h="wwwconf.h" -libwww_include_list="${libwww_include} ${libwww_dir} \ - ${libwww_dir}/include ${libwww_dir}/Library/src" -libwww_libdir_list="${libwww_library_dir} ${libwww_dir} ${libwww_dir}/lib \ - ${libwww_dir}/Library/src" +# Check whether --with-libwww-config or --without-libwww-config was given. +if test "${with_libwww_config+set}" = set; then + withval="$with_libwww_config" + + libwww_config=$with_libwww_config + try_system_wwwlib=yes -libwww_include_found=no -libwww_libdir_found=no -if test $try_system_wwwlib = yes; then - for d in $libwww_include_list; do - ok=yes - for h in $LibWWW_headers; do - if test ! -f $d/$h; then - ok=no - break - fi - done - if test $ok = yes; then - libwww_include=$d - libwww_include_found=yes +fi + + +if test "$needs_libwww" = no; then + LDLIBWWW= + LIBWWWCPPFLAGS= + LIBWWWDEP= +else + OLD_LIBS=$LIBS + + LibWWW_headers="WWWLib.h WWWApp.h WWWFile.h WWWHTTP.h WWWMIME.h WWWNews.h WWWTrans.h" + LibWWW_config_h="wwwconf.h" + libwww_include_list="${libwww_include} ${libwww_dir} \ + ${libwww_dir}/include ${libwww_dir}/Library/src" + libwww_libdir_list="${libwww_library_dir} ${libwww_dir} ${libwww_dir}/lib \ + ${libwww_dir}/Library/src" + + if test $try_system_wwwlib = yes; then + test -z "$libwww_config" && libwww_config=libwww-config + + # can we find the $libwww_config program? + LIBWWW_CONFIG= + if test -f "$libwww_config"; then + LIBWWW_CONFIG=$libwww_config + else + # Extract the first word of "$libwww_config", so it can be a program name with args. +set dummy $libwww_config; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3705: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_LIBWWW_CONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$LIBWWW_CONFIG" in + /*|[A-z]:/*) + ac_cv_path_LIBWWW_CONFIG="$LIBWWW_CONFIG" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_LIBWWW_CONFIG="$LIBWWW_CONFIG" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_path_LIBWWW_CONFIG="$ac_dir/$ac_word" break fi done + IFS="$ac_save_ifs" + ;; +esac fi - -if test $libwww_include_found = yes; then - LIBWWWCPPFLAGS="-I${libwww_include} -DHAVE_LIBWWW -DHAVE_WWWLIB_H" +LIBWWW_CONFIG="$ac_cv_path_LIBWWW_CONFIG" +if test -n "$LIBWWW_CONFIG"; then + echo "$ac_t""$LIBWWW_CONFIG" 1>&6 else - LIBWWWCPPFLAGS="-DHAVE_LIBWWW -DHAVE_WWWLIB_H" - if test $try_system_wwwlib = yes; then - libwww_include_found=yes - for ac_hdr in $LibWWW_headers + echo "$ac_t""no" 1>&6 +fi + + fi + + if test -n "$LIBWWW_CONFIG"; then + libwww_include_found=yes + libwww_libdir_found=yes + LDLIBWWW=`$libwww_config --libs` + + # te: I have seen xmlparse.h one directory above the directory given + # by libwww-config. Therefore, this hack: + libwww_config_cflags=`$libwww_config --cflags` + hack=`echo $libwww_config_cflags | sed 's@-I@@; s@/w3c-libwww.*@@'` + test -n "$hack" && test -f "$hack/xmlparse.h" \ + && libwww_config_cflags="$libwww_config_cflags -I$hack" + + LIBWWWCPPFLAGS="$libwww_config_cflags -DHAVE_LIBWWW -DHAVE_WWWLIB_H" + else + libwww_include_found=no + libwww_libdir_found=no + for d in $libwww_include_list; do + ok=yes + for h in $LibWWW_headers; do + if test ! -f $d/$h; then + ok=no + break + fi + done + if test $ok = yes; then + libwww_include=$d + libwww_include_found=yes + break + fi + done + + if test $libwww_include_found = yes; then + LIBWWWCPPFLAGS="-I${libwww_include} -DHAVE_LIBWWW -DHAVE_WWWLIB_H" + else + LIBWWWCPPFLAGS="-DHAVE_LIBWWW -DHAVE_WWWLIB_H" + if test $try_system_wwwlib = yes; then + libwww_include_found=yes + for ac_hdr in $LibWWW_headers do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3695: checking for $ac_hdr" >&5 +echo "configure:3781: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3791: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3727,27 +3814,25 @@ fi done - : - fi -fi - -# only check for libwww.a if the includes could be found -if test $libwww_include_found = yes; then - for d in $libwww_libdir_list; do - if test -f $d/libwww.a; then - libwww_libdir=$d - libwww_libdir_found=yes - fi - done + fi + fi - if test ${libwww_libdir_found} = yes; then - LDLIBWWW="-L${libwww_libdir} -lwww" - : - else - LDLIBWWW=-lwww - libwww_libdir_found=yes - echo $ac_n "checking for HTParse in -lwww""... $ac_c" 1>&6 -echo "configure:3752: checking for HTParse in -lwww" >&5 + # only check for libwww.a if the includes could be found + if test $libwww_include_found = yes; then + for d in $libwww_libdir_list; do + if test -f $d/libwww.a; then + libwww_libdir=$d + libwww_libdir_found=yes + fi + done + + if test ${libwww_libdir_found} = yes; then + LDLIBWWW="-L${libwww_libdir} -lwww" + else + LDLIBWWW=-lwww + libwww_libdir_found=yes + echo $ac_n "checking for HTParse in -lwww""... $ac_c" 1>&6 +echo "configure:3836: checking for HTParse in -lwww" >&5 ac_lib_var=`echo www'_'HTParse | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3755,7 +3840,7 @@ ac_save_LIBS="$LIBS" LIBS="-lwww $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3794,23 +3879,199 @@ libwww_libdir_found=no fi - : + fi + fi + fi fi + + if test "${libwww_include_found}" != yes || + test "${libwww_libdir_found}" != yes; then + if test $try_system_wwwlib = yes; then + echo "configure: warning: Have not found standard LIBWWW library. Shall compile my own one." 1>&2 + fi + LDLIBWWW='$(LIBWWWDIR)/libwww.a' + LIBWWWCPPFLAGS='-I$(LIBWWWDIR) -I$(LIBWWWSRCDIR) -DHAVE_LIBWWW -DHAVE_WWWLIB_H' + LIBWWWDEP='$(LIBWWWDIR)/libwww.a' + using_system_wwwlib=no + else + using_system_wwwlib=yes + LIBWWWDEP= + fi + LIBS=$OLD_LIBS fi -if test "${libwww_include_found}" != yes || - test "${libwww_libdir_found}" != yes; then - if test $try_system_wwwlib = yes; then - echo "configure: warning: Have not found standard LIBWWW library. Shall compile my own one." 1>&2 + + + + + + +# Check whether --with-system-t1lib or --without-system-t1lib was given. +if test "${with_system_t1lib+set}" = set; then + withval="$with_system_t1lib" + : +fi + + +# Check whether --with-t1lib_libdir or --without-t1lib_libdir was given. +if test "${with_t1lib_libdir+set}" = set; then + withval="$with_t1lib_libdir" + : +fi + + +# Check whether --with-t1lib_include or --without-t1lib_include was given. +if test "${with_t1lib_include+set}" = set; then + withval="$with_t1lib_include" + : +fi + + +if test "$needs_libt1" = no; then + LIBT1CPPFLAGS= + LDLIBT1= + LIBT1DEP= +else + EXTRA_LIBT1_INCLUDE= + EXTRA_LIBT1_LIBDIR= + + if test "$with_system_t1lib" = yes; then + if test "x$with_t1lib_libdir" != x; then + EXTRA_LIBT1_LIBDIR="-L$with_t1lib_libdir" + fi + if test "x$with_t1lib_include" != x; then + EXTRA_LIBT1_INCLUDE="-I$with_t1lib_include" + fi fi - LDLIBWWW='$(LIBWWWDIR)/libwww.a' - LIBWWWCPPFLAGS='-I$(LIBWWWDIR) -I$(LIBWWWSRCDIR) -DHAVE_LIBWWW -DHAVE_WWWLIB_H' - LIBWWWDEP='$(LIBWWWDIR)/libwww.a' + + OLD_LDFLAGS=$LDFLAGS + OLD_CPP=$CPP + OLD_LIBS=$LIBS + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR" + CPP="$CPP $EXTRA_LIBT1_INCLUDE" + + if test "$with_system_t1lib" = yes; then + echo $ac_n "checking for T1_AddFont in -lt1""... $ac_c" 1>&6 +echo "configure:3957: checking for T1_AddFont in -lt1" >&5 +ac_lib_var=`echo t1'_'T1_AddFont | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else - LIBWWWDEP= + ac_save_LIBS="$LIBS" +LIBS="-lt1 -lz -lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + t1lib=-lt1 +else + echo "$ac_t""no" 1>&6 +echo "configure: warning: Standard T1 library not found. Compiling my own." 1>&2 + with_system_t1lib=no fi + fi + + LDFLAGS="$LDFLAGS $EXTRA_LIBT1_LIBDIR -lt1 -lm" + if test "$with_system_t1lib" = yes; then + echo $ac_n "checking whether installed T1 lib is >= v 1.3.1 ""... $ac_c" 1>&6 +echo "configure:4003: checking whether installed T1 lib is >= v 1.3.1 " >&5 + if test "$cross_compiling" = yes; then + ac_compile_t1lib=1 + ] +else + cat > conftest.$ac_ext < +#include "t1lib.h" +#define BUFLEN 128 +int main() { + char *t1libId = T1_GetLibIdent(); + char testbuf[BUFLEN]; + char *p = testbuf; + int i; + int version_num; + /* T1_GetLibIdent() might return something like '0.8-beta2'; + convert the leading numbers to a single digit: */ + for (i = 0; i < BUFLEN; i++) { + if (t1libId[i] >= '0' && t1libId[i] <= '9') + *p++ = t1libId[i]; + else if (t1libId[i] != '.' && t1libId[i] != '_' && t1libId[i] != '-') + break; + } + version_num = strtoul(testbuf, (char **)NULL, 10); + /* xdvik needs >= 1.2.0 for parsing dvips map files. + Try to deal with version strings with 1 or more digits. */ + if (version_num >= 120 + || (version_num < 100 && version_num >= 12) + || (version_num < 10 && version_num >= 2)) + exit(0); + exit(1); +} + +EOF +if { (eval echo configure:4040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_compile_t1lib=0 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_compile_t1lib=1 +fi +rm -fr conftest* +fi + + if test $ac_compile_t1lib = 0; then + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no, will compile my own version" 1>&6 + with_system_t1lib=no + fi + fi + LDFLAGS=$OLD_LDFLAGS + CPP=$OLD_CPP + LIBS=$OLD_LIBS + + if test "$with_system_t1lib" != yes; then + LIBT1CPPFLAGS='-I$(LIBT1DIR) -I$(LIBT1SRCDIR) -I$(LIBT1DIR)/../type1 -I$(LIBT1SRCDIR)/../type1' + LDLIBT1='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + LIBT1DEP='$(LIBT1DIR)/libt1.a $(LIBT1DIR)/../type1/libtype1.a' + using_system_t1lib=no + else + LIBT1CPPFLAGS="$EXTRA_LIBT1_INCLUDE" + LDLIBT1="$EXTRA_LIBT1_LIBDIR -lt1" + LIBT1DEP= + using_system_t1lib=yes + fi +fi @@ -3828,7 +4089,7 @@ XLFLAG= fi echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6 -echo "configure:3833: checking for XextCreateExtension in -lXext" >&5 +echo "configure:4093: checking for XextCreateExtension in -lXext" >&5 ac_lib_var=`echo Xext'_'XextCreateExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3836,7 +4097,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXext -lX11 $X_EXTRA_LIBS $XLFLAG $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3903,7 +4164,7 @@ echo "$ac_t""adding DPS includes and libraries for Solaris" 1>&6 X_CFLAGS="$X_CFLAGS -I/usr/openwin/include/X11" echo $ac_n "checking for isinf in -lsunmath""... $ac_c" 1>&6 -echo "configure:3908: checking for isinf in -lsunmath" >&5 +echo "configure:4168: checking for isinf in -lsunmath" >&5 ac_lib_var=`echo sunmath'_'isinf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3911,7 +4172,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsunmath $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3949,12 +4210,12 @@ for ac_func in isinf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3954: checking for $ac_func" >&5 +echo "configure:4214: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4005,17 +4266,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4010: checking for $ac_hdr" >&5 +echo "configure:4270: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4051,6 +4312,51 @@ X_LIBS="$X_LIBS -lxview -lcps -lolgx -lxvps" fi +# needed for web2c later than 7.3.4: +echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 +echo "configure:4318: checking for main in -lm" >&5 +ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -4209,9 +4515,13 @@ s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g s%@LDT1LIB@%$LDT1LIB%g s%@BINPWD@%$BINPWD%g +s%@LIBWWW_CONFIG@%$LIBWWW_CONFIG%g s%@LDLIBWWW@%$LDLIBWWW%g s%@LIBWWWCPPFLAGS@%$LIBWWWCPPFLAGS%g s%@LIBWWWDEP@%$LIBWWWDEP%g +s%@LIBT1CPPFLAGS@%$LIBT1CPPFLAGS%g +s%@LDLIBT1@%$LDLIBT1%g +s%@LIBT1DEP@%$LIBT1DEP%g s%@x_ext_lib@%$x_ext_lib%g s%@x_tool_libs@%$x_tool_libs%g s%@PS_DEF@%$PS_DEF%g diff -Naur xdvik-22.40l/texk/xdvik/configure.in xdvik-22.40n/texk/xdvik/configure.in --- xdvik-22.40l/texk/xdvik/configure.in Wed Apr 10 01:14:49 2002 +++ xdvik-22.40n/texk/xdvik/configure.in Sat Sep 14 00:24:48 2002 @@ -53,6 +53,8 @@ sinclude(../../libs/libwww/libwww.ac) sinclude(../../libs/zlib/withenable.ac) sinclude(../../libs/zlib/zlib.ac) +sinclude(../../libs/t1lib/withenable.ac) +sinclude(../../libs/t1lib/t1lib.ac) # For --with-x-toolkit. Only distinguish `no' from everything else. # They don't get to disable X entirely, this is *x*dvi. @@ -114,6 +116,9 @@ AC_MSG_RESULT(adding NeWS libraries) X_LIBS="$X_LIBS -lxview -lcps -lolgx -lxvps" fi + +# needed for web2c later than 7.3.4: +AC_CHECK_LIB(m, main) AC_OUTPUT(Makefile) diff -Naur xdvik-22.40l/texk/xdvik/depend.mk xdvik-22.40n/texk/xdvik/depend.mk --- xdvik-22.40l/texk/xdvik/depend.mk Mon Mar 4 20:03:41 2002 +++ xdvik-22.40n/texk/xdvik/depend.mk Mon Sep 16 10:10:50 2002 @@ -6,8 +6,7 @@ $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h \ $(kpathsea_srcdir)/progname.h xdvi.h $(kpathsea_srcdir)/c-vararg.h message-window.h \ $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/c-stat.h \ - $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/tex-file.h dvi.h string-utils.h \ - ../../libs/t1lib/lib/t1lib/t1lib.h + $(kpathsea_srcdir)/magstep.h $(kpathsea_srcdir)/tex-file.h dvi.h string-utils.h dvi-init.o: dvi-init.c xdvi-config.h $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h $(kpathsea_srcdir)/c-unistd.h \ $(kpathsea_srcdir)/systypes.h $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ @@ -15,8 +14,7 @@ $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h \ $(kpathsea_srcdir)/progname.h xdvi.h $(kpathsea_srcdir)/c-vararg.h message-window.h \ $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/c-stat.h $(kpathsea_srcdir)/magstep.h \ - $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-file.h dvi.h string-utils.h \ - ../../libs/libwww/HTEscape.h ../../libs/t1lib/lib/t1lib/t1lib.h + $(kpathsea_srcdir)/tex-glyph.h $(kpathsea_srcdir)/tex-file.h dvi.h string-utils.h dvips.o: dvips.c xdvi-config.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-std.h $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h $(kpathsea_srcdir)/c-minmax.h \ @@ -57,68 +55,7 @@ $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h \ $(kpathsea_srcdir)/progname.h xdvi.h $(kpathsea_srcdir)/c-vararg.h message-window.h \ $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/c-stat.h \ - ../../libs/libwww/wwwconf.h ../../libs/libwww/WWWLib.h \ - ../../libs/libwww/wwwsys.h ../../libs/libwww/WWWUtil.h \ - ../../libs/libwww/HTUtils.h ../../libs/libwww/HTMemory.h \ - ../../libs/libwww/HTArray.h ../../libs/libwww/HTAssoc.h \ - ../../libs/libwww/HTList.h ../../libs/libwww/HTAtom.h \ - ../../libs/libwww/HTChunk.h ../../libs/libwww/HTString.h \ - ../../libs/libwww/HTUU.h ../../libs/libwww/WWWCore.h \ - ../../libs/libwww/HTLib.h ../../libs/libwww/HTUser.h \ - ../../libs/libwww/HTReq.h ../../libs/libwww/HTEvent.h \ - ../../libs/libwww/HTFormat.h ../../libs/libwww/HTStream.h \ - ../../libs/libwww/HTAnchor.h ../../libs/libwww/HTLink.h \ - ../../libs/libwww/HTMethod.h ../../libs/libwww/HTResponse.h \ - ../../libs/libwww/HTError.h ../../libs/libwww/HTNet.h \ - ../../libs/libwww/HTTrans.h ../../libs/libwww/HTIOStream.h \ - ../../libs/libwww/HTChannl.h ../../libs/libwww/HTHost.h \ - ../../libs/libwww/HTProt.h ../../libs/libwww/HTTimer.h \ - ../../libs/libwww/HTDNS.h ../../libs/libwww/HTParse.h \ - ../../libs/libwww/HTEscape.h ../../libs/libwww/HTUTree.h \ - ../../libs/libwww/HTWWWStr.h ../../libs/libwww/HTMemLog.h \ - ../../libs/libwww/HTAlert.h ../../libs/libwww/HTBind.h \ - ../../libs/libwww/HTStruct.h ../../libs/libwww/HTFWrite.h \ - ../../libs/libwww/HTInet.h ../../libs/libwww/HTHstMan.h \ - ../../libs/libwww/WWWInit.h ../../libs/libwww/HTProfil.h \ - ../../libs/libwww/HTInit.h ../../libs/libwww/WWWApp.h \ - ../../libs/libwww/HTEvtLst.h ../../libs/libwww/HTHome.h \ - ../../libs/libwww/HTDialog.h ../../libs/libwww/HTAccess.h \ - ../../libs/libwww/HTRules.h ../../libs/libwww/HTProxy.h \ - ../../libs/libwww/HTFilter.h ../../libs/libwww/HTLog.h \ - ../../libs/libwww/HTHist.h ../../libs/libwww/WWWTrans.h \ - ../../libs/libwww/HTANSI.h ../../libs/libwww/HTLocal.h \ - ../../libs/libwww/HTTCP.h ../../libs/libwww/HTSocket.h \ - ../../libs/libwww/HTReader.h ../../libs/libwww/HTWriter.h \ - ../../libs/libwww/HTBufWrt.h ../../libs/libwww/WWWHTTP.h \ - ../../libs/libwww/HTTPUtil.h ../../libs/libwww/HTTP.h \ - ../../libs/libwww/HTTPServ.h ../../libs/libwww/HTTPGen.h \ - ../../libs/libwww/HTTPReq.h ../../libs/libwww/HTTPRes.h \ - ../../libs/libwww/HTTChunk.h ../../libs/libwww/HTPEP.h \ - ../../libs/libwww/HTAAUtil.h ../../libs/libwww/HTAABrow.h \ - ../../libs/libwww/WWWFile.h ../../libs/libwww/HTFile.h \ - ../../libs/libwww/HTMulti.h ../../libs/libwww/WWWFTP.h \ - ../../libs/libwww/HTFTP.h ../../libs/libwww/HTFTPDir.h \ - ../../libs/libwww/WWWGophe.h ../../libs/libwww/HTGopher.h \ - ../../libs/libwww/WWWTelnt.h ../../libs/libwww/HTTelnet.h \ - ../../libs/libwww/WWWNews.h ../../libs/libwww/HTNews.h \ - ../../libs/libwww/HTNewsRq.h ../../libs/libwww/HTNewsLs.h \ - ../../libs/libwww/HTNDir.h ../../libs/libwww/WWWMIME.h \ - ../../libs/libwww/HTMIME.h ../../libs/libwww/HTHeader.h \ - ../../libs/libwww/HTMIMERq.h ../../libs/libwww/HTMIMImp.h \ - ../../libs/libwww/HTBound.h ../../libs/libwww/HTMulpar.h \ - ../../libs/libwww/WWWHTML.h ../../libs/libwww/HText.h \ - ../../libs/libwww/HTMLPDTD.h ../../libs/libwww/SGML.h \ - ../../libs/libwww/HTMLGen.h ../../libs/libwww/HTTeXGen.h \ - ../../libs/libwww/WWWStream.h ../../libs/libwww/HTConLen.h \ - ../../libs/libwww/HTGuess.h ../../libs/libwww/HTTee.h \ - ../../libs/libwww/HTMerge.h ../../libs/libwww/HTSChunk.h \ - ../../libs/libwww/HTXParse.h ../../libs/libwww/WWWDir.h \ - ../../libs/libwww/HTDir.h ../../libs/libwww/HTIcons.h \ - ../../libs/libwww/HTDescpt.h ../../libs/libwww/WWWCache.h \ - ../../libs/libwww/HTCache.h ../../libs/libwww/WWWZip.h \ - ../../libs/libwww/HTZip.h ../../libs/libwww/HTHInit.h \ - ../../libs/libwww/HTML.h ../../libs/libwww/HTPlain.h \ - ../../libs/libwww/HTBInit.h version.h string-utils.h + version.h string-utils.h message-window.o: message-window.c xdvi-config.h $(kpathsea_dir)/c-auto.h \ $(kpathsea_srcdir)/config.h $(kpathsea_srcdir)/c-std.h $(kpathsea_srcdir)/c-unistd.h \ $(kpathsea_srcdir)/systypes.h $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h \ @@ -216,7 +153,7 @@ $(kpathsea_srcdir)/c-limits.h $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h xdvi.h \ $(kpathsea_srcdir)/c-vararg.h message-window.h $(kpathsea_srcdir)/c-ctype.h \ - $(kpathsea_srcdir)/c-fopen.h ../../libs/libwww/HTEscape.h + $(kpathsea_srcdir)/c-fopen.h vf.o: vf.c xdvi-config.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-std.h $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h $(kpathsea_srcdir)/c-minmax.h \ @@ -229,68 +166,8 @@ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h $(kpathsea_srcdir)/c-proto.h \ $(kpathsea_srcdir)/debug.h $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h \ $(kpathsea_srcdir)/progname.h xdvi.h $(kpathsea_srcdir)/c-vararg.h message-window.h \ - $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/c-stat.h ../../libs/libwww/wwwconf.h \ - ../../libs/libwww/WWWLib.h ../../libs/libwww/wwwsys.h \ - ../../libs/libwww/WWWUtil.h ../../libs/libwww/HTUtils.h \ - ../../libs/libwww/HTMemory.h ../../libs/libwww/HTArray.h \ - ../../libs/libwww/HTAssoc.h ../../libs/libwww/HTList.h \ - ../../libs/libwww/HTAtom.h ../../libs/libwww/HTChunk.h \ - ../../libs/libwww/HTString.h ../../libs/libwww/HTUU.h \ - ../../libs/libwww/WWWCore.h ../../libs/libwww/HTLib.h \ - ../../libs/libwww/HTUser.h ../../libs/libwww/HTReq.h \ - ../../libs/libwww/HTEvent.h ../../libs/libwww/HTFormat.h \ - ../../libs/libwww/HTStream.h ../../libs/libwww/HTAnchor.h \ - ../../libs/libwww/HTLink.h ../../libs/libwww/HTMethod.h \ - ../../libs/libwww/HTResponse.h ../../libs/libwww/HTError.h \ - ../../libs/libwww/HTNet.h ../../libs/libwww/HTTrans.h \ - ../../libs/libwww/HTIOStream.h ../../libs/libwww/HTChannl.h \ - ../../libs/libwww/HTHost.h ../../libs/libwww/HTProt.h \ - ../../libs/libwww/HTTimer.h ../../libs/libwww/HTDNS.h \ - ../../libs/libwww/HTParse.h ../../libs/libwww/HTEscape.h \ - ../../libs/libwww/HTUTree.h ../../libs/libwww/HTWWWStr.h \ - ../../libs/libwww/HTMemLog.h ../../libs/libwww/HTAlert.h \ - ../../libs/libwww/HTBind.h ../../libs/libwww/HTStruct.h \ - ../../libs/libwww/HTFWrite.h ../../libs/libwww/HTInet.h \ - ../../libs/libwww/HTHstMan.h ../../libs/libwww/WWWInit.h \ - ../../libs/libwww/HTProfil.h ../../libs/libwww/HTInit.h \ - ../../libs/libwww/WWWApp.h ../../libs/libwww/HTEvtLst.h \ - ../../libs/libwww/HTHome.h ../../libs/libwww/HTDialog.h \ - ../../libs/libwww/HTAccess.h ../../libs/libwww/HTRules.h \ - ../../libs/libwww/HTProxy.h ../../libs/libwww/HTFilter.h \ - ../../libs/libwww/HTLog.h ../../libs/libwww/HTHist.h \ - ../../libs/libwww/WWWTrans.h ../../libs/libwww/HTANSI.h \ - ../../libs/libwww/HTLocal.h ../../libs/libwww/HTTCP.h \ - ../../libs/libwww/HTSocket.h ../../libs/libwww/HTReader.h \ - ../../libs/libwww/HTWriter.h ../../libs/libwww/HTBufWrt.h \ - ../../libs/libwww/WWWHTTP.h ../../libs/libwww/HTTPUtil.h \ - ../../libs/libwww/HTTP.h ../../libs/libwww/HTTPServ.h \ - ../../libs/libwww/HTTPGen.h ../../libs/libwww/HTTPReq.h \ - ../../libs/libwww/HTTPRes.h ../../libs/libwww/HTTChunk.h \ - ../../libs/libwww/HTPEP.h ../../libs/libwww/HTAAUtil.h \ - ../../libs/libwww/HTAABrow.h ../../libs/libwww/WWWFile.h \ - ../../libs/libwww/HTFile.h ../../libs/libwww/HTMulti.h \ - ../../libs/libwww/WWWFTP.h ../../libs/libwww/HTFTP.h \ - ../../libs/libwww/HTFTPDir.h ../../libs/libwww/WWWGophe.h \ - ../../libs/libwww/HTGopher.h ../../libs/libwww/WWWTelnt.h \ - ../../libs/libwww/HTTelnet.h ../../libs/libwww/WWWNews.h \ - ../../libs/libwww/HTNews.h ../../libs/libwww/HTNewsRq.h \ - ../../libs/libwww/HTNewsLs.h ../../libs/libwww/HTNDir.h \ - ../../libs/libwww/WWWMIME.h ../../libs/libwww/HTMIME.h \ - ../../libs/libwww/HTHeader.h ../../libs/libwww/HTMIMERq.h \ - ../../libs/libwww/HTMIMImp.h ../../libs/libwww/HTBound.h \ - ../../libs/libwww/HTMulpar.h ../../libs/libwww/WWWHTML.h \ - ../../libs/libwww/HText.h ../../libs/libwww/HTMLPDTD.h \ - ../../libs/libwww/SGML.h ../../libs/libwww/HTMLGen.h \ - ../../libs/libwww/HTTeXGen.h ../../libs/libwww/WWWStream.h \ - ../../libs/libwww/HTConLen.h ../../libs/libwww/HTGuess.h \ - ../../libs/libwww/HTTee.h ../../libs/libwww/HTMerge.h \ - ../../libs/libwww/HTSChunk.h ../../libs/libwww/HTXParse.h \ - ../../libs/libwww/WWWDir.h ../../libs/libwww/HTDir.h \ - ../../libs/libwww/HTIcons.h ../../libs/libwww/HTDescpt.h \ - ../../libs/libwww/WWWCache.h ../../libs/libwww/HTCache.h \ - ../../libs/libwww/WWWZip.h ../../libs/libwww/HTZip.h \ - ../../libs/libwww/HTHInit.h ../../libs/libwww/HTML.h \ - ../../libs/libwww/HTPlain.h ../../libs/libwww/HTBInit.h + $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/c-stat.h \ + statusline.h xdvi.o: xdvi.c xdvi-config.h $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/config.h \ $(kpathsea_srcdir)/c-std.h $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \ $(kpathsea_srcdir)/c-memstr.h $(kpathsea_srcdir)/c-errno.h $(kpathsea_srcdir)/c-minmax.h \ @@ -300,65 +177,4 @@ $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h $(kpathsea_srcdir)/c-pathch.h \ $(kpathsea_srcdir)/c-stat.h $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-file.h \ $(kpathsea_srcdir)/tex-hush.h $(kpathsea_srcdir)/tex-make.h string-utils.h \ - ../../libs/libwww/wwwconf.h ../../libs/libwww/WWWLib.h \ - ../../libs/libwww/wwwsys.h ../../libs/libwww/WWWUtil.h \ - ../../libs/libwww/HTUtils.h ../../libs/libwww/HTMemory.h \ - ../../libs/libwww/HTArray.h ../../libs/libwww/HTAssoc.h \ - ../../libs/libwww/HTList.h ../../libs/libwww/HTAtom.h \ - ../../libs/libwww/HTChunk.h ../../libs/libwww/HTString.h \ - ../../libs/libwww/HTUU.h ../../libs/libwww/WWWCore.h \ - ../../libs/libwww/HTLib.h ../../libs/libwww/HTUser.h \ - ../../libs/libwww/HTReq.h ../../libs/libwww/HTEvent.h \ - ../../libs/libwww/HTFormat.h ../../libs/libwww/HTStream.h \ - ../../libs/libwww/HTAnchor.h ../../libs/libwww/HTLink.h \ - ../../libs/libwww/HTMethod.h ../../libs/libwww/HTResponse.h \ - ../../libs/libwww/HTError.h ../../libs/libwww/HTNet.h \ - ../../libs/libwww/HTTrans.h ../../libs/libwww/HTIOStream.h \ - ../../libs/libwww/HTChannl.h ../../libs/libwww/HTHost.h \ - ../../libs/libwww/HTProt.h ../../libs/libwww/HTTimer.h \ - ../../libs/libwww/HTDNS.h ../../libs/libwww/HTParse.h \ - ../../libs/libwww/HTEscape.h ../../libs/libwww/HTUTree.h \ - ../../libs/libwww/HTWWWStr.h ../../libs/libwww/HTMemLog.h \ - ../../libs/libwww/HTAlert.h ../../libs/libwww/HTBind.h \ - ../../libs/libwww/HTStruct.h ../../libs/libwww/HTFWrite.h \ - ../../libs/libwww/HTInet.h ../../libs/libwww/HTHstMan.h \ - ../../libs/libwww/WWWInit.h ../../libs/libwww/HTProfil.h \ - ../../libs/libwww/HTInit.h ../../libs/libwww/WWWApp.h \ - ../../libs/libwww/HTEvtLst.h ../../libs/libwww/HTHome.h \ - ../../libs/libwww/HTDialog.h ../../libs/libwww/HTAccess.h \ - ../../libs/libwww/HTRules.h ../../libs/libwww/HTProxy.h \ - ../../libs/libwww/HTFilter.h ../../libs/libwww/HTLog.h \ - ../../libs/libwww/HTHist.h ../../libs/libwww/WWWTrans.h \ - ../../libs/libwww/HTANSI.h ../../libs/libwww/HTLocal.h \ - ../../libs/libwww/HTTCP.h ../../libs/libwww/HTSocket.h \ - ../../libs/libwww/HTReader.h ../../libs/libwww/HTWriter.h \ - ../../libs/libwww/HTBufWrt.h ../../libs/libwww/WWWHTTP.h \ - ../../libs/libwww/HTTPUtil.h ../../libs/libwww/HTTP.h \ - ../../libs/libwww/HTTPServ.h ../../libs/libwww/HTTPGen.h \ - ../../libs/libwww/HTTPReq.h ../../libs/libwww/HTTPRes.h \ - ../../libs/libwww/HTTChunk.h ../../libs/libwww/HTPEP.h \ - ../../libs/libwww/HTAAUtil.h ../../libs/libwww/HTAABrow.h \ - ../../libs/libwww/WWWFile.h ../../libs/libwww/HTFile.h \ - ../../libs/libwww/HTMulti.h ../../libs/libwww/WWWFTP.h \ - ../../libs/libwww/HTFTP.h ../../libs/libwww/HTFTPDir.h \ - ../../libs/libwww/WWWGophe.h ../../libs/libwww/HTGopher.h \ - ../../libs/libwww/WWWTelnt.h ../../libs/libwww/HTTelnet.h \ - ../../libs/libwww/WWWNews.h ../../libs/libwww/HTNews.h \ - ../../libs/libwww/HTNewsRq.h ../../libs/libwww/HTNewsLs.h \ - ../../libs/libwww/HTNDir.h ../../libs/libwww/WWWMIME.h \ - ../../libs/libwww/HTMIME.h ../../libs/libwww/HTHeader.h \ - ../../libs/libwww/HTMIMERq.h ../../libs/libwww/HTMIMImp.h \ - ../../libs/libwww/HTBound.h ../../libs/libwww/HTMulpar.h \ - ../../libs/libwww/WWWHTML.h ../../libs/libwww/HText.h \ - ../../libs/libwww/HTMLPDTD.h ../../libs/libwww/SGML.h \ - ../../libs/libwww/HTMLGen.h ../../libs/libwww/HTTeXGen.h \ - ../../libs/libwww/WWWStream.h ../../libs/libwww/HTConLen.h \ - ../../libs/libwww/HTGuess.h ../../libs/libwww/HTTee.h \ - ../../libs/libwww/HTMerge.h ../../libs/libwww/HTSChunk.h \ - ../../libs/libwww/HTXParse.h ../../libs/libwww/WWWDir.h \ - ../../libs/libwww/HTDir.h ../../libs/libwww/HTIcons.h \ - ../../libs/libwww/HTDescpt.h ../../libs/libwww/WWWCache.h \ - ../../libs/libwww/HTCache.h ../../libs/libwww/WWWZip.h \ - ../../libs/libwww/HTZip.h ../../libs/libwww/HTHInit.h \ - ../../libs/libwww/HTML.h ../../libs/libwww/HTPlain.h \ - ../../libs/libwww/HTBInit.h krheader.h version.h xdvi.icon + krheader.h version.h xdvi.icon diff -Naur xdvik-22.40l/texk/xdvik/dvi-draw.c xdvik-22.40n/texk/xdvik/dvi-draw.c --- xdvik-22.40l/texk/xdvik/dvi-draw.c Sat Aug 31 16:43:23 2002 +++ xdvik-22.40n/texk/xdvik/dvi-draw.c Sat Sep 14 23:18:43 2002 @@ -58,7 +58,7 @@ #if defined(HAVE_STRING_H) #include #else -extern char *strtok P2H(char *, _Xconst char *); +extern char *strtok(char *, _Xconst char *); #endif #include "dvi.h" @@ -231,13 +231,13 @@ int padMismatch=0; /* Does t1lib padding match xdvi required padding? */ int archpad; -PRIVATE void load_font_now P1C(int, idx); +PRIVATE void load_font_now(int idx); PRIVATE struct glyph *get_t1_glyph #ifdef TEXXET -P2C(wide_ubyte, cmd, wide_ubyte, ch); +(wide_ubyte cmd, wide_ubyte ch); #else -P1C(wide_ubyte, ch); +(wide_ubyte ch); #endif #ifdef WORDS_BIGENDIAN @@ -578,19 +578,11 @@ static void source_fwd_draw_box(); -#if NeedFunctionPrototypes #ifndef TEXXET static long set_no_char(wide_ubyte ch); #else static void set_no_char(wide_ubyte cmd, wide_ubyte ch); #endif /* TEXXET */ -#else /* !NeedFunctionPrototypes */ -#ifndef TEXXET -static long set_no_char(); -#else -static void set_no_char(); -#endif /* TEXXET */ -#endif /* NeedFunctionPrototypes */ /* * X routines. @@ -1411,10 +1403,10 @@ #ifndef TEXXET long -set_char P1C(wide_ubyte, ch) +set_char(wide_ubyte ch) #else void -set_char P2C(wide_ubyte, cmd, wide_ubyte, ch) +set_char(wide_ubyte cmd, wide_ubyte ch) #endif { struct glyph *g; @@ -1492,13 +1484,13 @@ /* ARGSUSED */ #ifndef TEXXET static long -set_empty_char P1C(wide_ubyte, ch) +set_empty_char(wide_ubyte ch) { return 0; } #else static void -set_empty_char P2C(wide_ubyte, cmd, wide_ubyte, ch) +set_empty_char(wide_ubyte cmd, wide_ubyte ch) { return; } @@ -1506,10 +1498,10 @@ #ifndef TEXXET long -load_n_set_char P1C(wide_ubyte, ch) +load_n_set_char(wide_ubyte ch) #else void -load_n_set_char P2C(wide_ubyte, cmd, wide_ubyte, ch) +load_n_set_char(wide_ubyte cmd, wide_ubyte ch) #endif { if (load_font(currinf.fontp)) { /* if not found */ @@ -1539,10 +1531,10 @@ #ifndef TEXXET long -set_vf_char P1C(wide_ubyte, ch) +set_vf_char(wide_ubyte ch) #else void -set_vf_char P2C(wide_ubyte, cmd, wide_ubyte, ch) +set_vf_char(wide_ubyte cmd, wide_ubyte ch) #endif { struct macro *m; @@ -1609,10 +1601,10 @@ #ifndef TEXXET static long -set_no_char P1C(wide_ubyte, ch) +set_no_char(wide_ubyte ch) #else static void -set_no_char P2C(wide_ubyte, cmd, wide_ubyte, ch) +set_no_char(wide_ubyte cmd, wide_ubyte ch) #endif { if (currinf.virtual) { @@ -1952,7 +1944,7 @@ void -draw_page P1C(void,) +draw_page(void) { if (dvi_file_changed() || page_offset == NULL) { /* dvi_time--; */ @@ -3750,7 +3742,8 @@ } canit = True; - XRaiseWindow(DISP, XtWindow(top_level)); + /* raise and eventually de-iconify window */ + XMapRaised(XtDisplay(top_level), XtWindow(top_level)); /* Now search that particular page. */ @@ -3825,7 +3818,7 @@ } PRIVATE char ** -load_vector P1C(char *, enc) +load_vector(char *enc) { char *filename; char **vector = NULL; @@ -3856,7 +3849,7 @@ PRIVATE int -add_tfm P1C(char *, texname) +add_tfm(char *texname) { /* Load font metrics if not already loaded. Return index into fontmetrics array. Can't fail. Fallback metrics must be @@ -3902,7 +3895,7 @@ } PRIVATE int -add_t1font P2C(char *, fontname, char *, filename) +add_t1font(char *fontname, char *filename) { /* Add t1 font to list, or not if it's already there. Return the t1lib font id. The filename argument is optional, but is assumed @@ -3970,7 +3963,7 @@ PRIVATE int -find_texfont P1C(char *, texname) +find_texfont(char *texname) { /* Find fontmap index of texfont */ int i; @@ -3985,10 +3978,10 @@ PRIVATE int -setup_encoded_T1_font P8C(char *, mapfile, - int, lineno, - char *, texname, char *, alias, - char *, filename, int, enc, int, ext, int, sl) +setup_encoded_T1_font(char * mapfile, + int lineno, + char *texname, char *alias, + char *filename, int enc, int ext, int sl) { /* xdvi T1 Font loading is done in two steps: @@ -4083,7 +4076,7 @@ PRIVATE void -load_font_now P1C(int, idx) +load_font_now(int idx) { /* At this point xdvi needs to draw a glyph from this font. But first it must be loaded/copied and modified if needed. */ @@ -4156,7 +4149,7 @@ PUBLIC int -find_T1_font P1C(char *, texname) +find_T1_font(char *texname) { /* Step 1b in the scenario above. xdvi knows that this font is needed. Check if it is available. But do not load yet. @@ -4244,7 +4237,7 @@ PRIVATE int -new_encoding P2C(char *, enc, char *, file) +new_encoding(char *enc, char *file) { /* (Possebly) new encoding entered from .cfg file, or from dvips map. When entered from dvips map the enc is null/anonymous */ @@ -4296,12 +4289,12 @@ PUBLIC void -add_T1_mapentry P6C(int, lineno, - char *, mapfile, - char *, name, - char *, file, - char *, vec, - char *, spec) +add_T1_mapentry(int lineno, + char *mapfile, + char *name, + char *file, + char *vec, + char *spec) { /* This is called from getpsinfo, once for each fontmap line `lineno'. We will dutifully enter the information into our fontmap table */ @@ -4352,7 +4345,7 @@ PRIVATE void -read_cfg_file P1C(char *, file) +read_cfg_file(char *file) { char *filename; FILE *mapfile; @@ -4456,9 +4449,9 @@ PRIVATE struct glyph * get_t1_glyph #ifdef TEXXET -P2C(wide_ubyte, cmd, wide_ubyte, ch) +(wide_ubyte cmd, wide_ubyte ch) #else -P1C(wide_ubyte, ch) +(wide_ubyte ch) #endif { /* @@ -4577,10 +4570,10 @@ #ifdef TEXXET PUBLIC void -set_t1_char P2C(wide_ubyte, cmd, wide_ubyte, ch) +set_t1_char(wide_ubyte cmd, wide_ubyte ch) #else PUBLIC long -set_t1_char P1C(wide_ubyte, ch) +set_t1_char(wide_ubyte ch) #endif { /* Process events even deepest in the drawing loop */ @@ -4599,7 +4592,7 @@ /* ARGSUSED */ PUBLIC void -read_T1_char P2C(struct font *, fontp, wide_ubyte, ch) +read_T1_char(struct font *fontp, wide_ubyte ch) { /* Should never be called */ fprintf(stderr, "BUG: asked to load %c\n", ch); @@ -4607,7 +4600,7 @@ PUBLIC void -init_t1 P1C(void,) +init_t1(void) { int i; void *success; diff -Naur xdvik-22.40l/texk/xdvik/dvips.c xdvik-22.40n/texk/xdvik/dvips.c --- xdvik-22.40l/texk/xdvik/dvips.c Sun Aug 25 23:40:36 2002 +++ xdvik-22.40n/texk/xdvik/dvips.c Sat Sep 14 23:18:43 2002 @@ -17,13 +17,13 @@ #define INLINE_SIZE (2000) static char was_inline[INLINE_SIZE]; -extern void add_T1_mapentry P6H(int, char *, char *, char *, char *, char *); +extern void add_T1_mapentry(int, char *, char *, char *, char *, char *); /* Read a dvips psfont map file. Return 1 if it was read ok. 0 otherwise. */ -int getpsinfo -P1C(char *, name) +int +getpsinfo(char *name) { FILE *deffile; char *p; diff -Naur xdvik-22.40l/texk/xdvik/events.c xdvik-22.40n/texk/xdvik/events.c --- xdvik-22.40l/texk/xdvik/events.c Thu Aug 29 22:51:20 2002 +++ xdvik-22.40n/texk/xdvik/events.c Sat Sep 14 23:18:43 2002 @@ -231,25 +231,24 @@ #define ACTION_DECL(name) \ void name ARGS((Widget, XEvent *, String *, Cardinal *)) -#define ACTION(name) \ - void \ - name P4C(Widget, w, \ - XEvent *, event, \ - String *, params, \ - Cardinal *, num_params) +#define ACTION(name) \ + void \ + name (Widget w, \ + XEvent *event, \ + String *params, \ + Cardinal *num_params) #else /* TOOLKIT */ #define ACTION_DECL(name) \ void name ARGS((XEvent *)) #define ACTION(name) \ void \ - name P1C(XEvent *, event) + name (XEvent *event) #endif /* TOOLKIT */ /* ARGSUSED */ void - null_mouse -P1C(XEvent *, event) +null_mouse(XEvent *event) { } @@ -3146,8 +3145,7 @@ } static void - mag_motion -P1C(XEvent *, event) +mag_motion(XEvent *event) { new_mag_x = event->xmotion.x + mag_conv_x; main_x = event->xmotion.x_root - new_mag_x; @@ -3157,8 +3155,7 @@ } static void - mag_release -P1C(XEvent *, event) +mag_release(XEvent *event) { if (alt.win != (Window) 0) { if (alt_stat) @@ -3176,8 +3173,7 @@ } static void -movemag(x, y) - int x, y; +movemag(int x, int y) { int xx, yy; @@ -3251,8 +3247,7 @@ static void - drag_motion -P1C(XEvent *, event) +drag_motion(XEvent *event) { #if MOTIF get_xy(); @@ -3297,8 +3292,7 @@ static void - drag_release -P1C(XEvent *, event) +drag_release(XEvent *event) { drag_motion(event); mouse_motion = mouse_release = null_mouse; @@ -3552,17 +3546,13 @@ #endif /* TOOLKIT */ void +handle_property_change( #ifdef TOOLKIT -/* ARGSUSED */ -handle_property_change(widget, junk, ev, cont) - Widget widget; - XtPointer junk; - XEvent *ev; - Boolean *cont; /* unused */ + Widget widget, XtPointer junk, XEvent *ev, Boolean *cont #else /* !TOOLKIT */ -handle_property_change(ev) - XEvent *ev; + XEvent *ev #endif + ) #define event (&(ev->xproperty)) { unsigned char *src_goto_property; @@ -3586,8 +3576,6 @@ } source_forward_search(src_goto_property); - /* eventually de-iconify window */ - XMapRaised(XtDisplay(top_level), XtWindow(top_level)); } #undef event diff -Naur xdvik-22.40l/texk/xdvik/font-open.c xdvik-22.40n/texk/xdvik/font-open.c --- xdvik-22.40l/texk/xdvik/font-open.c Mon Jan 7 13:52:15 2002 +++ xdvik-22.40n/texk/xdvik/font-open.c Sat Sep 14 23:18:44 2002 @@ -35,15 +35,12 @@ easier to avoid running mktexpk if we have a VF this way. */ FILE * +font_open(char *font, char **font_ret, double dpi, int *dpi_ret, + int dummy, char **filename_ret #ifdef T1LIB - font_open -P7C(char *, font, char **, font_ret, double, dpi, int *, dpi_ret, - int, dummy, char **, filename_ret, int *, t1id) -#else /* T1LIB */ - font_open -P6C(char *, font, char **, font_ret, double, dpi, int *, dpi_ret, - int, dummy, char **, filename_ret) -#endif /* T1LIB */ + , int *t1id +#endif + ) { FILE *ret; char *name; diff -Naur xdvik-22.40l/texk/xdvik/special.c xdvik-22.40n/texk/xdvik/special.c --- xdvik-22.40l/texk/xdvik/special.c Sat Aug 31 16:43:23 2002 +++ xdvik-22.40n/texk/xdvik/special.c Sat Sep 14 23:18:44 2002 @@ -627,7 +627,7 @@ static XIOErrorHandler oldhandler; static int -XDviIOErrorHandler P1C(Display *, disp) +XDviIOErrorHandler(Display *disp) { ps_destroy(); return oldhandler(disp); diff -Naur xdvik-22.40l/texk/xdvik/tfmload.c xdvik-22.40n/texk/xdvik/tfmload.c --- xdvik-22.40l/texk/xdvik/tfmload.c Mon Jun 4 23:07:34 2001 +++ xdvik-22.40n/texk/xdvik/tfmload.c Sat Sep 14 23:18:44 2002 @@ -14,9 +14,8 @@ int fallbacktfm=0; -int tfmload -P3C(char *, name, long *, design, long *, widths) - { +int tfmload(char *name, long *design, long *widths) +{ int i; int li; int nw, hd; diff -Naur xdvik-22.40l/texk/xdvik/util.c xdvik-22.40n/texk/xdvik/util.c --- xdvik-22.40l/texk/xdvik/util.c Sat Aug 31 16:43:23 2002 +++ xdvik-22.40n/texk/xdvik/util.c Sat Sep 14 23:18:44 2002 @@ -632,7 +632,7 @@ */ char * -urlocalize P1C(char *, filename) +urlocalize(char *filename) { if (strncmp(filename, "file:", 5) == 0) { @@ -666,10 +666,10 @@ FILE * xdvi_xfopen #ifndef VMS - P2C(_Xconst char *, filename, _Xconst char *, type) + (_Xconst char *filename, _Xconst char *type) #define TYPE type #else - P3C(_Xconst char *, filename, _Xconst char *, type, _Xconst char *, type2) + (_Xconst char *filename, _Xconst char *type, _Xconst char *type2) #define TYPE type, type2 #endif /* VMS */ { @@ -733,7 +733,7 @@ #ifdef HTEX FILE * -xfopen_local P2C(_Xconst char *, filename, _Xconst char *, type) +xfopen_local(_Xconst char *filename, _Xconst char *type) { FILE *f; int url_aware_save; diff -Naur xdvik-22.40l/texk/xdvik/version.h xdvik-22.40n/texk/xdvik/version.h --- xdvik-22.40l/texk/xdvik/version.h Sat Aug 31 17:14:20 2002 +++ xdvik-22.40n/texk/xdvik/version.h Mon Sep 16 17:08:18 2002 @@ -1,4 +1,4 @@ -#define XDVERSION "22.40l" +#define XDVERSION "22.40n" #ifdef Omega #define TVERSION XDVERSION" for Omega" #else diff -Naur xdvik-22.40l/texk/xdvik/wwwfetch.c xdvik-22.40n/texk/xdvik/wwwfetch.c --- xdvik-22.40l/texk/xdvik/wwwfetch.c Sat Aug 31 16:43:23 2002 +++ xdvik-22.40n/texk/xdvik/wwwfetch.c Fri Sep 13 00:59:29 2002 @@ -24,6 +24,9 @@ #include "WWWInit.h" #include "WWWCache.h" +#include "message-window.h" +#include "statusline.h" + #define LINE 1024 #define FILELISTCHUNK 20 @@ -64,8 +67,7 @@ /* print errors from libwww calls */ static Boolean -www_error_print (uri, request, op, msgnum, dfault, input, reply) - char *uri; +www_error_print (request, op, msgnum, dfault, input, reply) HTRequest *request; HTAlertOpcode op; int msgnum; @@ -73,11 +75,14 @@ void *input; HTAlertPar *reply; { + HTParentAnchor *anchor = HTRequest_anchor(request); + char *uri = HTAnchor_address((HTAnchor*) anchor); char *msg = HTDialog_errorMessage(request, op, msgnum, dfault, input); if (msg) { do_popup_message(MSG_ERR, NULL, "Couldn't fetch `%s':\nlibwww: %s\n", uri, msg); free(msg); } + free(uri); return True; } @@ -89,21 +94,96 @@ void *param; int status; { - HTParentAnchor *anchor = HTRequest_anchor(request); - char *uri = HTAnchor_address((HTAnchor*) anchor); - switch (status) { case HT_LOADED: /* success */ break; default: /* any error */ - www_error_print(uri, request, HT_A_MESSAGE, HT_MSG_NULL, NULL, + www_error_print(request, HT_A_MESSAGE, HT_MSG_NULL, NULL, HTRequest_error(request), NULL); break; } - free(uri); return HT_OK; } +/* how to get rid of the following internal? */ +static const char * HTDialogs[] = {HT_MSG_ENGLISH_INITIALIZER}; + +static Boolean +login_proc(HTRequest *request, + HTAlertOpcode op, int msgnum, + const char *dfault, void *input, + HTAlertPar *reply) +{ + const char *msg = HTDialogs[msgnum]; /* it seems there is no public function for this one ??? */ + fprintf(stderr, "LOGIN =========\n"); + fprintf(stderr, "%s\n", msg); + do_popup_message(MSG_INFO, "Sorry, login functionality is not implemented yet", "Not implemented yet: %s", msg); +} + +static Boolean +passwd_proc(HTRequest *request, + HTAlertOpcode op, int msgnum, + const char *dfault, void *input, + HTAlertPar *reply) +{ + char *msg = HTDialog_errorMessage(request, op, msgnum, dfault, input); + fprintf(stderr, "PASSWD =========\n"); + if (msg == NULL) + return; + fprintf(stderr, "%s\n", msg); + do_popup_message(MSG_INFO, + "Sorry, this URI requires authentication, but " + "password functionality is not implemented yet", "Not implemented yet: %s", msg); + free(msg); +} + +static Boolean +void_proc(HTRequest *request, + HTAlertOpcode op, int msgnum, + const char *dfault, void *input, + HTAlertPar *reply) +{ + char *msg = HTDialog_errorMessage(request, op, msgnum, dfault, input); + fprintf(stderr, "ERROR =========\n"); + if (msg == NULL) + return; + fprintf(stderr, "%s\n", msg); + do_popup_message(MSG_ERR, NULL, "error: %s", msg); + free(msg); + return HTAlert_setReplyMessage(reply, "anonymous"); +} + +/* progress messages */ +static Boolean +statusline_cb(HTRequest *request, + HTAlertOpcode op, int msgnum, + const char *dfault, void *input, + HTAlertPar *reply) +{ + HTParentAnchor *anchor = HTRequest_anchor(request); + char *uri = HTAnchor_address((HTAnchor*) anchor); + XEvent event; + char buf[2048]; + size_t offset; + + char *msg = HTDialog_progressMessage(request, op, msgnum, dfault, input); + + /* TODO: add some fancy animation here ... */ + snprintf(buf, 2048, "Retrieving \"%s\": %s", uri, msg); + print_statusline(STATUS_LONG, buf); + + free(uri); + free(msg); + +#ifdef MOTIF + XmUpdateDisplay(top_level); +#else + XSync(DISP, 0); + while (XCheckMaskEvent(DISP, ExposureMask, &event)) + XtDispatchEvent(&event); +#endif +} + /* wrapper for HTLoadToFile to work around a bug in that function */ int libwww_wrapper_HTLoadToFile(const char *url, HTRequest *request, const char *filename) @@ -137,6 +217,8 @@ return 0; } +extern Boolean dragcurs; /* defined in events.c */ + /* Given absolute URL, open a temporary filename, and do the transfer */ int www_fetch(url, savefile) @@ -144,6 +226,7 @@ char *savefile; { int status; + XEvent event; HTRequest *request; HTFormat content_type; @@ -152,19 +235,32 @@ savefile); } - /* Don't ask when overwriting temporary savefile. */ + /* we can't just set + HTAlert_setInteractive(NO); - /* unfortunatly this makes it impossible to use any alerts, - such as: - HTAlert_add(www_error_print, HT_A_MESSAGE); - so we need to do our own filtering. - TODO: Would it be better to register a dummy handler for - HT_A_CONFIRM instead of disabling interactive mode entirely?? - NOTE: the wrapper below doesn't check for existence of a tempfile, - so we could use HTAlert_add again. Will need some regression testing though. + since this would disable all alerts/callbacks. All of the following counts as `interactive': + - confirm before overwriting local files on disk + - passwords for ftp servers + - general progress messages (!) + We want to preserve at least the latter category, maybe in the future also the + password authentication stuff. So we need to register callbacks for all these + types separately. */ + + /* FIXME: is this one still needed? Do some regression testing on this. */ HTNet_addAfter(www_info_filter, NULL, NULL, HT_ALL, HT_FILTER_LATE); + HTAlert_add(www_error_print, HT_A_MESSAGE); + /* all these don't require user input: */ + HTAlert_add(statusline_cb, + HT_PROG_DNS | HT_PROG_CONNECT | HT_PROG_ACCEPT | + HT_PROG_READ | HT_PROG_WRITE | HT_PROG_DONE | + HT_PROG_INTERRUPT | HT_PROG_OTHER | HT_PROG_TIMEOUT | + HT_PROG_LOGIN | HT_A_PROGRESS); + /* these however do: */ + HTAlert_add(login_proc, HT_A_USER_PW); + HTAlert_add(passwd_proc, HT_A_SECRET | HT_A_PROMPT); + HTAlert_add(void_proc, HT_A_MESSAGE | HT_A_CONFIRM); request = HTRequest_new(); @@ -172,13 +268,19 @@ fprintf(stderr, "calling HTLoadToFile\n"); } + dragcurs = True; + while (XCheckMaskEvent(DISP, ExposureMask, &event)) + XtDispatchEvent(&event); + + /* + Use this wrapper to avoid bug with HTLoadToFile (see + http://lists.w3.org/Archives/Public/www-lib/2001AprJun/0152.html), + and problems with interactive confirmation before overwriting `savefile' + (which really is a temporary file in our case): + */ status = libwww_wrapper_HTLoadToFile(url, request, savefile); - /* Aarghh! Some libwww methods such as HTLoadFTP return non-null - status even when fatal errors have occurred (e.g. `login - failed'). So the following test can only catch some kinds of - errors, and that's why we need www_info_filter. - */ + /* Is this still needed? */ if (status == 0) { char *errmsg = HTDialog_errorMessage(request, 0, 0, NULL, HTRequest_error(request)); do_popup_message(MSG_ERR, NULL, @@ -187,6 +289,9 @@ free(errmsg); } + /* do we need this??? */ + /* HTEventList_loop(request); */ + if (debug & DBG_HYPER) { fprintf(stderr, "after request: status %d\n", status); } @@ -207,6 +312,7 @@ #ifdef DOFORKS exit(1); /* No cleanup! */ #else /* DOFORKS */ + dragcurs = False; return status; /* return status: YES (1) or NO (0) */ #endif /* DOFORKS */ } @@ -309,27 +415,6 @@ /* Step 1: make the relative URL absolute: */ strncpy(buf, rel_url, LINE); /* Put it in buf */ make_absolute(buf, base_url, LINE); - - /* Step 1.5: Check whether we already have it - if so return */ - - /* NOTE SU: I don't think this is always desired; what if the user wants - to fetch a new version? Can't we assume that he wants that - if he clicks on the link a second time? - (Also, if the temp file is deleted by accident, the URL will not be re-fetched). - Or should reread-dvi-file() flush the filelist, as in tickrec (special.c)? - Or should we ask interactively: - - Xdvi Info: - File xyz already downloaded - reload? - ------ - Yes No - */ - /* - for (i = 0; i < nURLs; i++) { - if (!strcmp(buf, filelist[i].url)) - return i; - } - */ /* Step 2: Find a temporary file to store the output in */ fd = xdvi_temp_fd(&tmpfile); diff -Naur xdvik-22.40l/texk/xdvik/xdvi-search.el xdvik-22.40n/texk/xdvik/xdvi-search.el --- xdvik-22.40l/texk/xdvik/xdvi-search.el Tue Aug 6 23:47:53 2002 +++ xdvik-22.40n/texk/xdvik/xdvi-search.el Thu Sep 12 22:04:29 2002 @@ -6,7 +6,7 @@ ;;; This file is available from: http://xdvi.sourceforge.net/xdvi-search.el ;;; ;;; Preliminary test version, tested with Emacs 20.4 to 21.2 and Xemacs 21.1 -;;; $Id: xdvi-search.el,v 1.2.4.3 2002/08/06 23:47:53 stefanulrich Exp $ +;;; $Id: xdvi-search.el,v 1.2.4.4 2002/09/12 22:04:29 stefanulrich Exp $ ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License @@ -103,7 +103,7 @@ "See `xdvi-jump-to-line' for documentation." (xdvi-jump-to-line 2)) -(defun xdvi-jump-to-line (prefix) +(defun xdvi-jump-to-line (&optional prefix) "Call xdvi-script to perform a `forward search' for current file and line number. The script (and thus xdvi) obtains three pieces of information: @@ -162,11 +162,13 @@ prefix argument 3 (full path) or 2 (relative path). Without a prefix argument or with a prefix argument of 1, the default (filename only) is used." - (interactive "p") + (interactive "P") (save-excursion (save-restriction (widen) (beginning-of-line 1) + (if (not prefix) + (setq prefix 1)) (let* (;;; current line in file. ;;; count-lines yields different results at beginning and in the ;;; middle of a line, so we normalize by going to BOL first and @@ -197,7 +199,7 @@ ;;; buffer file name without path: (file-name-nondirectory (buffer-file-name))))) (call-process xdvi-script - nil t nil + nil 0 nil ;;; args for -sourceposition: ;;; Bug fix by Hans Fredrik Nordhaug , 2001/08/08: ;;; use `int-to-string curr-line' instead of 'curr-line' diff -Naur xdvik-22.40l/texk/xdvik/xdvi.c xdvik-22.40n/texk/xdvik/xdvi.c --- xdvik-22.40l/texk/xdvik/xdvi.c Sat Aug 31 16:43:23 2002 +++ xdvik-22.40n/texk/xdvik/xdvi.c Sat Sep 14 23:18:44 2002 @@ -1888,7 +1888,7 @@ * this routine and read by the displaying copy of xdvi. */ -static int XdviErrorHandler P2H(Display *, XErrorEvent *); +static int XdviErrorHandler(Display *, XErrorEvent *); static unsigned long xdvi_next_request = 0; static int xerrno; diff -Naur xdvik-22.40l/texk/xdvik/xdvi.h xdvik-22.40n/texk/xdvik/xdvi.h --- xdvik-22.40l/texk/xdvik/xdvi.h Sat Aug 31 16:43:23 2002 +++ xdvik-22.40n/texk/xdvik/xdvi.h Sat Sep 14 23:18:44 2002 @@ -184,74 +184,8 @@ # endif #endif -#ifndef NeedFunctionPrototypes -#if __STDC__ -#define NeedFunctionPrototypes 1 -#else /* STDC */ -#define NeedFunctionPrototypes 0 -#endif /* STDC */ -#endif /* NeedFunctionPrototypes */ - -#if NeedFunctionPrototypes +/* only use definitions with prototypes now */ #define ARGS(x) x -#else -#define ARGS(x) () -#endif - -#ifndef KPATHSEA - -/* These macros munge function declarations to make them work in both - cases. The P?H macros are used for declarations, the P?C for - definitions. See from the GNU C library. P1H(void) - also works for definitions of routines which take no args. */ - -#if NeedFunctionPrototypes /* Don't use __STDC__ here (gcc + SunOS 4) */ - -#define P1H(p1) (p1) -#define P2H(p1,p2) (p1, p2) -#define P3H(p1,p2,p3) (p1, p2, p3) -#define P4H(p1,p2,p3,p4) (p1, p2, p3, p4) -#define P5H(p1,p2,p3,p4,p5) (p1, p2, p3, p4, p5) -#define P6H(p1,p2,p3,p4,p5,p6) (p1, p2, p3, p4, p5, p6) -#define P7H(p1,p2,p3,p4,p5,p6,p7) (p1, p2, p3, p4, p5, p6,p7) - -#define P1C(t1,n1)(t1 n1) -#define P2C(t1,n1, t2,n2) (t1 n1, t2 n2) -#define P3C(t1,n1, t2,n2, t3,n3)(t1 n1, t2 n2, t3 n3) -#define P4C(t1,n1, t2,n2, t3,n3, t4,n4) (t1 n1, t2 n2, t3 n3, t4 n4) -#define P5C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5) \ - (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5) -#define P6C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6) \ - (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5, t6 n6) -#define P7C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6, t7,n7) \ - (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5, t6 n6, t7,n7) - -#else /* not NeedFunctionPrototypes */ - -#define P1H(p1) () -#define P2H(p1, p2) () -#define P3H(p1, p2, p3) () -#define P4H(p1,p2,p3,p4) () -#define P5H(p1, p2, p3, p4, p5) () -#define P6H(p1, p2, p3, p4, p5, p6) () -#define P6H(p1, p2, p3, p4, p5, p6, p7) () - -#define P1C(t1,n1) (n1) t1 n1; -#define P2C(t1,n1, t2,n2) (n1,n2) t1 n1; t2 n2; -#define P3C(t1,n1, t2,n2, t3,n3) (n1,n2,n3) t1 n1; t2 n2; t3 n3; -#define P4C(t1,n1, t2,n2, t3,n3, t4,n4) (n1,n2,n3,n4) \ - t1 n1; t2 n2; t3 n3; t4 n4; -#define P5C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5) (n1,n2,n3,n4,n5) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; -#define P6C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6) (n1,n2,n3,n4,n5,n6) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; -#define P7C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6, t7,n7) \ - (n1,n2,n3,n4,n5,n6,n7) \ - t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7,n7; - -#endif /* not NeedFunctionPrototypes */ - -#endif /* not KPATHSEA */ #ifndef NeedWidePrototypes #define NeedWidePrototypes NeedFunctionPrototypes @@ -1125,7 +1059,7 @@ extern long set_char ARGS((wide_ubyte)); extern long load_n_set_char ARGS((wide_ubyte)); extern long set_vf_char ARGS((wide_ubyte)); -extern long set_t1_char P1H(wide_ubyte); +extern long set_t1_char ARGS((wide_ubyte)); #else /* TEXXET */ extern void set_char ARGS((wide_ubyte, wide_ubyte)); extern void load_n_set_char ARGS((wide_ubyte, wide_ubyte)); @@ -1243,7 +1177,7 @@ extern int pointerlocate ARGS((int *, int *)); #ifdef HTEX -char *urlocalize P1H(char *filename); +char *urlocalize ARGS((char *filename)); extern int lastwwwopen; EXTERN Boolean URL_aware INIT(False); diff -Naur xdvik-22.40l/withenable.ac xdvik-22.40n/withenable.ac --- xdvik-22.40l/withenable.ac Wed Apr 18 14:23:08 2001 +++ xdvik-22.40n/withenable.ac Sun Sep 15 15:14:13 2002 @@ -1,8 +1,10 @@ -AC_ARG_WITH(texinfo, - [ --without-texinfo do not build the texinfo package]) +dnl All these are only applicable for teTeX, not for the xdvik module. -AC_ARG_WITH(dialog, - [ --without-dialog do not build the dialog package]) - -AC_ARG_WITH(t1utils, - [ --without-t1utils do not build the t1utils package]) +dnl AC_ARG_WITH(texinfo, +dnl [ --without-texinfo do not build the texinfo package]) +dnl +dnl AC_ARG_WITH(dialog, +dnl [ --without-dialog do not build the dialog package]) +dnl +dnl AC_ARG_WITH(t1utils, +dnl [ --without-t1utils do not build the t1utils package])