diff options
author | Karl Berry <karl@freefriends.org> | 2006-12-06 01:23:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-12-06 01:23:33 +0000 |
commit | 3b0d4121fbdaa8b4dc48c1aeab08bd63d71d0307 (patch) | |
tree | c0e71b65ec445e74e995d7853a367aa30e50f0dd /Build/source | |
parent | ee72c8e218febb4e5e2395951e36cd91b36aabcd (diff) |
tex4ht-1.0.2006_12_04_1651
git-svn-id: svn://tug.org/texlive/trunk@2598 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rwxr-xr-x | Build/source/texk/tex4htk/htcontext | 4 | ||||
-rwxr-xr-x | Build/source/texk/tex4htk/htlatex | 2 | ||||
-rwxr-xr-x | Build/source/texk/tex4htk/htmex | 2 | ||||
-rwxr-xr-x | Build/source/texk/tex4htk/httex | 2 | ||||
-rwxr-xr-x | Build/source/texk/tex4htk/httexi | 2 | ||||
-rwxr-xr-x | Build/source/texk/tex4htk/mk4ht | 265 | ||||
-rw-r--r-- | Build/source/texk/tex4htk/t4ht.c | 162 | ||||
-rw-r--r-- | Build/source/texk/tex4htk/tex4ht.c | 466 |
8 files changed, 723 insertions, 182 deletions
diff --git a/Build/source/texk/tex4htk/htcontext b/Build/source/texk/tex4htk/htcontext index 190ac31f862..9d6d4549574 100755 --- a/Build/source/texk/tex4htk/htcontext +++ b/Build/source/texk/tex4htk/htcontext @@ -1,7 +1,7 @@ #!/bin/sh - texexec --arg="opt-arg=$2" --use=tex4ht $5 $1 + texexec --arg="ht-1=$2" --use=tex4ht $5 $1 tex4ht -f/$1 -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3 - t4ht -f/$1 $4 -cvalidatehtml ## -d~/WWW/temp/ -m644 + t4ht -f/$1 $4 ## -d~/WWW/temp/ -m644 diff --git a/Build/source/texk/tex4htk/htlatex b/Build/source/texk/tex4htk/htlatex index 04713bb7794..1b8b7cea74a 100755 --- a/Build/source/texk/tex4htk/htlatex +++ b/Build/source/texk/tex4htk/htlatex @@ -3,7 +3,7 @@ latex $5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input ' $1 latex $5 '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\g@addto@macro\@documentclasshook{\RequirePackage[#1,html]{tex4ht}}\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}}\makeatother\HCode '$2'.a.b.c.\input ' $1 tex4ht -f/$1 -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3 - t4ht -f/$1 $4 -cvalidatehtml ## -d~/WWW/temp/ -m644 + t4ht -f/$1 $4 ## -d~/WWW/temp/ -m644 diff --git a/Build/source/texk/tex4htk/htmex b/Build/source/texk/tex4htk/htmex index 7e34ac6d523..b4aa3d9a06e 100755 --- a/Build/source/texk/tex4htk/htmex +++ b/Build/source/texk/tex4htk/htmex @@ -3,7 +3,7 @@ mex $5 '\def\Link#1.a.b.c.{\expandafter\def\csname tex4ht\endcsname{\expandafter\def\csname tex4ht\endcsname{#1,html}\input tex4ht.sty }}\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\HCode '$2'.a.b.c.\input ' $1 mex $5 '\def\Link#1.a.b.c.{\expandafter\def\csname tex4ht\endcsname{\expandafter\def\csname tex4ht\endcsname{#1,html}\input tex4ht.sty }}\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\HCode '$2'.a.b.c.\input ' $1 tex4ht -f/$1 -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3 - t4ht -f/$1 $4 -cvalidatehtml ## -d~/WWW/temp/ -m644 + t4ht -f/$1 $4 ## -d~/WWW/temp/ -m644 diff --git a/Build/source/texk/tex4htk/httex b/Build/source/texk/tex4htk/httex index 1fdf5f3d940..44920e72077 100755 --- a/Build/source/texk/tex4htk/httex +++ b/Build/source/texk/tex4htk/httex @@ -3,7 +3,7 @@ tex $5 '\def\Link#1.a.b.c.{\expandafter\def\csname tex4ht\endcsname{\expandafter\def\csname tex4ht\endcsname{#1,html}\input tex4ht.sty }}\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\HCode '$2'.a.b.c.\input ' $1 tex $5 '\def\Link#1.a.b.c.{\expandafter\def\csname tex4ht\endcsname{\expandafter\def\csname tex4ht\endcsname{#1,html}\input tex4ht.sty }}\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\HCode '$2'.a.b.c.\input ' $1 tex4ht -f/$1 -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3 - t4ht -f/$1 $4 -cvalidatehtml ## -d~/WWW/temp/ -m644 + t4ht -f/$1 $4 ## -d~/WWW/temp/ -m644 diff --git a/Build/source/texk/tex4htk/httexi b/Build/source/texk/tex4htk/httexi index b3d841ed9a3..0ce3cb4a589 100755 --- a/Build/source/texk/tex4htk/httexi +++ b/Build/source/texk/tex4htk/httexi @@ -3,7 +3,7 @@ tex $5 '\def\Link#1.a.b.c.{\expandafter\def\csname tex4ht\endcsname{\expandafter\def\csname tex4ht\endcsname{#1,html}\input tex4ht.sty }}\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\let\svrm=\rm\def\rm{\svrm\ifx\c\comment\def\rm{\let\rm=\svrm\catcode`\@=12\catcode`\\=0 \csname tex4ht\endcsname\catcode`\@=0\catcode`\\=13 }\expandafter\rm\fi}\HCode '$2'.a.b.c.\input ' $1 tex $5 '\def\Link#1.a.b.c.{\expandafter\def\csname tex4ht\endcsname{\expandafter\def\csname tex4ht\endcsname{#1,html}\input tex4ht.sty }}\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\let\svrm=\rm\def\rm{\svrm\ifx\c\comment\def\rm{\let\rm=\svrm\catcode`\@=12\catcode`\\=0 \csname tex4ht\endcsname\catcode`\@=0\catcode`\\=13 }\expandafter\rm\fi}\HCode '$2'.a.b.c.\input ' $1 tex4ht -f/$1 -i~/tex4ht.dir/texmf/tex4ht/ht-fonts/$3 - t4ht -f/$1 $4 -cvalidatehtml ## -d~/WWW/temp/ -m644 + t4ht -f/$1 $4 ## -d~/WWW/temp/ -m644 # texindex ? diff --git a/Build/source/texk/tex4htk/mk4ht b/Build/source/texk/tex4htk/mk4ht index 019d9cfc7c8..0f4b664506c 100755 --- a/Build/source/texk/tex4htk/mk4ht +++ b/Build/source/texk/tex4htk/mk4ht @@ -1,7 +1,7 @@ #!/usr/bin/env perl #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -# mk4ht 2005-09-23-22:09 % -# Copyright (C) 2003--2005 Eitan M. Gurari % +# mk4ht 2006-08-28-20:45 % +# Copyright (C) 2003--2006 Eitan M. Gurari % # % # % # This work may be distributed and/or modified under the % @@ -29,56 +29,72 @@ my @options = ( "ht", "htlatex", "latex", "", "", "-cvalidatehtml", "ht", "httex", "tex", "", "", "-cvalidatehtml", "ht", "httexi", "texi", "", "", "-cvalidatehtml", - "ht", "htcontext", "texexec", "", "", "-cvalidatehtml", + "ht", "htcontext", "context", "", "", "-cvalidatehtml", + "xh", "xhlatex", "latex", "xhtml", "", "-cvalidate", + "xh", "xhtex", "tex", "xhtml", "", "-cvalidate", + "xh", "xhtexi", "texi", "xhtml", "", "-cvalidate", + "xh", "xhcontext","context", "xhtml", "", "-cvalidat", "uxh", "uxhlatex", "latex", "xhtml,uni-html4", " -cunihtf", "-cvalidate", "uxh", "uxhtex", "tex", "xhtml,uni-html4", " -cunihtf", "-cvalidate", "uxh", "uxhtexi", "texi", "xhtml,uni-html4", " -cunihtf", "-cvalidate", - "uxh", "uxhcontext","texexec", "xhtml,uni-html4", " -cunihtf", "-cvalidate", + "uxh", "uxhcontext","context", "xhtml,uni-html4", " -cunihtf", "-cvalidate", "xhm", "xhmlatex", "latex", "xhtml,mathml", " -cunihtf", "-cvalidate", "xhm", "xhmtex", "tex", "xhtml,mathml", " -cunihtf", "-cvalidate", "xhm", "xhmtexi", "texi", "xhtml,mathml", " -cunihtf", "-cvalidate", - "xhm", "xhmcontext","texexec", "xhtml,mathml", " -cunihtf", "-cvalidate", + "xhm", "xhmcontext","context", "xhtml,mathml", " -cunihtf", "-cvalidate", "mz", "mzlatex", "latex", "xhtml,mozilla", " -cmozhtf", "-cvalidate", "mz", "mztex", "tex", "xhtml,mozilla", " -cmozhtf", "-cvalidate", "mz", "mztexi", "texi", "xhtml,mozilla", " -cmozhtf", "-cvalidate", - "mz", "mzcontext", "texexec", "xhtml,mozilla", " -cmozhtf", "-cvalidate", - "oo", "oolatex", "latex", "xhtml,ooffice", "ooffice/\! -cmozhtf", "-coo -cvalidate", - "oo", "ootex", "tex", "xhtml,ooffice", "ooffice/\! -cmozhtf", "-coo -cvalidate", - "oo", "ootexi", "texi", "xhtml,ooffice", "ooffice/\! -cmozhtf", "-coo -cvalidate", - "oo", "oocontext", "texexec", "xhtml,ooffice", "ooffice/\! -cmozhtf", "-coo -cvalidate", + "mz", "mzcontext", "context", "xhtml,mozilla", " -cmozhtf", "-cvalidate", + "oo", "oolatex", "latex", "xhtml,ooffice", "ooffice/\! -cmozhtf", "-cooxtpipes -coo", + "oo", "ootex", "tex", "xhtml,ooffice", "ooffice/\! -cmozhtf", "-cooxtpipes -coo", + "oo", "ootexi", "texi", "xhtml,ooffice", "ooffice/\! -cmozhtf", "-cooxtpipes -coo", + "oo", "oocontext", "context", "xhtml,ooffice", "ooffice/\! -cmozhtf", "-cooxtpipes -coo", + "es", "eslatex", "latex", "xhtml,emspk", " -cemspkhtf -s4es", "-cemspk", + "es", "estex", "tex", "xhtml,emspk", " -cemspkhtf -s4es", "-cemspk", + "es", "estexi", "texi", "xhtml,emspk", " -cemspkhtf -s4es", "-cemspk", + "es", "escontext", "context", "xhtml,emspk", " -cemspkhtf -s4es", "-cemspk", + "js", "jslatex", "latex", "xhtml,jsml", " -cjsmlhtf", "-cjsml", + "js", "jstex", "tex", "xhtml,jsml", " -cjsmlhtf", "-cjsml", + "js", "jstexi", "texi", "xhtml,jsml", " -cjsmlhtf", "-cjsml", + "js", "jscontext", "context", "xhtml,jsml", " -cjsmlhtf", "-cjsml", "tei", "teilatex", "latex", "xhtml,tei", " -cunihtf", "-cvalidate", "tei", "teitex", "tex", "xhtml,tei", " -cunihtf", "-cvalidate", "tei", "teitexi", "texi", "xhtml,tei", " -cunihtf", "-cvalidate", - "tei", "teicontext","texexec", "xhtml,tei", " -cunihtf", "-cvalidate", + "tei", "teicontext","context", "xhtml,tei", " -cunihtf", "-cvalidate", "teim", "teimlatex", "latex", "xhtml,tei-mml"," -cunihtf", "-cvalidate", "teim", "teimtex", "tex", "xhtml,tei-mml"," -cunihtf", "-cvalidate", "teim", "teimtexi", "texi", "xhtml,tei-mml"," -cunihtf", "-cvalidate", - "teim", "teimcontext","texexec","xhtml,tei-mml"," -cunihtf", "-cvalidate", - "db", "dblatex", "latex", "xhtml,docbook", " -cunihtf", "-cvalidate", - "db", "dbtex", "tex", "xhtml,docbook", " -cunihtf", "-cvalidate", - "db", "dbtexi", "texi", "xhtml,docbook", " -cunihtf", "-cvalidate", - "db", "dbcontext", "texexec", "xhtml,docbook", " -cunihtf", "-cvalidate", - "dbm", "dbmlatex", "latex", "xhtml,docbook-mml", " -cunihtf", "-cvalidate", - "dbm", "dbmtex", "tex", "xhtml,docbook-mml", " -cunihtf", "-cvalidate", - "dbm", "dbmtexi", "texi", "xhtml,docbook-mml", " -cunihtf", "-cvalidate", - "dbm", "dbmcontext","texexec", "xhtml,docbook-mml", " -cunihtf", "-cvalidate", + "teim", "teimcontext","context","xhtml,tei-mml"," -cunihtf", "-cvalidate", + "db", "dblatex", "latex", "xhtml,docbook", " -cunihtf", "-cvalidate -cdocbk", + "db", "dbtex", "tex", "xhtml,docbook", " -cunihtf", "-cvalidate -cdocbk", + "db", "dbtexi", "texi", "xhtml,docbook", " -cunihtf", "-cvalidate -cdocbk", + "db", "dbcontext", "context", "xhtml,docbook", " -cunihtf", "-cvalidate -cdocbk", + "dbm", "dbmlatex", "latex", "xhtml,docbook-mml", " -cunihtf", "-cdocbk", + "dbm", "dbmtex", "tex", "xhtml,docbook-mml", " -cunihtf", "-cdocbk", + "dbm", "dbmtexi", "texi", "xhtml,docbook-mml", " -cunihtf", "-cdocbk", + "dbm", "dbmcontext","context", "xhtml,docbook-mml", " -cunihtf", "-cdocbk", "w", "wlatex", "latex", "xhtml,word", " -csymhtf", "", "w", "wtex", "tex", "xhtml,word", " -csymhtf", "", "w", "wtexi", "texi", "xhtml,word", " -csymhtf", "", - "w", "wcontext", "texexec", "xhtml,word", " -csymhtf", "", - "jh", "jhlatex", "latex", "html,javahelp,3.2,unicode,jh1.0", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp -cvalidate", - "jh", "jhtex", "tex", "html,javahelp,3.2,unicode,jh1.0", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp -cvalidate", - "jh", "jhtexi", "texi", "html,javahelp,3.2,unicode,jh1.0", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp -cvalidate", - "jh", "jhcontext","texexec", "html,javahelp,3.2,unicode,jh1.0", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp -cvalidate", + "w", "wcontext", "context", "xhtml,word", " -csymhtf", "", + "jh", "jhlatex", "latex", "html,javahelp,3.2,unicode", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp -cvalidatehtml", + "jh", "jhtex", "tex", "html,javahelp,3.2,unicode", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp -cvalidatehtml", + "jh", "jhtexi", "texi", "html,javahelp,3.2,unicode", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp -cvalidatehtml", + "jh", "jhcontext","context", "html,javahelp,3.2,unicode", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp -cvalidatehtml", + "jh1", "jh1latex", "latex", "html,javahelp,3.2,unicode,jh1.0", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp", + "jh1", "jh1tex", "tex", "html,javahelp,3.2,unicode,jh1.0", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp", + "jh1", "jh1texi", "texi", "html,javahelp,3.2,unicode,jh1.0", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp", + "jh1", "jh1context","context", "html,javahelp,3.2,unicode,jh1.0", " -cmozhtf -u10", " -d%1-doc/ -cjavahelp", ); sub showInstrucions(){ print " option1: mk4ht #1 \"#2\" \"#3\" \"#4\" \"#5\"\n"; print " \n"; - print " #1: htlatex, mzlatex, oolatex, dblatex, dbmlatex,\n"; - print " teilatex, teimlatex, uxhlatex, wlatex, xhlatex,\n"; - print " xhmlatex\n"; + print " #1: htlatex, xhlatex, mzlatex, oolatex, dblatex, dbmlatex,\n"; + print " jhlatex, eslatex, teilatex, teimlatex, uxhlatex, \n"; + print " wlatex, xhmlatex\n"; print " \n"; print " also 'tex', 'texi', and 'context' instead of 'latex'\n"; print " \n"; @@ -99,9 +115,70 @@ sub showInstrucions(){ print " variable, the requests for the commands \"latex\",\n"; print " \"tex\", etc. can be replaced with other equivalent\n"; print " commands (e.g., \"tex -fmt=latex\").\n"; + + print "--------------------------------------------------------------------------\n"; +print " Private configuration file: mk4ht.cfg\n"; +print "--------------------------------------------------------------------------\n"; +print "\n"; +print "A private configuration file mk4ht.cfg or .mk4ht may be placed at the\n"; +print "work or home directory, to update existing commands and introduce new\n"; +print "ones. The configuration file may contain records of the following\n"; +print "kinds.\n"; +print "\n"; +print " # Comment\n"; +print " \n"; +print " name = type\n"; +print " Defines a ht*tex like command, and assocites to it the \n"; +print " TeX compiler of the specified type. Examples of TeX \n"; +print " types: latex, tex, texi, and context.\n"; +print " \n"; +print " name.tex = options\n"; +print " Command line options for the compilation under\n"; +print " the (la)tex compiler\n"; +print " \n"; +print " name.tex4ht = options\n"; +print " Command line options for tex4ht.c \n"; +print " \n"; +print " name.t4ht = options\n"; +print " Command line options for t4ht.c\n"; +print " \n"; +print "Each record should appear in a different line. Variants\n"; +print "`name.tex += options', `name.tex4ht += options',\n"; +print "`name.t4ht += options' of the above records are also allowed.\n"; +print "They append the listed options to the base values.\n"; +print "\n"; +print "Example:\n"; +print "\n"; +print " foohlatex = latex\n"; +print " foohlatex.tex = xhtml,uni-html4\n"; +print " foohlatex.tex4ht += -cunihtf\n"; +print " foohlatex.t4ht = -cvalidate\n"; +print " htlatex.t4ht += -d./\n"; + + + print "--------------------------------------------------------------------------\n"; +print " Deleting files\n"; +print "--------------------------------------------------------------------------\n"; +print "\n"; +print "The configuration file mk4ht.cfg may also contain requests for\n"; +print "removing files created in the work directory during the compilation.\n"; +print "The requests are to be made through records of the following forms.\n"; +print "\n"; +print " clean ext1 ext2 ...\n"; +print " The extensions of the file name to be removed.\n"; +print " \n"; +print " clean.name ext1 ext2 ...\n"; +print " Conditional request. The `name' refers to the ht*tex \n"; +print " like command in use.\n"; +print "\n"; +print "Example:\n"; +print " clean dvi idv\n"; +print " clean.foohlatex lg \n"; +print " clean.htlatex lg tmp\n"; + } -print "mk4ht (2005-09-23-22:09)\n"; +print "mk4ht (2006-08-28-20:45)\n"; if( !@ARGV ){ print "improper command\n"; showInstrucions(); exit(1); @@ -110,22 +187,118 @@ my @command=("","","","",""); my $i=0; my $j=0; my $param; +my $name; +my $compiler; +my $tex; +my $tex4ht; +my $t4ht; +my $texp; +my $tex4htp = ""; +my $t4htp = ""; +my @ext; + foreach $param (@ARGV) { if( $i == 0 ){ + my $inf; +open $inf, "<mk4ht.cfg" +or +( open $inf, "<.mk4ht" + or + ( + open $inf, "<" . $ENV{HOME} . "/mk4ht.cfg" + or + ( + open $inf, "<" . $ENV{HOME} . "/.mk4ht" + or $inf = "" +) ) ) +; + +if( $inf ){ + print "(mk4ht cfg)\n"; + while(<$inf>) { + my($line) = $_; + chomp($line); # remove eoln char + if ($line =~ m|\s*#.*|) {} + elsif($line =~ m|^\s*(\S*)\.(\S*)\s*\+=\s*(.*\S)\s*$|) { + if( ($param."tex4ht") eq ($1.$2) ){ + $tex4htp = $tex4htp . " " . $3; + } + elsif( ($param."t4ht") eq ($1.$2) ){ + $t4htp = $t4htp . " " . $3; + } + elsif( ($param."tex") eq ($1.$2) ){ + $texp = $texp . "," . $3; + } + } + elsif($line =~ m|^\s*(\S*)\.(\S*)\s*=\s*(.*\S)\s*$|) { + if( ($param."tex4ht") eq ($1.$2) ){ + $tex4ht = $3 . " "; + $tex4htp = ""; + } + elsif( ($param."t4ht") eq ($1.$2) ){ + $t4ht = $3 . " "; + $t4htp = ""; + } + elsif( ($param."tex") eq ($1.$2) ){ + $tex = $3 . ","; + $texp = ""; + } + } + elsif($line =~ m|^\s*(\S*)\s*=\s*(.*\S)\s*$|) { + if( $param eq $1 ){ + $name = $1; + $compiler = $2; + } + } + elsif($line =~ m|^\s*clean\s+(.+)|){ + my(@array) = split(' ',$1); + push(@ext,@array); +} elsif($line =~ m|^\s*clean\.(\S+)\s+(.+)|){ + if( $1 eq @ARGV[0] ){ + my(@array) = split(' ',$2); + push(@ext,@array); +} } + + elsif ($line) { print "--- Error --- " . $line . "\n"; } + } + close $inf; +} + for( $j=1; $j<$#options; $j+=6 ){ if( $param eq $options[$j] ){ - if( $options[$j-1] eq "" ){ - $command[0] = $options[$j]; + if( $name ){ + $command[0] = "ht".$compiler; +if( $tex ){ $command[2] = $tex; } else { $command[2] = ""; } +if( $tex4ht ){ $command[3] = $tex4ht; } else { $command[3] = ""; } +if( $t4ht ){ $command[4] = $t4ht; } else { $command[4] = ""; } + } else { - $command[0] = "ht".$options[$j+1]; + if( $options[$j-1] eq "" ){ + $command[0] = $options[$j]; +} else { + $command[0] = "ht".$options[$j+1]; +} +if( $tex ){ $command[2] = $tex; } else { $command[2] = $options[$j+2]; } +if( $tex4ht ){ $command[3] = $tex4ht; } else { $command[3] = $options[$j+3]; } +if( $t4ht ){ $command[4] = $t4ht; } else { $command[4] = $options[$j+4]; } + } - $command[2] = $options[$j+2]; - $command[3] = $options[$j+3]; - $command[4] = $options[$j+4]; + if( $texp ){ $command[2] = $command[2] . "," . $texp; } +if( $tex4htp){ $command[3] = $command[3] . " " . $tex4htp; } +if( $t4htp ){ $command[4] = $command[4] . " " . $t4htp; } + last; } } - if( $j>$#options ){ print "improper command: $param \n"; - showInstrucions(); exit(1); } + if( $j>$#options ){ + if( $name ){ $command[0] = "ht".$compiler; +if( $tex ){ $command[2] = $tex; } else { $command[2] = ""; } +if( $tex4ht ){ $command[3] = $tex4ht; } else { $command[3] = ""; } +if( $t4ht ){ $command[4] = $t4ht; } else { $command[4] = ""; } + } + else { + print "improper command: $param \n"; + showInstrucions(); exit(1); + } } } elsif ( $i== 1 ) { $command[1] = $param; } elsif ( $i== 2 ) { @@ -148,6 +321,22 @@ print "$commando\n"; my $rtrn; if( $rtrn = system($commando) ){ print "--- error --- failed to execute command\n"; -} else { exit( !$rtrn ); } +} else { + my $file; +my $ext; +my(@array) = split('\.',@ARGV[1]); +my $texFile = @array[0]; +opendir(DIR,".") ; +while ($file = readdir(DIR) ){ + if(index($file,$texFile) == 0 ){ + foreach $ext(@ext){ + if (index($file,$ext,length($file)-length($ext)) != -1){ + if( stat($file)){ + unlink($file); + print "Deleted: ". $file . "\n"; +} } } } } +closedir(DIR); + exit( !$rtrn ); +} diff --git a/Build/source/texk/tex4htk/t4ht.c b/Build/source/texk/tex4htk/t4ht.c index a7245202f85..f2c9032bdde 100644 --- a/Build/source/texk/tex4htk/t4ht.c +++ b/Build/source/texk/tex4htk/t4ht.c @@ -1,7 +1,7 @@ /**********************************************************/ -/* t4ht.c 2005-08-04-07:03 */ -/* Copyright (C) 1998--2005 Eitan M. Gurari */ +/* t4ht.c 2006-09-13-14:28 */ +/* Copyright (C) 1998--2006 Eitan M. Gurari */ /* */ /* This work may be distributed and/or modified under the */ /* conditions of the LaTeX Project Public License, either */ @@ -296,12 +296,6 @@ #endif -struct htf_struct{ - Q_CHAR *key, *body; - struct htf_struct *next; -}; - - struct empty_pic_struct{ long int n; struct empty_pic_struct *next; @@ -341,6 +335,12 @@ struct sys_call_rec{ }; +struct htf_struct{ + Q_CHAR *key, *body, *media; + struct htf_struct *next; +}; + + struct script_struct{ Q_CHAR *command; struct script_struct *next; @@ -395,9 +395,6 @@ static Q_CHAR *noreuse = Q_NULL; U_CHAR *HOME_DIR; -static struct htf_struct *htf_rec = (struct htf_struct *) 0; - - static struct env_c_rec *envChoice = (struct env_c_rec*) 0; @@ -406,6 +403,9 @@ static BOOL system_yes; static struct sys_call_rec *system_calls = (struct sys_call_rec *) 0; +static struct htf_struct *htf_rec = (struct htf_struct *) 0; + + static BOOL status; @@ -435,9 +435,6 @@ static FILE* lg_file; static long begin_lg_file; -static C_CHAR warning[] = "--- warning --- "; - - static C_CHAR *warn_err_mssg[]={ "\n--------------------------------------------------------------------\n" @@ -1065,7 +1062,7 @@ static void warn_i_str ; #undef SEP #endif -{ (IGNORED) fprintf(stderr,warning); +{ (IGNORED) fprintf(stderr,"--- warning --- "); (IGNORED) fprintf(stderr,warn_err_mssg[n], str); } @@ -1428,15 +1425,15 @@ SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigint_handler, TRUE); (IGNORED) printf("----------------------------\n"); #ifndef KPATHSEA #ifdef PLATFORM - (IGNORED) printf("t4ht.c (2005-08-04-07:03 %s)\n",PLATFORM); + (IGNORED) printf("t4ht.c (2006-09-13-14:28 %s)\n",PLATFORM); #else - (IGNORED) printf("t4ht.c (2005-08-04-07:03)\n"); + (IGNORED) printf("t4ht.c (2006-09-13-14:28)\n"); #endif #else #ifdef PLATFORM - (IGNORED) printf("t4ht.c (2005-08-04-07:03 %s kpathsea)\n",PLATFORM); + (IGNORED) printf("t4ht.c (2006-09-13-14:28 %s kpathsea)\n",PLATFORM); #else - (IGNORED) printf("t4ht.c (2005-08-04-07:03 kpathsea)\n"); + (IGNORED) printf("t4ht.c (2006-09-13-14:28 kpathsea)\n"); #endif #endif @@ -1703,7 +1700,7 @@ if( dos_env_file ){ #ifdef KPATHSEA -if( !file ) { U_CHAR * envname; +if( !file ) { U_CHAR * envfile; char *arch, *p, str[256]; p = arch = (char *) kpse_var_value( "SELFAUTOLOC" ); @@ -1715,7 +1712,7 @@ while( *p != '\0' ){ } - envname = (char *) 0; + envfile = (char *) 0; if( arch ){ (IGNORED) sprintf(str,"%s%ctex4ht.env", arch+1, *arch); @@ -1723,24 +1720,43 @@ if( arch ){ (IGNORED) printf( "kpse_open_file (\"%s\", kpse_program_text_format)?\n", str ); } - envname= kpse_find_file (str, kpse_program_text_format, 0); + envfile= kpse_find_file (str, kpse_program_text_format, 0); } - if ( !envname ){ + if ( !envfile ){ if( debug ){ (IGNORED) printf( "kpse_open_file (\"tex4ht.env\", kpse_program_text_format)?\n"); } -envname= kpse_find_file ("tex4ht.env", kpse_program_text_format, 0); +envfile= kpse_find_file ("tex4ht.env", kpse_program_text_format, 0); } - if ( envname ){ - file = kpse_open_file (envname, kpse_program_text_format); - (IGNORED) printf("(%s)\n", envname); + if ( !envfile ){ +if( system("kpsewhich --progname=tex4ht tex4ht.env > tex4ht.tmp") == 0 ){ + +char fileaddr [256]; +int loc = 0; +FILE* file = f_open("tex4ht.tmp", READ_TEXT_FLAGS); +if( file ){ + while( (fileaddr[loc] = getc(file)) >=0 ){ + if( fileaddr[loc] == '\n' ){ fileaddr[loc] = '\0'; break; } + loc++; + } + (IGNORED) fclose(file); +} + + + envfile= kpse_find_file (fileaddr, kpse_program_text_format, 0); +} + + } + if ( envfile ){ + file = kpse_open_file (envfile, kpse_program_text_format); + (IGNORED) printf("(%s)\n", envfile); } if( debug && file ){ - (IGNORED) printf(".......Open kpathsea %s\n", envname); + (IGNORED) printf(".......Open kpathsea %s\n", envfile); } } if( debug ){ @@ -1967,7 +1983,7 @@ if( rec_op != No_op ){ } if( rec_op == No_op ){ - (IGNORED) fprintf(stderr,warning); + (IGNORED) fprintf(stderr,"--- warning --- "); (IGNORED) fprintf(stderr,"CopyTo: %s%s%s%s%s?\n", match[1], match[2], match[3], match[4], match[5]); } else { @@ -2098,7 +2114,7 @@ if( rec_op == Until_op ){ } if( p == (struct files_rec*) 0 ){ -(IGNORED) fprintf(stderr,"%sMissing `CopyTo From':\n", warning); +(IGNORED) fprintf(stderr,"%sMissing `CopyTo From':\n", "--- warning --- "); for( p = to_rec->down; p != (struct files_rec*) 0; p = p->down ){ (IGNORED) fprintf(stderr," %s %s%d %s\n", to_rec->name, p->op == From_op ? "From " : @@ -2250,17 +2266,37 @@ if( status ){ } } - if( status ){ Q_CHAR *key, *body; + if( status ){ Q_CHAR *key, *body, *media; body = key = match[1]; while( *body && (*body != ' ') ){ body++; } -if( *body == ' ' ){ *(body++) = '\0'; } +if( *body == ' ' ){ media = body; *(body++) = '\0'; } + +if( (int) strlen(body) > 6 ){ + if( (*(body) == '@') + && (*(body+1) == 'm') + && (*(body+2) == 'e') + && (*(body+3) == 'd') + && (*(body+4) == 'i') + && (*(body+5) == 'a') ) + { + body += 6; + while( *body == ' ' ){ body++; } + media = body; + while( (*body != ' ') && (*body != '\0') ){ body++; } + if( *body == ' ' ){ *(body++) = '\0'; } + while( *body == ' ' ){ body++; } +} } + + if( *body ){ if( *key ){ p = m_alloc(struct htf_struct, 1); p->next = (struct htf_struct *) 0; p->key = m_alloc(char, (int) strlen(key) + 1); (IGNORED) strcpy( p->key, key ); +p->media = m_alloc(char, (int) strlen(media) + 1); +(IGNORED) strcpy( p->media, media ); p->body = m_alloc(char, (int) strlen(body) + 1); (IGNORED) strcpy( p->body, body ); if( last_rec ){ @@ -2269,7 +2305,7 @@ if( last_rec ){ htf_rec = last_rec = p; } if( debug ){ - (IGNORED) printf(".......%s...%s\n", key, body); + (IGNORED) printf(".......%s...%s...%s\n", key, media, body); } } @@ -2628,14 +2664,6 @@ while( eoln_ch != EOF ) { p = match[4]; *(p + (int) strlen(p) - 2) = '\0'; -font_sty = htf_rec; -while ( font_sty ) { - if( eq_str(font_sty->key,match[1]) ){ break; } - font_sty = font_sty->next; -} - - - { Q_CHAR *p; second = (int) ( (int) get_long_int(match[3]) @@ -2651,7 +2679,11 @@ while ( font_sty ) { } - if( font_sty || (second != 100) ){ + +font_sty = htf_rec; +while ( font_sty ) { + if( eq_str(font_sty->key,match[1]) ){ + if( *(font_sty->media) == '\0' ){ (IGNORED) fprintf(css_file, (Font_css_base == NULL)? ".%s-%s" : Font_css_base, @@ -2671,7 +2703,51 @@ if( font_sty ) { (IGNORED) fprintf(css_file, "}\n"); -} } } + second = 100; + } else { + +(IGNORED) fprintf(css_file, "@media %s{", font_sty->media); +(IGNORED) fprintf(css_file, + (Font_css_base == NULL)? ".%s-%s" : Font_css_base, + match[1], match[2]); +if( !eq_str(match[4],"100") ){ + (IGNORED) fprintf(css_file, + (Font_css_mag == NULL)? "x-x-%s" : Font_css_mag, + match[4]); +} +(IGNORED) fprintf(css_file, "{"); +if( font_sty ) { + (IGNORED) fprintf(css_file, font_sty->body); +} +(IGNORED) fprintf(css_file, "}}\n"); + + + } + } + font_sty = font_sty->next; +} +if( second != 100 ){ +(IGNORED) fprintf(css_file, + (Font_css_base == NULL)? ".%s-%s" : Font_css_base, + match[1], match[2]); +if( !eq_str(match[4],"100") ){ + (IGNORED) fprintf(css_file, + (Font_css_mag == NULL)? "x-x-%s" : Font_css_mag, + match[4]); +} +(IGNORED) fprintf(css_file, "{"); +if( (second < 98) || (second > 102) ){ + (IGNORED) fprintf(css_file, "font-size:%d%c;", second, '%'); +} +if( font_sty ) { + (IGNORED) fprintf(css_file, font_sty->body); +} +(IGNORED) fprintf(css_file, "}\n"); + + } + + +} } diff --git a/Build/source/texk/tex4htk/tex4ht.c b/Build/source/texk/tex4htk/tex4ht.c index 619c6cff9e2..b3e17a976e7 100644 --- a/Build/source/texk/tex4htk/tex4ht.c +++ b/Build/source/texk/tex4htk/tex4ht.c @@ -1,7 +1,7 @@ /**********************************************************/ -/* tex4ht.c 2005-05-29-09:42 */ -/* Copyright (C) 1996--2005 Eitan M. Gurari */ +/* tex4ht.c 2006-09-13-14:27 */ +/* Copyright (C) 1996--2006 Eitan M. Gurari */ /* */ /* This work may be distributed and/or modified under the */ /* conditions of the LaTeX Project Public License, either */ @@ -523,8 +523,9 @@ struct ch_map_rec{ struct stack_entry{ long int x_val, y_val; INTEGER dx_1, dx_2, dy_1, dy_2; - BOOL text_on -, accented + BOOL text_on; + BOOL +accented ; @@ -640,6 +641,14 @@ struct gif_file_rec{ +struct css_ext_rec{ char* name; + struct css_ext_rec *next; }; + + +struct visited_file_rec{ char *name; + struct visited_file_rec *next; }; + + struct env_var_rec{ char* base; struct env_var_rec *next; }; @@ -722,9 +731,6 @@ static long int x_val = 0, max_x_val = -10000, max_y_val = 0, prev_y_val = 0; -static BOOL text_on = FALSE; - - static INTEGER dx_1 = 0, dx_2 = 0; @@ -741,6 +747,9 @@ static U_CHAR *space_str = (char *)0; static int ignore_chs=0, ignore_spaces=0, recover_spaces=0; +static BOOL text_on = FALSE; + + static U_CHAR rule_ch = '_'; static BOOL rule_ch_off @@ -1008,15 +1017,18 @@ static BOOL special_on = FALSE; static U_CHAR *warn_err_mssg[]={ -"improper command line\ntex4ht [-f<dir char>]in-file[.dvi]\n" +"improper command line\ntex4ht [-f<path-ch>]in-file[.dvi]\n" " [-c<tag name>] choose named segment in env file\n" " [-e<env-file>]\n" +" [-f<path-ch>] remove path from the file name\n" " [-g<bitmap-file-ext>]\n" " [-h(e|f|F|g|s|v|V)] trace: e-errors/warnings, f-htf, F-htf search\n" " g-groups, s-specials, v-env, V-env search\n" " [-i<htf-font-dir>]\n" " [-l<bookkeeping-file>]\n" " [-P(*|<filter>)] permission for system calls: *-always, filter\n" +" [-S<image-script>]\n" +" [-s<css-file-ext>] default: -s4cs; multiple entries allowed\n" " [-t<tfm-font-dir>]\n" " [-u10] base 10 for unicode characters\n" " [-utf8] utf-8 encoding for unicode characters\n" @@ -1086,9 +1098,6 @@ static U_CHAR *warn_err_mssg[]={ "" }; -static U_CHAR warning[] = "--- warning --- "; - - static BOOL err_context = FALSE; @@ -1672,8 +1681,16 @@ static INTEGER move_x i = (INTEGER) ( (double) (dx = x_val - max_x_val) / (text_on? word_sp : margin_sp) + 0.5 ); + +if( i==0 ){ + i = (INTEGER) ( (double) dx + / word_sp + + 0.5 ); +} + + if( i<0 ) i=0; -if( !i ){ +if( i==0 ){ long curr_pos; BOOL done; int ch, cr_fnt; @@ -1728,6 +1745,14 @@ word_sp = design_size_to_pt( font_tbl[cr_fnt].word_sp ) i = (INTEGER) ( (double) dx / (text_on? word_sp : margin_sp) + 0.5 ); + +if( i==0 ){ + i = (INTEGER) ( (double) dx + / word_sp + + 0.5 ); +} + + if( i>0 ){ i =1; } @@ -1776,10 +1801,12 @@ max_x_val = x_val; } else if( d && text_on && (x_val != max_x_val) ){ -i = (INTEGER) ( (double) (dx = d) / word_sp + 0.5 ); -if( i<0 ) i=0; -if( !i ) i = dx>99999L; -if( i ){ put_char(' '); } +if( !ignore_spaces ){ + i = (INTEGER) ( (double) (dx = d) / word_sp + 0.5 ); + if( i<0 ) i=0; + if( !i ) i = dx>99999L; + if( i ){ put_char(' '); } +} } @@ -1916,6 +1943,14 @@ if( (x_val + right) && i = (INTEGER) ( (double) (x_val + right - max_x_val) / (text_on? word_sp : margin_sp) + 0.5 ); + +if( i==0 ){ + i = (INTEGER) ( (double) (x_val + right - max_x_val) + / word_sp + + 0.5 ); +} + + if( i && !text_on ) try_new_line(); if( trace_dvi_R && !ch_map_flag ){ @@ -2766,7 +2801,7 @@ static void dump_htf ; #undef SEP #endif -{ int i, j, ch, chr; +{ int i, j, ch, chr=0; (IGNORED) fseek(file, 0L, 0); i=-1; j=0; while( (ch = getc(file)) != EOF ){ @@ -2886,7 +2921,7 @@ if( ( name == new_font_name ) && (n == 19) && (ch=='.') ){ i = i * 10 + ch - '0'; ch = get_html_ch(file); } if( i != bound ){ -(IGNORED) fprintf(stderr,warning); +(IGNORED) fprintf(stderr,"--- warning --- "); (IGNORED) fprintf(stderr,warn_err_mssg[22] , new_font_name, i, bound); show_err_context(); @@ -3063,9 +3098,11 @@ if( gif_file ){ } } -(IGNORED) printf("\nRenaming `%s____.png' to `%c%c%c%c____.png'\n", - str, xeh[(int)(ch[0])], xeh[(int)(ch[1])], - xeh[(int)(ch[2])], xeh[(int)(ch[3])]); +(IGNORED) printf("\nRenaming `%s____%s' to `%c%c%c%c____%s'\n", + str, gif, + xeh[(int)(ch[0])], xeh[(int)(ch[1])], + xeh[(int)(ch[2])], xeh[(int)(ch[3])] + , gif); p->name = m_alloc(char,m+1); (IGNORED) strcpy( p->name, str ); if( gif_file ){ p->next = gif_file->next; gif_file->next = p; } @@ -3335,7 +3372,7 @@ char *get_env_dir U_CHAR *p; if(! progname || ! *progname) return NULL; i = (int) strlen(progname); - while( (progname[--i] != dir_path_slash(progname) ) + while( (progname[--i] != (int) dir_path_slash(progname) ) && (i > 0) ) ; if(i == 0) return NULL; p = (char *) malloc(i+12); @@ -5564,7 +5601,7 @@ static void warn_i ; #undef SEP #endif -{ (IGNORED) fprintf(stderr,warning); +{ (IGNORED) fprintf(stderr,"--- warning --- "); (IGNORED) fprintf(stderr,warn_err_mssg[n]); show_err_context(); } @@ -5585,7 +5622,7 @@ static void warn_i_int ; #undef SEP #endif -{ (IGNORED) fprintf(stderr,warning); +{ (IGNORED) fprintf(stderr,"--- warning --- "); (IGNORED) fprintf(stderr, warn_err_mssg[n], i); show_err_context(); } @@ -5606,7 +5643,7 @@ static void warn_i_int_2 ; #undef SEP #endif -{ (IGNORED) fprintf(stderr,warning); +{ (IGNORED) fprintf(stderr,"--- warning --- "); (IGNORED) fprintf(stderr, warn_err_mssg[n], i, j); show_err_context(); } @@ -5631,7 +5668,8 @@ static void warn_i_str ; #undef SEP #endif -{ (IGNORED) fprintf(stderr,warning); +{ + (IGNORED) fprintf(stderr,"--- warning --- "); (IGNORED) fprintf(stderr,warn_err_mssg[n], str); show_err_context(); } @@ -5658,7 +5696,7 @@ static void warn_i_str2 ; #undef SEP #endif -{ (IGNORED) fprintf(stderr,warning); +{ (IGNORED) fprintf(stderr,"--- warning --- "); (IGNORED) fprintf(stderr,warn_err_mssg[n], str1,str2); show_err_context(); } @@ -5789,7 +5827,11 @@ long int eof_op_n, begin_postamble; int dis_pages; -int stack_id; +int stack_id=0; + + +static struct css_ext_rec * css_ext = (struct css_ext_rec *) 0; +static char css_default[] = "4cs"; BOOL in_accenting; @@ -5834,15 +5876,15 @@ SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigint_handler, TRUE); (IGNORED) printf("----------------------------\n"); #ifndef KPATHSEA #ifdef PLATFORM - (IGNORED) printf("tex4ht.c (2005-05-29-09:42 %s)\n",PLATFORM); + (IGNORED) printf("tex4ht.c (2006-09-13-14:27 %s)\n",PLATFORM); #else - (IGNORED) printf("tex4ht.c (2005-05-29-09:42)\n"); + (IGNORED) printf("tex4ht.c (2006-09-13-14:27)\n"); #endif #else #ifdef PLATFORM - (IGNORED) printf("tex4ht.c (2005-05-29-09:42 %s kpathsea)\n",PLATFORM); + (IGNORED) printf("tex4ht.c (2006-09-13-14:27 %s kpathsea)\n",PLATFORM); #else - (IGNORED) printf("tex4ht.c (2005-05-29-09:42 kpathsea)\n"); + (IGNORED) printf("tex4ht.c (2006-09-13-14:27 kpathsea)\n"); #endif #endif for(i=0; i<argc; i++){ @@ -6065,10 +6107,17 @@ tex4ht_fls_name = p+2; } break; } - case 's':{ + case 'S':{ font_gif = p+2; break; } + case 's':{ +struct css_ext_rec * css = m_alloc(struct css_ext_rec, 1);; +css->name = p + 2; +css->next = css_ext; +css_ext = css; + + break; } case 't':{ com_dir(p); fontdir[fontdir_count++] = p+2; @@ -6096,6 +6145,15 @@ switch( *(p+2) ){ else in_name = argv[i]; } +if( css_ext == (struct css_ext_rec *) 0 ){ + struct css_ext_rec * css = m_alloc(struct css_ext_rec, 1);; + css->name = css_default; + css->next = css_ext; + css_ext = css; +} + + + if( *in_name != '\0' ){ BOOL tag; job_name_n = (int) strlen( in_name ); @@ -6138,7 +6196,7 @@ if( (idv_file = fopen(job_name, WRITE_BIN_FLAGS)) == NULL ) { - U_CHAR *name; + U_CHAR *name=0; if( *out_name == '\0' ) { if( *in_name == '\0' ){ bad_arg; @@ -6266,7 +6324,7 @@ if( !dot_file && dos_env_file){ #ifdef KPATHSEA -if( !dot_file ) { U_CHAR * envname; +if( !dot_file ) { U_CHAR * envfile; char *arch, *p, str[256]; p = arch = (char *) kpse_var_value( "SELFAUTOLOC" ); @@ -6278,28 +6336,53 @@ while( *p != '\0' ){ } - envname = (char *) 0; + envfile = (char *) 0; if( arch ){ (IGNORED) sprintf(str,"%s%ctex4ht.env", arch+1, *arch); if( dump_env_search ){ (IGNORED) printf("kpse_open_file (\"%s\", ...)?\n", str ); } - envname= kpse_find_file (str, kpse_program_text_format, 0); + envfile= kpse_find_file (str, kpse_program_text_format, 0); } - if ( !envname ){ + if ( !envfile ){ if( dump_env_search ){ (IGNORED) printf("kpse_open_file (\"tex4ht.env\", ...)?\n"); } -envname= kpse_find_file ("tex4ht.env", kpse_program_text_format, 0); +envfile= kpse_find_file ("tex4ht.env", kpse_program_text_format, 0); + + } + if ( !envfile ){ +if( dump_env_search ){ + (IGNORED) printf("system(\"kpsewhich --progname=tex4ht tex4ht.env\")?\n"); +} +if( system("kpsewhich --progname=tex4ht tex4ht.env > tex4ht.tmp") == 0 ){ + +char fileaddr [256]; +int loc = 0; +FILE* file = f_open("tex4ht.tmp", READ_TEXT_FLAGS); +if( file ){ + while( (fileaddr[loc] = getc(file)) >=0 ){ + if( fileaddr[loc] == '\n' ){ fileaddr[loc] = '\0'; break; } + loc++; + } + (IGNORED) fclose(file); +} + + + envfile= kpse_find_file (fileaddr, kpse_program_text_format, 0); + if( envfile ){ + warn_i_str( 50, + "search support for kpse_find_file--unsing system kpsewhich calls instead"); +} } } - if ( envname ){ - dot_file = kpse_open_file (envname, + if ( envfile ){ + dot_file = kpse_open_file (envfile, kpse_program_text_format); - (IGNORED) printf("(%s)\n", envname); + (IGNORED) printf("(%s)\n", envfile); } else if( dump_env_search ){ p = (char *) kpse_var_value( "TEX4HTINPUTS" ); if( p ){ @@ -6586,7 +6669,10 @@ stack = m_alloc(struct stack_entry, ); { int i; - for( i=stack_len; i>=0; i--){ + for( i= +((int) stack_len + 2) + +-1; i>=0; i--){ stack[i].begin = (struct group_info *) 0; stack[i].end = (struct stack_end_entry *) 0; stack[i].stack_id = -1; @@ -6618,7 +6704,11 @@ unread_pages = (int) get_unt(2); { int fonts_n; -struct html_font_rec *html_font; +struct html_font_rec *html_font=0; + + +struct visited_file_rec * visited_file = + (struct visited_file_rec *) 0; struct env_var_rec *tfm_dirs, *htf_dirs; @@ -6627,8 +6717,8 @@ struct env_var_rec *tfm_dirs, *htf_dirs; #ifdef KPATHSEA -int cardinality; -char ** fontset; +int cardinality=0; +char ** fontset=0; #endif @@ -7013,7 +7103,8 @@ if( (font_tbl_size + 1) < MAXFONTS ) int font_name_n; font_tbl = font_tbl_size? (struct font_entry *) r_alloc((void *) font_tbl, - (size_t) ((font_tbl_size+1)*sizeof(struct font_entry))) + (size_t) ((font_tbl_size+1) + * sizeof(struct font_entry))) : m_alloc(struct font_entry, 1); switch( ch ){ @@ -7069,11 +7160,34 @@ switch( ch ){ #ifdef KPATHSEA { - U_CHAR * tfmname; - tfmname = kpse_find_file (file_name, kpse_tfm_format, 0); - if ( tfmname ){ - (IGNORED) printf("(%s)\n", tfmname); - font_file = kpse_open_file (tfmname, kpse_tfm_format); + U_CHAR * tfmfile; + tfmfile = kpse_find_file (file_name, kpse_tfm_format, 0); + if( !tfmfile ){ +char s [256]; +(IGNORED) strcpy(s, "kpsewhich "); +(IGNORED) strcat(s,file_name); +(IGNORED) strcat(s, " > tex4ht.tmp "); +if( system(s) == 0 ){ + +char fileaddr [256]; +int loc = 0; +FILE* file = f_open("tex4ht.tmp", READ_TEXT_FLAGS); +if( file ){ + while( (fileaddr[loc] = getc(file)) >=0 ){ + if( fileaddr[loc] == '\n' ){ fileaddr[loc] = '\0'; break; } + loc++; + } + (IGNORED) fclose(file); +} + + + tfmfile = kpse_find_file (fileaddr, kpse_program_text_format, 0); +} + + } + if ( tfmfile ){ + (IGNORED) printf("(%s)\n", tfmfile); + font_file = kpse_open_file (tfmfile, kpse_tfm_format); } } #else @@ -7400,8 +7514,10 @@ for( i = new_font.char_f; i <= new_font.char_l ; i++ ){ new_font.str[0] = &null_str; design_n = 0; -while( 1 ){ BOOL flag; - +{ char search_font_name [256]; + (IGNORED) strcpy(search_font_name,new_font.name); + while( 1 ){ BOOL flag; + if( eq_str( new_font_name, loopName) ){ U_CHAR name[256]; (IGNORED) sprintf(name, "%s.htf", new_font_name); @@ -7417,11 +7533,11 @@ if( loopBound > 10 ){ } - flag = TRUE; - for( ; font_name_n; font_name_n-- ){ FILE* file; - int char_f, char_l; - new_font_name[font_name_n] = '\0'; - + flag = TRUE; + for( ; font_name_n; font_name_n-- ){ FILE* file; + int char_f, char_l; + new_font_name[font_name_n] = '\0'; + { U_CHAR name[256]; (IGNORED) sprintf(name, "%s.htf", new_font_name); @@ -7527,9 +7643,9 @@ if( (strlen (new_font.family_name) + } - if( file != NULL){ - INTEGER x_char_l; - + if( file != NULL){ + INTEGER x_char_l; + x_char_l = get_html_file_id(file, new_font.char_f, new_font.char_l, 19); if( x_char_l != HTF_ALIAS) { @@ -7539,29 +7655,28 @@ if( x_char_l != HTF_ALIAS) { } - if( x_char_l == HTF_ALIAS) { - + if( x_char_l == HTF_ALIAS) { + { int chr; - char str[256]; font_name_n=0; while( (chr = get_html_ch(file)) != '\n' ){ - if( chr != ' ' ) str[font_name_n++] = chr; + if( chr != ' ' ) search_font_name[font_name_n++] = chr; } - str[font_name_n] = '\0'; - if( eq_str( str, new_font_name) ){ err_i_str(20, new_font_name); } + search_font_name[font_name_n] = '\0'; + if( eq_str( search_font_name, new_font_name) ){ err_i_str(20, new_font_name); } (IGNORED) printf("Searching `%s.htf' for `%s.htf'\n", - str, new_font.name); + search_font_name, new_font.name); htf_to_lg(html_font, new_font_name, fonts_n, file); new_font_name = (char *) r_alloc((void *) new_font_name, (size_t) (font_name_n+1)); - (IGNORED) strcpy(new_font_name,str); + (IGNORED) strcpy(new_font_name,search_font_name); font_name_n = strlen (new_font_name); } - (IGNORED) fclose(file); flag = FALSE; break; - } - + (IGNORED) fclose(file); flag = FALSE; break; + } + if( char_f <= new_font.char_l ){ U_CHAR del; int j, n; @@ -7574,7 +7689,7 @@ while( char_f < new_font.char_f ){ - char_f + 1; for( i = char_f - new_font.char_f; i < n; i++ ){ -{ int indirect_ch, base, value, digit, ch1; +{ int indirect_ch, base=0, value=0, digit, ch1; indirect_ch = 0; del = get_html_ch(file); j=0; while( (str[j++] = get_html_ch(file)) != del ) @@ -7732,30 +7847,31 @@ while( char_l > new_font.char_l ){ } - + (void) get_html_file_id(file, new_font.char_f, new_font.char_l, 18); - htf_to_lg(html_font, new_font_name, fonts_n, file); - + htf_to_lg(html_font, new_font_name, fonts_n, file); + if( dump_htf_files ){ dump_htf_files++; dump_htf( file ); dump_htf_files--; } - (IGNORED) fclose(file); break; - } } - if( flag ){ break; } -} -if( font_name_n == 0 ){ - warn_i_str(21,new_font.name); - (IGNORED) fprintf(stderr, - "%d--%d)\n", new_font.char_f, new_font.char_l); - dump_env(); -} else { + (IGNORED) fclose(file); break; + } } + if( flag ){ break; } + } + if( font_name_n == 0 ){ + warn_i_str(21,search_font_name); + (IGNORED) fprintf(stderr, + "%d--%d)\n", new_font.char_f, new_font.char_l); + dump_env(); + } else { if( dump_env_files ){ dump_env(); } } +} new_font.str = (unsigned U_CHAR **) r_alloc((void *) new_font.str, @@ -7792,6 +7908,158 @@ fonts_n++; } + +{ static struct css_ext_rec * search_css_ext; + for( search_css_ext = css_ext; + search_css_ext != (struct css_ext_rec *) 0; + search_css_ext = search_css_ext->next ){ + int css_name_n = (int) strlen( new_font.name ); + char * css_file_name = m_alloc(char, css_name_n + 1); + (IGNORED) strcpy(css_file_name, new_font.name); + for( ; css_name_n; css_name_n-- ){ + FILE* file; + css_file_name[css_name_n] = '\0'; + +{ U_CHAR name[256]; + (IGNORED) sprintf(name, "%s.%s", css_file_name, + search_css_ext->name); + + file = NULL; + +{ + struct htf_com_rec *p; + p = htf_font_dir; + while( p ){ + file = search_file_base(name, p->name, READ_TEXT_FLAGS, htf_dirs); + if( file ){ +#ifndef KPATHSEA + tex4ht_fls = TRUE; +#endif + break; + } + p = p->next; + } +} + + + if( !file ){ + if( ((file = f_open(name, READ_TEXT_FLAGS)) == NULL) && dot_file ) + file = search_in_dot_file( 'i', name, READ_TEXT_FLAGS, htf_dirs); +#ifdef HTFDIR + if( !file ) file = search_file_base(name, HTFDIR, + READ_TEXT_FLAGS, htf_dirs); +#endif + + +#ifdef KPATHSEA + if( !file ){ U_CHAR * htfname; + htfname= kpse_find_file (name, kpse_program_text_format, 0); + if ( htfname ){ + +{ U_CHAR * head, * tail, *p; + int n; + +n = (int) strlen(htfname); +tail = head = m_alloc(char, n+1); +(IGNORED) strcpy(head, htfname); +while( n>11 ){ + if( (*tail=='\\') || (*tail=='/') ){ + if( (*tail == *(tail+9)) && (*(tail+1) == 'h') + && (*(tail+2) == 't') && (*(tail+3) == '-') + && (*(tail+4) == 'f') && (*(tail+5) == 'o') + && (*(tail+6) == 'n') && (*(tail+7) == 't') + && (*(tail+8) == 's') ){ + p = tail + 9; *(tail + 10) = '\0'; tail += 11; + while( (*tail != *p) && (*tail != '\0') ){ tail++; } + break; + } } + tail++; n--; +} + + + htfname = (U_CHAR *) 0; + +for( n = 0 ; (n < cardinality) && !htfname ; n++){ + p = tail; + while( *p != '\0' ){ + char * s, *nm; + s = m_alloc(char, (int) strlen( head ) + + (int) strlen( fontset[n] ) + + (int) strlen( p ) + 1); + (IGNORED) strcpy(s,head); + (IGNORED) strcat(s,fontset[n]); + (IGNORED) strcat(s,p); + nm = kpse_find_file (s, kpse_program_text_format, 0); + free((void *) s); + if ( nm ){ + htfname = nm; break; + } + p++; + while( (*p != '\\') && (*p != '/') && (*p != '\0') ){ p++; } +} } + + +} + + + if ( htfname ){ + (IGNORED) printf("(%s)\n", htfname); + file= fopen(htfname,READ_TEXT_FLAGS); + } } + } +#endif + + + } + + + if( file != NULL ){ + + +BOOL is_visited = FALSE; +struct visited_file_rec * v = visited_file; +while( v != (struct visited_file_rec *) 0 ){ + if( eq_str(v->name, name) ){ + is_visited = TRUE; break; + } + v = v->next; +} + + +if( !is_visited ){ + +struct visited_file_rec * v = m_alloc(struct visited_file_rec, 1); +v->name = m_alloc(char, (int) strlen( name ) + 1 ); +(IGNORED) strcpy(v->name, name); +v->next = visited_file; +visited_file = v; + + + while( 1 ){ + int ch; + do{ + ch = (int) getc(file); + } while ( (ch == ' ') || (ch == '\n') || (ch == '\t') ); + if( ch == EOF ){ break; } + do{ + (void) putc( ch, log_file ); + ch = (int) getc(file); + } while ( (ch != '\n') && (ch != EOF) ); + (void) putc( '\n', log_file ); + if( ch == EOF ){ break; } +} } + + + (IGNORED) fclose(file); break; + } +} + + + } + free((void *) css_file_name); +} } + + free((void *) new_font_name); font_tbl_size++; } #ifdef MAXFONTS @@ -7801,6 +8069,14 @@ fonts_n++; } +while( visited_file != (struct visited_file_rec *) 0 ){ + struct visited_file_rec * v = visited_file; + visited_file = visited_file->next; + free((void *) v->name); + free((void *) v); +} + + #ifdef KPATHSEA if( export_str_chars ){ @@ -8788,7 +9064,7 @@ if( special_n>1 ) { special_n--; if ( get_char() == '%' ) { if( special_n>2 ) { - U_CHAR type, ch, *p, *q, *pp, *qq, pre[256], post[256]; + U_CHAR type, ch, *p, *q, *pp=0, *qq=0, pre[256], post[256]; special_n -= 2; type = get_char(); ch = get_char(); p = pre; while( special_n-- > 0 ) { @@ -9619,7 +9895,7 @@ if( special_n ){ = end_pos_body = pos_body = (char *) r_alloc((void *) pos_body,(size_t) special_n + 1); i = 0; -{ BOOL after_star; +{ BOOL after_star=0; while( special_n-- > 0 ){ if( (*p = get_char()) == ch ){ *p = '\0'; i++; @@ -9637,7 +9913,7 @@ if( special_n ){ -{ long int v; +{ long int v=0; double w[5]; int j; U_CHAR ch, sign; @@ -9684,7 +9960,7 @@ if( rect_pos ){ special_n -= 2; rect_pos = get_char() - '0';} min_pos_x = max_pos_x = base_pos_x = x_val; min_pos_y = max_pos_y = base_pos_y = y_val ; } else { U_CHAR *p; - double dim; + double dim=0.0; BOOL dim_on; if( no_root_file ){ open_o_file(); } @@ -10109,7 +10385,7 @@ if( i==0 ){ if( i-- ){ U_CHAR ch; if( (ch = get_char()) == '*' ) { - struct send_back_entry *p, *q, *t; + struct send_back_entry *p, *q, *t=0; if( back_id_off ){ while( i-- ){ (IGNORED) get_char(); } } else { @@ -10576,7 +10852,7 @@ struct group_path *start_head, *start_tail, *end_head, *end_tail, *parent_end_head, *parent_end_tail, *p, *q; -int place; +int place=0; start_head = start_tail = parent_start_head = parent_start_tail = end_head = end_tail = parent_end_head = parent_end_tail = (struct group_path *) 0; @@ -10993,11 +11269,11 @@ while( opened_files != (struct files_rec*) 0 ) INTEGER bop_addr; -int stack_depth; +int stack_depth=0; char cur_font[6]; -BOOL visible_cnt; +BOOL visible_cnt=FALSE; |