% $Id: tex4ht-t4ht.tex 418 2018-07-03 17:37:07Z karl $ % tex tex4ht-t4ht or ht tex tex4ht-t4ht % % Copyright 2009-2018 TeX Users Group % Copyright 1998-2009 Eitan M. Gurari % Released under LPPL 1.3c+. % See tex4ht-cpright.tex for license text. % bcc32 -DBCC32 t4ht.c % gcc -O2 -DKPATHSEA -I/usr/local/teTeX/include -L/usr/local/teTeX/lib -o t4ht t4ht.c -DHAVE_DIRENT_H -lkpathsea \input common.tex \input tex4ht.sty \Preamble{xhtml,th4,sections+,xhtml}\EndPreamble \input ProTex.sty \AlProTex{c,<<<>>>,`,title,list,_^,CodeLineNo} %\input tex4ht-cpright.tex \Comment{ }{} \def\CodeId#1#2{} \def\UnderLine#1{\ifHtml \HCode{}#1\HCode{}\else\underbar{#1}\fi} \let\CModifyShowCode=\ModifyShowCode \let\CModifyOutputCode=\ModifyOutputCode \def\ModifyShowCode{\def\[##1({##1\UnderLine{(}}\def \;{\UnderLine{;}}\CModifyShowCode} \catcode`\^=7 \catcode`\@=6 \catcode`\#=12 \catcode`\^^M=13\relax% \def\ModifyOutputCode{% \def\;{ SEP }% \def\[@@1(@@2)@@3;{@@1 #ifdef ANSI #define SEP , (@@3) #undef SEP #else #define SEP ; (@@2)@@3; #undef SEP #endif }% \CModifyOutputCode}% \catcode`\^^M=5 \catcode`\@=12 \catcode`\#=6 \catcode`\^=13 \let\'=\Verb \def\`{\expandafter\expandafter\expandafter\qts\Verb} \def\qts#1{`#1\aftergroup'} \def\FTP{http://www.cis.ohio-state.edu/\string~gurari/tpf/} \TocAt{Section,SubSection} \CutAt{Section} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \LikeChapter{t4ht: postprocessor for tex4ht} The compilation of this file requires the packages \Link[\FTP ProTex.sty]{}{}Pro\TeX\EndLink{} and \Link[\FTP AlProTex.sty]{}{}AlPro\TeX\EndLink. \TableOfContents[Section,SubSection] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \Section{Outline} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \SubSection{The Cases} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The post-processor \`'tex4ht.c' prepares a \`'.lg' file in which it lists the pictures that need to be generated, and the entries encountered in \''\Needs{...}'. The \`'.log' file contains the entries encountered in the \''\Needs-{...}'. The t4ht program (used to be a Perl script?) treats as commands the entries that are enclosed between double-quote (\''"') characters, and the other entries as comments. It first works on the \`'.lg' file and then on the \`'.log' file. The main output is a new \`'.css'. \<<< ` lg_file = open_file(lg_name,LG_EXT); if( lg_file ) { ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` (IGNORED) fclose(lg_file); } >>> \<<< eoln_ch = (int) 'x'; while( eoln_ch != EOF ) { status = scan_str("File: ", TRUE, lg_file); status = scan_until_end_str("", 1, status, lg_file); status = status && !eq_str(match[1],tmp_name); if( status ){ FILE* file; file = fopen(match[1], READ_TEXT_FLAGS); if( file ){ (IGNORED) fclose(file); } else { status = FALSE; } } if( status ){ if( dir ){ (void) execute_script(copy_script, match[1], dir? dir :"",".",""); } if( ch_mod ){ (void) execute_script(chmod_script, ch_mod, dir? dir:"",match[1], ""); } } } >>> % Need to input tex4ht-cpright.tex at this point, % if not, it causes an error while expanding the % macros like `jobname.tex, `version, ... % Still greek to me. :( CVR/2010/02/11 % \input tex4ht-cpright.tex \<<< /* t4ht.c (`version), generated from `jobname.tex Copyright (C) 2009-2018 TeX Users Group Copyright (C) `CopyYear.1998. Eitan M. Gurari ` */ ` ` ` `
` `[ int ` main(argc, argv) int argc`; Q_CHAR **argv ;{ ` ` ` ` ` ` ` return 0; } >>> \<<< (IGNORED) printf("----------------------------\n"); #ifndef KPATHSEA #ifdef PLATFORM (IGNORED) printf("t4ht.c (`version %s)\n",PLATFORM); #else (IGNORED) printf("t4ht.c (`version)\n"); #endif #else #ifdef PLATFORM (IGNORED) printf("t4ht.c (`version %s kpathsea)\n",PLATFORM); #else (IGNORED) printf("t4ht.c (`version kpathsea)\n"); #endif #endif ` { int i; for(i=0; i1)?"\n " : "", argv[i]); } (IGNORED) printf("\n"); } >>> \SubSection{char, signed char, unsigned char (gcc man)}: Each kind of machine has a default for what char should be. It is either like unsigned char by default or like signed char by default. Ideally, a portable program should always use signed char or unsigned char when it depends on the signedness of an object. But many programs have been written to use plain char and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. This option, and its inverse, let you make such a program work with the opposite default. The type char is always a distinct type from each of signed char and unsigned char, even though its behavior is always just like one of those two. \<<< #define Q_CHAR signed char #define U_CHAR unsigned char #define C_CHAR char #define Q_NULL (Q_CHAR *) 0 #define U_NULL (U_CHAR *) 0 #define C_NULL (C_CHAR *) 0 >>> Pointers to strings must use \`'C_CHAR', since we don't know how string constants are treated there. \<<< #define Q_CHAR char #define U_CHAR char #define C_CHAR char #define Q_NULL (Q_CHAR *) 0 #define U_NULL (U_CHAR *) 0 #define C_NULL (C_CHAR *) 0 >>> \SubSection{EOF Character} \<<< static int eoln_ch; >>> \Verbatim OBTW: when compiling t4ht.c, I get messages about the uselessness of comparing chars (which are unsigned, at least on a IRIX 6.5) to EOF which is defined as -1 in stdio.h).... and indeed it program loops endlessly. Adding the lines #undef EOF #define EOF 255 after the last #include gets the effect that you probably want (or perhaps better would be to define a constant EOFCHAR or something.) \EndVerbatim The getc returns the next character as an unsigned char converted to int. This is so to allow all characters to be return as well as end-of-file indicators (-1 in stdio) and error indicator. %%%%%%%%%%%%% \Section{Stop on tex4ht.c Err} %%%%%%%%%%%%% \<<< if( check_tex4ht_c_err ){ eoln_ch = (int) 'x'; while( eoln_ch != EOF ) { status = scan_str("tex4ht.c error: ", TRUE, lg_file); if( status ){ (IGNORED) fprintf(stderr, "--- Error --- tex4ht.c ran into problems\n" ); exit(EXIT_FAILURE); } status = scan_until_end_str("", 1, status, lg_file); } } >>> \<<< static BOOL check_tex4ht_c_err = FALSE; >>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \Section{Platform-dependent Code} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \SubSection{PreProcessor Directives} Symantec C++ for wid95: \''sc t4ht.c -mn -o+time -WA -3 -a8 -c -D_CONSOLE=1 -ot4ht.obj' \<<< #define IGNORED void >>> \<<< /* ********************************************** Compiler options * (uncommented | command line) * ------------------------------------------------* Classic C (CC) default #define ANSI ansi-c, c++ #define DOS_C #define HAVE_STRING_H #define HAVE_DIRENT_H #define HAVE_SYS_NDIR_H #define HAVE_SYS_DIR_H #define HAVE_NDIR_H #define HAVE_IO_H #define HAVE_UNISTD_H #define WIN32 #define KPATHSEA #define SYSTEM_FUNCTION_OK #define CDECL .......... #define BCC32 bordland c++ ************************************************* Tex4ht variables * (uncommented | command line) * ----------------------------------------------- */ ` /* ******************************************** */ ` ` ` ` #ifdef DOS_C #define DOS #endif #ifdef DOS #define DOS_WIN32 #ifndef HAVE_STRING_H #define HAVE_STRING_H #endif #endif #ifdef WIN32 #define DOS_WIN32 #endif ` ` ` ` >>> \<<< #ifdef BCC32 #define WIN32 #define ANSI #define HAVE_IO_H #define HAVE_STRING_H #define PLATFORM "ms-win32" #endif >>> % \<<< #ifdef BCC #define DOS_C #define ANSI #define HAVE_IO_H #define PLATFORM "ms-dos" #endif >>> \<<< #ifdef KPATHSEA #include #endif #include `% EOF, FILE `% #include `% EXIT_FAILURE `% >>> Under ANSI C, all malloc stuff is declared in \`'' (which you also include), hence this non-standard header is redundant. \<<< #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #endif >>> \<<< #ifdef HAVE_STRING_H #include #endif >>> \<<< #ifdef DOS_WIN32 #define STRUCT_DIRENT #endif >>> \<<< #ifdef HAVE_DIRENT_H ` #else #ifndef STRUCT_DIRENT #define STRUCT_DIRECT #endif ` #endif >>> \<<< #include >>> \<<< #ifdef HAVE_SYS_NDIR_H #include #endif #ifdef HAVE_SYS_DIR_H #include #endif #ifdef HAVE_NDIR_H #include #endif >>> REPLACE EXIT with somthing that DOS also accept. \<<< #ifdef DOS #define PROTOTYP #endif #ifdef ANSI #define PROTOTYP #endif #ifdef KWIN32 #define PROTOTYP #endif >>> \<<< #ifdef PROTOTYP #define MYVOID void #define ARG_I(x) x #define ARG_II(x,y) x,y #define ARG_III(x,y,z) x,y,z #define ARG_IV(x,y,z,w) x,y,z,w #define ARG_V(x,y,z,w,u) x,y,z,w,u #else #define MYVOID #define ARG_I(x) #define ARG_II(x,y) #define ARG_III(x,y,z) #define ARG_IV(x,y,z,w) #define ARG_V(x,y,z,w,u) #endif >>> \SubSection{KPATHSEA} \<<< ` #ifdef KPATHSEA #ifndef HAVE_STRCHR #define strchr index #endif #ifndef HAVE_STRRCHR #define strrchr rindex #endif #include #include #include #include #include #include #include #include #include #if !defined(_AMIGA) && !defined(WIN32) #include #endif #include #include #endif `%/* KPATHSEA */`% ` >>> \<<< ` #ifdef KPATHSEA #include #include #include #include #include #include #include #include #include #if !defined(_AMIGA) && !defined(WIN32) #include #endif #include #include #endif `%/* KPATHSEA */`% ` >>> The \`'__cdecl' is defined in KPATHSEA: kpathsea/c-protos.h is defined to nothing for compilers other than MS. \<<< #ifdef KPATHSEA #ifdef WIN32 #undef CDECL #define CDECL __cdecl #else #define CDECL #endif #endif >>> \<<< #ifdef KPATHSEA #ifdef WIN32 #define KWIN32 #endif #endif >>> \SubSection{Compilers} \List{} \item {BCC32} For Win 95. Options (\''bcc32' comamnd): \Verbatim Borland C++ 5.0 for Win32 Copyright (c) 1993, 1996 Borland International Syntax is: BCC32 [ options ] file[s] * = default; -x- = turn switch x off -3 * 80386 Instructions -4 80486 Instructions -Ax Disable extensions -B Compile via assembly -C Allow nested comments -Dxxx Define macro -Exxx Alternate Assembler name -Hxxx Use pre-compiled headers -Ixxx Include files directory -K Default char is unsigned -Lxxx Libraries directory -M Generate link map -N Check stack overflow -Ox Optimizations -P Force C++ compile -R Produce browser info -RT * Generate RTTI -S Produce assembly output -Txxx Set assembler option -Uxxx Undefine macro -Vx Virtual table control -X Suppress autodep. output -aN Align on N bytes -b * Treat enums as integers -c Compile only -d Merge duplicate strings -exxx Executable file name -fxx Floating point options -gN Stop after N warnings -iN Max. identifier length -jN Stop after N errors -k * Standard stack frame -lx Set linker option -nxxx Output file directory -oxxx Object file name -p Pascal calls -tWxxx Create Windows app -u * Underscores on externs -v Source level debugging -wxxx Warning control -xxxx Exception handling -y Produce line number info -zxxx Set segment names \EndVerbatim \item {BCC} For DOS. \item {MSVC++} For DOS. \`'c:\msvc\bin\cl -Ic:\msvc\include -DDOS t4ht.c' In tex-live \`' cl -D_X86_=1 -DWINVER=0x0400 -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN -D_MT -D_DLL -DKPATHSEA -D_IMPORT -DANSI -I. -I. -I.. -IG:\fptex\source\web2c-7.2 -c -W3 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -O2x -G5rs -Gy -c /Fodynamic\t4ht.obj .\t4ht.c' The following are the available flags (\''c:\msvc\bin\cl -help'). \Verbatim C COMPILER OPTIONS -MEMORY MODEL- /AS small model (default) /AC compact model /AM medium model /AL large model /AH huge model /AT tiny model (.COM files) /A (custom memory model) -OPTIMIZATION- /O enable optimization (same as /Ot) /O1 minimize space /O2 maximize speed /Oa assume no aliasing /Ob inline expansion (default n=0) /Oc local common subexpression opt. /Od disable optimization (default) /Oe enable registers allocation /Of[-] toggle p-code quoting /Og global common subexpression opt. /Oi enable intrinsic functions /Ol enable loop optimizations /On disable ``unsafe'' optimizations /Oo[-] toggle post code-gen. opt. /Op[-] improve floating-pt consistency /Oq enable maximum p-code optimization /Or gen. common exit code (CodeView) /Os favor code size /Ot favor code speed /Ov[-] toggle p-code frame sorting /OV control inlining by func. size /Ow assume cross-function aliasing /Ox maximum opts. (/Ob1cegilnot /Gs) /Oz enable ``unsafe'' optimizations -CODE GENERATION- /G0 8086 instructions (default) /G1 186 instructions /G2 286 instructions /G3 386 instructions (press to continue) /GA protected-mode Win entry/exit code /GD protected-mode Win entry/exit code /GE customize Windows entry/exit /Gq backwards compatibility with v. 6 /Gc Pascal style calling conventions /Gd C style calling conventions /Ge use stack-check calls /Gf enable string pooling /Ge use stack-check calls /Gf enable string pooling /Gs remove stack-check calls /Gn remove p-code native entry points /Gp specify p-code entry tables /Gr _fastcall style calling convention /Gt[num] data size threshold /GW real-mode Windows entry/exit code /Gw real-mode Windows entry/exit code /Gx assume that data is near /Gx- assume that data is far /Gy separate functions for linker /Zr check null pointers (/f only) -OUTPUT FILES- /Fa[file] name assembly listing file /Fc[file] name source/object listing /Fd[file] name .PDB filename /Fe name executable filename /Fl[file] name object listing filename /Fm[file] name map filename /Fo name object filename /Fr[file] name .SBR filename /Fp name .PCH filename /FR[file] name extended .SBR filename /Fs[file] name source listing filename -PREPROCESSOR- /C don't strip comments /D[=|#text] define macro /E preprocess to stdout /EP same as /E but no #line /I add #include path /P preprocess to file /U remove predefined macro /u remove all defined macros (press to continue) /X ignore "standard places" -LANGUAGE- /vd{0|1} disable/enable vtordisp /vm type of pointers to members /Z7 C 7 style CodeView information /Za disable extensions (implies /Op) /Zd line number information /Ze enable extensions (default) /Zg generate function prototypes /Zi prepare for debugging (CodeView) /Zl omit default library name in .OBJ /Zp[n] pack structs on n-byte boundary /Zs check syntax only -FLOATING POINT- /FPa calls with altmath /FPc calls with emulator /FPc87 calls with 8087 library /FPi inline with emulator (default) /FPi87 inline with 8087 -SOURCE LISTING- /Sl set line width /Sp set page length /St set title string /Ss set subtitle string -MISCELLANEOUS- /batch specify batch mode compilation /Bm set compiler's available mem. /c compile only, no link /H external name length /J default char type is unsigned /f select fast compiler (default) /f- select optimizing compiler /Yc create .PCH file /Yd put debug info in .PCH file /Yu use .PCH file /YX automatic precompiled header /nologo suppress copyright message (press to continue) /Mq compile for QuickWin /ND name data segment /NM name code segment /NQ combine p-code temp segments /NT name code segment /NV name far v-table segment /Tc compile file without .c /Tp compile file without .cpp /V set version string /W warning level (default n=1) /w disable all warnings /WX treat all warnings as errors /Zn turn off SBRPACK for .SBR files -MASM SUPPORT- /MA /Ta assemble file without .asm -LINKING- /F stack size (hex. bytes) /Lr append 'r' to default lib in .OBJ /link [lib] give lib name to linker /Ln do not link CRT.LIB /Ld select dynamically-linked library /Lw select statically-linked library \EndVerbatim \EndList \SubSection{DJGPP} \Verbatim * tex4ht.c [__DJGPP__] (ANSI, DOS_GIF_FILE): Define. (WRITE_BIN_FLAGS, READ_BIN_FLAGS): Use binary mode with DJGPP. (dos_file_names): New variable. (sig_err): If got fatal signal other than SIGINT or SIGQUIT, don't return to caller, since the program will be aborted otherwise. (main) [KPATHSEA]: If input is from stdin which is not a console device, switch it to binary mode. Set dos_file_names to TRUE for all DOS platforms, FALSE on Unix and WIN32, and compute at runtime for DJGPP. Simplify logic of finding the init file by pushing HOME=C: into environment if $HOME isn't defined on DOSISH systems. \EndVerbatim \<<< #ifdef __DJGPP__ #define DOS_WIN32 #define ANSI #endif >>> \<<< #ifdef __DJGPP__ if (s != SIGINT && s != SIGQUIT) exit(EXIT_FAILURE); #endif >>> \SubSection{Slashes n Directory Pathes} \<<< #if defined(DOS_WIN32) || defined(__DJGPP__) #define dir_path_slash(str) (is_forward_slash(str)? '/' : '\\') #else #define dir_path_slash(str) '/' #endif >>> \
<<< #if defined(DOS_WIN32) || defined(__DJGPP__) static BOOL is_forward_slash( ARG_I(Q_CHAR *) ); #endif >>> \<<< #if defined(DOS_WIN32) || defined(__DJGPP__) `[ static BOOL is_forward_slash(str) Q_CHAR * str ;{ while( *str ){ if( *(str++) == '/' ) { return TRUE; } } return FALSE; } #endif >>> \Section{Command-Line Options} \SubSection{Available Options} \List{disc} \item \`'.../'---Directory where files should be sent \item \`'-mXXX'---\`'chmod XXX' for files \item \`'-e...'---Name of invisible gif \item \`'-d'---Directory for config files \item \`'-p'---Ignore pictures (but not pictorial symbols) \item \`'-i'---Debugging info \item Other---Name of dvi file \EndList \Verbatim dvips -mode ibmvga -D 110 -f foo.idv -pp 92 > tmp.ps convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps foo.gif mv foo.gif /WWW/temp/. cp foo.html /WWW/temp/. chmod 644 /WWW/temp/foo.* \EndVerbatim \<<< "\n--------------------------------------------------------------------\n" "t4ht [-f]filename ...\n" " -b ignore -d -m -M for bitmaps\n" " -c... choose named segment in env file\n" " -d... directory for output files (default: current)\n" " -e... location of tex4ht.env\n" " -i debugging info\n" " -g ignore errors in system calls\n" " -m... chmod ... of new output files (reused bitmaps excluded)\n" " -p don't convert pictures (default: convert)\n" " -r replace bitmaps of all glyphs (default: reuse old ones)\n" " -M... chmod ... of all output files\n" " -Q quit, if tex4ht.c had problems\n" " -S... permission for system calls: *-always, filter\n" " -X... content for field %%3 in X scripts\n" " -.... content for field %%2 in . scripts\n\n" "Example: \n" " t4ht name -d/WWW/temp/ -etex4ht-32.env -m644\n" "--------------------------------------------------------------------\n" >>> If option \`'-e' is present, empty pictures are replaced with the named file (e.g., \`'empty.gif'). \SubSection{Scanning the Options} \<<< static Q_CHAR *ch_mod = Q_NULL; static Q_CHAR *debug = Q_NULL; static Q_CHAR *Xfield = Q_NULL; static Q_CHAR *Dotfield = Q_NULL; static Q_CHAR *dir = Q_NULL; static Q_CHAR *lg_name = Q_NULL, tmp_name[255], job_name[255]; static Q_CHAR *nopict = Q_NULL; static Q_CHAR *bitmaps_no_dm = Q_NULL; static BOOL newchmod = FALSE; static Q_CHAR *noreuse = Q_NULL; >>> \<<< { int i; Q_CHAR *p, *q; ` ` if( argc == 1 ){ bad_arg; } for(i=1; i } else { lg_name = argv[i]; } } if( lg_name == NULL ){ bad_arg; } ` ` } >>> \<<< { int i, count = 0; for(i=0; i>> \<<< { Q_CHAR *p, *q; FILE* file; (IGNORED) strcpy((char *) (char *) tmp_name, (char *) (char *) lg_name); p = q = tmp_name + strlen((char *) tmp_name ); while( p != tmp_name ){ if( *p == '.' ){ if( eq_str( p+1,LG_EXT ) ) { *p = '\0'; } else { (IGNORED) strct( tmp_name, LG_EXT); file = fopen( tmp_name, READ_TEXT_FLAGS ); if( file ){ (IGNORED) fclose(file); *q = '\0'; } else { *p = '\0'; } } break; } p--; } (IGNORED) strct(tmp_name, ".tmp"); } >>> \<<< (IGNORED) strcpy((char *) job_name, (char *) tmp_name); *(job_name + strlen((char *) job_name) - 4) = '\0'; >>> \Verbatim I found that I couldn't compile t4ht.c with KPATHSEA defined, and then noticed that it doesn't include any of the kpathsea headers. So I have patched t4ht.c to create two versions: one with the necessary kpathsea headers and one without. This is the output produced by 'diff'. Let me know if you want to merge my changes into your t4ht.c, and/or if you notice any errors! I have changed the second argument of 'kpse_set_program_name' from NULL (which would effectively mean argv[0]) to 'tex4ht', as that saves having to add a 'T4HTINPUTS' (or 'T4HTKINPUTS') variable into the kpathsea configuration file 'texmf.cnf' pointing to the same place for 'tex4ht.env' as the 'TEX4HTINPUTS' variable. For t4ht.c, the kpathsea library is only useful for locating the tex4ht.env configuration file. But as it can be used for this purpose for tex4ht.c, it seems a pity not to enable it for its companion program too. > 94a99,102 > > #ifdef KPATHSEA > > #include > > #include > > #endif > 943c951 > < kpse_set_program_name (argv[0], NULL); > --- > > kpse_set_program_name (argv[0], "tex4ht"); \EndVerbatim \<<< #ifdef KPATHSEA kpse_set_program_name (argv[0], "tex4ht"); #endif >>> If \`'strlen((char *) argv[i] ) == 2' the switch is followed by a space to be deleted when more input is awaited. \<<< if( (int) strlen((char *) argv[i] ) == 2 ){ if( ` ) { if( ++i == argc ) bad_arg; } q = argv[i]; } else q = p+2; switch( *(p+1) ){ case 'M':{ ch_mod = q; newchmod = TRUE; break; } case 'S':{ ` break; } case 'X':{ Xfield = q; break;} case 'b':{ bitmaps_no_dm = q-1; break;} case 'c':{ ` break;} case 'd':{ dir = (*q=='~')? abs_addr(q,NULL) : q; break; } case 'e':{ ` break; } case 'f':{ ` break; } case 'i':{ debug = q-1; break;} case 'g':{ always_call_sys = TRUE; break;} case 'm':{ ch_mod = q; break; } case 'p':{ nopict = q-1; break;} case 'Q':{ check_tex4ht_c_err = TRUE; break;} case 'r':{ noreuse = q-1; break;} case '.':{ Dotfield = q; break;} default:{ bad_arg; } } >>> \<<< (*(p+1) != 'i') && (*(p+1) != 'p') && (*(p+1) != 'r') && (*(p+1) != 'b') && (*(p+1) != 'g') && (*(p+1) != 'Q') >>> The following is to allow for commands \`'htlatex -f/../source/foo.tex' which draw files from other directories for latex, but use the current directory for tex4ht.c (and t4ht.c). The character immediately after \`'-f' is a directory indicator character. \<<< p = p + 2; lg_name = p + (int) strlen((char *) p ); while( *lg_name != *p ){ lg_name--; } lg_name++; >>> \
<<< static char * abs_addr( ARG_II( U_CHAR *, U_CHAR *) ); >>> \<<< `[ static char * abs_addr( dir, base) U_CHAR *dir`; U_CHAR *base ;{ U_CHAR *p; p = m_alloc(char, (int) strlen((char *) dir ) + (base? (int) strlen((char *) base ):0) + (int) strlen((char *) HOME_DIR )); *p = '\0'; if( (*(dir+1) == '~') && base ){ if( *base == '~' ){ (IGNORED) strct(p, HOME_DIR); (IGNORED) strct(p, base+1); } else { (IGNORED) strct(p, base); } (IGNORED) strct(p, dir+2); } else { (IGNORED) strct(p, HOME_DIR); (IGNORED) strct(p, dir+1); } return p; } >>> \<<< U_CHAR *HOME_DIR; >>> \<<< HOME_DIR = getenv("HOME"); >>> \Section{Identify the Empty Pictures} Messages about figures that don't exist are treated as requests for empty figures. Typically, they shouldn't be present unless they are programmed into \''\setbox'-like commands. tex4ht-c identifies in the \''.lg' file the empty figures it finds. The messages in the ``.lg'' file look like \`'--- empty picture --- aa.idv[1] ---'. \<<< { struct empty_pic_struct *last; last = empty_pic = (struct empty_pic_struct *) 0; while( TRUE ) { status = scan_str("--- empty picture --- ", TRUE, lg_file); status = scan_until_str( ".idv[" , 1, status, lg_file); status = scan_until_end_str("] ---", 1, status, lg_file); if( status ){ ` } if ( eoln_ch == EOF ){ break; } } ` last->next = (struct empty_pic_struct *) 0; last->n = 100000; } >>> \<<< if( last == (struct empty_pic_struct *) 0 ){ last = empty_pic = (struct empty_pic_struct *) m_alloc(struct empty_pic_struct, (int) 1); } else { last = last->next = (struct empty_pic_struct *) m_alloc(struct empty_pic_struct, (int) 1); } last->next = (struct empty_pic_struct *) 0; last->n = get_long_int(match[1]); >>> \<<< struct empty_pic_struct *empty_pic; >>> \<<< struct empty_pic_struct{ long int n; struct empty_pic_struct *next; }; >>> The list of empty pictures is stored in \`'emptypic'. %%%%%%%%%%%%%%%%%%%%%%% \Section{Process Gifs} %%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%% \SubSection{The Scripts} %%%%%%%%%%%%%%%%%%%%%%% \