diff --git a/books/Makefile.pamphlet b/books/Makefile.pamphlet index d1130cd..606862f 100644 --- a/books/Makefile.pamphlet +++ b/books/Makefile.pamphlet @@ -29,17 +29,96 @@ PS2PDF=ps2pdf RM=rm -f BOOKS=${PDF}/bookvol0.pdf ${PDF}/bookvol1.pdf ${PDF}/bookvol2.pdf \ - ${PDF}/bookvol3.pdf ${PDF}/bookvol4.pdf ${PDF}/bookvol5.pdf \ - ${PDF}/bookvol6.pdf ${PDF}/bookvol7.pdf ${PDF}/bookvol7.1.pdf \ + ${PDF}/bookvol3.pdf ${PDF}/bookvol4.pdf \ + ${PDF}/bookvol7.1.pdf \ ${PDF}/bookvol8.pdf ${PDF}/bookvol10.pdf \ ${PDF}/bookvol10.1.pdf ${PDF}/bookvol10.2.pdf ${PDF}/bookvol10.3.pdf \ ${PDF}/bookvol10.4.pdf ${PDF}/bookvol10.5.pdf \ ${PDF}/bookvol11.pdf ${PDF}/bookvol12.pdf ${PDF}/bookvolbib.pdf -BUUKS=${PDF}/bookvol9.pdf +BUUKS=${PDF}/bookvol5.pdf ${PDF}/bookvol6.pdf ${PDF}/bookvol7.pdf \ + ${PDF}/bookvol9.pdf all: ${PDF}/axiom.sty ${BUUKS} ${BOOKS} ${PDF}/toc.pdf +${PDF}/bookvol5.pdf: ${IN}/bookvol5.pamphlet + @echo books/1 making ${PDF}/bookvol5.pdf from ${IN}/bookvol5.pamphlet + @(cd ${PDF} ; \ + cp ${IN}/bookvol5.pamphlet ${PDF}/bookvol5.tex ; \ + cp -pr ${IN}/ps ${PDF} ; \ + if [ -z "${NOISE}" ] ; then \ + ${RM} bookvol5.toc ; \ + ${LATEX} bookvol5.tex ; \ + ${MAKEINDEX} bookvol9 >/dev/null ; \ + ${LATEX} bookvol5.tex >/dev/null ; \ + ${DVIPDFM} bookvol5.dvi 2>/dev/null ; \ + ${RM} bookvol5.aux bookvol5.dvi bookvol5.log bookvol5.ps ; \ + ${RM} bookvol5.idx bookvol5.tex bookvol5.pamphlet ; \ + ${RM} bookvol5.ilg bookvol5.ind ; \ + else \ + ${RM} bookvol5.toc ; \ + ${LATEX} bookvol5.tex >${TMP}/trace ; \ + echo ...first latex complete ; \ + ${MAKEINDEX} bookvol9 >${TMP}/trace ; \ + ${LATEX} bookvol5.tex >${TMP}/trace ; \ + ${DVIPDFM} bookvol5.dvi 2>${TMP}/trace ; \ + ${RM} bookvol5.aux bookvol5.dvi bookvol5.log bookvol5.ps ; \ + ${RM} bookvol5.idx bookvol5.tex bookvol5.pamphlet ; \ + ${RM} bookvol5.ilg bookvol5.ind ; \ + fi ) + +${PDF}/bookvol6.pdf: ${IN}/bookvol6.pamphlet + @echo books/1 making ${PDF}/bookvol6.pdf from ${IN}/bookvol6.pamphlet + @(cd ${PDF} ; \ + cp ${IN}/bookvol6.pamphlet ${PDF}/bookvol6.tex ; \ + cp -pr ${IN}/ps ${PDF} ; \ + if [ -z "${NOISE}" ] ; then \ + ${RM} bookvol6.toc ; \ + ${LATEX} bookvol6.tex ; \ + ${MAKEINDEX} bookvol9 >/dev/null ; \ + ${LATEX} bookvol6.tex >/dev/null ; \ + ${DVIPDFM} bookvol6.dvi 2>/dev/null ; \ + ${RM} bookvol6.aux bookvol6.dvi bookvol6.log bookvol6.ps ; \ + ${RM} bookvol6.idx bookvol6.tex bookvol6.pamphlet ; \ + ${RM} bookvol6.ilg bookvol6.ind ; \ + else \ + ${RM} bookvol6.toc ; \ + ${LATEX} bookvol6.tex >${TMP}/trace ; \ + echo ...first latex complete ; \ + ${MAKEINDEX} bookvol9 >${TMP}/trace ; \ + ${LATEX} bookvol6.tex >${TMP}/trace ; \ + ${DVIPDFM} bookvol6.dvi 2>${TMP}/trace ; \ + ${RM} bookvol6.aux bookvol6.dvi bookvol6.log bookvol6.ps ; \ + ${RM} bookvol6.idx bookvol6.tex bookvol6.pamphlet ; \ + ${RM} bookvol6.ilg bookvol6.ind ; \ + fi ) + +${PDF}/bookvol7.pdf: ${IN}/bookvol7.pamphlet + @echo books/1 making ${PDF}/bookvol7.pdf from ${IN}/bookvol7.pamphlet + @(cd ${PDF} ; \ + cp ${IN}/bookvol7.pamphlet ${PDF}/bookvol7.tex ; \ + cp -pr ${IN}/ps ${PDF} ; \ + if [ -z "${NOISE}" ] ; then \ + ${RM} bookvol7.toc ; \ + ${LATEX} bookvol7.tex ; \ + ${MAKEINDEX} bookvol9 >/dev/null ; \ + ${LATEX} bookvol7.tex >/dev/null ; \ + ${DVIPDFM} bookvol7.dvi 2>/dev/null ; \ + ${RM} bookvol7.aux bookvol7.dvi bookvol7.log bookvol7.ps ; \ + ${RM} bookvol7.idx bookvol7.tex bookvol7.pamphlet ; \ + ${RM} bookvol7.ilg bookvol7.ind ; \ + else \ + ${RM} bookvol7.toc ; \ + ${LATEX} bookvol7.tex >${TMP}/trace ; \ + echo ...first latex complete ; \ + ${MAKEINDEX} bookvol9 >${TMP}/trace ; \ + ${LATEX} bookvol7.tex >${TMP}/trace ; \ + ${DVIPDFM} bookvol7.dvi 2>${TMP}/trace ; \ + ${RM} bookvol7.aux bookvol7.dvi bookvol7.log bookvol7.ps ; \ + ${RM} bookvol7.idx bookvol7.tex bookvol7.pamphlet ; \ + ${RM} bookvol7.ilg bookvol7.ind ; \ + fi ) + ${PDF}/bookvol9.pdf: ${IN}/bookvol9.pamphlet @echo books/1 making ${PDF}/bookvol9.pdf from ${IN}/bookvol9.pamphlet @(cd ${PDF} ; \ diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index d1fc39f..558b23c 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -1,4 +1,5 @@ \documentclass[dvipdfm]{book} +\setlength{\textwidth}{400pt} \usepackage{hyperref} \usepackage{axiom} \usepackage{makeidx} diff --git a/books/bookvol6.pamphlet b/books/bookvol6.pamphlet index aeb08fd..38529bc 100644 --- a/books/bookvol6.pamphlet +++ b/books/bookvol6.pamphlet @@ -504,10 +504,10 @@ allows you to specify the spadclient program. By default it is\\ [-h] show usage \end{verbatim} -<>= +\begin{chunk}{axiomcmd} #!/bin/sh -@ +\end{chunk} The {\tt MALLOCTYPE} shell variable is an {\tt IBM} {\tt AIX} shell variable that controls buckets based extensions in the default memory allocator which may enhance performance. AIX uses a new @@ -515,37 +515,37 @@ memory management routine that does not zero {\tt malloc} memory and does not round up to the nearest power of 2, unlike most non-AIX systems. This can cause failures so we protect against that here. See the AIX Performance Tuning Guide\cite{9} for details. -<>= +\begin{chunk}{axiomcmd} MALLOCTYPE=3.1 export MALLOCTYPE -@ +\end{chunk} The {\tt nagman} process needs to know the hostname -<>= +\begin{chunk}{axiomcmd} HOST=`hostname` export HOST -@ +\end{chunk} There are 4 basic utilities used by this script. The {\tt ciao} script for immediate exit: -<>= +\begin{chunk}{axiomcmd} ciao() { echo "Goodbye." exit 1 } -@ +\end{chunk} The {\tt needsubopt} script which is used to issue an error message when one of the command line options requires an option: -<>= +\begin{chunk}{axiomcmd} needsubopt () { echo "The $1 option requires an argument." ciao } -@ +\end{chunk} The {\tt showuse} script which gives basic command line help: -<>= +\begin{chunk}{axiomcmd} showuse() { echo "axiom" echo " [-ht |-noht] whether to use HyperDoc" @@ -567,9 +567,9 @@ echo " [-clientprog fname] use named program for spadclient" echo " [-h] show usage" } -@ +\end{chunk} List the various workspaces if asked. -<>= +\begin{chunk}{axiomcmd} listwspaces() { echo "$1" @@ -577,32 +577,32 @@ listwspaces() echo "" } -@ +\end{chunk} Step 1. Ensure the environment is set. Just process ``-h''. If it exists in the command line then we print out the simple command line help menu. -<>= +\begin{chunk}{axiomcmd} if [ "$*" = "-h" ] ; then showuse fi -@ +\end{chunk} We assume that Axiom is installed in the standard place on a linux system. We will modify this assumption as we process the environment and command line. The term {\tt spad} is an historical shortened version of the name {\tt scratchpad}, the original name of the {\tt Axiom} system. -<>= +\begin{chunk}{axiomcmd} SPADDEFAULT=/usr/local/axiom/mnt/linux -@ +\end{chunk} If the {\tt \$AXIOM} shell variable is set then we use it.\\ If not, then if the {\tt \$SPAD} shell variable is set then we use it.\\ If not, then we try to use the default value above.\\ If not, we simply fail. -<>= +\begin{chunk}{axiomcmd} if [ "$SPAD" = "" ] ; then if [ "$AXIOM" = "" ] ; then SPAD=$SPADDEFAULT @@ -629,169 +629,169 @@ else fi fi -@ +\end{chunk} If we get here then all attempts to find axiom have failed so we complain and exit. -<>= +\begin{chunk}{axiomcmd} if [ ! -d "$SPAD" ] ; then echo "The directory for Axiom, $SPAD, does not exist." ciao fi -@ +\end{chunk} Step 2. Process command line arguments. Name the workspace directories -<>= +\begin{chunk}{axiomcmd} rootwsdir=$SPAD/bin -@ +\end{chunk} We set up the defaults for command-line arguments. We don't want just a list by default -<>= +\begin{chunk}{axiomcmd} list=no -@ +\end{chunk} We default to actually executing the workspace. -<>= +\begin{chunk}{axiomcmd} go=yes -@ +\end{chunk} We default to the {\tt AXIOMsys} workspace. -<>= +\begin{chunk}{axiomcmd} wsname=AXIOMsys -@ +\end{chunk} And all other options are unset. -<>= +\begin{chunk}{axiomcmd} otheropts="" -@ +\end{chunk} For each option on the command line do -<>= +\begin{chunk}{axiomcmd} while [ "$*" != "" ] ; do -@ -<>= +\end{chunk} +\begin{chunk}{axiomcmd} case $1 in -@ +\end{chunk} If the user specified list anywhere then we give the workspace list and exit. -<>= +\begin{chunk}{axiomcmd} -list) list=yes go=no;; -@ +\end{chunk} If the user specified {\tt go} or {\tt nogo} we handle that case -<>= +\begin{chunk}{axiomcmd} -go) go=yes ;; -nogo) go=no ;; -@ +\end{chunk} The workspace option requires an argument which follows immediately. If the argument is missing we complain and exit. -<>= +\begin{chunk}{axiomcmd} -ws) if [ "$2" = "" ] ; then needsubopt "$1" ; fi shift wsname="$1" ;; -@ +\end{chunk} We can specify the various subprograms to use. -<>= +\begin{chunk}{axiomcmd} -nagprog|-grprog|-htprog|-clefprog|-sessionprog|-clientprog) if [ "$2" = "" ] ; then needsubopt "$1" ; fi otheropts="$otheropts $1 $2" shift ;; -@ +\end{chunk} These options were not explained earlier and are only for developer use. -<>= +\begin{chunk}{axiomcmd} -paste|-rm|-rv) if [ "$2" = "" ] ; then needsubopt "$1" ; fi otheropts="$otheropts $1 $2" shift ;; -@ +\end{chunk} We handle the various [{\tt -option} $\vert$ {\tt -nooption}] cases -<>= +\begin{chunk}{axiomcmd} -clef|-noclef|-gr|-nogr|-ht|-noht|-iw|-noiw) otheropts="$otheropts $1" ;; -ihere|-noihere|-nox|-nag|-nonag) otheropts="$otheropts $1" ;; -@ +\end{chunk} The user wanted help so we will not execute. -<>= +\begin{chunk}{axiomcmd} -h) go=no ;; -@ +\end{chunk} The user is confused. Complain and exit. -<>= +\begin{chunk}{axiomcmd} *) echo "Unknown option: $1" echo "To use a specific workspace use, e.g.: spad -ws $1" ciao ;; esac -@ +\end{chunk} Move to the next option and loop. -<>= +\begin{chunk}{axiomcmd} shift done -@ +\end{chunk} Step 3. Handle options that require special case handling. The user just wanted to know what workspaces are available. -<>= +\begin{chunk}{axiomcmd} if [ $list = yes ] ; then listwspaces "AXIOM workspaces in \$AXIOM/bin = $rootwsdir: " $rootwsdir fi -@ +\end{chunk} Try to ensure a suitable workspace on this host. -<>= +\begin{chunk}{axiomcmd} if [ `expr $wsname : '.*/.*'` = 0 ] ; then serverws=$rootwsdir/$wsname else serverws=$wsname fi -@ +\end{chunk} If we can't find the executable then we complain and exit. -<>= +\begin{chunk}{axiomcmd} if [ ! -x $serverws ] ; then echo "Cannot find the executable $serverws" showuse ciao fi -@ +\end{chunk} The user just wanted to see what would happen so we output the command line and exit. -<>= +\begin{chunk}{axiomcmd} if [ $go = no ] ; then echo "Would now start the processes." echo exec $SPAD/bin/sman $otheropts -ws $serverws exit 0 fi -@ +\end{chunk} All of the options have been processed so we start {\tt sman} -<>= +\begin{chunk}{axiomcmd} exec $SPAD/bin/sman $otheropts -ws $serverws -@ +\end{chunk} \chapter{The {\tt sman} program} \section{sman.h} The spad\_proc structure holds information about the process id of a child process, what to do when it dies, and the shell command line necessary to restart the process. There is a linked list of these structures which maintains the process list for axiom. -<>= +\begin{chunk}{sman.h} /* Process control definitions. Used by fork_you and spawn_of_hell */ /* When a process dies it kills off everything else */ @@ -810,10 +810,10 @@ typedef struct spad_proc { struct spad_proc *next; } SpadProcess; -@ +\end{chunk} \section{sman} \subsection{includes} -<>= +\begin{chunk}{sman.includes} #include #include #include @@ -839,9 +839,9 @@ typedef struct spad_proc { #include "openpty.h1" #include "sman.h1" -@ +\end{chunk} \subsection{variables} -<>= +\begin{chunk}{sman.variables} char *ws_path; /* location of the AXIOM executable */ int start_clef; /* start clef under spad */ int start_graphics; /* start the viewman */ @@ -851,23 +851,23 @@ int start_spadclient; /* Start the client spad buffer */ int start_local_spadclient; /* Start the client spad buffer */ int use_X; /* Use the X windows environment */ int server_num; /* AXIOM server number */ -@ -We add a debug flag so we can print information about what [[sman]] +\end{chunk} +We add a debug flag so we can print information about what sman is trying to do. This change is pervasive as it touches nearly every routine. -<>= +\begin{chunk}{sman.variables} int tpd=0; /* to-print-debug information */ /************************************************/ /* definitions of programs which sman can start */ /************************************************/ -<> -<> -<> -<> -<> -<> +\getchunk{the viewman command line} +\getchunk{the nagman command line} +\getchunk{the hypertex command line} +\getchunk{the clef command line} +\getchunk{the session manager command line} +\getchunk{the spadclient command line} char *PasteFile = NULL; char *MakeRecordFile = NULL; char *VerifyRecordFile = NULL; @@ -907,9 +907,9 @@ struct termios childbuf; /* terminal structure for user i/o */ int nagman_signal=0; int death_signal = 0; -@ +\end{chunk} \subsection{process\_arguments} -<>= +\begin{chunk}{sman.processarguments} static void process_arguments(int argc,char ** argv) { @@ -1041,18 +1041,18 @@ process_arguments(int argc,char ** argv) if (tpd == 1) fprintf(stderr,"sman:process_arguments exit\n"); } -@ +\end{chunk} \subsection{should\_I\_clef} -<>= +\begin{chunk}{sman.shouldIclef} static int should_I_clef(void) { return(1); } -@ +\end{chunk} \subsection{in\_X} -<>= +\begin{chunk}{sman.inX} static int in_X(void) { @@ -1060,17 +1060,17 @@ in_X(void) return 0; } -@ +\end{chunk} \subsection{set\_up\_defaults} These are the default values for sman. A '1' value means that sman will try to start the given process, a '0' value means not starting the process. -We do not have replacement code for the [[nagman]] process nor -do we have a copy of the [[nag fortran library]] to test the process. -Until this changes we set [[start_nagman = 0]] in order to disable +We do not have replacement code for the nagman process nor +do we have a copy of the nag fortran library to test the process. +Until this changes we set start\_nagman = 0 in order to disable starting this process by default. -<>= +\begin{chunk}{sman.setupdefaults} static void set_up_defaults(void) { @@ -1086,9 +1086,9 @@ set_up_defaults(void) if (tpd == 1) fprintf(stderr,"sman:set_up_defaults exit\n"); } -@ +\end{chunk} \subsection{process\_options} -<>= +\begin{chunk}{sman.processoptions} static void process_options(int argc, char **argv) { @@ -1098,27 +1098,27 @@ process_options(int argc, char **argv) if (tpd == 1) fprintf(stderr,"sman:process_options exit\n"); } -@ +\end{chunk} \subsection{death\_handler} -<>= +\begin{chunk}{sman.deathhandler} static void death_handler(int sig) { death_signal = 1; } -@ +\end{chunk} \subsection{nagman\_handler} -<>= +\begin{chunk}{sman.nagmanhandler} static void nagman_handler(int sig) { nagman_signal=1; } -@ +\end{chunk} \subsection{sman\_catch\_signals} -<>= +\begin{chunk}{sman.smancatchsignals} static void sman_catch_signals(void) { @@ -1150,10 +1150,10 @@ sman_catch_signals(void) } -@ +\end{chunk} \subsection{fix\_env} insert SPADSERVER and SPADNUM variables into the environemnt -<>= +\begin{chunk}{sman.fixenv} static void fix_env(char **envp, int spadnum) { @@ -1169,9 +1169,9 @@ fix_env(char **envp, int spadnum) new_envp[i+2] = envp[i]; } -@ +\end{chunk} \subsection{init\_term\_io} -<>= +\begin{chunk}{sman.inittermio} static void init_term_io(void) { @@ -1192,9 +1192,9 @@ init_term_io(void) _EOL = oldbuf.c_cc[VEOL]; } -@ +\end{chunk} \subsection{strPrefix} -<>= +\begin{chunk}{sman.strPrefix} static char * strPrefix(char *prefix,char * s) { @@ -1206,9 +1206,9 @@ strPrefix(char *prefix,char * s) return NULL; } -@ +\end{chunk} \subsection{check\_spad\_proc} -<>= +\begin{chunk}{sman.checkspadproc} static void check_spad_proc(char *file, char *prefix) { @@ -1225,9 +1225,9 @@ check_spad_proc(char *file, char *prefix) } } -@ +\end{chunk} \subsection{clean\_up\_old\_sockets} -<>= +\begin{chunk}{sman.cleanupoldsockets} static void clean_up_old_sockets(void) { @@ -1256,9 +1256,9 @@ clean_up_old_sockets(void) unlink(tmp_file); } -@ +\end{chunk} \subsection{fork\_you} -<>= +\begin{chunk}{sman.forkyou} static SpadProcess * fork_you(int death_action) { @@ -1276,11 +1276,11 @@ fork_you(int death_action) return proc; } -@ +\end{chunk} \subsection{exec\_command\_env} Note that the next-to-last argument of {\tt execle} must be an explicit NULL pointer. The previous naked 0 value was not correct. -<>= +\begin{chunk}{sman.execcommandenv} static void exec_command_env(char *command,char ** env) { @@ -1289,9 +1289,9 @@ exec_command_env(char *command,char ** env) execle("/bin/sh","/bin/sh", "-c", new_command, (char *)0, env); } -@ +\end{chunk} \subsection{spawn\_of\_hell} -<>= +\begin{chunk}{sman.spawnofhell} static SpadProcess * spawn_of_hell(char *command, int death_action) { @@ -1304,10 +1304,10 @@ spawn_of_hell(char *command, int death_action) return NULL; } -@ +\end{chunk} \subsection{start\_the\_spadclient} run a AXIOM client in the main process -<>= +\begin{chunk}{sman.startthespadclient} static void start_the_spadclient(void) { @@ -1337,9 +1337,9 @@ start_the_spadclient(void) spawn_of_hell(command, NadaDelShitsky); } -@ +\end{chunk} \subsection{start\_the\_local\_spadclient} -<>= +\begin{chunk}{sman.startthelocalspadclient} static void start_the_local_spadclient(void) { @@ -1353,9 +1353,9 @@ start_the_local_spadclient(void) spawn_of_hell(command, NadaDelShitsky); } -@ +\end{chunk} \subsection{start\_the\_nagman} -<>= +\begin{chunk}{sman.startthenagman} static void start_the_nagman(void) { @@ -1366,18 +1366,18 @@ start_the_nagman(void) #endif } -@ +\end{chunk} \subsection{start\_the\_session\_manager} -<>= +\begin{chunk}{sman.startthesessionmanager} static void start_the_session_manager(void) { spawn_of_hell(SessionManagerProgram, Die); } -@ +\end{chunk} \subsection{start\_the\_hypertex} -<>= +\begin{chunk}{sman.startthehypertex} static void start_the_hypertex(void) { @@ -1399,18 +1399,18 @@ start_the_hypertex(void) else spawn_of_hell(HypertexProgram, CleanHypertexSocket); } -@ +\end{chunk} \subsection{start\_the\_graphics} -<>= +\begin{chunk}{sman.startthegraphics} static void start_the_graphics(void) { spawn_of_hell(GraphicsProgram, DoItAgain); } -@ +\end{chunk} \subsection{fork\_Axiom} -<>= +\begin{chunk}{sman.forkAxiom} /* Start the AXIOM session in a separate process, */ /* using a pseudo-terminal to catch all input and output */ static void @@ -1483,9 +1483,9 @@ fork_Axiom(void) } } -@ +\end{chunk} \subsection{start\_the\_Axiom} -<>= +\begin{chunk}{sman.starttheAxiom} static void start_the_Axiom(char **envp) { @@ -1504,11 +1504,11 @@ start_the_Axiom(char **envp) close(ptsNum); } -@ +\end{chunk} \subsection{clean\_up\_sockets} In order to be able to restart hyperdoc from the axiom command prompt we need to remove the socket for this server. -<>= +\begin{chunk}{sman.cleanupsockets} static void clean_hypertex_socket(void) { @@ -1530,9 +1530,9 @@ clean_up_sockets(void) clean_hypertex_socket(); } -@ +\end{chunk} \subsection{read\_from\_spad\_io} -<>= +\begin{chunk}{sman.readfromspadio} static void read_from_spad_io(int ptcNum) { @@ -1566,9 +1566,9 @@ read_from_spad_io(int ptcNum) } } -@ +\end{chunk} \subsection{read\_from\_manager} -<>= +\begin{chunk}{sman.readfrommanager} static void read_from_manager(int ptcNum) { @@ -1583,9 +1583,9 @@ read_from_manager(int ptcNum) } } -@ +\end{chunk} \subsection{manage\_spad\_io} -<>= +\begin{chunk}{sman.managespadio} static void manage_spad_io(int ptcNum) { @@ -1626,18 +1626,18 @@ manage_spad_io(int ptcNum) } } -@ +\end{chunk} \subsection{init\_spad\_process\_list} -<>= +\begin{chunk}{sman.initspadprocesslist} static void init_spad_process_list(void) { spad_process_list = NULL; } -@ +\end{chunk} \subsection{print\_spad\_process\_list} -<>= +\begin{chunk}{sman.printspadprocesslist} #if 0 static void print_spad_process_list() @@ -1649,9 +1649,9 @@ print_spad_process_list() } #endif -@ +\end{chunk} \subsection{find\_child} -<>= +\begin{chunk}{sman.findchild} static SpadProcess * find_child(int proc_id) { @@ -1661,9 +1661,9 @@ find_child(int proc_id) return NULL; } -@ +\end{chunk} \subsection{kill\_all\_children} -<>= +\begin{chunk}{sman.killallchildren} static void kill_all_children(void) { @@ -1679,18 +1679,18 @@ kill_all_children(void) } -@ +\end{chunk} \subsection{clean\_up\_terminal} -<>= +\begin{chunk}{sman.cleanupterminal} static void clean_up_terminal(void) { tcsetattr(0, TCSAFLUSH, &oldbuf); } -@ +\end{chunk} \subsection{monitor\_children} -<>= +\begin{chunk}{sman.monitorchildren} static void monitor_children(void) { @@ -1749,14 +1749,14 @@ monitor_children(void) } } -@ +\end{chunk} \subsection{main sman} -The main procedure should return an [[int]]. We change the return value -here and in [[src/include/sman.h1]]. -<>= +The main procedure should return an int. We change the return value +here and in src/include/sman.h1. +\begin{chunk}{sman.result} return(0); -@ -<>= +\end{chunk} +\begin{chunk}{sman.main} int main(int argc, char *argv[],char *envp[]) { @@ -1787,67 +1787,67 @@ main(int argc, char *argv[],char *envp[]) } manage_spad_io(ptcNum); if (tpd == 1) fprintf(stderr,"sman:main exit\n"); -<> +\getchunk{sman.result} } -@ +\end{chunk} \subsection{sman} -<>= +\begin{chunk}{sman} #define _SMAN_C -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> - -@ +\getchunk{sman.includes} +\getchunk{sman.variables} +\getchunk{sman.processarguments} +\getchunk{sman.shouldIclef} +\getchunk{sman.inX} +\getchunk{sman.setupdefaults} +\getchunk{sman.processoptions} +\getchunk{sman.deathhandler} +\getchunk{sman.nagmanhandler} +\getchunk{sman.smancatchsignals} +\getchunk{sman.fixenv} +\getchunk{sman.inittermio} +\getchunk{sman.strPrefix} +\getchunk{sman.checkspadproc} +\getchunk{sman.cleanupoldsockets} +\getchunk{sman.forkyou} +\getchunk{sman.execcommandenv} +\getchunk{sman.spawnofhell} +\getchunk{sman.startthespadclient} +\getchunk{sman.startthelocalspadclient} +\getchunk{sman.startthenagman} +\getchunk{sman.startthesessionmanager} +\getchunk{sman.startthehypertex} +\getchunk{sman.startthegraphics} +\getchunk{sman.forkAxiom} +\getchunk{sman.starttheAxiom} +\getchunk{sman.cleanupsockets} +\getchunk{sman.readfromspadio} +\getchunk{sman.readfrommanager} +\getchunk{sman.managespadio} +\getchunk{sman.initspadprocesslist} +\getchunk{sman.printspadprocesslist} +\getchunk{sman.findchild} +\getchunk{sman.killallchildren} +\getchunk{sman.cleanupterminal} +\getchunk{sman.monitorchildren} +\getchunk{sman.main} + +\end{chunk} \chapter{Support Routines} \section{Command Completion} Hyperdoc has the ability to do command completion. The known commands are listed, one entry per line, in a file called command.list. \chapter{The {\tt viewman} program} -<>= +\begin{chunk}{the viewman command line} char *GraphicsProgram = "$AXIOM/lib/viewman"; -@ +\end{chunk} \chapter{The {\tt nagman} program} -<>= +\begin{chunk}{the nagman command line} char *NagManagerProgram = "$AXIOM/lib/nagman"; -@ +\end{chunk} \section{nag.x} -<>= +\begin{chunk}{nag.nag.x} /* * msg.x: Remote message printing protocol @@ -1903,10 +1903,10 @@ program NAGPROG { } = 100088; -@ +\end{chunk} \section{nagman} \subsection{includes} -<>= +\begin{chunk}{nag.includes} #include #include #include @@ -1930,9 +1930,9 @@ program NAGPROG { #include "bsdsignal.h1" #include "nagman.h1" -@ +\end{chunk} \subsection{variables} -<>= +\begin{chunk}{nag.variables} #ifdef ALPHAplatform extern int getdomainname( char *, int ); #endif @@ -1959,13 +1959,13 @@ struct hostnode { nagst nag4; Sock *sock1; -@ +\end{chunk} \subsection{term} this code runs when the user quits axiom. before nagman dies, it does an rpc call to nagd to tell it to get rid of files etc. The rpc call in -question is [[axend_1]] +question is axend\_1 we also send a USR1 to sman to beget another nagman -<>= +\begin{chunk}{nag.term} static void term(int sig) { @@ -1997,9 +1997,9 @@ term(int sig) exit(0); } -@ +\end{chunk} \subsection{size\_of\_file} -<>= +\begin{chunk}{nag.sizeoffile} static long size_of_file(char *filename) { @@ -2010,9 +2010,9 @@ size_of_file(char *filename) } -@ +\end{chunk} \subsection{rpcloop} -<>= +\begin{chunk}{nag.rpcloop} static void rpcloop(void) { @@ -2322,11 +2322,11 @@ rpcloop(void) } -@ +\end{chunk} \subsection{catchSignals} catchSignals sets up signal handling. If nagman gets a sigterm it does not die but goes back to rpcloop -<>= +\begin{chunk}{nag.catchSignals} static void catchSignals(void) { @@ -2334,9 +2334,9 @@ catchSignals(void) bsdSignal(SIGSEGV,term,RestartSystemCalls); } -@ +\end{chunk} \subsection{main nagman} -<>= +\begin{chunk}{nag.main} void main(int argc,char **argv) { @@ -2382,34 +2382,34 @@ main(int argc,char **argv) rpcloop(); } -@ +\end{chunk} \subsection{nagman} -<>= +\begin{chunk}{nagman} #define _NAGMAN_C -<> -<> -<> -<> -<> -<> -<> -@ +\getchunk{nag.includes} +\getchunk{nag.variables} +\getchunk{nag.term} +\getchunk{nag.sizeoffile} +\getchunk{nag.rpcloop} +\getchunk{nag.catchSignals} +\getchunk{nag.main} +\end{chunk} \chapter{The {\tt hypertex} program} -<>= +\begin{chunk}{the hypertex command line} char *HypertexProgram = "$AXIOM/bin/hypertex -s"; -@ +\end{chunk} \chapter{The {\tt clef} program} -<>= +\begin{chunk}{the clef command line} char *ClefProgram = "$AXIOM/bin/clef -f $AXIOM/lib/command.list -e "; -@ +\end{chunk} \chapter{The {\tt session} program} -<>= +\begin{chunk}{the session manager command line} char *SessionManagerProgram = "$AXIOM/lib/session"; -@ +\end{chunk} \section{session} \subsection{includes} -<>= +\begin{chunk}{ses.includes} #include #include #include @@ -2424,9 +2424,9 @@ char *SessionManagerProgram = "$AXIOM/lib/session"; #include "bsdsignal.h1" #include "session.h1" -@ +\end{chunk} \subsection{variables} -<>= +\begin{chunk}{ses.variables} #define BufSize 4096 /* size of communication buffer */ typedef struct sock_list { /* linked list of Sock */ @@ -2446,20 +2446,20 @@ int num_active_clients = 0; /* number of InterpWindows attached */ int reading_output = 0; fd_set session_socket_mask; -@ +\end{chunk} \subsection{usr1\_handler} -<>= +\begin{chunk}{ses.usr1handler} static void usr1_handler(int sig) { return; } -@ +\end{chunk} \subsection{usr2\_handler} SIGUSR2 is generated by spadclients. We interpret it as an interrupt for the Lisp. -<>= +\begin{chunk}{ses.usr2handler} static void usr2_handler(int sig) { @@ -2467,18 +2467,18 @@ usr2_handler(int sig) return; } -@ +\end{chunk} \subsection{term\_handler} -<>= +\begin{chunk}{ses.termhandler} static void term_handler(int sig) { exit(1); } -@ +\end{chunk} \subsection{pr} -<>= +\begin{chunk}{ses.pr} static void pr() { @@ -2492,9 +2492,9 @@ pr() fprintf(stderr,"\n"); } -@ +\end{chunk} \subsection{close\_client} -<>= +\begin{chunk}{ses.closeclient} static void close_client(int frame) { @@ -2567,9 +2567,9 @@ pr(); #endif } -@ +\end{chunk} \subsection{read\_SpadServer\_command} -<>= +\begin{chunk}{ses.readSpadServercommand} static void read_SpadServer_command(void) { @@ -2597,9 +2597,9 @@ read_SpadServer_command(void) } } -@ +\end{chunk} \subsection{test\_sock\_for\_process} -<>= +\begin{chunk}{ses.testsockforprocess} static int test_sock_for_process(Sock *sock) { @@ -2607,9 +2607,9 @@ test_sock_for_process(Sock *sock) return kill(sock->pid, 0); } -@ +\end{chunk} \subsection{read\_menu\_client\_command} -<>= +\begin{chunk}{ses.readmenuclientcommand} static void read_menu_client_command(void) { @@ -2662,9 +2662,9 @@ fprintf(stderr,"menu:QuerySpad\n"); } } -@ +\end{chunk} \subsection{read\_from\_spad\_io} -<>= +\begin{chunk}{ses.readfromspadio} static void read_from_spad_io(void) { @@ -2677,9 +2677,9 @@ read_from_spad_io(void) } } -@ +\end{chunk} \subsection{kill\_spad} -<>= +\begin{chunk}{ses.killspad} static void kill_spad(void) { @@ -2697,9 +2697,9 @@ kill_spad(void) exit(0); } -@ +\end{chunk} \subsection{accept\_session\_connection} -<>= +\begin{chunk}{ses.acceptsessionconnection} static int accept_session_connection(Sock *server_sock) { @@ -2775,9 +2775,9 @@ pr(); return (-1); } -@ +\end{chunk} \subsection{read\_from\_session} -<>= +\begin{chunk}{ses.readfromsession} static void read_from_session(Sock *sock) { @@ -2804,9 +2804,9 @@ read_from_session(Sock *sock) reading_output = 1; } -@ +\end{chunk} \subsection{manage\_sessions} -<>= +\begin{chunk}{ses.managesessions} static void manage_sessions(void) { @@ -2873,9 +2873,9 @@ fprintf(stderr,"rd=%u]\n",*((long *)rd.fds_bits)); } } -@ +\end{chunk} \subsection{main sessionmanager} -<>= +\begin{chunk}{ses.main} int main(void) { @@ -2939,36 +2939,36 @@ main(void) return(0); } -@ +\end{chunk} \subsection{session} -<>= +\begin{chunk}{session} /* #define DEBUG */ #define _SESSION_C -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> - -@ +\getchunk{ses.includes} +\getchunk{ses.variables} +\getchunk{ses.usr1handler} +\getchunk{ses.usr2handler} +\getchunk{ses.termhandler} +\getchunk{ses.pr} +\getchunk{ses.closeclient} +\getchunk{ses.readSpadServercommand} +\getchunk{ses.testsockforprocess} +\getchunk{ses.readmenuclientcommand} +\getchunk{ses.readfromspadio} +\getchunk{ses.killspad} +\getchunk{ses.acceptsessionconnection} +\getchunk{ses.readfromsession} +\getchunk{ses.managesessions} +\getchunk{ses.main} + +\end{chunk} \chapter{The {\tt spadclient} program} -<>= +\begin{chunk}{the spadclient command line} char *SpadClientProgram = "$AXIOM/lib/spadclient"; -@ +\end{chunk} \section{spadclient} -<>= +\begin{chunk}{spadclient} #define _SPADCLIENT_C #include @@ -2999,9 +2999,9 @@ main(void) return(0); } -@ +\end{chunk} \chapter{The Command Completion List} -<>= +\begin{chunk}{command.list} - / /\ @@ -7125,7 +7125,7 @@ WeierstrassPreparation WildFunctionFieldIntegralBasis XExponentialPackage ZeroDimensionalSolvePackage -@ +\end{chunk} \chapter{Research Topics} These are included here as ideas that may get expanded in more detail later. \section{Proofs} @@ -7193,7 +7193,7 @@ Note that the provisos need not be an interval. They could be anything such as a polynomial or a property like ``$f(x)$ is entire''. \chapter{Makefile} \section{Environment variables} -<>= +\begin{chunk}{make.environment} BOOK=${SPD}/books/bookvol6.pamphlet # this is where we are compiling from @@ -7222,19 +7222,19 @@ LDFLAGS= -L${LIB} -lspad ${LDF} SMANOBJS= ${LIB}/libspad.a -@ +\end{chunk} \section{The axiom command} -<>= +\begin{chunk}{make.axiomcmd} ${OUT}/axiom: ${BOOK} @echo 1 making ${OUT}/axiom from ${BOOK} @ (cd ${OUT} ; \ - ${TANGLE} -R"axiomcmd" ${BOOK} >axiom ) + echo '(tangle "${BOOK}" "axiomcmd" "axiom")' | ${OBJ}/${SYS}/bin/lisp ) @chmod +x ${OUT}/axiom @ cp ${OUT}/axiom ${MID} -@ +\end{chunk} \section{session} -<>= +\begin{chunk}{make.session} ${OUTLIB}/session: ${SMANOBJS} ${MIDOBJ}/session.o @ echo 1 linking session @ ${CC} -o ${OUTLIB}/session ${MIDOBJ}/session.o ${SMANOBJS} @@ -7242,17 +7242,18 @@ ${OUTLIB}/session: ${SMANOBJS} ${MIDOBJ}/session.o ${MID}/session.c: ${BOOK} @ echo 2 making ${MID}/session.c from ${BOOK} @ (cd ${MID} ; \ - ${TANGLE} -R"session" ${BOOK} >session.c ) + echo '(tangle "${BOOK}" "session" "session.c")' | \ + ${OBJ}/${SYS}/bin/lisp ) ${MIDOBJ}/session.o: ${MID}/session.c ${INC}/session.h1 @ echo 3 making ${MIDOBJ}/session.o from ${MID}/session.c @ ( cd ${MIDOBJ} ; ${CC} -c ${CFLAGS} ${MID}/session.c -I${INC} ) -@ +\end{chunk} \section{nagman} Note that we do not build the nagman component as we do not have the -necessary code (for instance, [[callnag]]). -<>= +necessary code (for instance, callnag). +\begin{chunk}{make.nagman} ${OUT}/nagman: ${SMANOBJS} ${MIDOBJ}/nagman.o @ echo 5 linking nagman @ ${CC} -o ${OUT}/nagman ${MIDOBJ}/nagman.o ${SMANOBJS} @@ -7260,15 +7261,16 @@ ${OUT}/nagman: ${SMANOBJS} ${MIDOBJ}/nagman.o ${MID}/nagman.c: ${BOOK} @ echo 6 making ${MID}/nagman.c from ${IN}/bookvol6.pamphlet @ (cd ${MID} ; \ - ${TANGLE} -R"nagman" ${BOOK} >nagman.c ) + echo '(tangle "${BOOK}" "nagman" "nagman.c")' | \ + ${OBJ}/${SYS}/bin/lisp ) ${MIDOBJ}/nagman.o: ${MID}/nagman.c ${INC}/nagman.h1 @ echo 7 making ${MIDOBJ}/nagman.o from ${MID}/nagman.c @ ( cd ${MIDOBJ} ; ${CC} -c ${CFLAGS} ${MID}/nagman.c -I${INC} ) -@ +\end{chunk} \section{spadclient} -<>= +\begin{chunk}{make.spadclient} ${OUTLIB}/spadclient: ${SMANOBJS} ${MIDOBJ}/spadclient.o @ echo 9 linking spadclient @ ${CC} -o ${OUTLIB}/spadclient ${MIDOBJ}/spadclient.o ${SMANOBJS} @@ -7276,15 +7278,16 @@ ${OUTLIB}/spadclient: ${SMANOBJS} ${MIDOBJ}/spadclient.o ${MID}/spadclient.c: ${BOOK} @ echo 10 making ${MID}/spadclient.c from ${IN}/bookvol6.pamphlet @ (cd ${MID} ; \ - ${TANGLE} -R"spadclient" ${BOOK} >spadclient.c ) + echo '(tangle "${BOOK}" "spadclient" "spadclient.c")' | \ + ${OBJ}/${SYS}/bin/lisp ) ${MIDOBJ}/spadclient.o: ${MID}/spadclient.c ${INC}/spadclient.h1 @ echo 11 making ${MIDOBJ}/spadclient.o from ${MID}/spadclient.c @ ( cd ${MIDOBJ} ; ${CC} -c ${CFLAGS} ${MID}/spadclient.c -I${INC} ) -@ +\end{chunk} \section{sman} -<>= +\begin{chunk}{make.sman} ${OUT}/sman: ${SMANOBJS} ${MIDOBJ}/sman.o @ echo 13 linking sman @ ${CC} -o ${OUT}/sman ${MIDOBJ}/sman.o ${SMANOBJS} @@ -7292,32 +7295,34 @@ ${OUT}/sman: ${SMANOBJS} ${MIDOBJ}/sman.o ${MID}/sman.h: ${BOOK} @ echo 00 making ${MID}/sman.h from ${IN}/bookvol6.pamphlet @ (cd ${MID} ; \ - ${TANGLE} -R"sman.h" ${BOOK} >sman.h ) + echo '(tangle "${BOOK}" "sman.h" "sman.h")' | \ + ${OBJ}/${SYS}/bin/lisp ) ${MID}/sman.c: ${MID}/sman.h ${BOOK} @ echo 14 making ${MID}/sman.c from ${IN}/bookvol6.pamphlet @ (cd ${MID} ; \ - ${TANGLE} -R"sman" ${BOOK} >sman.c ) + echo '(tangle "${BOOK}" "sman" "sman.c")' | \ + ${OBJ}/${SYS}/bin/lisp ) ${MIDOBJ}/sman.o: ${MID}/sman.c ${INC}/sman.h1 @ echo 15 making ${MIDOBJ}/sman.o from ${MID}/sman.c @ ( cd ${MIDOBJ} ; ${CC} -I${INC} -I${MID} -c ${CFLAGS} ${MID}/sman.c ) -@ -<<*>>= -<> +\end{chunk} +\begin{chunk}{*} +\getchunk{make.environment} all: ${OUTLIB}/session ${OUTLIB}/spadclient ${OUT}/sman ${OUT}/axiom @ echo 18 finished ${IN} clean: @echo 19 cleaning ${SRC}/sman -<> -<> -<> -<> -<> -@ +\getchunk{make.axiomcmd} +\getchunk{make.sman} +\getchunk{make.session} +\getchunk{make.spadclient} +\getchunk{make.nagman} +\end{chunk} \begin{thebibliography}{99} \bibitem{1} Jenks, R.J. and Sutor, R.S. \\ ``Axiom -- The Scientific Computation System''\\ diff --git a/books/bookvol7.pamphlet b/books/bookvol7.pamphlet index 29ac270..e222344 100644 --- a/books/bookvol7.pamphlet +++ b/books/bookvol7.pamphlet @@ -4276,7 +4276,7 @@ cflow --emacs -l -n -b -T --omit-arguments hypertex.c \subsection{BeStruct} \index{struct!BeStruct} \index{BeStruct struct} -<>= +\begin{chunk}{BeStruct} typedef struct be_struct { int type; char *id; @@ -4285,12 +4285,12 @@ typedef struct be_struct { BeStruct *top_be_stack; -@ +\end{chunk} \section{Shared Code for file handling} \subsection{strpostfix} \index{shared!strpostfix} \index{strpostfix shared} -<>= +\begin{chunk}{strpostfix} static int strpostfix(char *s, char *t) { int slen = strlen(s), tlen = strlen(t); if (tlen > slen) @@ -4301,7 +4301,7 @@ static int strpostfix(char *s, char *t) { return 1; } -@ +\end{chunk} \subsection{extendHT} If the filename does not end with the string ``.pamphlet'', or ``.ht'', or ``.pht'', then add ``.ht'' as the default. @@ -4314,7 +4314,7 @@ For system pages we hand generate the paste files and add them to the hyperdoc volume. \index{shared!extendHT} \index{extendHT shared} -<>= +\begin{chunk}{extendHT} void extendHT(char *name) { if (!strpostfix(name, ".pamphlet") && !strpostfix(name, ".ht") && @@ -4323,7 +4323,7 @@ void extendHT(char *name) { return; } -@ +\end{chunk} \subsection{buildHtFilename} This procedure is sent a filename, and from it tries to build the full filename, this it returns in the fullname variable. If the file is not @@ -4332,7 +4332,7 @@ including the .ht extension. The aname is the filename minus the added .ht extension, and the pathname. \index{shared!buildHtFilename} \index{buildHtFilename shared} -<>= +\begin{chunk}{buildHtFilename} static int buildHtFilename(char *fname, char *aname, char *name) { char cdir[256]; char *c_dir; @@ -4428,11 +4428,11 @@ static int buildHtFilename(char *fname, char *aname, char *name) { } } -@ +\end{chunk} \subsection{pathname} \index{shared!pathname} \index{pathname shared} -<>= +\begin{chunk}{pathname} static int pathname(char *name) { while (*name) if (*name++ == '/') @@ -4440,12 +4440,12 @@ static int pathname(char *name) { return 0; } -@ +\end{chunk} \subsection{htFileOpen} This procedure opens the proper HT file \index{htFileOpen!main} \index{main htFileOpen} -<>= +\begin{chunk}{htFileOpen} FILE *htFileOpen(char *fname, char *aname, char *name) { FILE *ht_fp; int ret_value; @@ -4463,7 +4463,7 @@ FILE *htFileOpen(char *fname, char *aname, char *name) { } -@ +\end{chunk} \subsection{dbFileOpen} This function is responsible for actually opening the database file. For the moment it gets the \$AXIOM environment variable, and appends to it @@ -4480,7 +4480,7 @@ found. -JMW \index{shared!dbFileOpen} \index{dbFileOpen shared} -<>= +\begin{chunk}{dbFileOpen} FILE *dbFileOpen(char *dbFile) { static char *db_path_trace = NULL; char *dbFile_trace; @@ -4531,11 +4531,11 @@ FILE *dbFileOpen(char *dbFile) { return (db_fp); } -@ +\end{chunk} \subsection{tempFileOpen} \index{shared!tempFileOpen} \index{tempFileOpen shared} -<>= +\begin{chunk}{tempFileOpen} FILE *tempFileOpen(char *temp_dbFile) { FILE *temp_db_fp; /** Just make the name and open it **/ @@ -4548,13 +4548,13 @@ FILE *tempFileOpen(char *temp_dbFile) { } return temp_db_fp; } -@ +\end{chunk} \section{Shared Code for Hash Table Handling} \subsection{halloc} Allocate memory and bomb if none left (HyperDoc alloc) \index{shared!halloc} \index{halloc shared} -<>= +\begin{chunk}{halloc} char *halloc(int bytes, char *msg) { static char buf[200]; char *result; @@ -4576,13 +4576,13 @@ char *halloc(int bytes, char *msg) { } return result; } -@ +\end{chunk} \subsection{hashInit} Initialize a hash table. \index{shared!hashInit} \index{hashInit shared} -<>= +\begin{chunk}{hashInit} void hashInit(HashTable *table, int size, EqualFunction equal, HashcodeFunction hash_code) { int i; @@ -4596,11 +4596,11 @@ void hashInit(HashTable *table, int size, EqualFunction equal, table->num_entries = 0; } -@ +\end{chunk} \subsection{freeHash} \index{shared!freeHash} \index{freeHash shared} -<>= +\begin{chunk}{freeHash} void freeHash(HashTable *table, FreeFunction free_fun) { if (table) { int i; @@ -4618,12 +4618,12 @@ void freeHash(HashTable *table, FreeFunction free_fun) { } } -@ +\end{chunk} \subsection{hashInsert} Insert an entry into a hash table. \index{shared!hashInsert} \index{hashInsert shared} -<>= +\begin{chunk}{hashInsert} void hashInsert(HashTable *table, char *data, char *key) { HashEntry *entry = (HashEntry *) halloc(sizeof(HashEntry), "HashEntry"); int code; @@ -4638,11 +4638,11 @@ void hashInsert(HashTable *table, char *data, char *key) { table->num_entries++; } -@ +\end{chunk} \subsection{hashFind} \index{shared!hashFind} \index{hashFind shared} -<>= +\begin{chunk}{hashFind} char *hashFind(HashTable *table, char *key) { HashEntry *entry; int code = table->hash_code(key, table->size) % table->size; @@ -4652,11 +4652,11 @@ char *hashFind(HashTable *table, char *key) { return NULL; } -@ +\end{chunk} \subsection{hashReplace} \index{shared!hashReplace} \index{hashReplace shared} -<>= +\begin{chunk}{hashReplace} char *hashReplace(HashTable *table, char *data, char *key) { HashEntry *entry; int code = table->hash_code(key, table->size) % table->size; @@ -4669,11 +4669,11 @@ char *hashReplace(HashTable *table, char *data, char *key) { return NULL; } -@ +\end{chunk} \subsection{hashDelete} \index{shared!hashDelete} \index{hashDelete shared} -<>= +\begin{chunk}{hashDelete} void hashDelete(HashTable *table, char *key) { HashEntry **entry; int code = table->hash_code(key, table->size) % table->size; @@ -4685,11 +4685,11 @@ void hashDelete(HashTable *table, char *key) { } } -@ +\end{chunk} \subsection{hashMap} \index{shared!hashMap} \index{hashMap shared} -<>= +\begin{chunk}{hashMap} void hashMap(HashTable *table, MappableFunction func) { int i; HashEntry *e; @@ -4700,11 +4700,11 @@ void hashMap(HashTable *table, MappableFunction func) { (*func) (e->data); } -@ +\end{chunk} \subsection{hashCopyEntry} \index{shared!hashCopyEntry} \index{hashCopyEntry shared} -<>= +\begin{chunk}{hashCopyEntry} HashEntry *hashCopyEntry(HashEntry *e) { HashEntry *ne; if (e == NULL) @@ -4717,11 +4717,11 @@ HashEntry *hashCopyEntry(HashEntry *e) { } /* copy a hash table */ -@ +\end{chunk} \subsection{hashCopyTable} \index{shared!hashCopyTable} \index{hashCopyTable shared} -<>= +\begin{chunk}{hashCopyTable} HashTable *hashCopyTable(HashTable *table) { HashTable *nt = (HashTable *) halloc(sizeof(HashTable), "copy hash table"); int i; @@ -4736,12 +4736,12 @@ HashTable *hashCopyTable(HashTable *table) { return nt; } -@ +\end{chunk} \subsection{stringHash} Hash code function for strings. \index{shared!stringHash} \index{stringHash shared} -<>= +\begin{chunk}{stringHash} int stringHash(char *s, int size) { int c = 0; char *p =s; @@ -4750,22 +4750,22 @@ int stringHash(char *s, int size) { return c % size; } -@ +\end{chunk} \subsection{stringEqual} Test strings for equality. \index{shared!stringEqual} \index{stringEqual shared} -<>= +\begin{chunk}{stringEqual} int stringEqual(char *s1, char *s2) { return (strcmp(s1, s2) == 0); } -@ +\end{chunk} \subsection{allocString} Make a fresh copy of the given string. \index{shared!allocString} \index{allocString shared} -<>= +\begin{chunk}{allocString} char *allocString(char *str) { char * result; result = halloc(strlen(str)+1,"String"); @@ -4773,12 +4773,12 @@ char *allocString(char *str) { return (result); } -@ +\end{chunk} \section{Shared Code for Error Handling} \subsection{jump} \index{shared!jump} \index{jump shared} -<>= +\begin{chunk}{jump} void jump(void) { if (gWindow == NULL) exit(-1); @@ -4787,7 +4787,7 @@ void jump(void) { exit(-1); } -@ +\end{chunk} \subsection{dumpToken} We need a function to print the token object for debugging. @@ -4799,17 +4799,17 @@ token to be printed. For instance, a call would look like: There is no return value. \index{shared!dumpToken} \index{dumpToken shared} -<>= +\begin{chunk}{dumpToken} void dumpToken(char *caller, Token t) { fprintf(stderr,"TPDHERE:%s:dumpToken type=%s id=%s\n", caller,token_table[t.type],t.id); } -@ +\end{chunk} \subsection{printPageAndFilename} \index{shared!printPageAndFilename} \index{printPageAndFilename shared} -<>= +\begin{chunk}{printPageAndFilename} void printPageAndFilename(void) { char obuff[128]; if (gPageBeingParsed->type == Normal) { @@ -4837,11 +4837,11 @@ void printPageAndFilename(void) { fprintf(stderr, "%s", obuff); } -@ +\end{chunk} \subsection{printNextTenTokens} \index{shared!printNextTenTokens} \index{printNextTenTokens shared} -<>= +\begin{chunk}{printNextTenTokens} void printNextTenTokens(void) { int i; int v; @@ -4855,12 +4855,12 @@ void printNextTenTokens(void) { fprintf(stderr, "\n"); } -@ +\end{chunk} \subsection{printToken} Print out a token value. \index{shared!printToken} \index{printToken shared} -<>= +\begin{chunk}{printToken} void printToken(void) { if (token.type == Word) printf("%s ", token.id); @@ -4871,11 +4871,11 @@ void printToken(void) { fflush(stdout); } -@ +\end{chunk} \subsection{tokenName} \index{shared!tokenName} \index{tokenName shared} -<>= +\begin{chunk}{tokenName} void tokenName(int type) { if (type <= NumberUserTokens) strcpy(ebuffer, token_table[type]); @@ -4948,7 +4948,7 @@ void tokenName(int type) { } } -@ +\end{chunk} \subsection{htperror} This is the error handling routine in AXIOM. The main routine is called htperror(): arguments: msg - like perror it accepts an error @@ -4959,7 +4959,7 @@ The prints out the page name, and then the filename in which the error occurred. If possible it also tries to print out the next ten tokens. \index{shared!htperror} \index{htperror shared} -<>= +\begin{chunk}{htperror} void tpderror(char *msg, int errn) { char obuff[256]; /* The first thing I do is create the error message */ @@ -4974,7 +4974,7 @@ void tpderror(char *msg, int errn) { printPageAndFilename(); printNextTenTokens(); } -@ +\end{chunk} \section{Shared Code for Lexical Analyzer} Lexical analyzer stuff. Exported functions: @@ -5001,7 +5001,7 @@ value of the variable ``inputType''. If this variable is: Initialize the parser keyword hash table. \index{shared!parserInit} \index{parserInit shared} -<>= +\begin{chunk}{parserInit} void parserInit(void) { int i; Token *toke; @@ -5019,13 +5019,13 @@ void parserInit(void) { } } -@ +\end{chunk} \subsection{initScanner} \label{initScanner} Initialize the lexical scanner to read from a file. \index{shared!initScanner} \index{initScanner shared} -<>= +\begin{chunk}{initScanner} void initScanner(void) { if (getenv("HTASCII")) { useAscii = (strcmp(getenv("HTASCII"), "yes") == 0); @@ -5044,13 +5044,13 @@ void initScanner(void) { line_number = 1; } -@ +\end{chunk} \subsection{saveScannerState} These variables save the current state of scanner. Currently only one level of saving is allowed. In the future we should allow nested saves. \index{shared!saveScannerState} \index{saveScannerState shared} -<>= +\begin{chunk}{saveScannerState} void saveScannerState(void) { StateNode *new_item=(StateNode *)halloc((sizeof(StateNode)), "StateNode"); new_item->page_start_fpos = page_start_fpos; @@ -5067,12 +5067,12 @@ void saveScannerState(void) { top_state_node = new_item; } -@ +\end{chunk} \subsection{restoreScannerState} Restore the saved scanner state. \index{shared!restoreScannerState} \index{restoreScannerState shared} -<>= +\begin{chunk}{restoreScannerState} void restoreScannerState(void) { StateNode *x = top_state_node; if (top_state_node == NULL) { @@ -5096,23 +5096,23 @@ void restoreScannerState(void) { free(x); } -@ +\end{chunk} \subsection{ungetChar} Return the character to the input stream. \index{shared!ungetChar} \index{ungetChar shared} -<>= +\begin{chunk}{ungetChar} void ungetChar(int c) { if (c == '\n') line_number--; last_ch = c; } -@ +\end{chunk} \subsection{getChar} \index{shared!getChar} \index{getChar shared} -<>= +\begin{chunk}{getChar} int getChar(void) { int c; c = getChar1(); @@ -5158,12 +5158,12 @@ int getChar(void) { return c; } -@ +\end{chunk} \subsection{getChar1} Return the next character in the input stream. \index{shared!getChar1} \index{getChar1 shared} -<>= +\begin{chunk}{getChar1} static int getChar1(void) { int c; int cmd; @@ -5221,23 +5221,23 @@ AGAIN: } } -@ +\end{chunk} \subsection{ungetToken} Return current token to the input stream. \index{shared!ungetToken} \index{ungetToken shared} -<>= +\begin{chunk}{ungetToken} void ungetToken(void) { last_token = 1; unget_toke.type = token.type; unget_toke.id = allocString(token.id - 1); } -@ +\end{chunk} \subsection{getToken} \index{shared!getToken} \index{getToken shared} -<>= +\begin{chunk}{getToken} int getToken(void) { int c, ws; int nls = 0; @@ -5392,11 +5392,11 @@ int getToken(void) { return 0; } -@ +\end{chunk} \subsection{pushBeStack} \index{shared!pushBeStack} \index{pushBeStack shared} -<>= +\begin{chunk}{pushBeStack} void pushBeStack(int type,char * id) { BeStruct *be = (BeStruct *) halloc(sizeof(BeStruct), "BeginENd stack"); if (gWindow != NULL) { @@ -5408,14 +5408,14 @@ void pushBeStack(int type,char * id) { return; } -@ +\end{chunk} \subsection{checkAndPopBeStack} This routine pops the be stack and compares types. If they are the same then I am okay and return a 1. Else I return a two and try to print a meaningful message. \index{shared!checkAndPopBeStack} \index{checkAndPopBeStack shared} -<>= +\begin{chunk}{checkAndPopBeStack} void checkAndPopBeStack(int type,char * id) { BeStruct *x; if (gWindow == NULL) @@ -5440,11 +5440,11 @@ void checkAndPopBeStack(int type,char * id) { jump(); } -@ +\end{chunk} \subsection{clearBeStack} \index{shared!clearBeStack} \index{clearBeStack shared} -<>= +\begin{chunk}{clearBeStack} int clearBeStack(void) { BeStruct *x = top_be_stack, *y; top_be_stack = NULL; @@ -5456,11 +5456,11 @@ int clearBeStack(void) { return 1; } -@ +\end{chunk} \subsection{beType} \index{shared!beType} \index{beType shared} -<>= +\begin{chunk}{beType} int beType(char *which) { Token store; getExpectedToken(Lbrace); @@ -5529,7 +5529,7 @@ int beType(char *which) { return 0; } -@ +\end{chunk} \subsection{beginType} This routine parses a statement of the form \verb|\begin{word}|. Once it has read the word it tries to assign it a type. Once that is done it sends @@ -5538,7 +5538,7 @@ For the moment I cannot even going to use a hashTable, although in the future this may be needed. \index{shared!beginType} \index{beginType shared} -<>= +\begin{chunk}{beginType} int beginType(void) { /*Token store;*/ int ret_val; @@ -5564,7 +5564,7 @@ int beginType(void) { return 1; } -@ +\end{chunk} \subsection{endType} This routine gets the end type just as the beginType routine does, But then it checks to see if recieved the proper endType. By a clever @@ -5572,7 +5572,7 @@ trick, the proper end type is 3000 + type. When environments this will have to change. \index{shared!endType} \index{endType shared} -<>= +\begin{chunk}{endType} int endType(void) { int ret; ret = beType("end"); @@ -5610,11 +5610,11 @@ int endType(void) { return 1; } -@ +\end{chunk} \subsection{keywordType} \index{shared!keywordType} \index{keywordType shared} -<>= +\begin{chunk}{keywordType} int keywordType(void) { Token *token_ent; /* first check to see if it is a reserved token */ @@ -5652,12 +5652,12 @@ int keywordType(void) { return 0; } -@ +\end{chunk} \subsection{getExpectedToken} Read a token, and report a syntax error if it has the wrong type. \index{shared!getExpectedToken} \index{getExpectedToken shared} -<>= +\begin{chunk}{getExpectedToken} void getExpectedToken(int type) { getToken(); if (token.type != type) { @@ -5679,11 +5679,11 @@ void getExpectedToken(int type) { } } -@ +\end{chunk} \subsection{spadErrorHandler} \index{shared!spadErrorHandler} \index{spadErrorHandler shared} -<>= +\begin{chunk}{spadErrorHandler} static void spadErrorHandler(void) { /* fprintf(stderr, "got a spad error\n"); */ longjmp(jmpbuf, 1); @@ -5691,11 +5691,11 @@ static void spadErrorHandler(void) { exit(-1); } -@ +\end{chunk} \subsection{resetConnection} \index{shared!resetConnection} \index{resetConnection shared} -<>= +\begin{chunk}{resetConnection} void resetConnection(void) { if (spadSocket) { FD_CLR(spadSocket->socket, &socket_mask); @@ -5712,12 +5712,12 @@ void resetConnection(void) { } } -@ +\end{chunk} \subsection{spadBusy} Returns true if spad is currently computing. \index{shared!spadBusy} \index{spadBusy shared} -<>= +\begin{chunk}{spadBusy} int spadBusy(void) { if (sessionServer == NULL) return 1; @@ -5726,11 +5726,11 @@ int spadBusy(void) { } /* connect to AXIOM , return 0 if succesful, 1 if not */ -@ +\end{chunk} \subsection{connectSpad} \index{shared!connectSpad} \index{connectSpad shared} -<>= +\begin{chunk}{connectSpad} int connectSpad(void) { if (!MenuServerOpened) { fprintf(stderr,"(HyperDoc) Warning: Not connected to AXIOM Server!\n"); @@ -5749,10 +5749,10 @@ int connectSpad(void) { /* if (spadBusy()) return SpadBusy; */ return Connected; } -@ +\end{chunk} \section{htadd shared code} \index{htadd shared code} -<>= +\begin{chunk}{htadd shared code} #include "bsdsignal.h" #include "bsdsignal.h1" #include "sockio-c.h1" @@ -5904,56 +5904,56 @@ char *token_table[] = { "controlbitmap" }; -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> - -@ +\getchunk{token.h} +\getchunk{spadErrorHandler} +\getchunk{spadBusy} +\getchunk{connectSpad} +\getchunk{resetConnection} +\getchunk{pathname} +\getchunk{BeStruct} +\getchunk{strpostfix} +\getchunk{extendHT} +\getchunk{buildHtFilename} +\getchunk{htFileOpen} +\getchunk{tempFileOpen} +\getchunk{halloc} +\getchunk{hashInit} +\getchunk{hashInsert} +\getchunk{hashDelete} +\getchunk{hashMap} +\getchunk{hashFind} +\getchunk{hashReplace} +\getchunk{freeHash} +\getchunk{stringHash} +\getchunk{stringEqual} +\getchunk{allocString} +\getchunk{jump} +\getchunk{tokenName} +\getchunk{printToken} +\getchunk{printPageAndFilename} +\getchunk{printNextTenTokens} +\getchunk{parserInit} +\getchunk{initScanner} +\getchunk{saveScannerState} +\getchunk{restoreScannerState} +\getchunk{ungetChar} +\getchunk{getExpectedToken} +\getchunk{ungetToken} +\getchunk{getChar1} +\getchunk{getChar} +\getchunk{getToken} +\getchunk{pushBeStack} +\getchunk{clearBeStack} +\getchunk{checkAndPopBeStack} +\getchunk{beType} +\getchunk{beginType} +\getchunk{endType} +\getchunk{keywordType} + +\end{chunk} \section{hypertex shared code} \index{hypertex shared code} -<>= +\begin{chunk}{hypertex shared code} #include "bsdsignal.h" #include "bsdsignal.h1" #include "sockio-c.h1" @@ -6105,56 +6105,56 @@ char *token_table[] = { "controlbitmap" }; -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> - -@ +\getchunk{token.h} +\getchunk{spadErrorHandler} +\getchunk{spadBusy} +\getchunk{connectSpad} +\getchunk{resetConnection} +\getchunk{pathname} +\getchunk{BeStruct} +\getchunk{strpostfix} +\getchunk{extendHT} +\getchunk{buildHtFilename} +\getchunk{htFileOpen} +\getchunk{tempFileOpen} +\getchunk{halloc} +\getchunk{hashInit} +\getchunk{hashInsert} +\getchunk{hashDelete} +\getchunk{hashMap} +\getchunk{hashFind} +\getchunk{hashReplace} +\getchunk{freeHash} +\getchunk{stringHash} +\getchunk{stringEqual} +\getchunk{allocString} +\getchunk{jump} +\getchunk{tokenName} +\getchunk{printToken} +\getchunk{printPageAndFilename} +\getchunk{printNextTenTokens} +\getchunk{parserInit} +\getchunk{initScanner} +\getchunk{saveScannerState} +\getchunk{restoreScannerState} +\getchunk{ungetChar} +\getchunk{getExpectedToken} +\getchunk{ungetToken} +\getchunk{getChar1} +\getchunk{getChar} +\getchunk{getToken} +\getchunk{pushBeStack} +\getchunk{clearBeStack} +\getchunk{checkAndPopBeStack} +\getchunk{beType} +\getchunk{beginType} +\getchunk{endType} +\getchunk{keywordType} + +\end{chunk} \chapter{Shared include files} \section{debug.c} -<>= +\begin{chunk}{debug.c} #include "debug.h" #ifdef free @@ -6164,7 +6164,7 @@ hfree(char *p) { } #endif -@ +\end{chunk} \section{hyper.h} The \verb|hypertex| function, of which this is the top level, is a browser for Axiom information. It works off a database of pages. The pages are @@ -6186,7 +6186,7 @@ The \verb|hypertex| function looks in \verb|$AXIOM/doc| by default. This can be over-ridden by setting the \verb|HTPATH| shell variable to point to the desired directory containing the pages and the ht.db file. -<>= +\begin{chunk}{hyper.h} #include #include #include @@ -6197,7 +6197,7 @@ the ht.db file. #include #include "com.h" -<> +\getchunk{token.h} #include "hash.h" #define boolean unsigned short int @@ -6695,7 +6695,7 @@ typedef struct parameter_list_type { struct parameter_list_type *next; } *ParameterList; -@ +\end{chunk} \chapter{The spadbuf function} \section{spadbuf Call Graph} This was generated by the GNU cflow program with the argument list. @@ -6745,7 +6745,7 @@ cflow --emacs -l -n -b -T --omit-arguments spadbuf.c \end{verbatim} \section{Constants and Headers} \subsection{System includes} -<>= +\begin{chunk}{spadbuf} #include #include #include @@ -6755,9 +6755,9 @@ cflow --emacs -l -n -b -T --omit-arguments spadbuf.c #include #include -@ +\end{chunk} \subsection{Local includes} -<>= +\begin{chunk}{spadbuf} #include "debug.h" #include "bsdsignal.h" #include "edible.h" @@ -6771,17 +6771,17 @@ cflow --emacs -l -n -b -T --omit-arguments spadbuf.c #include "cursor.h1" #include "fnct-key.h1" -@ +\end{chunk} \section{externs} -<>= +\begin{chunk}{spadbuf} extern char in_buff[]; /* buffer for storing characters read until they are processed */ extern char buff[]; /* Buffers for collecting input and */ extern int buff_flag[]; /* flags for whether buff chars are printing or non-printing */ -@ +\end{chunk} \section{local variables} -<>= +\begin{chunk}{spadbuf} unsigned char _INTR, _QUIT, _ERASE, _KILL, _EOF, _EOL, _RES1, _RES2; int contNum; /* do reading and all the other fun stuff * depend on this for all there ioctl's */ @@ -6809,23 +6809,23 @@ int (*old_handler) (); Sock *session_sock, *menu_sock; char *buff_name = NULL; /* name for the aixterm */ -@ +\end{chunk} \section{Code} This routine used to be used to send sigint onto spad, but now they go through just fine on their own reinstated for AIX V3.2 \subsection{spadbufInterHandler} \index{spadbuf!spadbufInterHandler} \index{spadbufInterHandler spadbuf} -<>= +\begin{chunk}{spadbuf} static void spadbufInterHandler(int sig) { send_signal(session_sock, SIGUSR2); } -@ +\end{chunk} \subsection{spadbufFunctionChars} \index{spadbuf!spadbufFunctionChars} \index{spadbufFunctionChars spadbuf} -<>= +\begin{chunk}{spadbuf} static void spadbufFunctionChars(void) { /** once I have that get the special characters ****/ _INTR = oldbuf.c_cc[VINTR]; @@ -6837,13 +6837,13 @@ static void spadbufFunctionChars(void) { return; } -@ +\end{chunk} \subsection{interpIO} Act as terminal session for sock connected to stdin and stdout of another process. \index{spadbuf!interpIO} \index{interpIO spadbuf} -<>= +\begin{chunk}{spadbuf} static void interpIO(void) { char buf[1024]; fd_set rd; @@ -6890,11 +6890,11 @@ static void interpIO(void) { } } -@ +\end{chunk} \subsection{} \index{spadbuf!initParent} \index{initParent spadbuf} -<>= +\begin{chunk}{spadbuf} static void initParent(void) { /** get the original termio settings, so I never have to check again **/ if (tcgetattr(0,&oldbuf) == -1) { @@ -6929,7 +6929,7 @@ static void initParent(void) { Cursor_shape(2); } -@ +\end{chunk} \subsection{main} Modified on 6/13/90 for the command line completion abiltities of Since I am only calling this program from within spadint, I decided @@ -6939,7 +6939,7 @@ that the usage should be. \end{verbatim} \index{spadbuf!main} \index{main spadbuf} -<>= +\begin{chunk}{spadbuf} int main(int argc,char ** argv) { FILE *fopen(); if (argc < 2) { @@ -6967,7 +6967,7 @@ int main(int argc,char ** argv) { return(1); } -@ +\end{chunk} \chapter{The ex2ht function} \section{ex2ht Call Graph} This was generated by the GNU cflow program with the argument list. @@ -7033,7 +7033,7 @@ The ex2ht command creates a cover page for structured HyperDoc example pages \section{Constants and Headers} \subsection{System includes} -<>= +\begin{chunk}{ex2ht} #include #include #include @@ -7042,43 +7042,43 @@ The ex2ht command creates a cover page for structured HyperDoc example pages #include #include -@ +\end{chunk} \subsection{Local includes} -<>= +\begin{chunk}{ex2ht} #include "debug.h" #include "ex2ht.h1" -@ +\end{chunk} \section{defines} -<>= +\begin{chunk}{ex2ht} #define MaxLineLength 512 #define MaxFiles 100 -@ +\end{chunk} \section{local variables} -<>= +\begin{chunk}{ex2ht} char *files[MaxFiles]; int numFiles = 0; struct timeval latest_date[2] ={{0,0},{0,0}}; FILE *coverFile; -@ +\end{chunk} \section{Code} \subsection{allocString} \index{ex2ht!allocString} \index{allocString ex2ht} -<>= +\begin{chunk}{ex2ht} char *allocString(char *s) { char *t = (char *) malloc(strlen(s) + 1); strcpy(t, s); return t; } -@ +\end{chunk} \subsection{strPrefix} \index{ex2ht!strPrefix} \index{strPrefix ex2ht} -<>= +\begin{chunk}{ex2ht} char *strPrefix(char *prefix, char *s) { while (*prefix != '\0' && *prefix == *s) { prefix++; @@ -7089,11 +7089,11 @@ char *strPrefix(char *prefix, char *s) { return NULL; } -@ +\end{chunk} \subsection{getExTitle} \index{ex2ht!getExTitle} \index{getExTitle ex2ht} -<>= +\begin{chunk}{ex2ht} char *getExTitle(FILE *inFile, char *line) { char *title; while (fgets(line, MaxLineLength, inFile) != NULL) @@ -7105,11 +7105,11 @@ char *getExTitle(FILE *inFile, char *line) { return NULL; } -@ +\end{chunk} \subsection{exToHt} \index{ex2ht!exToHt} \index{exToHt ex2ht} -<>= +\begin{chunk}{ex2ht} void exToHt(char *filename) { char line[MaxLineLength], *line2; char *title, *pagename; @@ -7166,31 +7166,31 @@ void exToHt(char *filename) { } } -@ +\end{chunk} \subsection{emitHeader} \index{ex2ht!emitHeader} \index{emitHeader ex2ht} -<>= +\begin{chunk}{ex2ht} void emitHeader(FILE *outFile, char *pageName, char *pageTitle) { fprintf(outFile, "\\begin{page}{%s}{%s}\n", pageName, pageTitle); fprintf(outFile, "\\beginscroll\\beginmenu\n"); } -@ +\end{chunk} \subsection{emitFooter} \index{ex2ht!emitFooter} \index{emitFooter ex2ht} -<>= +\begin{chunk}{ex2ht} void emitFooter(FILE *outFile) { fprintf(outFile, "\\endmenu\\endscroll\\end{page}\n"); } -@ +\end{chunk} \subsection{emitMenuEntry} s is ``pageName\}\{title\}'' \index{ex2ht!emitMenuEntry} \index{emitMenuEntry ex2ht} -<>= +\begin{chunk}{ex2ht} void emitMenuEntry(char *line, FILE *outFile) { char pageName[MaxLineLength], title[MaxLineLength]; char *p = pageName, *t = title; @@ -7204,11 +7204,11 @@ void emitMenuEntry(char *line, FILE *outFile) { fprintf(outFile, "\\menudownlink%s}{%s}\n", title, pageName); } -@ +\end{chunk} \subsection{emitSpadCommand} \index{ex2ht!emitSpadCommand} \index{emitSpadCommand ex2ht} -<>= +\begin{chunk}{ex2ht} void emitSpadCommand(char *line, char *prefix, FILE *outFile) { int braceCount = 1; char command[MaxLineLength], *t = command; @@ -7225,11 +7225,11 @@ void emitSpadCommand(char *line, char *prefix, FILE *outFile) { fprintf(outFile, "%s%s}\n", prefix, command); } -@ +\end{chunk} \subsection{openCoverPage} \index{ex2ht!openCoverPage} \index{openCoverPage ex2ht} -<>= +\begin{chunk}{ex2ht} void openCoverPage(void) { coverFile = fopen("coverex.ht", "w"); if (coverFile == NULL) { @@ -7241,39 +7241,39 @@ void openCoverPage(void) { fprintf(coverFile, "\\beginscroll\\table{\n"); } -@ +\end{chunk} \subsection{closeCoverPage} \index{ex2ht!closeCoverPage} \index{closeCoverPage ex2ht} -<>= +\begin{chunk}{ex2ht} void closeCoverPage(void) { fprintf(coverFile, "}\\endscroll\\end{page}\n\n"); } -@ +\end{chunk} \subsection{closeCoverFile} \index{ex2ht!closeCoverFile} \index{closeCoverFile ex2ht} -<>= +\begin{chunk}{ex2ht} void closeCoverFile(void) { fclose(coverFile); utimes("coverex.ht",latest_date); } -@ +\end{chunk} \subsection{emitCoverLink} \index{ex2ht!emitCoverLink} \index{emitCoverLink ex2ht} -<>= +\begin{chunk}{ex2ht} void emitCoverLink(char *name, char *title) { fprintf(coverFile, "{\\downlink{%s}{%s}}\n", title, name); } -@ +\end{chunk} \subsection{addFile} \index{ex2ht!addFile} \index{addFile ex2ht} -<>= +\begin{chunk}{ex2ht} void addFile(char *filename) { FILE *file = fopen(filename, "r"); int c; @@ -7289,11 +7289,11 @@ void addFile(char *filename) { unlink(filename); } -@ +\end{chunk} \subsection{main} \index{ex2ht!main} \index{main ex2ht} -<>= +\begin{chunk}{ex2ht} int main(int argc, char **argv){ int i; if (argc == 1) { @@ -7310,7 +7310,7 @@ int main(int argc, char **argv){ return 0; } -@ +\end{chunk} \chapter{The htadd command} \section{htadd Call Graph} This was generated by the GNU cflow program with the argument list. @@ -7559,24 +7559,24 @@ similar to: \section{Constants and Headers} \subsection{System includes} -<>= +\begin{chunk}{htadd} #include #include #include #include -@ +\end{chunk} \subsection{structs} -<>= +\begin{chunk}{htadd} typedef struct toke { /* HyperDoc parser tokens */ int type; /* token type. One of those listed below */ char *id; /* string value if type == Identifier */ } Token; -@ +\end{chunk} \subsection{Local includes} -<>= -<> +\begin{chunk}{htadd} +\getchunk{hyper.h} #include "htadd.h1" #include "addfile.h1" #include "halloc.h1" @@ -7584,9 +7584,9 @@ typedef struct toke { /* HyperDoc parser tokens */ #include "hterror.h1" #include "lex.h1" -@ +\end{chunk} \subsection{extern references} -<>= +\begin{chunk}{htadd} extern HyperDocPage *gPageBeingParsed; extern short int gInSpadsrc; extern short int gInVerbatim; @@ -7595,9 +7595,9 @@ extern int line_number; /* keeps track of which line a page starts on * including a line number counter into * HyperDoc. */ -@ +\end{chunk} \subsection{defines} -<>= +\begin{chunk}{htadd} #define Delete 1 #define System 2 #define Current 4 @@ -7621,9 +7621,9 @@ extern int line_number; /* keeps track of which line a page starts on (whitespace(c)) -@ +\end{chunk} \subsection{forward declarations} -<>= +\begin{chunk}{htadd} static void updateDB(FILE *db, FILE *temp_db, FILE *new_file, char *addname, char *fullname, int fresh); static void addNewPages(FILE *temp_db, FILE *new_file, @@ -7638,9 +7638,9 @@ void printNextTenTokens(void); int getToken(void); int keywordType(void); -@ +\end{chunk} \subsection{local variables} -<>= +\begin{chunk}{htadd} int fresh = 0; int MenuServerOpened; @@ -7655,11 +7655,11 @@ Sock *spadSocket = NULL; int still_reading; int str_len; -@ +\end{chunk} \section{The Shared Code} -<>= -<> -@ +\begin{chunk}{htadd} +\getchunk{htadd shared code} +\end{chunk} \section{Code} \subsection{parseArgs} This routine parses the command line arguments. It parses @@ -7667,7 +7667,7 @@ the command line arguments. It returns a flag which tells the calling routine what database file to use, and whether or not to delete files. \index{htadd!parseArgs} \index{parseArgs htadd} -<>= +\begin{chunk}{htadd} static void parseArgs(char **argv, char *db_dir, char **filenames, short *fl) { *fl = 0; while (*++argv) { @@ -7704,12 +7704,12 @@ static void parseArgs(char **argv, char *db_dir, char **filenames, short *fl) { *filenames = NULL; } -@ +\end{chunk} \subsection{writable} Check to see if the user has permission \index{htadd!writable} \index{writable htadd} -<>= +\begin{chunk}{htadd} static int writable(struct stat buff) { #ifdef DEBUG unsigned short uid = geteuid(), gid = getegid(); @@ -7727,13 +7727,13 @@ static int writable(struct stat buff) { return 0; } -@ +\end{chunk} \subsection{buildDBFilename} This procedure builds the db filename. Subsequently, it is passed onto all the add files that are called. \index{htadd!buildDBFilename} \index{buildDBFilename htadd} -<>= +\begin{chunk}{htadd} static int buildDBFilename(short flag, char *db_dir, char *dbfilename) { int ret_status; struct stat buff; @@ -7778,7 +7778,7 @@ static int buildDBFilename(short flag, char *db_dir, char *dbfilename) { return 0; } -@ +\end{chunk} \subsection{addfile} This procedure now works as follows: \begin{enumerate} @@ -7799,7 +7799,7 @@ paths mentioned are used. \end{enumerate} \index{htadd!addfile} \index{addfile htadd} -<>= +\begin{chunk}{htadd} static void addfile(char *dbname, char *name, int fresh) { char fullname[256]; char temp_dbFile[256]; @@ -7842,11 +7842,11 @@ static void addfile(char *dbname, char *name, int fresh) { } } -@ +\end{chunk} \subsection{updateDB} \index{htadd!updateDB} \index{updateDB htadd} -<>= +\begin{chunk}{htadd} static void updateDB(FILE *db, FILE *temp_db, FILE *new_file, char *addname, char *fullname, int fresh) { /*fprintf(stderr,"TPDHERE:updateDB:addname=%s fullname=%s fresh=%d/n", @@ -7898,11 +7898,11 @@ static void updateDB(FILE *db, FILE *temp_db, FILE *new_file, } } -@ +\end{chunk} \subsection{addNewPages} \index{htadd!addNewPages} \index{addNewPages htadd} -<>= +\begin{chunk}{htadd} static void addNewPages(FILE *temp_db, FILE *new_file, char *addname, char *fullname) { char type[15]; @@ -7954,11 +7954,11 @@ static void addNewPages(FILE *temp_db, FILE *new_file, printf("Added %3d pages and/or macros from %s\n", pages, addname); } -@ +\end{chunk} \subsection{copyFile} \index{htadd!copyFile} \index{copyFile htadd} -<>= +\begin{chunk}{htadd} static void copyFile(char *f1, char *f2) { FILE *fp1, *fp2; int c; @@ -7971,11 +7971,11 @@ static void copyFile(char *f1, char *f2) { fclose(fp1); } -@ +\end{chunk} \subsection{getFilename} \index{htadd!getFilename} \index{getFilename htadd} -<>= +\begin{chunk}{htadd} static void getFilename(void) { int c, ws; @@ -8008,11 +8008,11 @@ static void getFilename(void) { } } -@ +\end{chunk} \subsection{deleteFile} \index{htadd!deleteFile} \index{deleteFile htadd} -<>= +\begin{chunk}{htadd} static int deleteFile(char *dbname, char *name) { char temp_dbFile[256]; FILE *db_fp, *temp_db_fp; @@ -8035,11 +8035,11 @@ static int deleteFile(char *dbname, char *name) { return 0; } -@ +\end{chunk} \subsection{deleteDB} \index{htadd!deleteDB} \index{deleteDB htadd} -<>= +\begin{chunk}{htadd} static void deleteDB(FILE *db, FILE *temp_db, char *name) { char *fname; int c/*, file_there = 0*/, mtime; @@ -8073,11 +8073,11 @@ static void deleteDB(FILE *db, FILE *temp_db, char *name) { } while (c != EOF); } -@ +\end{chunk} \subsection{main} \index{htadd!main} \index{main htadd} -<>= +\begin{chunk}{htadd} int main(int argc, char **argv) { /*int i;*/ char db_dir[256]; /* the directory where the db file is */ @@ -8103,7 +8103,7 @@ int main(int argc, char **argv) { return 0; } -@ +\end{chunk} \chapter{The hthits function} This source file implements HyperDoc's ability to scan files for a given pattern. For that purpose it needs a ``regex'' for string @@ -8193,7 +8193,7 @@ cflow --emacs -l -n -b -T --omit-arguments hthits.c \end{verbatim} \section{Constants and Headers} \subsection{System includes} -<>= +\begin{chunk}{hthits} #include #include #include @@ -8202,44 +8202,44 @@ cflow --emacs -l -n -b -T --omit-arguments hthits.c #include #include -@ +\end{chunk} \subsection{defines} -<>= +\begin{chunk}{hthits} #define MAX_HTDB_LINE 1024 #define MAX_ENTRY_TYPE 30 /* I.e. \page \newcommand \patch ... */ #define MAX_ENTRY_NAME 1024 /* E.g. DifferentialCalculusPage */ #define MAX_COMP_REGEX 1024 -@ +\end{chunk} \subsection{structs} \index{struct!PgInfo} \index{PgInfo struct} -<>= +\begin{chunk}{hthits} typedef struct pgInfo { char name[MAX_ENTRY_NAME]; long start, size; } PgInfo ; -@ +\end{chunk} \subsection{Local includes} -<>= +\begin{chunk}{hthits} #include "debug.h" #include "hthits.h1" -@ +\end{chunk} \subsection{local variables} -<>= +\begin{chunk}{hthits} char *progName; char *pattern; char *htdbFName; int gverifydates=0; regex_t reg_pattern; -@ +\end{chunk} \subsection{cmdline} \index{hthits!cmdline} \index{cmdline hthits} -<>= +\begin{chunk}{hthits} void cmdline(int argc,char ** argv) { progName = argv[0]; if (argc != 3) { @@ -8250,11 +8250,11 @@ void cmdline(int argc,char ** argv) { htdbFName = argv[2]; } -@ +\end{chunk} \subsection{handleHtdb} \index{hthits!handleHtdb} \index{handleHtdb hthits} -<>= +\begin{chunk}{hthits} void handleHtdb(void) { FILE *htdbFile; int c; @@ -8270,11 +8270,11 @@ void handleHtdb(void) { fclose(htdbFile); } -@ +\end{chunk} \subsection{handleFile} \index{hthits!handleFile} \index{handleFile hthits} -<>= +\begin{chunk}{hthits} void handleFile(FILE *htdbFile) { static PgInfo *pgInfoV = 0; static int pgInfoC = 0; @@ -8360,11 +8360,11 @@ void handleFile(FILE *htdbFile) { handleFilePages(htfname, npages, pgInfoV); } -@ +\end{chunk} \subsection{handleFilePages} \index{hthits!handleFilePages} \index{handleFilePages hthits} -<>= +\begin{chunk}{hthits} void handleFilePages(char *fname, int pgc, PgInfo *pgv) { FILE *infile; int i; @@ -8378,11 +8378,11 @@ void handleFilePages(char *fname, int pgc, PgInfo *pgv) { fclose(infile); } -@ +\end{chunk} \subsection{handlePage} \index{hthits!handlePage} \index{handlePage hthits} -<>= +\begin{chunk}{hthits} void handlePage(FILE *infile,PgInfo * pg) { static char *pgBuf = 0; static int pgBufSize = 0; @@ -8411,11 +8411,11 @@ void handlePage(FILE *infile,PgInfo * pg) { searchPage(pg->name, title, body); } -@ +\end{chunk} \subsection{searchPage} \index{hthits!searchPage} \index{searchPage hthits} -<>= +\begin{chunk}{hthits} void searchPage(char *pgname,char * pgtitle,char * pgbody) { char *bodyrest; regmatch_t match_pos; @@ -8434,14 +8434,14 @@ void searchPage(char *pgname,char * pgtitle,char * pgbody) { } } -@ +\end{chunk} \subsection{squirt} Given string s and length n, output ` followed by the first n characters of s with ` and newline converted to blanks. This function destructively modifies s. \index{hthits!squirt} \index{squirt hthits} -<>= +\begin{chunk}{hthits} void squirt(char *s, int n) { register char *t, *e; int c; @@ -8456,12 +8456,12 @@ void squirt(char *s, int n) { s[n] = c; } -@ +\end{chunk} \subsection{splitpage} Any newlines and separator characters in the title are changed to blanks. \index{hthits!splitpage} \index{splitpage hthits} -<>= +\begin{chunk}{hthits} void splitpage(char *buf, char **ptitle, char **pbody) { int n, depth, tno; char *s; @@ -8491,11 +8491,11 @@ void splitpage(char *buf, char **ptitle, char **pbody) { } } -@ +\end{chunk} \subsection{untexbuf} \index{hthits!untexbuf} \index{untexbuf hthits} -<>= +\begin{chunk}{hthits} void untexbuf(register char *s) { register char *d = s; while (*s) @@ -8525,31 +8525,31 @@ void untexbuf(register char *s) { *d = 0; } -@ +\end{chunk} \subsection{badDB} \index{hthits!badDB} \index{badDB hthits} -<>= +\begin{chunk}{hthits} void badDB(void) { fprintf(stderr, "%s: bad database file %s\n", progName, htdbFName); exit(1); } -@ +\end{chunk} \subsection{regerr} \index{hthits!regerr} \index{regerr hthits} -<>= +\begin{chunk}{hthits} void regerr(int code) { fprintf(stderr, "%s: regular expression error %d for \"%s\"\n", progName, code, pattern); } -@ +\end{chunk} \subsection{main} \index{hthits!main} \index{main hthits} -<>= +\begin{chunk}{hthits} int main(int argc,char ** argv) { cmdline(argc, argv); regcomp(®_pattern, pattern, REG_NEWLINE); @@ -8557,7 +8557,7 @@ int main(int argc,char ** argv) { return(0); } -@ +\end{chunk} \chapter{The hypertex command} This is the main module of the HyperDoc program. It contains the main routine which initializes all the X stuff, and the tables. Then it passes @@ -8565,7 +8565,7 @@ control over to the main event loop. \index{hypertex} \section{Constants and Headers} \subsection{System includes} -<>= +\begin{chunk}{hypertex} #ifdef SGIplatform #include #endif @@ -8587,19 +8587,19 @@ control over to the main event loop. #include #include -@ +\end{chunk} \section{structs} -<>= +\begin{chunk}{hypertex} typedef struct toke { /* HyperDoc parser tokens */ int type; /* token type. One of those listed below */ char *id; /* string value if type == Identifier */ } Token; -@ +\end{chunk} \subsection{Local includes} -<>= +\begin{chunk}{hypertex} #include "debug.h" -<> +\getchunk{hyper.h} #include "all-hyper-proto.h1" #include "bsdsignal.h" @@ -8611,9 +8611,9 @@ typedef struct toke { /* HyperDoc parser tokens */ #include "spadcolors.h1" #include "util.h1" -@ +\end{chunk} \section{structs} -<>= +\begin{chunk}{hypertex} typedef struct mr_stack { /** The structure for storing parser mode and region **/ short int fParserMode; @@ -8626,9 +8626,9 @@ typedef struct sock_list { /* linked list of Sock */ struct sock_list *next; } Sock_List; -@ +\end{chunk} \section{defines} -<>= +\begin{chunk}{hypertex} #define above(y) ((y) + gWindow->page->scroll_off < gWindow->page->top_scroll_margin) #define AllMode 0 @@ -8831,9 +8831,9 @@ static char sup3dpr_bits[] = { #define whitespace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n') -@ +\end{chunk} \section{externs} -<>= +\begin{chunk}{hypertex} extern FILE *cfile; extern TextNode *curr_node; extern TextNode *cur_spadcom; /* spad command being parsed *** */ @@ -8943,9 +8943,9 @@ extern int word_off_height; /* the diff between text height and */ extern int yOff; /* y offset for scrolling regions */ -@ +\end{chunk} \section{local variables} -<>= +\begin{chunk}{hypertex} char *active_file_list[MaxInputFiles]; unsigned long bigmask= 0xffffffff; @@ -9155,9 +9155,9 @@ int word_off_height; /* the diff between text height and */ int yOff; -@ +\end{chunk} \section{The Shared Code} -<>= +\begin{chunk}{hypertex} int windowEqual(Window *w1, Window *w2); int windowCode(Window *w, int size); CondNode *allocCondnode(void); @@ -9379,55 +9379,55 @@ int issueUnixpaste(TextNode *node); char *vbuf = NULL; int vbuf_size = 0; -<> -<> -<> -<> -<> -<> -@ +\getchunk{hypertex shared code} +\getchunk{hashCopyEntry} +\getchunk{hashCopyTable} +\getchunk{dbFileOpen} +\getchunk{htperror} +\getchunk{dumpToken} +\end{chunk} \section{Code} \subsection{sigusr2Handler} SIGUSR2 is raised by the spadbuf program when it is done with the current command \index{hypertex!sigusr2Handler} \index{sigusr2Handler hypertex} -<>= +\begin{chunk}{hypertex} void sigusr2Handler(int sig) { gIsEndOfOutput = 1; return ; } -@ +\end{chunk} \subsection{sigcldHandler} Why were we waiting after the child had already died? Because we don't want zombies \index{hypertex!sigcldHandler} \index{sigcldHandler hypertex} -<>= +\begin{chunk}{hypertex} void sigcldHandler(int sig) { int x; wait(&x); } -@ +\end{chunk} \subsection{cleanSocket} Clean up spad sockets on exit. \index{hypertex!cleanSocket} \index{cleanSocket hypertex} -<>= +\begin{chunk}{hypertex} void cleanSocket(void) { char name[256]; make_server_name(name, MenuServerName); unlink(name); } -@ +\end{chunk} \subsection{initHash} Initializes the hash table for Files, and Windows \index{hypertex!initHash} \index{initHash hypertex} -<>= +\begin{chunk}{hypertex} static void initHash(void) { hashInit(&gFileHashTable, FileHashSize, @@ -9443,12 +9443,12 @@ static void initHash(void) { (HashcodeFunction) stringHash); } -@ +\end{chunk} \subsection{initPageStructs} Initialize the HyperDoc page hierarchy data structures \index{hypertex!initPageStructs} \index{initPageStructs hypertex} -<>= +\begin{chunk}{hypertex} void initPageStructs(HDWindow *w) { int i; w->fMemoStackIndex = 0; @@ -9461,11 +9461,11 @@ void initPageStructs(HDWindow *w) { w->fDownLinkStack[i] = NULL; } -@ +\end{chunk} \subsection{checkArguments} \index{hypertex!checkArguments} \index{checkArguments hypertex} -<>= +\begin{chunk}{hypertex} static void checkArguments(void) { int i; /* @@ -9514,11 +9514,11 @@ static void checkArguments(void) { } } -@ +\end{chunk} \subsection{makeServerConnections} \index{hypertex!makeServerConnections} \index{makeServerConnections hypertex} -<>= +\begin{chunk}{hypertex} static void makeServerConnections(void) { int i, wait_time; /* @@ -9602,14 +9602,14 @@ static void makeServerConnections(void) { } } } -@ +\end{chunk} \section{Condition Handling} \subsection{insertCond} This routine creates a new cond node and inserts it into the current cond table \index{hypertex!insertCond} \index{insertCond hypertex} -<>= +\begin{chunk}{hypertex} void insertCond(char *label, char *cond) { CondNode *condnode = (CondNode *) hashFind(gWindow->fCondHashTable, label); if (condnode) { @@ -9625,11 +9625,11 @@ void insertCond(char *label, char *cond) { hashInsert(gWindow->fCondHashTable, (char *) condnode, condnode->label); } -@ +\end{chunk} \subsection{changeCond} \index{hypertex!changeCond} \index{changeCond hypertex} -<>= +\begin{chunk}{hypertex} void changeCond(char *label, char *newcond) { CondNode *condnode = (CondNode *) hashFind(gWindow->fCondHashTable, label); if (condnode == NULL) { @@ -9642,11 +9642,11 @@ void changeCond(char *label, char *newcond) { } } -@ +\end{chunk} \subsection{checkMemostack} \index{hypertex!checkMemostack} \index{checkMemostack hypertex} -<>= +\begin{chunk}{hypertex} static int checkMemostack(TextNode *node) { char *buffer; int stackp = gWindow->fMemoStackIndex; @@ -9665,12 +9665,12 @@ static int checkMemostack(TextNode *node) { return found; } -@ +\end{chunk} \subsection{checkCondition} Checks the condition presented and returns a 1 or a 0. \index{hypertex!checkCondition} \index{checkCondition hypertex} -<>= +\begin{chunk}{hypertex} int checkCondition(TextNode *node) { CondNode *cond; InputBox *box; @@ -9705,13 +9705,13 @@ int checkCondition(TextNode *node) { } } -@ +\end{chunk} \section{Dialog Handling} \subsection{redrawWin} \index{hypertex!redrawWin} \index{redrawWin hypertex} -<>= +\begin{chunk}{hypertex} static void redrawWin(void) { XUnmapSubwindows(gXDisplay, gWindow->fMainWindow); XUnmapSubwindows(gXDisplay, gWindow->fScrollWindow); @@ -9719,13 +9719,13 @@ static void redrawWin(void) { showPage(gWindow->page); } -@ +\end{chunk} \subsection{mystrncpy} Copies the characters from buff1 to buff2 starting at position buff2+n and buff1+n \index{hypertex!mystrncpy} \index{mystrncpy hypertex} -<>= +\begin{chunk}{hypertex} static char *mystrncpy(char *buff1, char *buff2, int n) { int i; for (i = n - 1; i >= 0; i--) @@ -9733,42 +9733,42 @@ static char *mystrncpy(char *buff1, char *buff2, int n) { return buff2; } -@ +\end{chunk} \subsection{incLineNumbers} \index{hypertex!incLineNumbers} \index{incLineNumbers hypertex} -<>= +\begin{chunk}{hypertex} static void incLineNumbers(LineStruct *line) { for (; line != NULL; line = line->next) line->line_number++; } -@ +\end{chunk} \subsection{decLineNumbers} \index{hypertex!decLineNumbers} \index{decLineNumbers hypertex} -<>= +\begin{chunk}{hypertex} static void decLineNumbers(LineStruct *line) { for (; line != NULL; line = line->next) line->line_number--; return; } -@ +\end{chunk} \subsection{decreaseLineNumbers} \index{hypertex!decreaseLineNumbers} \index{decreaseLineNumbers hypertex} -<>= +\begin{chunk}{hypertex} static void decreaseLineNumbers(LineStruct *line, int am) { for (; line != NULL; line = line->next) line->line_number -= am; } -@ +\end{chunk} \subsection{overwriteBuffer} \index{hypertex!overwriteBuffer} \index{overwriteBuffer hypertex} -<>= +\begin{chunk}{hypertex} static void overwriteBuffer(char *buffer, InputItem *item) { LineStruct *newline; LineStruct *addline = item->curr_line; @@ -9838,14 +9838,14 @@ static void overwriteBuffer(char *buffer, InputItem *item) { /* */ -@ +\end{chunk} \subsection{moveSymForward} This routine takes the current line and moves it num forward. The only way I have to move any other lines forward is if this line has length > size \index{hypertex!moveSymForward} \index{moveSymForward hypertex} -<>= +\begin{chunk}{hypertex} static int moveSymForward(LineStruct *line, int num, int size, InputItem *sym) { LineStruct *newline; @@ -9889,11 +9889,11 @@ static int moveSymForward(LineStruct *line, int num, int size, } } -@ +\end{chunk} \subsection{clearCursorline} \index{hypertex!clearCursorline} \index{clearCursorline hypertex} -<>= +\begin{chunk}{hypertex} static void clearCursorline(InputItem *sym) { XCharStruct extents; int dir, asc, des; @@ -9910,11 +9910,11 @@ static void clearCursorline(InputItem *sym) { sym->curr_line->len); } -@ +\end{chunk} \subsection{insertBuffer} \index{hypertex!insertBuffer} \index{insertBuffer hypertex} -<>= +\begin{chunk}{hypertex} static void insertBuffer(char *buffer, InputItem *sym) { /*int num = strlen(buffer);*/ LineStruct *line = sym->curr_line; @@ -10002,11 +10002,11 @@ static void insertBuffer(char *buffer, InputItem *sym) { updateInputsymbol(sym); } -@ +\end{chunk} \subsection{addBufferToSym} \index{hypertex!addBufferToSym} \index{addBufferToSym hypertex} -<>= +\begin{chunk}{hypertex} void addBufferToSym(char *buffer,InputItem *sym) { if (gInInsertMode) insertBuffer(buffer, sym); @@ -10014,11 +10014,11 @@ void addBufferToSym(char *buffer,InputItem *sym) { overwriteBuffer(buffer, sym); } -@ +\end{chunk} \subsection{drawInputsymbol} \index{hypertex!drawInputsymbol} \index{drawInputsymbol hypertex} -<>= +\begin{chunk}{hypertex} void drawInputsymbol(InputItem *sym) { int y_spot = start_y; LineStruct *cline; @@ -10050,11 +10050,11 @@ void drawInputsymbol(InputItem *sym) { drawCursor(sym); } -@ +\end{chunk} \subsection{updateInputsymbol} \index{hypertex!updateInputsymbol} \index{updateInputsymbol hypertex} -<>= +\begin{chunk}{hypertex} void updateInputsymbol(InputItem *sym) { int y_spot = start_y; LineStruct *cline; @@ -10092,11 +10092,11 @@ void updateInputsymbol(InputItem *sym) { drawCursor(sym); } -@ +\end{chunk} \subsection{drawCursor} \index{hypertex!drawCursor} \index{drawCursor hypertex} -<>= +\begin{chunk}{hypertex} static void drawCursor(InputItem *sym) { int cursor_y; XCharStruct extents; @@ -10127,11 +10127,11 @@ static void drawCursor(InputItem *sym) { in_cursor_height); } -@ +\end{chunk} \subsection{moveCursorHome} \index{hypertex!moveCursorHome} \index{moveCursorHome hypertex} -<>= +\begin{chunk}{hypertex} static void moveCursorHome(InputItem *sym) { LineStruct *trace = sym->curr_line; /* now move the cursor to the beginning of the current line */ @@ -10143,11 +10143,11 @@ static void moveCursorHome(InputItem *sym) { drawCursor(sym); } -@ +\end{chunk} \subsection{moveCursorEnd} \index{hypertex!moveCursorEnd} \index{moveCursorEnd hypertex} -<>= +\begin{chunk}{hypertex} static void moveCursorEnd(InputItem *sym) { LineStruct *trace = sym->curr_line; /* now move the cursor to the beginning of the current line */ @@ -10159,11 +10159,11 @@ static void moveCursorEnd(InputItem *sym) { drawCursor(sym); } -@ +\end{chunk} \subsection{void moveCursorForward} \index{hypertex!void moveCursorForward} \index{void moveCursorForward hypertex} -<>= +\begin{chunk}{hypertex} static void moveCursorForward(InputItem *sym) { if (sym->curr_line->buff_pntr == sym->curr_line->len && !sym->curr_line->next) { @@ -10191,11 +10191,11 @@ static void moveCursorForward(InputItem *sym) { drawCursor(sym); } -@ +\end{chunk} \subsection{moveCursorDown} \index{hypertex!moveCursorDown} \index{moveCursorDown hypertex} -<>= +\begin{chunk}{hypertex} static void moveCursorDown(InputItem *sym) { int bp = sym->curr_line->buff_pntr; /*int size = sym->size;*/ @@ -10216,11 +10216,11 @@ static void moveCursorDown(InputItem *sym) { } } -@ +\end{chunk} \subsection{moveCursorUp} \index{hypertex!moveCursorUp} \index{moveCursorUp hypertex} -<>= +\begin{chunk}{hypertex} static void moveCursorUp(InputItem *sym) { int bp = sym->curr_line->buff_pntr; /*int size = sym->size;*/ @@ -10243,11 +10243,11 @@ static void moveCursorUp(InputItem *sym) { } } -@ +\end{chunk} \subsection{clearCursor} \index{hypertex!clearCursor} \index{clearCursor hypertex} -<>= +\begin{chunk}{hypertex} static void clearCursor(InputItem *sym) { XCharStruct extents; int dir, asc, des; @@ -10265,11 +10265,11 @@ static void clearCursor(InputItem *sym) { sym->curr_line->len); } -@ +\end{chunk} \subsection{moveCursorBackward} \index{hypertex!moveCursorBackward} \index{moveCursorBackward hypertex} -<>= +\begin{chunk}{hypertex} static void moveCursorBackward(InputItem *sym) { if (sym->curr_line->buff_pntr == 0) { if (sym->curr_line->prev == NULL) { @@ -10294,11 +10294,11 @@ static void moveCursorBackward(InputItem *sym) { drawCursor(sym); } -@ +\end{chunk} \subsection{moveRestBack} \index{hypertex!moveRestBack} \index{moveRestBack hypertex} -<>= +\begin{chunk}{hypertex} static char moveRestBack(LineStruct *line, int size) { char c = '\000'; if (line != NULL && line->len != 0) @@ -10329,11 +10329,11 @@ static char moveRestBack(LineStruct *line, int size) { return c; } -@ +\end{chunk} \subsection{deleteRestOfLine} \index{hypertex!deleteRestOfLine} \index{deleteRestOfLine hypertex} -<>= +\begin{chunk}{hypertex} static void deleteRestOfLine(InputItem *sym) { LineStruct *curr_line = sym->curr_line; LineStruct *line=NULL; @@ -10394,11 +10394,11 @@ static void deleteRestOfLine(InputItem *sym) { updateInputsymbol(sym); } -@ +\end{chunk} \subsection{backOverEoln} \index{hypertex!backOverEoln} \index{backOverEoln hypertex} -<>= +\begin{chunk}{hypertex} static void backOverEoln(InputItem *sym) { /* * This routine is very similar to a tough enter except it starts @@ -10467,11 +10467,11 @@ static void backOverEoln(InputItem *sym) { updateInputsymbol(sym); } -@ +\end{chunk} \subsection{moveBackOneChar} \index{hypertex!moveBackOneChar} \index{moveBackOneChar hypertex} -<>= +\begin{chunk}{hypertex} static int moveBackOneChar(InputItem *sym) { char c = '\000', d = '\000'; int dl = 0; @@ -10560,21 +10560,21 @@ static int moveBackOneChar(InputItem *sym) { return 1; } -@ +\end{chunk} \subsection{backOverChar} \index{hypertex!backOverChar} \index{backOverChar hypertex} -<>= +\begin{chunk}{hypertex} static void backOverChar(InputItem *sym) { if (moveBackOneChar(sym)) updateInputsymbol(sym); } -@ +\end{chunk} \subsection{deleteEoln} \index{hypertex!deleteEoln} \index{deleteEoln hypertex} -<>= +\begin{chunk}{hypertex} static void deleteEoln(InputItem *sym) { /* much the same as back_over eoln except my perspective has changed */ char buff[1024]; @@ -10637,11 +10637,11 @@ static void deleteEoln(InputItem *sym) { updateInputsymbol(sym); } -@ +\end{chunk} \subsection{deleteOneChar} \index{hypertex!deleteOneChar} \index{deleteOneChar hypertex} -<>= +\begin{chunk}{hypertex} static int deleteOneChar(InputItem *sym) { char c = '\000'; /* This routine moves all the characters back one */ @@ -10691,24 +10691,24 @@ static int deleteOneChar(InputItem *sym) { return 1; } -@ +\end{chunk} \subsection{deleteChar} \index{hypertex!deleteChar} \index{deleteChar hypertex} -<>= +\begin{chunk}{hypertex} static void deleteChar(InputItem *sym) { if (deleteOneChar(sym)) updateInputsymbol(sym); } -@ +\end{chunk} \subsection{toughEnter} This routine takes all the characters from the current cursor on, and copies them into a temp buffer, from which they are recopied back starting at the next line. \index{hypertex!toughEnter} \index{toughEnter hypertex} -<>= +\begin{chunk}{hypertex} static void toughEnter(InputItem *sym) { char buff[1024]; LineStruct *trace; @@ -10775,13 +10775,13 @@ static void toughEnter(InputItem *sym) { sym->curr_line->buff_pntr = 0; } -@ +\end{chunk} \subsection{enterNewLine} At this point the user has hit a return. Let me just be naive, and take everything from the current spot on, and put it on a new line \index{hypertex!enterNewLine} \index{enterNewLine hypertex} -<>= +\begin{chunk}{hypertex} static void enterNewLine(InputItem *sym) { LineStruct *newline; LineStruct *trace; @@ -10855,11 +10855,11 @@ static void enterNewLine(InputItem *sym) { redrawWin(); } -@ +\end{chunk} \subsection{dialog} \index{hypertex!dialog} \index{dialog hypertex} -<>= +\begin{chunk}{hypertex} void dialog(XEvent *event, KeySym keysym, char *buffer) { InputItem *item; item = gWindow->page->currentItem; @@ -10981,7 +10981,7 @@ void dialog(XEvent *event, KeySym keysym, char *buffer) { break; } } -@ +\end{chunk} \section{Format and Display a page} Display is performed in two steps. First the page is formatted assuming that we have an infinitely long window. In this stage @@ -10990,11 +10990,10 @@ the page is actually drawn on the screen. In this process we use the value of page->y\_off as an offset into the scrolling region to compute what is actually to be displayed on the page. -@ \subsection{showPage} \index{hypertex!showPage} \index{showPage hypertex} -<>= +\begin{chunk}{hypertex} void showPage(HyperDocPage *page) { XWindowChanges wc; int doShowScrollBars = 1; @@ -11081,11 +11080,11 @@ void showPage(HyperDocPage *page) { XFlush(gXDisplay); } -@ +\end{chunk} \subsection{exposePage} \index{hypertex!exposePage} \index{exposePage hypertex} -<>= +\begin{chunk}{hypertex} void exposePage(HyperDocPage *page) { int width, height, doShowScrollBars = 1; initTopGroup(); @@ -11132,11 +11131,11 @@ void exposePage(HyperDocPage *page) { XFlush(gXDisplay); } -@ +\end{chunk} \subsection{scrollPage} \index{hypertex!scrollPage} \index{scrollPage hypertex} -<>= +\begin{chunk}{hypertex} void scrollPage(HyperDocPage *page) { initTopGroup(); /* free the active button list */ @@ -11153,11 +11152,11 @@ void scrollPage(HyperDocPage *page) { XFlush(gXDisplay); } -@ +\end{chunk} \subsection{pastePage} \index{hypertex!pastePage} \index{pastePage hypertex} -<>= +\begin{chunk}{hypertex} void pastePage(TextNode *node) { int width, height; int old_off = gWindow->page->scroll_off; @@ -11202,17 +11201,16 @@ void pastePage(TextNode *node) { XFlush(gXDisplay); } -@ +\end{chunk} \section{Event Handling} This is the main X loop. It keeps grabbing events. Since the only way the window can die is through an event, it never actually end. One of the subroutines it calls is responsible for killing everything. -@ \subsection{mainEventLoop} \index{hypertex!mainEventLoop} \index{mainEventLoop hypertex} -<>= +\begin{chunk}{hypertex} void mainEventLoop(void) { XEvent event; int Xcon; @@ -11283,11 +11281,11 @@ void mainEventLoop(void) { } } -@ +\end{chunk} \subsection{handleEvent} \index{hypertex!handleEvent} \index{handleEvent hypertex} -<>= +\begin{chunk}{hypertex} static void handleEvent(XEvent * event) { XWindowAttributes wa; /* fprintf(stderr,"event:handleEvent entered\n");*/ @@ -11399,11 +11397,11 @@ static void handleEvent(XEvent * event) { } -@ +\end{chunk} \subsection{createWindow} \index{hypertex!createWindow} \index{createWindow hypertex} -<>= +\begin{chunk}{hypertex} static void createWindow(void) { XWindowAttributes wa; XGetWindowAttributes(gXDisplay, gWindow->fMainWindow, &wa); @@ -11421,13 +11419,13 @@ static void createWindow(void) { /* */ -@ +\end{chunk} \subsection{quitHyperDoc} This routine is called when the quitbutton is hit. For the moment I am just going to leave it all behind. \index{hypertex!quitHyperDoc} \index{quitHyperDoc hypertex} -<>= +\begin{chunk}{hypertex} void quitHyperDoc(void) { HyperDocPage *page; if (gSessionHashTable.num_entries == 1 || gParentWindow == gWindow) { @@ -11454,13 +11452,13 @@ void quitHyperDoc(void) { exitHyperDoc(); } -@ +\end{chunk} \subsection{findPage} findPage takes as an argument the HyperDoc for a page name and returns the associated page. \index{hypertex!findPage} \index{findPage hypertex} -<>= +\begin{chunk}{hypertex} static HyperDocPage *findPage(TextNode * node) { char *page_name; HyperDocPage *page; @@ -11484,12 +11482,12 @@ static HyperDocPage *findPage(TextNode * node) { return page; } -@ +\end{chunk} \subsection{downlink} Pushes a page onto the down link stack. \index{hypertex!downlink} \index{downlink hypertex} -<>= +\begin{chunk}{hypertex} static void downlink(void) { if (gWindow->fDownLinkStackIndex == MaxDownlinkDepth) fprintf(stderr, "exceeded maximum link nesting level\n"); @@ -11497,11 +11495,11 @@ static void downlink(void) { gWindow->fDownLinkStack[gWindow->fDownLinkStackIndex++] = gWindow->page; } -@ +\end{chunk} \subsection{memolink} \index{hypertex!memolink} \index{memolink hypertex} -<>= +\begin{chunk}{hypertex} static void memolink(void) { if (gWindow->fMemoStackIndex == MaxMemoDepth) fprintf(stderr, "exceeded maximum link nesting level\n"); @@ -11512,22 +11510,22 @@ static void memolink(void) { } } -@ +\end{chunk} \subsection{killAxiomPage} \index{hypertex!killAxiomPage} \index{killAxiomPage hypertex} -<>= +\begin{chunk}{hypertex} static void killAxiomPage(HyperDocPage * page) { char command[512]; sprintf(command, "(|htpDestroyPage| '%s)", page->name); sendLispCommand(command); } -@ +\end{chunk} \subsection{killPage} \index{hypertex!killPage} \index{killPage hypertex} -<>= +\begin{chunk}{hypertex} static void killPage(HyperDocPage * page) { page->scroll_off = 0; if (page->type == SpadGen) { @@ -11537,12 +11535,12 @@ static void killPage(HyperDocPage * page) { } } -@ +\end{chunk} \subsection{returnlink} Pops the memo stack. \index{hypertex!returnlink} \index{returnlink hypertex} -<>= +\begin{chunk}{hypertex} static HyperDocPage *returnlink(void) { int i; if (gWindow->fMemoStackIndex == 0) { @@ -11565,11 +11563,11 @@ static HyperDocPage *returnlink(void) { /* pops a page if it can from the downlink stack */ -@ +\end{chunk} \subsection{uplink} \index{hypertex!uplink} \index{uplink hypertex} -<>= +\begin{chunk}{hypertex} static HyperDocPage *uplink(void) { if (gWindow->fDownLinkStackIndex == 0) return returnlink(); @@ -11579,11 +11577,11 @@ static HyperDocPage *uplink(void) { } } -@ +\end{chunk} \subsection{windowlinkHandler} \index{hypertex!windowlinkHandler} \index{windowlinkHandler hypertex} -<>= +\begin{chunk}{hypertex} static void windowlinkHandler(TextNode * node) { char *page_name; /* first try and find the page */ @@ -11594,24 +11592,24 @@ static void windowlinkHandler(TextNode * node) { /* gWindow->fWindowHashTable = gWindow->page->fLinkHashTable;*/ } -@ +\end{chunk} \subsection{makeWindowLink} \index{hypertex!makeWindowLink} \index{makeWindowLink hypertex} -<>= +\begin{chunk}{hypertex} void makeWindowLink(char *name) { if (initTopWindow(name) != -1) {}/* gWindow->fWindowHashTable = gWindow->page->fLinkHashTable; */ } -@ +\end{chunk} \subsection{lispwindowlinkHandler} Since we are popping up a new window, then we had better change all the cursors right away. We won't get another chance at it. \index{hypertex!lispwindowlinkHandler} \index{lispwindowlinkHandler hypertex} -<>= +\begin{chunk}{hypertex} static void lispwindowlinkHandler(HyperLink * link) { if (initTopWindow(NULL) != -1) { HyperDocPage *page = NULL; @@ -11624,11 +11622,11 @@ static void lispwindowlinkHandler(HyperLink * link) { } } -@ +\end{chunk} \subsection{pasteButton} \index{hypertex!pasteButton} \index{pasteButton hypertex} -<>= +\begin{chunk}{hypertex} static HyperDocPage *pasteButton(PasteNode * paste) { HyperDocPage *page = NULL; int pastewhere=paste->where; @@ -11649,11 +11647,11 @@ static HyperDocPage *pasteButton(PasteNode * paste) { return page; } -@ +\end{chunk} \subsection{helpForHyperDoc} \index{hypertex!helpForHyperDoc} \index{helpForHyperDoc hypertex} -<>= +\begin{chunk}{hypertex} void helpForHyperDoc(void) { HyperDocPage *page = NULL; /* do not do anything if we are already at the "no more help" page */ @@ -11673,11 +11671,11 @@ void helpForHyperDoc(void) { BeepAtTheUser(); } -@ +\end{chunk} \subsection{findButtonInList} \index{hypertex!findButtonInList} \index{findButtonInList hypertex} -<>= +\begin{chunk}{hypertex} static HyperLink *findButtonInList(HDWindow * window, int x, int y) { ButtonList *bl; if (!window || window->page->type == UnloadedPageType) @@ -11691,11 +11689,11 @@ static HyperLink *findButtonInList(HDWindow * window, int x, int y) { return NULL; } -@ +\end{chunk} \subsection{getHyperLink} \index{hypertex!getHyperLink} \index{getHyperLink hypertex} -<>= +\begin{chunk}{hypertex} static HyperLink *getHyperLink(XButtonEvent * event) { HyperLink *l1, *l2; l1 = @@ -11706,13 +11704,13 @@ static HyperLink *getHyperLink(XButtonEvent * event) { return l2; } -@ +\end{chunk} \subsection{handleButton} Handle a button pressed event. window is the subwindow in which the event occured, and button is the button which was pressed. \index{hypertex!handleButton} \index{handleButton hypertex} -<>= +\begin{chunk}{hypertex} static void handleButton(int button, XButtonEvent * event) { HyperLink *link; HyperDocPage *page = NULL; @@ -11883,11 +11881,11 @@ static void handleButton(int button, XButtonEvent * event) { } } -@ +\end{chunk} \subsection{exitHyperDoc} \index{hypertex!exitHyperDoc} \index{exitHyperDoc hypertex} -<>= +\begin{chunk}{hypertex} void exitHyperDoc(void) { XEvent event; if (gSessionHashTable.num_entries == 1 || gParentWindow == gWindow) { @@ -11921,11 +11919,11 @@ void exitHyperDoc(void) { XFlush(gXDisplay); } -@ +\end{chunk} \subsection{setWindow} \index{hypertex!setWindow} \index{setWindow hypertex} -<>= +\begin{chunk}{hypertex} static int setWindow(Window window) { Window root, parent, *children, grandparent,myarg; HDWindow *htw; @@ -11977,22 +11975,22 @@ ERROR: * This procedure whips thru the stack and clears all expose events for the * given routine */ -@ +\end{chunk} \subsection{clearExposures} \index{hypertex!clearExposures} \index{clearExposures hypertex} -<>= +\begin{chunk}{hypertex} static void clearExposures(Window w) { XEvent report; XFlush(gXDisplay); while (XCheckTypedWindowEvent(gXDisplay, w, Expose, &report)); } -@ +\end{chunk} \subsection{getNewWindow} \index{hypertex!getNewWindow} \index{getNewWindow hypertex} -<>= +\begin{chunk}{hypertex} void getNewWindow(void) { int val; char buf[128]; @@ -12105,11 +12103,11 @@ void getNewWindow(void) { } } -@ +\end{chunk} \subsection{setCursor} \index{hypertex!setCursor} \index{setCursor hypertex} -<>= +\begin{chunk}{hypertex} static void setCursor(HDWindow *window,Cursor state) { if (state == gBusyCursor) XDefineCursor(gXDisplay, window->fMainWindow, gBusyCursor); @@ -12120,11 +12118,11 @@ static void setCursor(HDWindow *window,Cursor state) { XFlush(gXDisplay); } -@ +\end{chunk} \subsection{changeCursor} \index{hypertex!changeCursor} \index{changeCursor hypertex} -<>= +\begin{chunk}{hypertex} static void changeCursor(Cursor state, HDWindow *window) { if (window->fDisplayedCursor == state) return; @@ -12132,11 +12130,11 @@ static void changeCursor(Cursor state, HDWindow *window) { setCursor(window, state); } -@ +\end{chunk} \subsection{handleMotionEvent} \index{hypertex!handleMotionEvent} \index{handleMotionEvent hypertex} -<>= +\begin{chunk}{hypertex} static void handleMotionEvent(XMotionEvent *event) { if (!gWindow) return; @@ -12146,11 +12144,11 @@ static void handleMotionEvent(XMotionEvent *event) { changeCursor(gNormalCursor, gWindow); } -@ +\end{chunk} \subsection{initCursorState} \index{hypertex!initCursorState} \index{initCursorState hypertex} -<>= +\begin{chunk}{hypertex} static void initCursorState(HDWindow *window) { if (window) { int x, y, rx, ry, but; @@ -12164,38 +12162,38 @@ static void initCursorState(HDWindow *window) { } } -@ +\end{chunk} \subsection{initCursorStates} \index{hypertex!initCursorStates} \index{initCursorStates hypertex} -<>= +\begin{chunk}{hypertex} static void initCursorStates(void) { hashMap(&gSessionHashTable,(MappableFunction) initCursorState); } -@ +\end{chunk} \subsection{makeBusyCursor} \index{hypertex!makeBusyCursor} \index{makeBusyCursor hypertex} -<>= +\begin{chunk}{hypertex} static void makeBusyCursor(HDWindow *window) { changeCursor(gBusyCursor, window); } -@ +\end{chunk} \subsection{makeBusyCursors} \index{hypertex!makeBusyCursors} \index{makeBusyCursors hypertex} -<>= +\begin{chunk}{hypertex} static void makeBusyCursors(void) { hashMap(&gSessionHashTable, (MappableFunction)makeBusyCursor); } -@ +\end{chunk} \subsection{HyperDocErrorHandler} \index{hypertex!HyperDocErrorHandler} \index{HyperDocErrorHandler hypertex} -<>= +\begin{chunk}{hypertex} static int HyperDocErrorHandler(Display *display, XErrorEvent *xe) { if (xe->request_code != 15) { char buf[1024]; @@ -12211,22 +12209,22 @@ static int HyperDocErrorHandler(Display *display, XErrorEvent *xe) { return(0); } -@ +\end{chunk} \subsection{setErrorHandlers} \index{hypertex!setErrorHandlers} \index{setErrorHandlers hypertex} -<>= +\begin{chunk}{hypertex} static void setErrorHandlers(void) { XSetErrorHandler(HyperDocErrorHandler); } -@ +\end{chunk} \section{Line Extent Computation} \subsection{computeInputExtent} Computes the extent of the input string or box. \index{hypertex!computeInputExtent} \index{computeInputExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeInputExtent(TextNode * node) { InputItem *item; int t_width; @@ -12256,11 +12254,11 @@ static void computeInputExtent(TextNode * node) { text_x += t_width; } -@ +\end{chunk} \subsection{computePunctuationExtent} \index{hypertex!computePunctuationExtent} \index{computePunctuationExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computePunctuationExtent(TextNode * node) { int twidth; int nextwidth; @@ -12309,11 +12307,11 @@ static void computePunctuationExtent(TextNode * node) { gInLine = 1; } -@ +\end{chunk} \subsection{computeWordExtent} \index{hypertex!computeWordExtent} \index{computeWordExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeWordExtent(TextNode * node) { int twidth; int nextwidth; @@ -12356,11 +12354,11 @@ static void computeWordExtent(TextNode * node) { gInLine = 1; } -@ +\end{chunk} \subsection{computeVerbatimExtent} \index{hypertex!computeVerbatimExtent} \index{computeVerbatimExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeVerbatimExtent(TextNode *node) { node->height = normal_textHeight; node->width = strlen(node->data.text); @@ -12370,11 +12368,11 @@ static void computeVerbatimExtent(TextNode *node) { return; } -@ +\end{chunk} \subsection{computeSpadsrctxtExtent} \index{hypertex!computeSpadsrctxtExtent} \index{computeSpadsrctxtExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeSpadsrctxtExtent(TextNode *node) { node->height = normal_textHeight; node->width = strlen(node->data.text); @@ -12388,11 +12386,11 @@ static void computeSpadsrctxtExtent(TextNode *node) { return; } -@ +\end{chunk} \subsection{computeDashExtent} \index{hypertex!computeDashExtent} \index{computeDashExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeDashExtent(TextNode *node) { int num_dashes; int twidth; @@ -12438,11 +12436,11 @@ static void computeDashExtent(TextNode *node) { return; } -@ +\end{chunk} \subsection{computeTextExtent} \index{hypertex!computeTextExtent} \index{computeTextExtent hypertex} -<>= +\begin{chunk}{hypertex} void computeTextExtent(TextNode *node) { for (; node != NULL; node = node->next) { switch (node->type) { @@ -12763,11 +12761,11 @@ void computeTextExtent(TextNode *node) { } } -@ +\end{chunk} \subsection{computeBeginItemsExtent} \index{hypertex!computeBeginItemsExtent} \index{computeBeginItemsExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeBeginItemsExtent(TextNode * node) { int store_x, store_y, lh; /* @@ -12799,22 +12797,22 @@ static void computeBeginItemsExtent(TextNode * node) { gInLine = 0; } -@ +\end{chunk} \subsection{computeItemExtent} \index{hypertex!computeItemExtent} \index{computeItemExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeItemExtent(TextNode * node) { if (gInLine) startNewline(present_line_height, node); text_x = item_indent; } -@ +\end{chunk} \subsection{computeMitemExtent} \index{hypertex!computeMitemExtent} \index{computeMitemExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeMitemExtent(TextNode *node) { if (gInLine) { startNewline(present_line_height, node); @@ -12822,11 +12820,11 @@ static void computeMitemExtent(TextNode *node) { text_x = item_indent; } -@ +\end{chunk} \subsection{endifExtent} \index{hypertex!endifExtent} \index{endifExtent hypertex} -<>= +\begin{chunk}{hypertex} static void endifExtent(TextNode *node) { /* * This node has the responsibilty for updating text_x and text_y so that @@ -12837,13 +12835,13 @@ static void endifExtent(TextNode *node) { if_node = NULL; } -@ +\end{chunk} \subsection{computeIfcondExtent} This routine checks the value of the condition and swaps in the {\tt else} or the {\tt then} depending. \index{hypertex!computeIfcondExtent} \index{computeIfcondExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeIfcondExtent(TextNode *node) { TextNode *condnode = node->data.ifnode->cond; TextNode *tln = gLineNode; @@ -12902,11 +12900,11 @@ static void computeIfcondExtent(TextNode *node) { popGroupStack(); } -@ +\end{chunk} \subsection{computeCenterExtent} \index{hypertex!computeCenterExtent} \index{computeCenterExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeCenterExtent(TextNode * node) { if (gInLine) startNewline(present_line_height, node); @@ -12920,11 +12918,11 @@ static void computeCenterExtent(TextNode * node) { } } -@ +\end{chunk} \subsection{computeBfExtent} \index{hypertex!computeBfExtent} \index{computeBfExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeBfExtent(TextNode *node) { if (gInLine && node->space) text_x += inter_word_space; @@ -12933,11 +12931,11 @@ static void computeBfExtent(TextNode *node) { bfTopGroup(); } -@ +\end{chunk} \subsection{computeEmExtent} \index{hypertex!computeEmExtent} \index{computeEmExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeEmExtent(TextNode *node) { if (gInLine && node->space) text_x += inter_word_space; @@ -12949,11 +12947,11 @@ static void computeEmExtent(TextNode *node) { emTopGroup(); } -@ +\end{chunk} \subsection{computeItExtent} \index{hypertex!computeItExtent} \index{computeItExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeItExtent(TextNode *node) { if (gInLine && node->space) text_x += inter_word_space; @@ -12961,11 +12959,11 @@ static void computeItExtent(TextNode *node) { node->y = text_y; } -@ +\end{chunk} \subsection{computeRmExtent} \index{hypertex!computeRmExtent} \index{computeRmExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeRmExtent(TextNode *node) { if (gInLine && node->space) text_x += inter_word_space; @@ -12974,11 +12972,11 @@ static void computeRmExtent(TextNode *node) { rmTopGroup(); } -@ +\end{chunk} \subsection{computeButtonExtent} \index{hypertex!computeButtonExtent} \index{computeButtonExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeButtonExtent(TextNode *node) { int twidth; /*int store_x = text_x;*/ @@ -13001,11 +12999,11 @@ static void computeButtonExtent(TextNode *node) { link_node = node; } -@ +\end{chunk} \subsection{endbuttonExtent} \index{hypertex!endbuttonExtent} \index{endbuttonExtent hypertex} -<>= +\begin{chunk}{hypertex} static void endbuttonExtent(TextNode *node) { int temp; int height; @@ -13038,11 +13036,11 @@ static void endbuttonExtent(TextNode *node) { link_node = NULL; } -@ +\end{chunk} \subsection{computePastebuttonExtent} \index{hypertex!computePastebuttonExtent} \index{computePastebuttonExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computePastebuttonExtent(TextNode *node) { int twidth; pushActiveGroup(); @@ -13062,11 +13060,11 @@ static void computePastebuttonExtent(TextNode *node) { return; } -@ +\end{chunk} \subsection{endpastebuttonExtent} \index{hypertex!endpastebuttonExtent} \index{endpastebuttonExtent hypertex} -<>= +\begin{chunk}{hypertex} static void endpastebuttonExtent(TextNode *node) { int temp; int height; @@ -13092,11 +13090,11 @@ static void endpastebuttonExtent(TextNode *node) { gInLine = 1; } -@ +\end{chunk} \subsection{computePasteExtent} \index{hypertex!computePasteExtent} \index{computePasteExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computePasteExtent(TextNode *node) { if (gInLine) { startNewline(present_line_height, node); @@ -13107,12 +13105,12 @@ static void computePasteExtent(TextNode *node) { node->height = line_height; } -@ +\end{chunk} \subsection{computeSpadcommandExtent} Compute the text extent of a spadcommand node. \index{hypertex!computeSpadcommandExtent} \index{computeSpadcommandExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeSpadcommandExtent(TextNode *node) { /* * From now on if there is an example which will take over a line, then @@ -13138,11 +13136,11 @@ static void computeSpadcommandExtent(TextNode *node) { spad_node = node; } -@ +\end{chunk} \subsection{computeSpadsrcExtent} \index{hypertex!computeSpadsrcExtent} \index{computeSpadsrcExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeSpadsrcExtent(TextNode *node) { /* * From now on if there is an example which will take over a line, then @@ -13162,11 +13160,11 @@ static void computeSpadsrcExtent(TextNode *node) { spad_node = node; } -@ +\end{chunk} \subsection{endSpadcommandExtent} \index{hypertex!endSpadcommandExtent} \index{endSpadcommandExtent hypertex} -<>= +\begin{chunk}{hypertex} static void endSpadcommandExtent(TextNode *node) { int temp; int height; @@ -13193,11 +13191,11 @@ static void endSpadcommandExtent(TextNode *node) { spad_node = NULL; } -@ +\end{chunk} \subsection{endSpadsrcExtent} \index{hypertex!endSpadsrcExtent} \index{endSpadsrcExtent hypertex} -<>= +\begin{chunk}{hypertex} static void endSpadsrcExtent(TextNode *node) { int temp; int height; @@ -13224,11 +13222,11 @@ static void endSpadsrcExtent(TextNode *node) { spad_node = NULL; } -@ +\end{chunk} \subsection{computeMboxExtent} \index{hypertex!computeMboxExtent} \index{computeMboxExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeMboxExtent(TextNode *node) { node->width = textWidth(node->next, Endmbox); if (node->space) @@ -13241,11 +13239,11 @@ static void computeMboxExtent(TextNode *node) { node->y = text_y; } -@ +\end{chunk} \subsection{computeBoxExtent} \index{hypertex!computeBoxExtent} \index{computeBoxExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeBoxExtent(TextNode *node) { int t_width; /* @@ -13268,11 +13266,11 @@ static void computeBoxExtent(TextNode *node) { gInLine = 1; } -@ +\end{chunk} \subsection{computeIrExtent} \index{hypertex!computeIrExtent} \index{computeIrExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeIrExtent(TextNode *node) { int t_width; /* @@ -13300,12 +13298,12 @@ static void computeIrExtent(TextNode *node) { text_x += node->width; } -@ +\end{chunk} \subsection{computeImageExtent} Read a bitmap file into memory. \index{hypertex!computeImageExtent} \index{computeImageExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeImageExtent(TextNode *node) { if (text_x + node->width > right_margin) { startNewline(present_line_height, node); @@ -13323,12 +13321,12 @@ static void computeImageExtent(TextNode *node) { gInLine = 1; } -@ +\end{chunk} \subsection{computeTableExtent} Compute the coordinates of the entries in a table. \index{hypertex!computeTableExtent} \index{computeTableExtent hypertex} -<>= +\begin{chunk}{hypertex} static void computeTableExtent(TextNode **node) { int num_cols, num_lines; int max_width = 0, node_width, col_width; @@ -13385,11 +13383,11 @@ static void computeTableExtent(TextNode **node) { gInLine = 0; } -@ +\end{chunk} \subsection{computeTitleExtent} \index{hypertex!computeTitleExtent} \index{computeTitleExtent hypertex} -<>= +\begin{chunk}{hypertex} void computeTitleExtent(HyperDocPage *page) { right_margin_space = non_scroll_right_margin_space; page->title->height = twheight + gWindow->border_width; @@ -13403,11 +13401,11 @@ void computeTitleExtent(HyperDocPage *page) { twheight); } -@ +\end{chunk} \subsection{computeHeaderExtent} \index{hypertex!computeHeaderExtent} \index{computeHeaderExtent hypertex} -<>= +\begin{chunk}{hypertex} void computeHeaderExtent(HyperDocPage *page) { /* * Hopefully we will soon be able to actually compute the needed height @@ -13435,11 +13433,11 @@ void computeHeaderExtent(HyperDocPage *page) { } } -@ +\end{chunk} \subsection{computeFooterExtent} \index{hypertex!computeFooterExtent} \index{computeFooterExtent hypertex} -<>= +\begin{chunk}{hypertex} void computeFooterExtent(HyperDocPage * page) { if (page->footer) { gExtentRegion = Footer; @@ -13462,11 +13460,11 @@ void computeFooterExtent(HyperDocPage * page) { } } -@ +\end{chunk} \subsection{computeScrollingExtent} \index{hypertex!computeScrollingExtent} \index{computeScrollingExtent hypertex} -<>= +\begin{chunk}{hypertex} void computeScrollingExtent(HyperDocPage *page) { /* Check to see if there is a scrolling region */ if (!page->scrolling) { @@ -13495,7 +13493,7 @@ void computeScrollingExtent(HyperDocPage *page) { page->scrolling->height = text_y; } -@ +\end{chunk} \subsection{startNewline} The startNewline function updates the current header node, and also allocates if needed memory for the next Line Header. It also assigns @@ -13503,7 +13501,7 @@ the first TextNode on the line to the structure, because this is the last time I will be able to do this. \index{hypertex!startNewline} \index{startNewline hypertex} -<>= +\begin{chunk}{hypertex} void startNewline(int distance, TextNode * node) { if (gLineNode != NULL) { if (gTopOfGroupStack->center) @@ -13516,13 +13514,13 @@ void startNewline(int distance, TextNode * node) { gInLine = 0; } -@ +\end{chunk} \subsection{centerNodes} The centerNodes goes through and centers all the text between the two given nodes. \index{hypertex!centerNodes} \index{centerNodes hypertex} -<>= +\begin{chunk}{hypertex} static void centerNodes(TextNode * begin_node, TextNode * end_node) { int begin_x, end_x, wmid_x, offset, mid_x; TextNode *node; @@ -13539,11 +13537,11 @@ static void centerNodes(TextNode * begin_node, TextNode * end_node) { node->x += offset; } -@ +\end{chunk} \subsection{punctuationWidth} \index{hypertex!punctuationWidth} \index{punctuationWidth hypertex} -<>= +\begin{chunk}{hypertex} static int punctuationWidth(TextNode * node) { int twidth, width = strlen(node->data.text); twidth = XTextWidth(gTopOfGroupStack->cur_font, node->data.text, width); @@ -13553,11 +13551,11 @@ static int punctuationWidth(TextNode * node) { return twidth; } -@ +\end{chunk} \subsection{inputStringWidth} \index{hypertex!inputStringWidth} \index{inputStringWidth hypertex} -<>= +\begin{chunk}{hypertex} static int inputStringWidth(TextNode * node) { InputItem *item; int t_width; @@ -13569,11 +13567,11 @@ static int inputStringWidth(TextNode * node) { return t_width; } -@ +\end{chunk} \subsection{wordWidth} \index{hypertex!wordWidth} \index{wordWidth hypertex} -<>= +\begin{chunk}{hypertex} static int wordWidth(TextNode * node) { int twidth, len = strlen(node->data.text); twidth = XTextWidth(gTopOfGroupStack->cur_font, node->data.text, len); @@ -13582,11 +13580,11 @@ static int wordWidth(TextNode * node) { return twidth; } -@ +\end{chunk} \subsection{verbatimWidth} \index{hypertex!verbatimWidth} \index{verbatimWidth hypertex} -<>= +\begin{chunk}{hypertex} static int verbatimWidth(TextNode * node) { int twidth, len = strlen(node->data.text); twidth = XTextWidth(gTopOfGroupStack->cur_font, node->data.text, len); @@ -13595,11 +13593,11 @@ static int verbatimWidth(TextNode * node) { return twidth; } -@ +\end{chunk} \subsection{widthOfDash} \index{hypertex!widthOfDash} \index{widthOfDash hypertex} -<>= +\begin{chunk}{hypertex} static int widthOfDash(TextNode * node) { int num_dashes, twidth; num_dashes = strlen(node->data.text); @@ -13613,12 +13611,12 @@ static int widthOfDash(TextNode * node) { return twidth; } -@ +\end{chunk} \subsection{textWidth} Return the gWindow->width in pixels of the given text node, when displayed \index{hypertex!textWidth} \index{textWidth hypertex} -<>= +\begin{chunk}{hypertex} int textWidth(TextNode * node, int Ender) { int twidth = 0, num_words; for (num_words = 0; node != NULL; num_words++, node = node->next) { @@ -13803,14 +13801,14 @@ int textWidth(TextNode * node, int Ender) { /* */ -@ +\end{chunk} \subsection{totalWidth} The totalWidth function traces through the nodes, until it finds a blank space. It is used by computeWordExtent, and computePunctuation extent to determine. How far we go before we actually see white space. \index{hypertex!totalWidth} \index{totalWidth hypertex} -<>= +\begin{chunk}{hypertex} int totalWidth(TextNode * node, int Ender) { int twidth = 0; for (; (node != NULL); node = node->next) { @@ -13898,12 +13896,12 @@ int totalWidth(TextNode * node, int Ender) { return twidth; } -@ +\end{chunk} \subsection{initExtents} The initExtents function initialize some text size variables \index{hypertex!initExtents} \index{initExtents hypertex} -<>= +\begin{chunk}{hypertex} void initExtents(void) { present_line_height = line_height; gInLine = 0; @@ -13919,12 +13917,12 @@ void initExtents(void) { clearItemStack(); } -@ +\end{chunk} \subsection{initTitleExtents} The initTitleExtents function initialize some title text size variables. \index{hypertex!initTitleExtents} \index{initTitleExtents hypertex} -<>= +\begin{chunk}{hypertex} void initTitleExtents(HyperDocPage * page) { present_line_height = line_height; gInLine = 0; @@ -13940,12 +13938,12 @@ void initTitleExtents(HyperDocPage * page) { clearItemStack(); } -@ +\end{chunk} \subsection{initText} The initText function initialize some text size variables. \index{hypertex!initText} \index{initText hypertex} -<>= +\begin{chunk}{hypertex} void initText(void) { normal_textHeight = gRmFont->ascent + gRmFont->descent; line_height = gRmFont->ascent + gRmFont->descent + inter_line_space; @@ -13953,24 +13951,24 @@ void initText(void) { space_width = gRmFont->max_bounds.width; } -@ +\end{chunk} \subsection{textHeight} The textHeight function returns the height of a piece of formatted text in pixels. \index{hypertex!textHeight} \index{textHeight hypertex} -<>= +\begin{chunk}{hypertex} int textHeight(TextNode * node, int Ender) { cur_height = 0; return textHeight1(node, Ender); } -@ +\end{chunk} \subsection{textHeight1} The textHeight1 function is the recursive part of textHeight. \index{hypertex!textHeight1} \index{textHeight1 hypertex} -<>= +\begin{chunk}{hypertex} static int textHeight1(TextNode * node, int Ender) { for (; node != NULL; node = node->next) { if (Ender == Endtokens) { @@ -14090,12 +14088,12 @@ static int textHeight1(TextNode * node, int Ender) { return cur_height; } -@ +\end{chunk} \subsection{maxX} The maxX function returns the height of a piece of formatted text in pixels. \index{hypertex!maxX} \index{maxX hypertex} -<>= +\begin{chunk}{hypertex} int maxX(TextNode * node, int Ender) { maxXvalue = 0; for (; node != NULL; node = node->next) { @@ -14172,11 +14170,11 @@ int maxX(TextNode * node, int Ender) { return cur_height; } -@ +\end{chunk} \subsection{Xvalue} \index{hypertex!Xvalue} \index{Xvalue hypertex} -<>= +\begin{chunk}{hypertex} static int Xvalue(TextNode * node) { for (; node != NULL; node = node->next) { switch (node->type) { @@ -14227,13 +14225,13 @@ static int Xvalue(TextNode * node) { return 0; } -@ +\end{chunk} \subsection{trailingSpace} The trailingSpace function computes the length of the trailing spaces of a node. \index{hypertex!trailingSpace} \index{trailingSpace hypertex} -<>= +\begin{chunk}{hypertex} int trailingSpace(TextNode * node) { int space = 0; for (; node->type < Endtokens; node = node->next); @@ -14243,12 +14241,12 @@ int trailingSpace(TextNode * node) { return space; } -@ +\end{chunk} \subsection{insertBitmapFile} The insertBitmapFile function reads a bitmap file into memory. \index{hypertex!insertBitmapFile} \index{insertBitmapFile hypertex} -<>= +\begin{chunk}{hypertex} void insertBitmapFile(TextNode * node) { char *filename = node->data.text; int bm_width, bm_height; @@ -14283,12 +14281,12 @@ void insertBitmapFile(TextNode * node) { } } -@ +\end{chunk} \subsection{insertPixmapFile} The insertPixmapFile function reads a pixmap file into memory. \index{hypertex!insertPixmapFile} \index{insertPixmapFile hypertex} -<>= +\begin{chunk}{hypertex} void insertPixmapFile(TextNode * node) { char *filename = node->data.text; int bm_width, bm_height, ret_val; @@ -14332,12 +14330,12 @@ void insertPixmapFile(TextNode * node) { } } -@ +\end{chunk} \subsection{plh} The plh function calculates the closet value of line\_height > height. \index{hypertex!plh} \index{plh hypertex} -<>= +\begin{chunk}{hypertex} int plh(int height) { int rheight = height; if (gExtentRegion == Scrolling) { @@ -14347,17 +14345,16 @@ int plh(int height) { return rheight; } -@ +\end{chunk} \section{Handling forms} A few routines used to help with form extents -@ \subsection{computeFormPage} To solve the problem of improperly nested \verb|\em|, I will have to keep and always initialize the top of the stack. \index{hypertex!computeFormPage} \index{computeFormPage hypertex} -<>= +\begin{chunk}{hypertex} void computeFormPage(HyperDocPage *page) { while (popGroupStack() >= 0); /* @@ -14369,22 +14366,22 @@ void computeFormPage(HyperDocPage *page) { gWindow->height = windowHeight(gWindow->page); } -@ +\end{chunk} \subsection{windowWidth} A simple function that returns the width needed to store show the number of columns given. \index{hypertex!windowWidth} \index{windowWidth hypertex} -<>= +\begin{chunk}{hypertex} int windowWidth(int cols) { return (left_margin + cols * space_width + non_scroll_right_margin_space); } -@ +\end{chunk} \subsection{windowHeight} \index{hypertex!windowHeight} \index{windowHeight hypertex} -<>= +\begin{chunk}{hypertex} static int windowHeight(HyperDocPage *page) { int temp; temp = page->header->height + top_margin + bottom_margin; @@ -14393,11 +14390,11 @@ static int windowHeight(HyperDocPage *page) { return (temp); } -@ +\end{chunk} \subsection{formHeaderExtent} \index{hypertex!formHeaderExtent} \index{formHeaderExtent hypertex} -<>= +\begin{chunk}{hypertex} static void formHeaderExtent(HyperDocPage *page) { /* * Hopefully I will soon be able to actually compute the needed height @@ -14414,11 +14411,11 @@ static void formHeaderExtent(HyperDocPage *page) { page->header->height += gWindow->border_width; } -@ +\end{chunk} \subsection{formFooterExtent} \index{hypertex!formFooterExtent} \index{formFooterExtent hypertex} -<>= +\begin{chunk}{hypertex} static void formFooterExtent(HyperDocPage *page) { if (page->footer) { gExtentRegion = Footer; @@ -14436,11 +14433,11 @@ static void formFooterExtent(HyperDocPage *page) { } } -@ +\end{chunk} \subsection{formScrollingExtent} \index{hypertex!formScrollingExtent} \index{formScrollingExtent hypertex} -<>= +\begin{chunk}{hypertex} static void formScrollingExtent(HyperDocPage *page) { /* * Check to see if there is a scrolling region @@ -14462,13 +14459,13 @@ static void formScrollingExtent(HyperDocPage *page) { } } -@ +\end{chunk} \section{Managing the HyperDoc group stack} \subsection{popGroupStack} This routine pops the top of the current group stack. \index{hypertex!popGroupStack} \index{popGroupStack hypertex} -<>= +\begin{chunk}{hypertex} int popGroupStack(void) { GroupItem *junk; /* @@ -14487,11 +14484,11 @@ int popGroupStack(void) { return 1; } -@ +\end{chunk} \subsection{pushGroupStack} \index{hypertex!pushGroupStack} \index{pushGroupStack hypertex} -<>= +\begin{chunk}{hypertex} void pushGroupStack(void) { /* * This routine makes room by pushing a new item on the stack @@ -14505,11 +14502,11 @@ void pushGroupStack(void) { gTopOfGroupStack = newgp; } -@ +\end{chunk} \subsection{initGroupStack} \index{hypertex!initGroupStack} \index{initGroupStack hypertex} -<>= +\begin{chunk}{hypertex} void initGroupStack(void) { gTopOfGroupStack = (GroupItem *) halloc(sizeof(GroupItem), "Push Group Stack"); @@ -14519,11 +14516,11 @@ void initGroupStack(void) { gTopOfGroupStack->cur_font = NULL; } -@ +\end{chunk} \subsection{emTopGroup} \index{hypertex!emTopGroup} \index{emTopGroup hypertex} -<>= +\begin{chunk}{hypertex} void emTopGroup(void) { if (! gTopOfGroupStack->next) pushGroupStack(); @@ -14532,11 +14529,11 @@ void emTopGroup(void) { changeText(gTopOfGroupStack->cur_color, gTopOfGroupStack->cur_font); } -@ +\end{chunk} \subsection{rmTopGroup} \index{hypertex!rmTopGroup} \index{rmTopGroup hypertex} -<>= +\begin{chunk}{hypertex} void rmTopGroup(void) { if (! gTopOfGroupStack->next) pushGroupStack(); @@ -14545,11 +14542,11 @@ void rmTopGroup(void) { changeText(gTopOfGroupStack->cur_color, gTopOfGroupStack->cur_font); } -@ +\end{chunk} \subsection{lineTopGroup} \index{hypertex!lineTopGroup} \index{lineTopGroup hypertex} -<>= +\begin{chunk}{hypertex} void lineTopGroup(void) { if (! gTopOfGroupStack->next) pushGroupStack(); @@ -14559,11 +14556,11 @@ void lineTopGroup(void) { } -@ +\end{chunk} \subsection{bfTopGroup} \index{hypertex!bfTopGroup} \index{bfTopGroup hypertex} -<>= +\begin{chunk}{hypertex} void bfTopGroup(void) { /* * Just in case the person is tryin a \em without a grouping @@ -14575,11 +14572,11 @@ void bfTopGroup(void) { changeText(gTopOfGroupStack->cur_color, gTopOfGroupStack->cur_font); } -@ +\end{chunk} \subsection{ttTopGroup} \index{hypertex!ttTopGroup} \index{ttTopGroup hypertex} -<>= +\begin{chunk}{hypertex} void ttTopGroup(void) { if (! gTopOfGroupStack->next) pushGroupStack(); @@ -14588,11 +14585,11 @@ void ttTopGroup(void) { changeText(gTopOfGroupStack->cur_color, gTopOfGroupStack->cur_font); } -@ +\end{chunk} \subsection{pushActiveGroup} \index{hypertex!pushActiveGroup} \index{pushActiveGroup hypertex} -<>= +\begin{chunk}{hypertex} void pushActiveGroup(void) { pushGroupStack(); gTopOfGroupStack->cur_font = gActiveFont; @@ -14600,11 +14597,11 @@ void pushActiveGroup(void) { changeText(gTopOfGroupStack->cur_color, gTopOfGroupStack->cur_font); } -@ +\end{chunk} \subsection{pushSpadGroup} \index{hypertex!pushSpadGroup} \index{pushSpadGroup hypertex} -<>= +\begin{chunk}{hypertex} void pushSpadGroup(void) { pushGroupStack(); gTopOfGroupStack->cur_font = gAxiomFont; @@ -14612,11 +14609,11 @@ void pushSpadGroup(void) { changeText(gTopOfGroupStack->cur_color, gTopOfGroupStack->cur_font); } -@ +\end{chunk} \subsection{initTopGroup} \index{hypertex!initTopGroup} \index{initTopGroup hypertex} -<>= +\begin{chunk}{hypertex} void initTopGroup(void) { /* clear the group stack */ while (popGroupStack() >= 0) @@ -14627,21 +14624,21 @@ void initTopGroup(void) { changeText(gTopOfGroupStack->cur_color, gTopOfGroupStack->cur_font); } -@ +\end{chunk} \subsection{centerTopGroup} \index{hypertex!centerTopGroup} \index{centerTopGroup hypertex} -<>= +\begin{chunk}{hypertex} void centerTopGroup(void) { pushGroupStack(); gTopOfGroupStack->center = 1; } -@ +\end{chunk} \subsection{copyGroupStack} \index{hypertex!copyGroupStack} \index{copyGroupStack hypertex} -<>= +\begin{chunk}{hypertex} GroupItem *copyGroupStack(void) { GroupItem *newgp = NULL; GroupItem *first = NULL; @@ -14664,11 +14661,11 @@ GroupItem *copyGroupStack(void) { return first; } -@ +\end{chunk} \subsection{freeGroupStack} \index{hypertex!freeGroupStack} \index{freeGroupStack hypertex} -<>= +\begin{chunk}{hypertex} void freeGroupStack(GroupItem *g) { GroupItem *trace = g; while (trace) { @@ -14677,12 +14674,12 @@ void freeGroupStack(GroupItem *g) { free(junk); } } -@ +\end{chunk} \section{Handle input, output, and Axiom communication} \subsection{makeRecord} \index{hypertex!makeRecord} \index{makeRecord hypertex} -<>= +\begin{chunk}{hypertex} void makeRecord(void) { int i; for (i=0;i>= +\begin{chunk}{hypertex} void verifyRecord(void) { int i; for (i=0;i>= +\begin{chunk}{hypertex} void ht2Input(void) { HashTable *table; HashEntry *entry; @@ -14750,11 +14747,11 @@ void ht2Input(void) { } } -@ +\end{chunk} \subsection{makeInputFileName} \index{hypertex!makeInputFileName} \index{makeInputFileName hypertex} -<>= +\begin{chunk}{hypertex} static char *makeInputFileName(char *buf, char *filename) { char *b, *c; strcpy(buf, filename); @@ -14766,11 +14763,11 @@ static char *makeInputFileName(char *buf, char *filename) { return b; } -@ +\end{chunk} \subsection{makePasteFileName} \index{hypertex!makePasteFileName} \index{makePasteFileName hypertex} -<>= +\begin{chunk}{hypertex} static char *makePasteFileName(char *buf, char *filename) { char *b, *c; strcpy(buf, filename); @@ -14782,11 +14779,11 @@ static char *makePasteFileName(char *buf, char *filename) { return b; } -@ +\end{chunk} \subsection{makeTheInputFile} \index{hypertex!makeTheInputFile} \index{makeTheInputFile hypertex} -<>= +\begin{chunk}{hypertex} static void makeTheInputFile(UnloadedPage *page) { char buf[1024], *b; if (!page->fpos.name) @@ -14804,11 +14801,11 @@ static void makeTheInputFile(UnloadedPage *page) { } } -@ +\end{chunk} \subsection{makeInputFileFromPage} \index{hypertex!makeInputFileFromPage} \index{makeInputFileFromPage hypertex} -<>= +\begin{chunk}{hypertex} static void makeInputFileFromPage(HyperDocPage *page) { TextNode *node; int starting_file = 1,/* i,*/ /*len,*/ ret_val; @@ -14888,22 +14885,22 @@ static void makeInputFileFromPage(HyperDocPage *page) { } } -@ +\end{chunk} \subsection{strCopy} \index{hypertex!strCopy} \index{strCopy hypertex} -<>= +\begin{chunk}{hypertex} char *strCopy(char *s) { char *b = halloc(strlen(s) + 1,"String"); strcpy(b, s); return b; } -@ +\end{chunk} \subsection{inListAndNewer} \index{hypertex!inListAndNewer} \index{inListAndNewer hypertex} -<>= +\begin{chunk}{hypertex} static int inListAndNewer(char *inputFile, char *htFile) { int ret_val, found = 0, i; struct stat htBuf, inputBuf; @@ -14956,11 +14953,11 @@ static int inListAndNewer(char *inputFile, char *htFile) { return ret_val; } -@ +\end{chunk} \subsection{makeInputFileList} \index{hypertex!makeInputFileList} \index{makeInputFileList hypertex} -<>= +\begin{chunk}{hypertex} static void makeInputFileList(void) { int i; char buf[256], *name; @@ -14971,11 +14968,11 @@ static void makeInputFileList(void) { } } -@ +\end{chunk} \subsection{printPasteLine} \index{hypertex!printPasteLine} \index{printPasteLine hypertex} -<>= +\begin{chunk}{hypertex} void printPasteLine(FILE *pfile,char *str) { char *free = "\\free", *bound = "\\bound", *f = free, *b = bound; int justSaw = 0; @@ -15004,11 +15001,11 @@ void printPasteLine(FILE *pfile,char *str) { } } -@ +\end{chunk} \subsection{getSpadOutput} \index{hypertex!getSpadOutput} \index{getSpadOutput hypertex} -<>= +\begin{chunk}{hypertex} void getSpadOutput(FILE *pfile,char *command,int com_type) { int n, i; char buf[1024]; @@ -15021,7 +15018,7 @@ void getSpadOutput(FILE *pfile,char *command,int com_type) { unescapeString(command); } -@ +\end{chunk} \subsection{getGraphOutput} THEMOS says: There is a problem here in that we issue the (|close|) and then go on. If this is the last command ,we will soon send a SIGTERM and @@ -15031,7 +15028,7 @@ Fix: Call a Lisp function that checks health of the viewport. We do this after the (|close|). \index{hypertex!getGraphOutput} \index{getGraphOutput hypertex} -<>= +\begin{chunk}{hypertex} void getGraphOutput(char *command,char *pagename,int com_type) { int n, i; char buf[1024]; @@ -15051,11 +15048,11 @@ void getGraphOutput(char *command,char *pagename,int com_type) { get_int(spadSocket); } -@ +\end{chunk} \subsection{sendCommand} \index{hypertex!sendCommand} \index{sendCommand hypertex} -<>= +\begin{chunk}{hypertex} static void sendCommand(char *command,int com_type) { char buf[1024]; if (com_type != Spadsrc) { @@ -15079,11 +15076,11 @@ static void sendCommand(char *command,int com_type) { } } -@ +\end{chunk} \subsection{printPaste} \index{hypertex!printPaste} \index{printPaste hypertex} -<>= +\begin{chunk}{hypertex} static void printPaste(FILE *pfile,char *realcom,char *command, char *pagename,int com_type) { fprintf(pfile, "\\begin{patch}{%sPatch%d}\n", pagename, example_number); @@ -15111,11 +15108,11 @@ static void printPaste(FILE *pfile,char *realcom,char *command, fflush(pfile); } -@ +\end{chunk} \subsection{printGraphPaste} \index{hypertex!printGraphPaste} \index{printGraphPaste hypertex} -<>= +\begin{chunk}{hypertex} static void printGraphPaste(FILE *pfile,char *realcom, char *command,char *pagename,int com_type) { fprintf(pfile, "\\begin{patch}{%sPatch%d}\n", pagename, example_number); @@ -15146,13 +15143,13 @@ static void printGraphPaste(FILE *pfile,char *realcom, fflush(pfile); } -@ +\end{chunk} \section{X Window window initialization code} Initialize the X Window System. \subsection{initializeWindowSystem} \index{hypertex!initializeWindowSystem} \index{initializeWindowSystem hypertex} -<>= +\begin{chunk}{hypertex} void initializeWindowSystem(void) { char *display_name = NULL; XColor fg, bg; @@ -15205,7 +15202,7 @@ void initializeWindowSystem(void) { /* fprintf(stderr,"initx:initializeWindowSystem:exited\n");*/ } -@ +\end{chunk} \subsection{initTopWindow} This routine is responsible for initializing a HyperDoc Window. At this point, all the fonts have been loaded, and X has been initialized. All I @@ -15217,7 +15214,7 @@ name. If the page name is NULL, it doesn't try to find it in the Hash Table, but rather just allocates a page of no name \index{hypertex!initTopWindow} \index{initTopWindow hypertex} -<>= +\begin{chunk}{hypertex} int initTopWindow(char *name) { HyperDocPage *page; XSetWindowAttributes wa; /* The X attributes structure */ @@ -15260,12 +15257,12 @@ int initTopWindow(char *name) { return 1; } -@ +\end{chunk} \subsection{openFormWindow} Create and initialize a form HyperDoc window. \index{hypertex!openFormWindow} \index{openFormWindow hypertex} -<>= +\begin{chunk}{hypertex} static void openFormWindow(void) { int x, y, width, height; unsigned int fwidth = 0, fheight = 0; @@ -15322,11 +15319,11 @@ static void openFormWindow(void) { XFlush(gXDisplay); } -@ +\end{chunk} \subsection{initFormWindow} \index{hypertex!initFormWindow} \index{initFormWindow hypertex} -<>= +\begin{chunk}{hypertex} int initFormWindow(char *name, int cols) { XSetWindowAttributes wa; /* The X attributes structure */ /* First allocate memory for the new window structure */ @@ -15354,11 +15351,11 @@ int initFormWindow(char *name, int cols) { return 1; } -@ +\end{chunk} \subsection{setNameAndIcon} \index{hypertex!setNameAndIcon} \index{setNameAndIcon hypertex} -<>= +\begin{chunk}{hypertex} static void setNameAndIcon(void) { char *icon_name = "HyperDoc"; char *s; @@ -15386,11 +15383,11 @@ static void setNameAndIcon(void) { XSetIconName(gXDisplay, gWindow->fMainWindow, icon_name); } -@ +\end{chunk} \subsection{getBorderProperties} \index{hypertex!getBorderProperties} \index{getBorderProperties hypertex} -<>= +\begin{chunk}{hypertex} static int getBorderProperties(void) { char *bwidth; int bw; @@ -15418,12 +15415,12 @@ static int getBorderProperties(void) { return bw; } -@ +\end{chunk} \subsection{openWindow} Create and initialize the HyperDoc window. \index{hypertex!openWindow} \index{openWindow hypertex} -<>= +\begin{chunk}{hypertex} static void openWindow(Window w) { int x = 0, y = 0; /*int border_width = 2;*/ @@ -15465,7 +15462,7 @@ static void openWindow(Window w) { XDefineCursor(gXDisplay, gWindow->fMainWindow, gNormalCursor); } -@ +\end{chunk} \subsection{setSizeHints} This routine gets and sets the size for a new window. If the w paramter is null, it means that this is the initial window. Thus the @@ -15474,7 +15471,7 @@ the window w is used as a guidline, and the new window is placed on top of it. \index{hypertex!setSizeHints} \index{setSizeHints hypertex} -<>= +\begin{chunk}{hypertex} static void setSizeHints(Window w) { int x, y; unsigned int width, height; @@ -15545,12 +15542,12 @@ static void setSizeHints(Window w) { XFlush(gXDisplay); } -@ +\end{chunk} \subsection{getGCs} Create the graphics contexts to be used for all drawing operations. \index{hypertex!getGCs} \index{getGCs hypertex} -<>= +\begin{chunk}{hypertex} static void getGCs(HDWindow *window) { /*unsigned long valuemask = 0;*/ XGCValues values; @@ -15583,12 +15580,12 @@ static void getGCs(HDWindow *window) { XSetForeground(gXDisplay, window->fControlGC, gControlForegroundColor); } -@ +\end{chunk} \subsection{loadFont} Load a font and store the information in the fontInfo parameter. \index{hypertex!loadFont} \index{loadFont hypertex} -<>= +\begin{chunk}{hypertex} static void loadFont(XFontStruct **fontInfo, char *fontname) { if ((*fontInfo = XLoadQueryFont(gXDisplay, fontname)) == NULL) { fprintf(stderr, "(HyperDoc) Cannot load font %s ; using default.\n", @@ -15602,7 +15599,7 @@ static void loadFont(XFontStruct **fontInfo, char *fontname) { } } -@ +\end{chunk} \subsection{ingItColorsAndFonts} This routine initializes all the colors and fonts that the user wishes to use. It checks for all the following properties in \verb|$HOME/.Xdefaults.| @@ -15619,7 +15616,7 @@ use. It checks for all the following properties in \verb|$HOME/.Xdefaults.| \end{itemize} \index{hypertex!ingItColorsAndFonts} \index{ingItColorsAndFonts hypertex} -<>= +\begin{chunk}{hypertex} static void ingItColorsAndFonts(void) { char property[256]; char *prop = &property[0]; @@ -15786,11 +15783,11 @@ static void ingItColorsAndFonts(void) { /* fprintf(stderr,"initx:ingItColorsAndFonts:exited\n");*/ } -@ +\end{chunk} \subsection{changeText} \index{hypertex!changeText} \index{changeText hypertex} -<>= +\begin{chunk}{hypertex} void changeText(int color, XFontStruct *font) { if (font) { XGCValues gcv; @@ -15803,7 +15800,7 @@ void changeText(int color, XFontStruct *font) { } } -@ +\end{chunk} \subsection{getColor} This routine checks the .Xdefaults file of the user for the specified color. If found it allocates a place in the color map for it. If @@ -15811,7 +15808,7 @@ not found, or if an error occurrs, it writes an error message, and uses the given default value. \index{hypertex!getColor} \index{getColor hypertex} -<>= +\begin{chunk}{hypertex} static int getColor(char *name, char *class, int def, Colormap *map) { char fullname[256]; char fullclass[256]; @@ -15855,12 +15852,12 @@ static int getColor(char *name, char *class, int def, Colormap *map) { } } -@ +\end{chunk} \subsection{mergeDatabases} \label{mergeDatabases} \index{hypertex!mergeDatabases} \index{mergeDatabases hypertex} -<>= +\begin{chunk}{hypertex} static void mergeDatabases(void) { XrmDatabase homeDB, serverDB, applicationDB; char filenamebuf[1024]; @@ -15904,11 +15901,11 @@ static void mergeDatabases(void) { XrmMergeDatabases(homeDB, &rDB); } -@ +\end{chunk} \subsection{isIt850} \index{hypertex!isIt850} \index{isIt850 hypertex} -<>= +\begin{chunk}{hypertex} int isIt850(XFontStruct *fontarg) { char *s; int i,val; @@ -15930,12 +15927,12 @@ int isIt850(XFontStruct *fontarg) { return(0); } -@ +\end{chunk} \section{Handling user page interaction} \subsection{fillBox} \index{hypertex!fillBox} \index{fillBox hypertex} -<>= +\begin{chunk}{hypertex} void fillBox(Window w,ImageStruct * image) { XClearWindow(gXDisplay, w); XPutImage(gXDisplay, w, gWindow->fControlGC, @@ -15944,11 +15941,11 @@ void fillBox(Window w,ImageStruct * image) { image->height); } -@ +\end{chunk} \subsection{toggleInputBox} \index{hypertex!toggleInputBox} \index{toggleInputBox hypertex} -<>= +\begin{chunk}{hypertex} void toggleInputBox(HyperLink *link) { InputBox *box; box = link->reference.box; @@ -15962,11 +15959,11 @@ void toggleInputBox(HyperLink *link) { } } -@ +\end{chunk} \subsection{toggleRadioBox} \index{hypertex!toggleRadioBox} \index{toggleRadioBox hypertex} -<>= +\begin{chunk}{hypertex} void toggleRadioBox(HyperLink *link) { InputBox *box; box = link->reference.box; @@ -15983,11 +15980,11 @@ void toggleRadioBox(HyperLink *link) { } } -@ +\end{chunk} \subsection{clearRbs} \index{hypertex!clearRbs} \index{clearRbs hypertex} -<>= +\begin{chunk}{hypertex} static void clearRbs(InputBox *list) { InputBox *trace = list; while (trace && !trace->picked) @@ -15998,11 +15995,11 @@ static void clearRbs(InputBox *list) { } } -@ +\end{chunk} \subsection{changeInputFocus} \index{hypertex!changeInputFocus} \index{changeInputFocus hypertex} -<>= +\begin{chunk}{hypertex} void changeInputFocus(HyperLink *link) { InputItem *new_item = link->reference.string; InputItem *old_item = gWindow->page->currentItem; @@ -16026,11 +16023,11 @@ void changeInputFocus(HyperLink *link) { updateInputsymbol(new_item); } -@ +\end{chunk} \subsection{nextInputFocus} \index{hypertex!nextInputFocus} \index{nextInputFocus hypertex} -<>= +\begin{chunk}{hypertex} void nextInputFocus(void) { InputItem *old_item = gWindow->page->currentItem, *new_item, *trace; if (gWindow->page->currentItem == NULL || @@ -16053,11 +16050,11 @@ void nextInputFocus(void) { drawInputsymbol(new_item); } -@ +\end{chunk} \subsection{prevInputFocus} \index{hypertex!prevInputFocus} \index{prevInputFocus hypertex} -<>= +\begin{chunk}{hypertex} void prevInputFocus(void) { InputItem *old_item = gWindow->page->currentItem, *new_item, *trace; if (gWindow->page->currentItem == NULL) { @@ -16088,11 +16085,11 @@ void prevInputFocus(void) { drawInputsymbol(new_item); } -@ +\end{chunk} \subsection{returnItem} \index{hypertex!returnItem} \index{returnItem hypertex} -<>= +\begin{chunk}{hypertex} InputItem *returnItem(char *name) { InputItem *list; list = gWindow->page->input_list; @@ -16104,11 +16101,11 @@ InputItem *returnItem(char *name) { return NULL; } -@ +\end{chunk} \subsection{deleteItem} \index{hypertex!deleteItem} \index{deleteItem hypertex} -<>= +\begin{chunk}{hypertex} int deleteItem(char *name) { InputItem *list; InputItem *prev = NULL; @@ -16132,12 +16129,12 @@ int deleteItem(char *name) { return 0; } -@ +\end{chunk} \section{Manipulate the item stack} \subsection{pushItemStack} \index{hypertex!pushItemStack} \index{pushItemStack hypertex} -<>= +\begin{chunk}{hypertex} void pushItemStack(void) { ItemStack *is = (ItemStack *) halloc(sizeof(ItemStack), "Item stack"); is->indent = indent; @@ -16148,11 +16145,11 @@ void pushItemStack(void) { return; } -@ +\end{chunk} \subsection{clearItemStack} \index{hypertex!clearItemStack} \index{clearItemStack hypertex} -<>= +\begin{chunk}{hypertex} void clearItemStack(void) { ItemStack *is = gTopOfItemStack, *chuck; while (is != NULL) { @@ -16163,11 +16160,11 @@ void clearItemStack(void) { return; } -@ +\end{chunk} \subsection{popItemStack} \index{hypertex!popItemStack} \index{popItemStack hypertex} -<>= +\begin{chunk}{hypertex} void popItemStack(void) { ItemStack *chuck; if (gTopOfItemStack == NULL) { @@ -16182,11 +16179,11 @@ void popItemStack(void) { free(chuck); } -@ +\end{chunk} \subsection{copyItemStack} \index{hypertex!copyItemStack} \index{copyItemStack hypertex} -<>= +\begin{chunk}{hypertex} ItemStack *copyItemStack(void) { ItemStack *new = NULL; ItemStack *prev = NULL; @@ -16209,11 +16206,11 @@ ItemStack *copyItemStack(void) { return first; } -@ +\end{chunk} \subsection{freeItemStack} \index{hypertex!freeItemStack} \index{freeItemStack hypertex} -<>= +\begin{chunk}{hypertex} void freeItemStack(ItemStack *is) { ItemStack *junk = NULL; ItemStack *trace = is; @@ -16224,12 +16221,12 @@ void freeItemStack(ItemStack *is) { } } -@ +\end{chunk} \section{Keyboard handling} \subsection{handleKey} \index{hypertex!handleKey} \index{handleKey hypertex} -<>= +\begin{chunk}{hypertex} void handleKey(XEvent *event) { char key_buffer[20]; int key_buffer_size = 20; @@ -16369,12 +16366,12 @@ void handleKey(XEvent *event) { } } -@ +\end{chunk} \subsection{getModifierMask} This routine returns the modifier mask associated to a key symbol. \index{hypertex!getModifierMask} \index{getModifierMask hypertex} -<>= +\begin{chunk}{hypertex} static unsigned int getModifierMask(KeySym sym) { unsigned int i, mask; XModifierKeymap *mod; @@ -16399,13 +16396,13 @@ static unsigned int getModifierMask(KeySym sym) { return 0; } -@ +\end{chunk} \subsection{initKeyin} This routine initializes some of the variables needed by the input strings, and boxes. \index{hypertex!initKeyin} \index{initKeyin hypertex} -<>= +\begin{chunk}{hypertex} void initKeyin(void) { char *prop; unsigned int nlm; @@ -16444,14 +16441,14 @@ void initKeyin(void) { } } -@ +\end{chunk} \section{Handle page macros} \subsection{scanHyperDoc} This routine keeps scanning until it reaches it pops off 1 more right brace then left brace. \index{hypertex!scanHyperDoc} \index{scanHyperDoc hypertex} -<>= +\begin{chunk}{hypertex} void scanHyperDoc(void) { HDWindow *twin = gWindow; int ret_val; @@ -16484,11 +16481,11 @@ void scanHyperDoc(void) { gWindow = twin; } -@ +\end{chunk} \subsection{number} \index{hypertex!number} \index{number hypertex} -<>= +\begin{chunk}{hypertex} int number(char *str) { char *t = str; while (*t) @@ -16497,12 +16494,12 @@ int number(char *str) { return 1; } -@ +\end{chunk} \subsection{loadMacro} Parse a given macro given the pointer to the unloaded macro. \index{hypertex!loadMacro} \index{loadMacro hypertex} -<>= +\begin{chunk}{hypertex} static char *loadMacro(MacroStore *macro) { int ret_val; long start_fpos; @@ -16566,11 +16563,11 @@ static char *loadMacro(MacroStore *macro) { return macro_buff; } -@ +\end{chunk} \subsection{initParameterElem} \index{hypertex!initParameterElem} \index{initParameterElem hypertex} -<>= +\begin{chunk}{hypertex} ParameterList initParameterElem(int number) { ParameterList new; int count; @@ -16588,11 +16585,11 @@ ParameterList initParameterElem(int number) { return new; } -@ +\end{chunk} \subsection{pushParameters} \index{hypertex!pushParameters} \index{pushParameters hypertex} -<>= +\begin{chunk}{hypertex} int pushParameters(ParameterList new) { if (new == NULL) { fprintf(stderr, "Tried pushing a null list onto the parameter stack\n"); @@ -16603,13 +16600,13 @@ int pushParameters(ParameterList new) { return 1; } -@ +\end{chunk} \subsection{popParameters} Simply pops the top of the parameter list, being good and freeing all the memory. \index{hypertex!popParameters} \index{popParameters hypertex} -<>= +\begin{chunk}{hypertex} int popParameters(void) { ParameterList old; int count; @@ -16628,12 +16625,12 @@ int popParameters(void) { return 1; } -@ +\end{chunk} \subsection{parseMacro} This routine loads a macro if needed, and then parses it from the string. \index{hypertex!parseMacro} \index{parseMacro hypertex} -<>= +\begin{chunk}{hypertex} int parseMacro(void) { MacroStore *macro; int s; @@ -16670,11 +16667,11 @@ int parseMacro(void) { } } -@ +\end{chunk} \subsection{getParameterStrings} \index{hypertex!getParameterStrings} \index{getParameterStrings hypertex} -<>= +\begin{chunk}{hypertex} static void getParameterStrings(int number,char * macro_name) { static char buffer[4096]; char *buffer_pntr; @@ -16759,11 +16756,11 @@ static void getParameterStrings(int number,char * macro_name) { return ; } -@ +\end{chunk} \subsection{parseParameters} \index{hypertex!parseParameters} \index{parseParameters hypertex} -<>= +\begin{chunk}{hypertex} void parseParameters(void) { int value; if (!number(token.id)) { @@ -16783,24 +16780,24 @@ void parseParameters(void) { return; } -@ +\end{chunk} \section{Memory management routines} \subsection{freeIfNonNULL} \index{hypertex!freeIfNonNULL} \index{freeIfNonNULL hypertex} -<>= +\begin{chunk}{hypertex} static void freeIfNonNULL(void *p) { if (p){ free(p); } } -@ +\end{chunk} \subsection{allocHdWindow} Allocate an HDWindow Structure and initialize it. \index{hypertex!allocHdWindow} \index{allocHdWindow hypertex} -<>= +\begin{chunk}{hypertex} HDWindow *allocHdWindow(void) { HDWindow *w = (HDWindow *) halloc(sizeof(HDWindow), "HDWindow"); w->fMemoStack = (HyperDocPage **) @@ -16833,11 +16830,11 @@ HDWindow *allocHdWindow(void) { return w; } -@ +\end{chunk} \subsection{freeHdWindow} \index{hypertex!freeHdWindow} \index{freeHdWindow hypertex} -<>= +\begin{chunk}{hypertex} void freeHdWindow(HDWindow *w) { if (w) { free(w->fMemoStack); @@ -16864,12 +16861,12 @@ void freeHdWindow(HDWindow *w) { } } -@ +\end{chunk} \subsection{allocNode} Allocate an empty text node. \index{hypertex!allocNode} \index{allocNode hypertex} -<>= +\begin{chunk}{hypertex} TextNode *allocNode(void) { TextNode *temp_node; temp_node = (TextNode *) halloc(sizeof(TextNode), "Text Node"); @@ -16886,11 +16883,11 @@ TextNode *allocNode(void) { return temp_node; } -@ +\end{chunk} \subsection{freeNode} \index{hypertex!freeNode} \index{freeNode hypertex} -<>= +\begin{chunk}{hypertex} void freeNode(TextNode *node, short int des) { if (node == NULL) return; @@ -17059,11 +17056,11 @@ void freeNode(TextNode *node, short int des) { free(node); } -@ +\end{chunk} \subsection{allocIfnode} \index{hypertex!allocIfnode} \index{allocIfnode hypertex} -<>= +\begin{chunk}{hypertex} IfNode *allocIfnode(void) { IfNode *tempif; tempif = (IfNode *) halloc(sizeof(struct if_node), "IfNode"); @@ -17071,11 +17068,11 @@ IfNode *allocIfnode(void) { return tempif; } -@ +\end{chunk} \subsection{allocCondnode} \index{hypertex!allocCondnode} \index{allocCondnode hypertex} -<>= +\begin{chunk}{hypertex} CondNode *allocCondnode(void) { CondNode *temp; temp = (CondNode *) halloc(sizeof(struct cond_node), "Cond Node"); @@ -17083,11 +17080,11 @@ CondNode *allocCondnode(void) { return temp; } -@ +\end{chunk} \subsection{freeCond} \index{hypertex!freeCond} \index{freeCond hypertex} -<>= +\begin{chunk}{hypertex} static void freeCond(CondNode *cond) { if (cond) { free(cond->label); @@ -17097,12 +17094,12 @@ static void freeCond(CondNode *cond) { } } -@ +\end{chunk} \subsection{allocPage} Allocate a new HyperDoc page. \index{hypertex!allocPage} \index{allocPage hypertex} -<>= +\begin{chunk}{hypertex} HyperDocPage *allocPage(char *name) { HyperDocPage *page; page = (HyperDocPage *) halloc(sizeof(HyperDocPage), "HyperDocPage"); @@ -17123,7 +17120,7 @@ HyperDocPage *allocPage(char *name) { return page; } -@ +\end{chunk} \subsection{freePage} \label{freePage} This routine now checks for an environment variable NOFREE. If found @@ -17131,7 +17128,7 @@ it returns. At least, that's what the comment claims but I see no code to implement this. It's not a bad idea though. \index{hypertex!freePage} \index{freePage hypertex} -<>= +\begin{chunk}{hypertex} void freePage(HyperDocPage *page) { if (page == NULL) return; @@ -17179,11 +17176,11 @@ void freePage(HyperDocPage *page) { } } -@ +\end{chunk} \subsection{freePaste} \index{hypertex!freePaste} \index{freePaste hypertex} -<>= +\begin{chunk}{hypertex} static void freePaste(PasteNode *paste, short int des) { if (paste) { freeGroupStack(paste->group); @@ -17193,11 +17190,11 @@ static void freePaste(PasteNode *paste, short int des) { } } -@ +\end{chunk} \subsection{freePastebutton} \index{hypertex!freePastebutton} \index{freePastebutton hypertex} -<>= +\begin{chunk}{hypertex} static void freePastebutton(TextNode *node, short int des) { /* * if I am freeing from within parse patch, then I have to do some @@ -17222,11 +17219,11 @@ static void freePastebutton(TextNode *node, short int des) { freeIfNonNULL(node->data.text); } -@ +\end{chunk} \subsection{freePastearea} \index{hypertex!freePastearea} \index{freePastearea hypertex} -<>= +\begin{chunk}{hypertex} static void freePastearea(TextNode *node, short int des) { if (des) { PasteNode *paste; @@ -17244,38 +17241,38 @@ static void freePastearea(TextNode *node, short int des) { freeIfNonNULL(node->data.text); } -@ +\end{chunk} \subsection{freeString} \index{hypertex!freeString} \index{freeString hypertex} -<>= +\begin{chunk}{hypertex} void freeString(char *str) { freeIfNonNULL(str); } -@ +\end{chunk} \subsection{freeDepend} \index{hypertex!freeDepend} \index{freeDepend hypertex} -<>= +\begin{chunk}{hypertex} static void freeDepend(SpadcomDepend *sd) { freeIfNonNULL((char *) sd); } -@ +\end{chunk} \subsection{dontFree} \index{hypertex!dontFree} \index{dontFree hypertex} -<>= +\begin{chunk}{hypertex} static void dontFree(void *link) { return; } -@ +\end{chunk} \subsection{freeLines} \index{hypertex!freeLines} \index{freeLines hypertex} -<>= +\begin{chunk}{hypertex} static void freeLines(LineStruct *lines) { if (lines->prev != NULL) lines->prev->next = NULL; @@ -17288,11 +17285,11 @@ static void freeLines(LineStruct *lines) { } } -@ +\end{chunk} \subsection{freeInputItem} \index{hypertex!freeInputItem} \index{freeInputItem hypertex} -<>= +\begin{chunk}{hypertex} void freeInputItem(InputItem *sym, short int des) { freeIfNonNULL(sym->name); freeLines(sym->lines); @@ -17300,11 +17297,11 @@ void freeInputItem(InputItem *sym, short int des) { XDestroyWindow(gXDisplay, sym->win); } -@ +\end{chunk} \subsection{freeInputList} \index{hypertex!freeInputList} \index{freeInputList hypertex} -<>= +\begin{chunk}{hypertex} void freeInputList(InputItem *il) { while (il) { InputItem *trash = il; @@ -17314,11 +17311,11 @@ void freeInputList(InputItem *il) { } } -@ +\end{chunk} \subsection{freeInputBox} \index{hypertex!freeInputBox} \index{freeInputBox hypertex} -<>= +\begin{chunk}{hypertex} static void freeInputBox(InputBox *box) { if (box) { freeIfNonNULL(box->name); @@ -17326,11 +17323,11 @@ static void freeInputBox(InputBox *box) { } } -@ +\end{chunk} \subsection{freeRadioBoxes} \index{hypertex!freeRadioBoxes} \index{freeRadioBoxes hypertex} -<>= +\begin{chunk}{hypertex} static void freeRadioBoxes(RadioBoxes *radio) { if (radio) { freeRadioBoxes(radio->next); @@ -17339,11 +17336,11 @@ static void freeRadioBoxes(RadioBoxes *radio) { } } -@ +\end{chunk} \subsection{allocInputline} \index{hypertex!allocInputline} \index{allocInputline hypertex} -<>= +\begin{chunk}{hypertex} LineStruct *allocInputline(int size) { int i; LineStruct *line = @@ -17356,11 +17353,11 @@ LineStruct *allocInputline(int size) { return line; } -@ +\end{chunk} \subsection{allocPasteNode} \index{hypertex!allocPasteNode} \index{allocPasteNode hypertex} -<>= +\begin{chunk}{hypertex} PasteNode *allocPasteNode(char *name) { PasteNode *pastenode = (PasteNode *) halloc(sizeof(PasteNode), "PasteNode"); @@ -17373,11 +17370,11 @@ PasteNode *allocPasteNode(char *name) { return pastenode; } -@ +\end{chunk} \subsection{allocPatchstore} \index{hypertex!allocPatchstore} \index{allocPatchstore hypertex} -<>= +\begin{chunk}{hypertex} PatchStore *allocPatchstore(void) { PatchStore *p = (PatchStore *) halloc(sizeof(PatchStore), "PatchStore"); p->loaded = 0; @@ -17385,11 +17382,11 @@ PatchStore *allocPatchstore(void) { return p; } -@ +\end{chunk} \subsection{freePatch} \index{hypertex!freePatch} \index{freePatch hypertex} -<>= +\begin{chunk}{hypertex} void freePatch(PatchStore *p) { if (p) { if (p->name) @@ -17402,11 +17399,11 @@ void freePatch(PatchStore *p) { } } -@ +\end{chunk} \subsection{allocInputbox} \index{hypertex!allocInputbox} \index{allocInputbox hypertex} -<>= +\begin{chunk}{hypertex} InputBox *allocInputbox(void) { InputBox *box = (InputBox *) halloc(sizeof(InputBox), "InputBox"); box->picked = 0; @@ -17415,11 +17412,11 @@ InputBox *allocInputbox(void) { return box; } -@ +\end{chunk} \subsection{allocRbs} \index{hypertex!allocRbs} \index{allocRbs hypertex} -<>= +\begin{chunk}{hypertex} RadioBoxes *allocRbs(void) { RadioBoxes *newrb = (RadioBoxes *) halloc(sizeof(RadioBoxes), "Radio Boxes"); newrb->next = NULL; @@ -17427,11 +17424,11 @@ RadioBoxes *allocRbs(void) { return newrb; } -@ +\end{chunk} \subsection{allocButtonList} \index{hypertex!allocButtonList} \index{allocButtonList hypertex} -<>= +\begin{chunk}{hypertex} ButtonList *allocButtonList(void) { ButtonList *newbl = (ButtonList *) halloc(sizeof(ButtonList), "Button List"); newbl->link = NULL; @@ -17440,11 +17437,11 @@ ButtonList *allocButtonList(void) { return newbl; } -@ +\end{chunk} \subsection{freeButtonList} \index{hypertex!freeButtonList} \index{freeButtonList hypertex} -<>= +\begin{chunk}{hypertex} void freeButtonList(ButtonList *bl) { while (bl) { ButtonList *nbl = bl->next; @@ -17453,12 +17450,12 @@ void freeButtonList(ButtonList *bl) { } } -@ +\end{chunk} \subsection{resizeBuffer} Resizable static buffers. \index{hypertex!resizeBuffer} \index{resizeBuffer hypertex} -<>= +\begin{chunk}{hypertex} char *resizeBuffer(int size, char *oldBuf, int *oldSize) { char *newBuf; int newSize; @@ -17475,12 +17472,12 @@ char *resizeBuffer(int size, char *oldBuf, int *oldSize) { return newBuf; } -@ +\end{chunk} \section{Page parsing routines} \subsection{PushMR} \index{hypertex!PushMR} \index{PushMR hypertex} -<>= +\begin{chunk}{hypertex} static void PushMR(void) { MR_Stack *newStackItem = (MR_Stack *) halloc(sizeof(MR_Stack), "Mode Region Stack"); @@ -17490,11 +17487,11 @@ static void PushMR(void) { top_mr_stack = newStackItem; } -@ +\end{chunk} \subsection{PopMR} \index{hypertex!PopMR} \index{PopMR hypertex} -<>= +\begin{chunk}{hypertex} static void PopMR(void) { MR_Stack *old = top_mr_stack; if (old == NULL) { @@ -17510,11 +17507,11 @@ static void PopMR(void) { } } -@ +\end{chunk} \subsection{loadPage} \index{hypertex!loadPage} \index{loadPage hypertex} -<>= +\begin{chunk}{hypertex} void loadPage(HyperDocPage *page) { if (page->type == UnloadedPageType) { HyperDocPage *new_page; @@ -17526,12 +17523,12 @@ void loadPage(HyperDocPage *page) { } } -@ +\end{chunk} \subsection{displayPage} Display a HyperDoc page with the given name, parsing it if needed. \index{hypertex!displayPage} \index{displayPage hypertex} -<>= +\begin{chunk}{hypertex} void displayPage(HyperDocPage *page) { HyperDocPage *new_page; XUnmapSubwindows(gXDisplay, gWindow->fMainWindow); @@ -17568,12 +17565,12 @@ void displayPage(HyperDocPage *page) { showPage(page); } -@ +\end{chunk} \subsection{formatPage} Parse a given HyperDoc Page, from the top. \index{hypertex!formatPage} \index{formatPage hypertex} -<>= +\begin{chunk}{hypertex} static HyperDocPage *formatPage(UnloadedPage *ulpage) { /*int ret_val;*/ HyperDocPage *page = allocPage(ulpage->name); @@ -17592,11 +17589,11 @@ static HyperDocPage *formatPage(UnloadedPage *ulpage) { /* parse the HyperDoc statements in the given string */ -@ +\end{chunk} \subsection{parseFromString} \index{hypertex!parseFromString} \index{parseFromString hypertex} -<>= +\begin{chunk}{hypertex} void parseFromString(char *str) { saveScannerState(); last_ch = NoChar; @@ -17607,11 +17604,11 @@ void parseFromString(char *str) { restoreScannerState(); } -@ +\end{chunk} \subsection{parseTitle} \index{hypertex!parseTitle} \index{parseTitle hypertex} -<>= +\begin{chunk}{hypertex} static void parseTitle(HyperDocPage *page) { TextNode *node; PushMR(); @@ -17645,11 +17642,11 @@ static void parseTitle(HyperDocPage *page) { PopMR(); } -@ +\end{chunk} \subsection{parseHeader} \index{hypertex!parseHeader} \index{parseHeader hypertex} -<>= +\begin{chunk}{hypertex} static void parseHeader(HyperDocPage *page) { TextNode *node; PushMR(); @@ -17666,12 +17663,12 @@ static void parseHeader(HyperDocPage *page) { * parse a page from the top level */ -@ +\end{chunk} \subsection{initParsePage} Parse a page from the top level. \index{hypertex!initParsePage} \index{initParsePage hypertex} -<>= +\begin{chunk}{hypertex} static void initParsePage(HyperDocPage *page) { gEndedPage = gInDesc = gStringValueOk = gInIf = gInButton = gInOptional = gInVerbatim = gInPaste = gInItems = @@ -17694,11 +17691,11 @@ static void initParsePage(HyperDocPage *page) { gPageBeingParsed = page; } -@ +\end{chunk} \subsection{initParsePatch} \index{hypertex!initParsePatch} \index{initParsePatch hypertex} -<>= +\begin{chunk}{hypertex} void initParsePatch(HyperDocPage *page) { gEndedPage = gInDesc = gStringValueOk = gInIf = gInButton = gInOptional = gInVerbatim = gInPaste = gInItems = @@ -17712,11 +17709,11 @@ void initParsePatch(HyperDocPage *page) { gPageBeingParsed = page; } -@ +\end{chunk} \subsection{parsePage} \index{hypertex!parsePage} \index{parsePage hypertex} -<>= +\begin{chunk}{hypertex} static void parsePage(HyperDocPage *page) { initParsePage(page); /* Get the name of the page */ @@ -17738,7 +17735,7 @@ static void parsePage(HyperDocPage *page) { /* */ -@ +\end{chunk} \subsection{parseHyperDoc} The general HyperDoc parsing function. expects to see anything. This function will parse until it sees either: @@ -17749,7 +17746,7 @@ function will parse until it sees either: \end{enumerate} \index{hypertex!parseHyperDoc} \index{parseHyperDoc hypertex} -<>= +\begin{chunk}{hypertex} void parseHyperDoc(void) { TextNode *node = NULL /*, *save_node = NULL, *arg_node = NULL*/ ; for(;;) { @@ -18073,12 +18070,12 @@ void parseHyperDoc(void) { } } -@ +\end{chunk} \subsection{parsePageFromSocket} Parse a page from a socket source. \index{hypertex!parsePageFromSocket} \index{parsePageFromSocket hypertex} -<>= +\begin{chunk}{hypertex} HyperDocPage *parsePageFromSocket(void) { HyperDocPage *page = allocPage((char *) NULL); HyperDocPage *hpage; @@ -18121,11 +18118,11 @@ HyperDocPage *parsePageFromSocket(void) { return page; } -@ +\end{chunk} \subsection{parsePageFromUnixfd} \index{hypertex!parsePageFromUnixfd} \index{parsePageFromUnixfd hypertex} -<>= +\begin{chunk}{hypertex} HyperDocPage *parsePageFromUnixfd(void) { HyperDocPage *page = allocPage((char *) NULL); initScanner(); @@ -18152,11 +18149,11 @@ HyperDocPage *parsePageFromUnixfd(void) { return page; } -@ +\end{chunk} \subsection{startScrolling} \index{hypertex!startScrolling} \index{startScrolling hypertex} -<>= +\begin{chunk}{hypertex} static void startScrolling(void) { /* * if I am here than I had a begin scroll. This means I should end the @@ -18180,11 +18177,11 @@ static void startScrolling(void) { curr_node->type = Scrollingnode; } -@ +\end{chunk} \subsection{startFooter} \index{hypertex!startFooter} \index{startFooter hypertex} -<>= +\begin{chunk}{hypertex} static void startFooter(void) { /* * This ends the parsing of the scrolling region, and then starts to @@ -18210,11 +18207,11 @@ static void startFooter(void) { gWindow->fDisplayedWindow = gWindow->fMainWindow; } -@ +\end{chunk} \subsection{endAPage} \index{hypertex!endAPage} \index{endAPage hypertex} -<>= +\begin{chunk}{hypertex} static void endAPage(void) { if (gParserRegion == Scrolling) { fprintf(stderr, "%s\n", @@ -18240,11 +18237,11 @@ static void endAPage(void) { } } -@ +\end{chunk} \subsection{parseReplacepage} \index{hypertex!parseReplacepage} \index{parseReplacepage hypertex} -<>= +\begin{chunk}{hypertex} static void parseReplacepage(void) { getExpectedToken(Lbrace); getToken(); @@ -18252,31 +18249,31 @@ static void parseReplacepage(void) { getExpectedToken(Rbrace); } -@ +\end{chunk} \subsection{windowEqual} Hash functions for active link windows. \index{hypertex!windowEqual} \index{windowEqual hypertex} -<>= +\begin{chunk}{hypertex} int windowEqual(Window *w1, Window *w2) { return *w1 == *w2; } -@ +\end{chunk} \subsection{windowCode} Hash code for a window. \index{hypertex!windowCode} \index{windowCode hypertex} -<>= +\begin{chunk}{hypertex} int windowCode(Window *w, int size) { return (*w) % size; } -@ +\end{chunk} \subsection{windowId} \index{hypertex!windowId} \index{windowId hypertex} -<>= +\begin{chunk}{hypertex} char *windowId(Window w) { char *ret; char buff[32]; @@ -18288,14 +18285,14 @@ char *windowId(Window w) { return (ret); } -@ +\end{chunk} \subsection{readHtDb} This procedure reads the ht database. It makes repeated calls to dbFileOpen, and while the returned pointer is not null, it continues to read the presented data base files. \index{hypertex!readHtDb} \index{readHtDb hypertex} -<>= +\begin{chunk}{hypertex} void readHtDb(HashTable *page_hash, HashTable *macro_hash, HashTable *patch_hash) { FILE *db_fp; @@ -18336,7 +18333,7 @@ void readHtDb(HashTable *page_hash, HashTable *macro_hash, freeHash(&ht_gFileHashTable, (FreeFunction)freeString); } -@ +\end{chunk} \subsection{readHtFile} This procedure reads a single HyperDoc database file. It is passed an already initilaized file pointer. It reads the whole file, updating the @@ -18344,7 +18341,7 @@ page hash, or the macro hash only when a previous entry with the same name is not found \index{hypertex!readHtFile} \index{readHtFile hypertex} -<>= +\begin{chunk}{hypertex} static void readHtFile(HashTable *page_hash, HashTable *macro_hash, HashTable *patch_hash, FILE *db_fp, char *dbFile) { char filename[256]; @@ -18516,12 +18513,12 @@ static void readHtFile(HashTable *page_hash, HashTable *macro_hash, "parse-aux:readHtFile:read %d pages from database\n", pages); */ } -@ +\end{chunk} \subsection{makeLinkWindow} Create an unmapped input-only window for an active screen area. \index{hypertex!makeLinkWindow} \index{makeLinkWindow hypertex} -<>= +\begin{chunk}{hypertex} HyperLink *makeLinkWindow(TextNode *link_node, int type, int isSubWin) { HyperLink *link; XSetWindowAttributes at; @@ -18565,11 +18562,11 @@ HyperLink *makeLinkWindow(TextNode *link_node, int type, int isSubWin) { return 0; } -@ +\end{chunk} \subsection{makePasteWindow} \index{hypertex!makePasteWindow} \index{makePasteWindow hypertex} -<>= +\begin{chunk}{hypertex} HyperLink *makePasteWindow(PasteNode *paste) { HyperLink *link; XSetWindowAttributes at; @@ -18596,12 +18593,12 @@ HyperLink *makePasteWindow(PasteNode *paste) { } -@ +\end{chunk} \subsection{makeSpecialPage} Create a HyperDoc page structure with the given type and name. \index{hypertex!makeSpecialPage} \index{makeSpecialPage hypertex} -<>= +\begin{chunk}{hypertex} static HyperDocPage *makeSpecialPage(int type, char *name) { HyperDocPage *page = allocPage(name); if (page == NULL) { @@ -18614,12 +18611,12 @@ static HyperDocPage *makeSpecialPage(int type, char *name) { return page; } -@ +\end{chunk} \subsection{main} Insert the special button page types into the page hash table. \index{hypertex!main} \index{main hypertex} -<>= +\begin{chunk}{hypertex} void makeSpecialPages(HashTable *pageHashTable) { hashInsert(pageHashTable, (char *)makeSpecialPage(Quitbutton, "QuitPage"), @@ -18632,13 +18629,13 @@ void makeSpecialPages(HashTable *pageHashTable) { "UpPage"); } -@ +\end{chunk} \subsection{addDependencies} Here is where I put the item into the pages linked list. Parse the \verb|\bound{varlist}| command, and add vars to dependency table. \index{hypertex!addDependencies} \index{addDependencies hypertex} -<>= +\begin{chunk}{hypertex} void addDependencies(void) { TextNode *bound_node = curr_node; TextNode *node; @@ -18679,12 +18676,12 @@ void addDependencies(void) { } } -@ +\end{chunk} \subsection{isNumber} Returns true iff the TextNode contains a single integer. \index{hypertex!isNumber} \index{isNumber hypertex} -<>= +\begin{chunk}{hypertex} int isNumber(char * str) { char *s; for (s = str; *s != '\0'; s++) { @@ -18694,14 +18691,14 @@ int isNumber(char * str) { return 1; } -@ +\end{chunk} \subsection{parserError} This procedure is called by the parser when an error occurs. It prints the error message, followed by the next 10 tokens to ease finding the error for the user. \index{hypertex!parserError} \index{parserError hypertex} -<>= +\begin{chunk}{hypertex} void parserError(char *str) { int i, v; fprintf(stderr, " %s\n", str); @@ -18716,12 +18713,12 @@ void parserError(char *str) { exit(-1); } -@ +\end{chunk} \subsection{getFilename} Advance token to the next token in the input stream. \index{hypertex!getFilename} \index{getFilename hypertex} -<>= +\begin{chunk}{hypertex} int getFilename(void) { int c, ws; static int seen_white = 0; /*UNUSED */ @@ -18764,11 +18761,11 @@ int getFilename(void) { return 1; } -@ +\end{chunk} \subsection{getInputString} \index{hypertex!getInputString} \index{getInputString hypertex} -<>= +\begin{chunk}{hypertex} char *getInputString(void) { char *string; TextNode *string_node,*save_node; @@ -18785,13 +18782,13 @@ char *getInputString(void) { return string; } -@ +\end{chunk} \subsection{getWhere} Tries to determine if there is an optional argument for where I should be parsing from. If so it then tries to determine which. \index{hypertex!getWhere} \index{getWhere hypertex} -<>= +\begin{chunk}{hypertex} int getWhere(void) { int tw; getToken(); @@ -18817,11 +18814,11 @@ int getWhere(void) { return tw; } -@ +\end{chunk} \subsection{findFp} \index{hypertex!findFp} \index{findFp hypertex} -<>= +\begin{chunk}{hypertex} FILE *findFp(FilePosition fp) { FILE *lfile; char fullname[256], addname[256]; @@ -18844,13 +18841,13 @@ FILE *findFp(FilePosition fp) { return lfile; } -@ +\end{chunk} \section{Handle InputString, SimpleBox, RadioBox input} -@ + \subsection{makeInputWindow} \index{hypertex!makeInputWindow} \index{makeInputWindow hypertex} -<>= +\begin{chunk}{hypertex} HyperLink *makeInputWindow(InputItem * item) { HyperLink *link; XSetWindowAttributes at; @@ -18880,11 +18877,11 @@ HyperLink *makeInputWindow(InputItem * item) { } /* create an unmapped input window for boxes */ -@ +\end{chunk} \subsection{makeBoxWindow} \index{hypertex!makeBoxWindow} \index{makeBoxWindow hypertex} -<>= +\begin{chunk}{hypertex} HyperLink *makeBoxWindow(InputBox * box, int type) { HyperLink *link = 0; XSetWindowAttributes at; @@ -18911,11 +18908,11 @@ HyperLink *makeBoxWindow(InputBox * box, int type) { return link; } -@ +\end{chunk} \subsection{initializeDefault} \index{hypertex!initializeDefault} \index{initializeDefault hypertex} -<>= +\begin{chunk}{hypertex} void initializeDefault(InputItem *item,char * buff) { LineStruct *newline; LineStruct *curr_line; @@ -18957,12 +18954,12 @@ void initializeDefault(InputItem *item,char * buff) { item->curr_line = curr_line; } -@ +\end{chunk} \subsection{parseInputstring} Parse the input string statement. \index{hypertex!parseInputstring} \index{parseInputstring hypertex} -<>= +\begin{chunk}{hypertex} void parseInputstring(void) { TextNode *input_node = curr_node; char *name; @@ -19009,11 +19006,11 @@ void parseInputstring(void) { return ; } -@ +\end{chunk} \subsection{parseSimplebox} \index{hypertex!parseSimplebox} \index{parseSimplebox hypertex} -<>= +\begin{chunk}{hypertex} void parseSimplebox(void) { InputBox *box; char *name; @@ -19094,11 +19091,11 @@ void parseSimplebox(void) { return; } -@ +\end{chunk} \subsection{parseRadiobox} \index{hypertex!parseRadiobox} \index{parseRadiobox hypertex} -<>= +\begin{chunk}{hypertex} void parseRadiobox(void) { InputBox *box; char *name; @@ -19183,11 +19180,11 @@ void parseRadiobox(void) { return; } -@ +\end{chunk} \subsection{addBoxToRbList} \index{hypertex!addBoxToRbList} \index{addBoxToRbList hypertex} -<>= +\begin{chunk}{hypertex} static void addBoxToRbList(char *name,InputBox *box) { RadioBoxes *trace = gPageBeingParsed->radio_boxes; InputBox *list; @@ -19215,11 +19212,11 @@ static void addBoxToRbList(char *name,InputBox *box) { return; } -@ +\end{chunk} \subsection{checkOthers} \index{hypertex!checkOthers} \index{checkOthers hypertex} -<>= +\begin{chunk}{hypertex} static int checkOthers(InputBox *list) { InputBox *trace = list; while (trace != NULL && !trace->picked) @@ -19230,12 +19227,12 @@ static int checkOthers(InputBox *list) { return 0; } -@ +\end{chunk} \subsection{insertItem} Inserts an item into the current input list. \index{hypertex!insertItem} \index{insertItem hypertex} -<>= +\begin{chunk}{hypertex} static void insertItem(InputItem *item) { InputItem *trace = gPageBeingParsed->input_list; if (gPageBeingParsed->currentItem == NULL) { @@ -19255,11 +19252,11 @@ static void insertItem(InputItem *item) { } } -@ +\end{chunk} \subsection{initPasteItem} {hypertex!initPasteItem} \index{initPasteItem hypertex} -<>= +\begin{chunk}{hypertex} void initPasteItem(InputItem *item) { InputItem *trace = gPageBeingParsed->input_list; if (!item) { @@ -19273,11 +19270,11 @@ void initPasteItem(InputItem *item) { } } -@ +\end{chunk} \subsection{repasteItem} \index{hypertex!repasteItem} \index{repasteItem hypertex} -<>= +\begin{chunk}{hypertex} void repasteItem(void) { InputItem *trace; if (save_item) { @@ -19294,11 +19291,11 @@ void repasteItem(void) { save_item = NULL; } -@ +\end{chunk} \subsection{currentItem} \index{hypertex!currentItem} \index{currentItem hypertex} -<>= +\begin{chunk}{hypertex} InputItem *currentItem(void) { InputItem *trace = gPageBeingParsed->input_list; if (trace) { @@ -19309,11 +19306,11 @@ InputItem *currentItem(void) { return NULL; } -@ +\end{chunk} \subsection{alreadyThere} \index{hypertex!alreadyThere} \index{alreadyThere hypertex} -<>= +\begin{chunk}{hypertex} int alreadyThere(char *name) { RadioBoxes *trace = gPageBeingParsed->radio_boxes; while (trace && strcmp(trace->name, name)) @@ -19324,11 +19321,11 @@ int alreadyThere(char *name) { return 0; } -@ +\end{chunk} \subsection{parseRadioboxes} \index{hypertex!parseRadioboxes} \index{parseRadioboxes hypertex} -<>= +\begin{chunk}{hypertex} void parseRadioboxes(void) { TextNode *return_node = curr_node; RadioBoxes *newrb; @@ -19383,12 +19380,12 @@ void parseRadioboxes(void) { return; } -@ +\end{chunk} \section{Routines for paste-in areas} \subsection{parsePaste} \index{hypertex!parsePaste} \index{parsePaste hypertex} -<>= +\begin{chunk}{hypertex} void parsePaste(void) { TextNode *pn = curr_node; PasteNode *paste; @@ -19469,11 +19466,11 @@ void parsePaste(void) { gInPaste--; } -@ +\end{chunk} \subsection{parsePastebutton} \index{hypertex!parsePastebutton} \index{parsePastebutton hypertex} -<>= +\begin{chunk}{hypertex} void parsePastebutton(void) { PasteNode *paste; TextNode *pb; @@ -19524,7 +19521,7 @@ void parsePastebutton(void) { pb->link = makePasteWindow(paste); } -@ +\end{chunk} \subsection{parsePatch} This routine is responsible for parsing a patch from a file. To do this I guess er will initScanner, then parse, the parsed piece of text @@ -19532,7 +19529,7 @@ will replace the current PasteNode which will be squashed down to nothing, and then discarded. \index{hypertex!parsePatch} \index{parsePatch hypertex} -<>= +\begin{chunk}{hypertex} HyperDocPage *parsePatch(PasteNode *paste) { TextNode *new; TextNode *end_node; @@ -19652,11 +19649,11 @@ HyperDocPage *parsePatch(PasteNode *paste) { return gWindow->page; } -@ +\end{chunk} \subsection{loadPatch} \index{hypertex!loadPatch} \index{loadPatch hypertex} -<>= +\begin{chunk}{hypertex} static void loadPatch(PatchStore *patch) { long start_fpos; int size = 0; @@ -19690,12 +19687,12 @@ static void loadPatch(PatchStore *patch) { restoreScannerState(); } -@ +\end{chunk} \section{parsing routines for node types} \subsection{parseIfcond} \index{hypertex!parseIfcond} \index{parseIfcond hypertex} -<>= +\begin{chunk}{hypertex} void parseIfcond(void) { TextNode *ifnode = curr_node; TextNode *endif; @@ -19762,11 +19759,11 @@ void parseIfcond(void) { gInIf--; } -@ +\end{chunk} \subsection{parseCondnode} \index{hypertex!parseCondnode} \index{parseCondnode hypertex} -<>= +\begin{chunk}{hypertex} static void parseCondnode(void) { getToken(); switch (token.type) { @@ -19798,11 +19795,11 @@ static void parseCondnode(void) { } } -@ +\end{chunk} \subsection{parseHasreturnto} \index{hypertex!parseHasreturnto} \index{parseHasreturnto hypertex} -<>= +\begin{chunk}{hypertex} static void parseHasreturnto(void) { TextNode *hrt = curr_node, *arg_node = allocNode(); curr_node->type = Hasreturnto; @@ -19814,11 +19811,11 @@ static void parseHasreturnto(void) { curr_node = hrt; } -@ +\end{chunk} \subsection{parseNewcond} \index{hypertex!parseNewcond} \index{parseNewcond hypertex} -<>= +\begin{chunk}{hypertex} void parseNewcond(void) { char label[256]; getExpectedToken(Lbrace); @@ -19829,11 +19826,11 @@ void parseNewcond(void) { curr_node->type = Noop; } -@ +\end{chunk} \subsection{parseSetcond} \index{hypertex!parseSetcond} \index{parseSetcond hypertex} -<>= +\begin{chunk}{hypertex} void parseSetcond(void) { char label[256], cond[256]; getExpectedToken(Lbrace); @@ -19848,11 +19845,11 @@ void parseSetcond(void) { curr_node->type = Noop; } -@ +\end{chunk} \subsection{parseBeginItems} \index{hypertex!parseBeginItems} \index{parseBeginItems hypertex} -<>= +\begin{chunk}{hypertex} void parseBeginItems(void) { TextNode *bi = curr_node; /* @@ -19881,11 +19878,11 @@ void parseBeginItems(void) { gInItems++; } -@ +\end{chunk} \subsection{parseItem} \index{hypertex!parseItem} \index{parseItem hypertex} -<>= +\begin{chunk}{hypertex} void parseItem(void) { if (!gInItems) { fprintf(stderr, "\\item found outside an items environment\n"); @@ -19918,11 +19915,11 @@ void parseItem(void) { } } -@ +\end{chunk} \subsection{parseMitem} \index{hypertex!parseMitem} \index{parseMitem hypertex} -<>= +\begin{chunk}{hypertex} void parseMitem(void) { if (!gInItems) { fprintf(stderr, "\\mitem found outside an items environment\n"); @@ -19933,11 +19930,11 @@ void parseMitem(void) { curr_node->type = Mitem; } -@ +\end{chunk} \subsection{parseVerbatim} \index{hypertex!parseVerbatim} \index{parseVerbatim hypertex} -<>= +\begin{chunk}{hypertex} void parseVerbatim(int type) { int size = 0, c; char *end_string, *vb = vbuf, *es; @@ -19987,11 +19984,11 @@ void parseVerbatim(int type) { curr_node->type = Endverbatim; } -@ +\end{chunk} \subsection{parseInputPix} \index{hypertex!parseInputPix} \index{parseInputPix hypertex} -<>= +\begin{chunk}{hypertex} void parseInputPix(void) { TextNode *pixnode; char *filename; @@ -20026,11 +20023,11 @@ void parseInputPix(void) { } } -@ +\end{chunk} \subsection{parseCenterline} \index{hypertex!parseCenterline} \index{parseCenterline hypertex} -<>= +\begin{chunk}{hypertex} void parseCenterline(void) { curr_node->type = token.type; curr_node->space = token.id[-1]; @@ -20049,11 +20046,11 @@ void parseCenterline(void) { curr_node->type = Endcenter; } -@ +\end{chunk} \subsection{parseCommand} \index{hypertex!parseCommand} \index{parseCommand hypertex} -<>= +\begin{chunk}{hypertex} void parseCommand(void) { TextNode *link_node, *save_node, *arg_node; gInButton++; @@ -20086,11 +20083,11 @@ void parseCommand(void) { gInButton--; } -@ +\end{chunk} \subsection{parseButton} \index{hypertex!parseButton} \index{parseButton hypertex} -<>= +\begin{chunk}{hypertex} void parseButton(void) { TextNode *link_node, *save_node; gInButton++; @@ -20127,11 +20124,11 @@ void parseButton(void) { gInButton--; } -@ +\end{chunk} \subsection{parseSpadcommand} \index{hypertex!parseSpadcommand} \index{parseSpadcommand hypertex} -<>= +\begin{chunk}{hypertex} void parseSpadcommand(TextNode *spad_node) { example_number++; gInButton++; @@ -20148,11 +20145,11 @@ void parseSpadcommand(TextNode *spad_node) { gInButton--; } -@ +\end{chunk} \subsection{parseSpadsrc} \index{hypertex!parseSpadsrc} \index{parseSpadsrc hypertex} -<>= +\begin{chunk}{hypertex} void parseSpadsrc(TextNode *spad_node) { char buf[512], *c = buf; int ch, start_opts = 0; @@ -20184,11 +20181,11 @@ void parseSpadsrc(TextNode *spad_node) { gInSpadsrc--; } -@ +\end{chunk} \subsection{parseEnv} \index{hypertex!parseEnv} \index{parseEnv hypertex} -<>= +\begin{chunk}{hypertex} void parseEnv(TextNode *node) { char *env; char buff[256]; @@ -20215,13 +20212,13 @@ void parseEnv(TextNode *node) { getExpectedToken(Rbrace); } -@ +\end{chunk} \subsection{parseValue1} This parseValue routine accepts an empty \verb|{}| but makes it a zero instead of a one. Thus \verb|\indent{}| is equivelant to \verb|\indent{0}|. \index{hypertex!parseValue1} \index{parseValue1 hypertex} -<>= +\begin{chunk}{hypertex} void parseValue1(void) { TextNode *value_node, *ocn = curr_node; char *s; @@ -20243,13 +20240,13 @@ void parseValue1(void) { curr_node = ocn; } -@ +\end{chunk} \subsection{parseValue2} This command accepts an empty argument command. Thus \verb|\space{}| is equivelant \verb|\space{1}| \index{hypertex!parseValue2} \index{parseValue2 hypertex} -<>= +\begin{chunk}{hypertex} void parseValue2(void) { TextNode *value_node, *ocn = curr_node; char *s; @@ -20272,12 +20269,12 @@ void parseValue2(void) { } -@ +\end{chunk} \subsection{parseTable} Parse a \verb|\table| command. \index{hypertex!parseTable} \index{parseTable hypertex} -<>= +\begin{chunk}{hypertex} void parseTable(void) { TextNode *tn = curr_node; if (gParserMode != AllMode) { @@ -20320,11 +20317,11 @@ void parseTable(void) { } } -@ +\end{chunk} \subsection{parseBox} \index{hypertex!parseBox} \index{parseBox hypertex} -<>= +\begin{chunk}{hypertex} void parseBox(void) { curr_node->type = token.type; curr_node->space = token.id[-1]; @@ -20336,11 +20333,11 @@ void parseBox(void) { curr_node->type = Endbox; } -@ +\end{chunk} \subsection{parseMbox} \index{hypertex!parseMbox} \index{parseMbox hypertex} -<>= +\begin{chunk}{hypertex} void parseMbox(void) { curr_node->type = token.type; curr_node->space = token.id[-1]; @@ -20352,11 +20349,11 @@ void parseMbox(void) { curr_node->type = Endbox; } -@ +\end{chunk} \subsection{parseFree} \index{hypertex!parseFree} \index{parseFree hypertex} -<>= +\begin{chunk}{hypertex} void parseFree(void) { TextNode *freeNode = curr_node; curr_node->type = token.type; @@ -20370,11 +20367,11 @@ void parseFree(void) { curr_node = freeNode; } -@ +\end{chunk} \subsection{parseHelp} \index{hypertex!parseHelp} \index{parseHelp hypertex} -<>= +\begin{chunk}{hypertex} void parseHelp(void) { curr_node->type = Noop; getToken(); @@ -20397,7 +20394,7 @@ void parseHelp(void) { } } -@ +\end{chunk} \section{Reading bitmaps} \subsection{HTReadBitmapFile} This file was produced by J.M. Wiley with some help from the bitmap editor @@ -20406,7 +20403,7 @@ to transform it into a Pixmap. He did this because the routine XReadBitmapFile does not seeem to work too well (whatever that means). \index{hypertex!HTReadBitmapFile} \index{HTReadBitmapFile hypertex} -<>= +\begin{chunk}{hypertex} XImage *HTReadBitmapFile(Display *display,int screen,char * filename, int *width, int *height) { XImage *image; @@ -20501,11 +20498,11 @@ XImage *HTReadBitmapFile(Display *display,int screen,char * filename, return image; } -@ +\end{chunk} \subsection{readHot} \index{hypertex!readHot} \index{readHot hypertex} -<>= +\begin{chunk}{hypertex} static int readHot(FILE *fd,char Line[],int *x_hot,int *y_hot) { char Buff[256]; /* @@ -20522,11 +20519,11 @@ static int readHot(FILE *fd,char Line[],int *x_hot,int *y_hot) { return 1; } -@ +\end{chunk} \subsection{readWandH} \index{hypertex!readWandH} \index{readWandH hypertex} -<>= +\begin{chunk}{hypertex} static int readWandH(FILE *fd,unsigned int *width,unsigned int *height) { char Line[256], Buff[256]; if (fgets(Line, MAXLINE, fd) == NULL) @@ -20549,12 +20546,12 @@ static int readWandH(FILE *fd,unsigned int *width,unsigned int *height) { return 1; } -@ +\end{chunk} \subsection{insertImageStruct} Read a bitmap file into memory. \index{hypertex!insertImageStruct} \index{insertImageStruct hypertex} -<>= +\begin{chunk}{hypertex} ImageStruct *insertImageStruct(char *filename) { int bm_width, bm_height; XImage *im; @@ -20580,7 +20577,7 @@ ImageStruct *insertImageStruct(char *filename) { return image; } -@ +\end{chunk} \section{Scrollbar handling routines} The scrollbar is displayed on the side of the HyperDoc display, if needed. It is composed of four windows @@ -20621,11 +20618,10 @@ See the routines \item moveScroller -- to see how the scroller is moved when the user scrolls \end{itemize} -@ \subsection{makeScrollBarWindows} \index{hypertex!makeScrollBarWindows} \index{makeScrollBarWindows hypertex} -<>= +\begin{chunk}{hypertex} void makeScrollBarWindows(void) { XSetWindowAttributes at; at.cursor = gActiveCursor; @@ -20700,11 +20696,11 @@ void makeScrollBarWindows(void) { CWBackPixmap, &at); } -@ +\end{chunk} \subsection{drawScroller3DEffects} \index{hypertex!drawScroller3DEffects} \index{drawScroller3DEffects hypertex} -<>= +\begin{chunk}{hypertex} static void drawScroller3DEffects(HDWindow * hdWindow, int x1, int y1, int x2, int y2) { XClearWindow(gXDisplay, hdWindow->scroller); @@ -20728,11 +20724,11 @@ static void drawScroller3DEffects(HDWindow * hdWindow, int x1, int y1, XSetForeground(gXDisplay, hdWindow->fControlGC, gControlForegroundColor); } -@ +\end{chunk} \subsection{showScrollBars} \index{hypertex!showScrollBars} \index{showScrollBars hypertex} -<>= +\begin{chunk}{hypertex} void showScrollBars(HDWindow * hdWindow) { XWindowChanges wc; /*int src_x = 0, src_y = 0;*/ @@ -20783,12 +20779,12 @@ void showScrollBars(HDWindow * hdWindow) { **************************************************************************/ -@ +\end{chunk} \subsection{moveScroller} Moves the scroller to it's proper place. \index{hypertex!moveScroller} \index{moveScroller hypertex} -<>= +\begin{chunk}{hypertex} void moveScroller(HDWindow * hdWindow) { XWindowChanges wc; int t = (int) (hdWindow->fScrollBarHeight * (-hdWindow->page->scroll_off)); @@ -20803,14 +20799,14 @@ void moveScroller(HDWindow * hdWindow) { drawScroller3DEffects(hdWindow, 0, 0, wc.width, wc.height); } -@ +\end{chunk} \subsection{drawScrollLines} Checks the pageFlags to see if we need a top, or a bottom line. These are the horizontal lines framing a scrolling region when the scrolling region is not the entire window. \index{hypertex!drawScrollLines} \index{drawScrollLines hypertex} -<>= +\begin{chunk}{hypertex} void drawScrollLines(void) { if (!(gWindow->page->pageFlags & NOLINES)) { lineTopGroup(); @@ -20838,12 +20834,12 @@ void drawScrollLines(void) { } } -@ +\end{chunk} \subsection{calculateScrollBarMeasures} Calculates all the measures for the scrollbars. \index{hypertex!calculateScrollBarMeasures} \index{calculateScrollBarMeasures hypertex} -<>= +\begin{chunk}{hypertex} void calculateScrollBarMeasures(void) { int t; /* @@ -20906,11 +20902,11 @@ void calculateScrollBarMeasures(void) { gWindow->fScrollerTopPos = (int) (t / (gWindow->page->scrolling->height)); } -@ +\end{chunk} \subsection{linkScrollBars} \index{hypertex!linkScrollBars} \index{linkScrollBars hypertex} -<>= +\begin{chunk}{hypertex} void linkScrollBars(void) { HyperLink *uplink = (HyperLink *) halloc(sizeof(HyperLink), "HyperLink"); HyperLink *downlink = (HyperLink *) halloc(sizeof(HyperLink), "HyperLink"); @@ -20931,11 +20927,11 @@ void linkScrollBars(void) { hashInsert(gLinkHashTable, (char *)downlink,(char *) &downlink->win); } -@ +\end{chunk} \subsection{scrollUp} \index{hypertex!scrollUp} \index{scrollUp hypertex} -<>= +\begin{chunk}{hypertex} void scrollUp(void) { if (gWindow->page->scroll_off == 0); /* BeepAtTheUser(); *//* The * beeping annoyed me. RSS */ @@ -20954,11 +20950,11 @@ void scrollUp(void) { } } -@ +\end{chunk} \subsection{scrollUpPage} \index{hypertex!scrollUpPage} \index{scrollUpPage hypertex} -<>= +\begin{chunk}{hypertex} void scrollUpPage(void) { if (gWindow->page->scroll_off == 0); /* BeepAtTheUser(); */ else { @@ -20971,11 +20967,11 @@ void scrollUpPage(void) { } } -@ +\end{chunk} \subsection{scrollToFirstPage} \index{hypertex!scrollToFirstPage} \index{scrollToFirstPage hypertex} -<>= +\begin{chunk}{hypertex} void scrollToFirstPage(void) { if (gWindow->page->scroll_off == 0); /* BeepAtTheUser(); */ else { @@ -20985,11 +20981,11 @@ void scrollToFirstPage(void) { } } -@ +\end{chunk} \subsection{scrollDown} \index{hypertex!scrollDown} \index{scrollDown hypertex} -<>= +\begin{chunk}{hypertex} void scrollDown(void) { if (-(gWindow->page->scroll_off) >= (gWindow->page->scrolling->height - gWindow->scrollheight)) { @@ -21009,11 +21005,11 @@ void scrollDown(void) { } } -@ +\end{chunk} \subsection{scrollDownPage} \index{hypertex!scrollDownPage} \index{scrollDownPage hypertex} -<>= +\begin{chunk}{hypertex} void scrollDownPage(void) { if (gWindow->page->scrolling == NULL || (-(gWindow->page->scroll_off) >= (gWindow->page->scrolling->height - gWindow->scrollheight))) { @@ -21030,14 +21026,14 @@ void scrollDownPage(void) { } } -@ +\end{chunk} \subsection{scrollScroller} This routine checks to see where in the window the button press occured. It then tries to move the scroller so that the top of the scroller is at the spot of the event \index{hypertex!scrollScroller} \index{scrollScroller hypertex} -<>= +\begin{chunk}{hypertex} void scrollScroller(XButtonEvent * event) { int y = event->y; int top = y; @@ -21068,11 +21064,11 @@ void scrollScroller(XButtonEvent * event) { scrollPage(gWindow->page); } -@ +\end{chunk} \subsection{hideScrollBars} \index{hypertex!hideScrollBars} \index{hideScrollBars hypertex} -<>= +\begin{chunk}{hypertex} void hideScrollBars(HDWindow * hdWindow) { XUnmapWindow(gXDisplay, hdWindow->fScrollDownWindow); XUnmapWindow(gXDisplay, hdWindow->fScrollUpWindow); @@ -21080,21 +21076,21 @@ void hideScrollBars(HDWindow * hdWindow) { XUnmapWindow(gXDisplay, hdWindow->scroller); } -@ +\end{chunk} \subsection{getScrollBarMinimumSize} \index{hypertex!getScrollBarMinimumSize} \index{getScrollBarMinimumSize hypertex} -<>= +\begin{chunk}{hypertex} void getScrollBarMinimumSize(int *width, int *height) { (*width) = sup_width + 4; (*height) = sup_height + sdown_height + 5; } -@ +\end{chunk} \subsection{ch} \index{hypertex!ch} \index{ch hypertex} -<>= +\begin{chunk}{hypertex} static int ch(int height) { int rem = height % line_height; if (rem == 0) @@ -21102,11 +21098,11 @@ static int ch(int height) { return height - rem + line_height; } -@ +\end{chunk} \subsection{changeWindowBackgroundPixmap} \index{hypertex!changeWindowBackgroundPixmap} \index{changeWindowBackgroundPixmap hypertex} -<>= +\begin{chunk}{hypertex} static void changeWindowBackgroundPixmap(Window window, Pixmap pixmap) { if (pixmap) { XSetWindowAttributes at; @@ -21116,18 +21112,17 @@ static void changeWindowBackgroundPixmap(Window window, Pixmap pixmap) { } } -@ +\end{chunk} \section{Display text object} /* * Display the page whose extent has been computed, using the actual size of * the window, and yOff to determine clipped areas */ -@ \subsection{showText} \index{hypertex!showText} \index{showText hypertex} -<>= +\begin{chunk}{hypertex} void showText(TextNode *node, int Ender) { for (; node != NULL; node = node->next) { switch (node->type) { @@ -21371,11 +21366,11 @@ void showText(TextNode *node, int Ender) { } } -@ +\end{chunk} \subsection{showLink} \index{hypertex!showLink} \index{showLink hypertex} -<>= +\begin{chunk}{hypertex} static void showLink(TextNode *node) { XWindowChanges wc; int active; @@ -21441,11 +21436,11 @@ static void showLink(TextNode *node) { rmTopGroup(); } -@ +\end{chunk} \subsection{showPaste} \index{hypertex!showPaste} \index{showPaste hypertex} -<>= +\begin{chunk}{hypertex} static void showPaste(TextNode *node) { PasteNode *paste; if (!(paste = (PasteNode *) hashFind(gWindow->fPasteHashTable, @@ -21463,11 +21458,11 @@ static void showPaste(TextNode *node) { paste->item_stack = (ItemStack *) copyItemStack(); } -@ +\end{chunk} \subsection{showPastebutton} \index{hypertex!showPastebutton} \index{showPastebutton hypertex} -<>= +\begin{chunk}{hypertex} static void showPastebutton(TextNode *node) { XWindowChanges wc; pushActiveGroup(); @@ -21484,12 +21479,12 @@ static void showPastebutton(TextNode *node) { XMapWindow(gXDisplay, node->link->win); } -@ +\end{chunk} \subsection{showInput} Display an input string window. \index{hypertex!showInput} \index{showInput hypertex} -<>= +\begin{chunk}{hypertex} static void showInput(TextNode *node) { XWindowChanges wc; InputItem *item; @@ -21511,11 +21506,11 @@ static void showInput(TextNode *node) { drawInputsymbol(item); } -@ +\end{chunk} \subsection{showSimpleBox} \index{hypertex!showSimpleBox} \index{showSimpleBox hypertex} -<>= +\begin{chunk}{hypertex} static void showSimpleBox(TextNode *node) { XWindowChanges wc; InputBox *box; @@ -21537,12 +21532,12 @@ static void showSimpleBox(TextNode *node) { } } -@ +\end{chunk} \subsection{showSpadcommand} Display a spad command node. \index{hypertex!showSpadcommand} \index{showSpadcommand hypertex} -<>= +\begin{chunk}{hypertex} static void showSpadcommand(TextNode *node) { XWindowChanges wc; gInAxiomCommand = 1; @@ -21563,12 +21558,12 @@ static void showSpadcommand(TextNode *node) { XMapWindow(gXDisplay, node->link->win); } -@ +\end{chunk} \subsection{showImage} Display a pixmap. \index{hypertex!showImage} \index{showImage hypertex} -<>= +\begin{chunk}{hypertex} static void showImage(TextNode *node, GC gc) { int src_x, src_y, src_width, src_height, dest_x, dest_y, ret_val; if (!pix_visible(node->y, node->height)) @@ -21625,7 +21620,7 @@ static void showImage(TextNode *node, GC gc) { } } -@ +\end{chunk} \section{Axiom communication interface} Still a problem with closeClient. @@ -21633,7 +21628,7 @@ Still a problem with closeClient. Issue a AXIOM command to the buffer associated with a page. \index{hypertex!issueSpadcommand} \index{issueSpadcommand hypertex} -<>= +\begin{chunk}{hypertex} void issueSpadcommand(HyperDocPage *page, TextNode *command, int immediate, int type) { char *buf; @@ -21665,12 +21660,12 @@ void issueSpadcommand(HyperDocPage *page, TextNode *command, gIsEndOfOutput = 0; } -@ +\end{chunk} \subsection{sendPile} \label{sendPile} \index{hypertex!sendPile} \index{sendPile hypertex} -<>= +\begin{chunk}{hypertex} static void sendPile(Sock *sock,char * str) { FILE *f; char name[512], command[512]; @@ -21686,11 +21681,11 @@ static void sendPile(Sock *sock,char * str) { send_string(sock, command); } -@ +\end{chunk} \subsection{issueDependentCommands} \index{hypertex!issueDependentCommands} \index{issueDependentCommands hypertex} -<>= +\begin{chunk}{hypertex} static void issueDependentCommands(HyperDocPage *page, TextNode *command,int type) { TextNode *node, *depend_label; @@ -21721,11 +21716,11 @@ static void issueDependentCommands(HyperDocPage *page, } } -@ +\end{chunk} \subsection{markAsExecuted} \index{hypertex!markAsExecuted} \index{markAsExecuted hypertex} -<>= +\begin{chunk}{hypertex} static void markAsExecuted(HyperDocPage *page, TextNode *command,int type) { TextNode *node, *depend_label; SpadcomDepend *depend; @@ -21747,12 +21742,12 @@ static void markAsExecuted(HyperDocPage *page, TextNode *command,int type) { } } -@ +\end{chunk} \subsection{startUserBuffer} Start a spad buffer for the page associated with the give. \index{hypertex!startUserBuffer} \index{startUserBuffer hypertex} -<>= +\begin{chunk}{hypertex} static void startUserBuffer(HyperDocPage *page) { char buf[1024], *title; char *SPAD; @@ -21808,12 +21803,12 @@ static void startUserBuffer(HyperDocPage *page) { sleep(2); } -@ +\end{chunk} \subsection{clearExecutionMarks} Clears the execution marks in a hash table when a buffer has been killed. \index{hypertex!clearExecutionMarks} \index{clearExecutionMarks hypertex} -<>= +\begin{chunk}{hypertex} static void clearExecutionMarks(HashTable *depend_hash) { int i; HashEntry *h; @@ -21827,11 +21822,11 @@ static void clearExecutionMarks(HashTable *depend_hash) { } } -@ +\end{chunk} \subsection{acceptMenuConnection} \index{hypertex!acceptMenuConnection} \index{acceptMenuConnection hypertex} -<>= +\begin{chunk}{hypertex} Sock *acceptMenuConnection(Sock *server_sock) { int sock_fd; Sock_List *pls; @@ -21862,14 +21857,14 @@ Sock *acceptMenuConnection(Sock *server_sock) { return (Sock *) plSock; } -@ +\end{chunk} \subsection{acceptMenuServerConnection} TTT thinks this code should just provide a Sock to the page. The only client assumed is a spadbuf. Since spadbuf was invoked with the page name, it just passes it back here as a check (\verb|get_string| line). \index{hypertex!acceptMenuServerConnection} \index{acceptMenuServerConnection hypertex} -<>= +\begin{chunk}{hypertex} static void acceptMenuServerConnection(HyperDocPage *page) { int ret_code/*, i*/; fd_set rd; @@ -21921,14 +21916,14 @@ static void acceptMenuServerConnection(HyperDocPage *page) { } } -@ +\end{chunk} \subsection{printToString} This routine takes a text node and creates a string out of it. This is for use with things such as spad commands. There are a very limited set of node types it can handle, so be careful. \index{hypertex!printToString} \index{printToString hypertex} -<>= +\begin{chunk}{hypertex} char *printToString(TextNode *command) { int len = 0; printToString1(command, &len); @@ -21936,11 +21931,11 @@ char *printToString(TextNode *command) { return printToString1(command, NULL); } -@ +\end{chunk} \subsection{printToString1} \index{hypertex!printToString1} \index{printToString1 hypertex} -<>= +\begin{chunk}{hypertex} char *printToString1(TextNode *command,int * sizeBuf) { char *c = p2sBuf; char *s; @@ -22177,11 +22172,11 @@ char *printToString1(TextNode *command,int * sizeBuf) { * type is link, then we wait for a HyperDoc card to be returned */ -@ +\end{chunk} \subsection{issueServerCommand} \index{hypertex!issueServerCommand} \index{issueServerCommand hypertex} -<>= +\begin{chunk}{hypertex} HyperDocPage *issueServerCommand(HyperLink *link) { TextNode *command = (TextNode *) link->reference.node; int ret_val; @@ -22229,11 +22224,11 @@ HyperDocPage *issueServerCommand(HyperLink *link) { return page; } -@ +\end{chunk} \subsection{issueServerpaste} \index{hypertex!issueServerpaste} \index{issueServerpaste hypertex} -<>= +\begin{chunk}{hypertex} int issueServerpaste(TextNode *command) { char *buf; int ret_val; @@ -22247,11 +22242,11 @@ int issueServerpaste(TextNode *command) { return 1; } -@ +\end{chunk} \subsection{issueUnixcommand} \index{hypertex!issueUnixcommand} \index{issueUnixcommand hypertex} -<>= +\begin{chunk}{hypertex} void issueUnixcommand(TextNode *node) { char *buf; char *copy; @@ -22265,11 +22260,11 @@ void issueUnixcommand(TextNode *node) { return; } -@ +\end{chunk} \subsection{issueUnixlink} \index{hypertex!issueUnixlink} \index{issueUnixlink hypertex} -<>= +\begin{chunk}{hypertex} HyperDocPage *issueUnixlink(TextNode *node) { HyperDocPage *page; char *buf; @@ -22284,11 +22279,11 @@ HyperDocPage *issueUnixlink(TextNode *node) { return page; } -@ +\end{chunk} \subsection{issueUnixpaste} \index{hypertex!issueUnixpaste} \index{issueUnixpaste hypertex} -<>= +\begin{chunk}{hypertex} int issueUnixpaste(TextNode *node) { char *buf; buf = printToString(node); @@ -22299,12 +22294,12 @@ int issueUnixpaste(TextNode *node) { return 1; } -@ +\end{chunk} \subsection{serviceSessionSocket} Called when sessionServer selects. \index{hypertex!serviceSessionSocket} \index{serviceSessionSocket hypertex} -<>= +\begin{chunk}{hypertex} void serviceSessionSocket(void) { int cmd, pid; cmd = get_int(sessionServer); @@ -22321,12 +22316,12 @@ void serviceSessionSocket(void) { } } -@ +\end{chunk} \subsection{switchFrames} Let spad know which frame to issue command via \index{hypertex!switchFrames} \index{switchFrames hypertex} -<>= +\begin{chunk}{hypertex} static void switchFrames(void) { if (sessionServer == NULL) { fprintf(stderr, "(HyperDoc) No session manager connected!\n"); @@ -22341,11 +22336,11 @@ static void switchFrames(void) { send_int(sessionServer, gWindow->fAxiomFrame); } -@ +\end{chunk} \subsection{sendLispCommand} \index{hypertex!sendLispCommand} \index{sendLispCommand hypertex} -<>= +\begin{chunk}{hypertex} void sendLispCommand(char *command) { int ret_val; ret_val = connectSpad(); @@ -22356,33 +22351,33 @@ void sendLispCommand(char *command) { send_string(spadSocket, command); } -@ +\end{chunk} \subsection{escapeString} \index{hypertex!escapeString} \index{escapeString hypertex} -<>= +\begin{chunk}{hypertex} void escapeString(char *s) { char *st; for (st = s; *st; st++) *st = funnyEscape(*st); } -@ +\end{chunk} \subsection{unescapeString} \index{hypertex!unescapeString} \index{unescapeString hypertex} -<>= +\begin{chunk}{hypertex} void unescapeString(char *s) { char *st; for (st = s; *st; st++) *st = funnyUnescape(*st); } -@ +\end{chunk} \subsection{closeClient} \index{hypertex!closeClient} \index{closeClient hypertex} -<>= +\begin{chunk}{hypertex} static void closeClient(int pid) { Sock_List *pSock, *locSock; /* @@ -22424,11 +22419,11 @@ static void closeClient(int pid) { } } -@ +\end{chunk} \subsection{printSourceToString} \index{hypertex!printSourceToString} \index{printSourceToString hypertex} -<>= +\begin{chunk}{hypertex} char *printSourceToString(TextNode *command) { int len = 0; printSourceToString1(command, &len); @@ -22436,11 +22431,11 @@ char *printSourceToString(TextNode *command) { return printSourceToString1(command, NULL); } -@ +\end{chunk} \subsection{printSourceToString1} \index{hypertex!printSourceToString1} \index{printSourceToString1 hypertex} -<>= +\begin{chunk}{hypertex} char *printSourceToString1(TextNode *command,int * sizeBuf) { char *c = p2sBuf; char *s; @@ -22819,12 +22814,12 @@ we close the brace then */ return p2sBuf; } -@ +\end{chunk} \section{Produce titlebar} \subsection{makeTitleBarWindows} \index{hypertex!makeTitleBarWindows} \index{makeTitleBarWindows hypertex} -<>= +\begin{chunk}{hypertex} void makeTitleBarWindows(void) { XSetWindowAttributes at; unsigned long valuemask = 0L; @@ -22855,11 +22850,11 @@ void makeTitleBarWindows(void) { XChangeWindowAttributes(gXDisplay,gWindow->fTitleBarButton4,valuemask,&at); } -@ +\end{chunk} \subsection{showTitleBar} \index{hypertex!showTitleBar} \index{showTitleBar hypertex} -<>= +\begin{chunk}{hypertex} void showTitleBar(void) { XWindowChanges wc; int height, hbw = (int) gWindow->border_width / 2; @@ -22921,11 +22916,11 @@ void showTitleBar(void) { popGroupStack(); } -@ +\end{chunk} \subsection{linkTitleBarWindows} \index{hypertex!linkTitleBarWindows} \index{linkTitleBarWindows hypertex} -<>= +\begin{chunk}{hypertex} void linkTitleBarWindows(void) { HyperLink *tw1link = (HyperLink *) halloc(sizeof(HyperLink), "HyperLink"), *tw2link = (HyperLink *) halloc(sizeof(HyperLink), "HyperLink"), @@ -22953,11 +22948,11 @@ void linkTitleBarWindows(void) { hashInsert(gLinkHashTable, (char *)tw4link,(char *) &tw4link->win); } -@ +\end{chunk} \subsection{readTitleBarImages} \index{hypertex!readTitleBarImages} \index{readTitleBarImages hypertex} -<>= +\begin{chunk}{hypertex} static void readTitleBarImages(void) { int w, h; char filename[128]; @@ -22995,23 +22990,23 @@ static void readTitleBarImages(void) { &twwidth, &twheight); } -@ +\end{chunk} \subsection{getTitleBarMinimumSize} \index{hypertex!getTitleBarMinimumSize} \index{getTitleBarMinimumSize hypertex} -<>= +\begin{chunk}{hypertex} void getTitleBarMinimumSize(int *width, int *height) { (*width) = 4 * twwidth + 40; (*height) = twheight + 2; } -@ +\end{chunk} \subsection{main} Initialize hash tables, signal handlers and windows, then call the main event handling loop \index{hypertex!main} \index{main hypertex} -<>= +\begin{chunk}{hypertex} int main(int argc, char **argv) { int ret_status; /* Initialize some global values */ @@ -23112,14 +23107,14 @@ int main(int argc, char **argv) { return 0; } -@ +\end{chunk} \chapter{The htsearch script} Construct a page with a menu of references to the word. The syntax of the command is: \begin{verbatim} htsearch word \end{verbatim} -<>= +\begin{chunk}{htsearch} #!/bin/sh htbindir=$AXIOM/lib @@ -23131,7 +23126,7 @@ then else ( cd $htpagedir; $htbindir/hthits "$1" $htpagedir/ht.db | sort -r -n -k 1.22 | $htbindir/presea case=0 expr="$1" -) fi -@ +\end{chunk} \chapter{The presea script} This is part of 'presea' which is is run on output of 'hthits'. 'hthits' outputs looks like: @@ -23152,7 +23147,7 @@ This used to read: j=split($0,b,"{"); m=m+substr(b[j],1,length(b[j])-1); \end{verbatim} -<>= +\begin{chunk}{presea} #!/bin/awk -f BEGIN {n=0;m=0 } @@ -23182,9 +23177,9 @@ END { printf "\\end{page}\n"; } -@ +\end{chunk} \section{token.h} -<>= +\begin{chunk}{token.h} /* Here are a couple of flags added for whitespace stuff. They tell @@ -23392,10 +23387,10 @@ extern FILE *unixfd; #define Endpaste 4029 #define Endspadsrc 4030 -@ +\end{chunk} \chapter{The Bitmaps} \section{ht\_icon} -<>= +\begin{chunk}{hticon} #define ht_icon_width 40 #define ht_icon_height 40 #define ht_icon_x_hot -1 @@ -23418,9 +23413,9 @@ static char ht_icon_bits[] = { 0xcf, 0x00, 0x80, 0x7f, 0x7f, 0xfe, 0x00, 0x80, 0x3f, 0x3e, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -@ +\end{chunk} \section{exit.bitmap} -<>= +\begin{chunk}{exit.bitmap} #define exit_width 60 #define exit_height 30 #define exit_x_hot -1 @@ -23446,9 +23441,9 @@ static char exit_bits[] = { 0x9e, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -@ +\end{chunk} \section{help2.bitmap} -<>= +\begin{chunk}{help2.bitmap} #define help2_width 60 #define help2_height 30 #define help2_x_hot -1 @@ -23474,9 +23469,9 @@ static char help2_bits[] = { 0x01, 0x9c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -@ +\end{chunk} \section{return3.bitmap} -<>= +\begin{chunk}{return3.bitmap} #define return3_width 60 #define return3_height 30 #define return3_x_hot -1 @@ -23502,9 +23497,9 @@ static char return3_bits[] = { 0xf9, 0xf3, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -@ +\end{chunk} \section{up3.bitmap} -<>= +\begin{chunk}{up3.bitmap} #define up3_width 60 #define up3_height 30 static char up3_bits[] = { @@ -23528,9 +23523,9 @@ static char up3_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -@ +\end{chunk} \section{noop.bitmap} -<>= +\begin{chunk}{noop.bitmap} #define noop_width 60 #define noop_height 30 #define noop_x_hot -1 @@ -23556,9 +23551,9 @@ static char noop_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; -@ +\end{chunk} \section{exit3d.bitmap} -<>= +\begin{chunk}{exit3d.bitmap} #define exit3d.bitmap_width 60 #define exit3d.bitmap_height 30 static char exit3d.bitmap_bits[] = { @@ -23582,9 +23577,9 @@ static char exit3d.bitmap_bits[] = { 0x55, 0x55, 0x55, 0x07, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x0e, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x05}; -@ +\end{chunk} \section{help3d.bitmap} -<>= +\begin{chunk}{help3d.bitmap} #define help3d.bitmap_width 60 #define help3d.bitmap_height 30 static char help3d.bitmap_bits[] = { @@ -23608,9 +23603,9 @@ static char help3d.bitmap_bits[] = { 0x55, 0x7d, 0x55, 0x07, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xba, 0xaa, 0x0e, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x05}; -@ +\end{chunk} \section{home3d.bitmap} -<>= +\begin{chunk}{home3d.bitmap} #define home3d.bitmap_width 60 #define home3d.bitmap_height 30 static char home3d.bitmap_bits[] = { @@ -23634,9 +23629,9 @@ static char home3d.bitmap_bits[] = { 0xaa, 0xaa, 0xaa, 0x0e, 0x51, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x07, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x0a}; -@ +\end{chunk} \section{up3d.bitmap} -<>= +\begin{chunk}{up3d.bitmap} #define up3_width 60 #define up3_height 30 static char up3_bits[] = { @@ -23660,9 +23655,9 @@ static char up3_bits[] = { 0x55, 0x55, 0x55, 0x07, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x0e, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x05}; -@ +\end{chunk} \section{noop3d.bitmap} -<>= +\begin{chunk}{noop3d.bitmap} #define noop_width 60 #define noop_height 30 static char noop_bits[] = { @@ -23686,9 +23681,9 @@ static char noop_bits[] = { 0x55, 0x55, 0x55, 0x07, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x0e, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x05}; -@ +\end{chunk} \chapter{Makefile} -<<*>>= +\begin{chunk}{*} BOOK=${SPD}/books/bookvol7.pamphlet WORK=${OBJ}/${SYS}/hyper IN=${SPD}/books @@ -23724,41 +23719,48 @@ all: ${OUTLIB}/spadbuf ${OUTLIB}/ex2ht ${OUTBIN}/htadd ${OUTLIB}/hthits \ ${OUTLIB}/spadbuf: ${BOOK} @ echo 1 making ${OUTLIB}/spadbuf from ${BOOK} @ (cd ${WORK} ; \ - ${TANGLE} -R"spadbuf" ${BOOK} >spadbuf.c ; \ - ${CC} -I${INC} ${CFLAGS} spadbuf.c -o ${OUTLIB}/spadbuf ${LDFLAGS} ) + echo '(tangle "${BOOK}" "spadbuf" "spadbuf.c")' | \ + ${OBJ}/${SYS}/bin/lisp ; \ + ${CC} -I${INC} ${CFLAGS} spadbuf.c -o ${OUTLIB}/spadbuf ${LDFLAGS} ) ${OUTLIB}/ex2ht: ${BOOK} @ echo 2 making ${OUTLIB}/ex2ht from ${BOOK} @ (cd ${WORK} ; \ - ${TANGLE} -R"ex2ht" ${BOOK} >ex2ht.c ; \ - ${CC} -I${INC} ${CFLAGS} ex2ht.c -o ${OUTLIB}/ex2ht ${LDFLAGS} ) + echo '(tangle "${BOOK}" "ex2ht" "ex2ht.c")' | \ + ${OBJ}/${SYS}/bin/lisp ; \ + ${CC} -I${INC} ${CFLAGS} ex2ht.c -o ${OUTLIB}/ex2ht ${LDFLAGS} ) ${OUTBIN}/htadd: ${BOOK} @ echo 3 making ${OUTBIN}/htadd from ${BOOK} @ (cd ${WORK} ; \ - ${TANGLE} -R"htadd" ${BOOK} >htadd.c ; \ + echo '(tangle "${BOOK}" "htadd" "htadd.c")' | \ + ${OBJ}/${SYS}/bin/lisp ; \ ${CC} -I${INC} ${CFLAGS} htadd.c -o ${OUTBIN}/htadd ${LDFLAGS} ) ${OUTLIB}/hthits: ${BOOK} @ echo 4 making ${OUTBIN}/hthits from ${BOOK} @ (cd ${WORK} ; \ - ${TANGLE} -R"hthits" ${BOOK} >hthits.c ; \ + echo '(tangle "${BOOK}" "hthits" "hthits.c")' | \ + ${OBJ}/${SYS}/bin/lisp ; \ ${CC} -I${INC} ${CFLAGS} hthits.c -o ${OUTLIB}/hthits ${LDFLAGS} ) ${OUTBIN}/htsearch: ${BOOK} @echo 5 making ${OUTBIN}/htsearch from ${BOOK} - @${TANGLE} -R"htsearch" ${BOOK} >${OUTBIN}/htsearch + @ echo '(tangle "${BOOK}" "htsearch" "${OUTBIN}/htsearch")' | \ + ${OBJ}/${SYS}/bin/lisp @chmod a+x ${OUTBIN}/htsearch ${OUTLIB}/presea: ${BOOK} @echo 6 making ${OUTLIB}/presea from ${BOOK} - @${TANGLE} -R"presea" ${BOOK} >${OUTLIB}/presea + @ echo '(tangle "${BOOK}" "presea" "${OUTLIB}/presea")' | \ + ${OBJ}/${SYS}/bin/lisp @chmod a+x ${OUTLIB}/presea ${OUTBIN}/hypertex: ${BOOK} @ echo 7 ${OUTBIN}/hypertex from ${BOOK} @ (cd ${WORK} ; \ - ${TANGLE} -R"hypertex" ${BOOK} >hypertex.c ; \ + echo '(tangle "${BOOK}" "hypertex" "hypertex.c")' | \ + ${OBJ}/${SYS}/bin/lisp ; \ ${CC} -I${INC} ${CFLAGS} hypertex.c -o ${OUTBIN}/hypertex \ ${LDFLAGS} -lX11 -lm -L${LIB} ) @@ -23774,7 +23776,7 @@ ${HYPER}/axbook: ${IN}/axbook.tgz @ echo 10 making ${HYPER}/axbook/xhtml from ${IN}/axbook.tgz @( cd ${HYPER} ; tar -zxf ${IN}/axbook.tgz ) -@ +\end{chunk} \eject \begin{thebibliography}{99} \bibitem{1} Jenks, R.J. and Sutor, R.S. diff --git a/changelog b/changelog index a9abc27..c864eac 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,9 @@ +20110123 tpd src/axiom-website/patches.html 20110123.02.tpd.patch +20110123 tpd books/Makefile move to lisp tangle +20110123 tpd src/Makefile move to lisp tangle +20110123 tpd books/bookvol7 move to lisp tangle +20110123 tpd books/bookvol6 move to lisp tangle +20110123 tpd books/bookvol5 move to lisp tangle 20110123 tpd src/axiom-website/patches.html 20110123.01.tpd.patch 20110123 tpd src/input/fname.input fix failing test 20110122 tpd src/axiom-website/patches.html 20110122.05.tpd.patch diff --git a/src/Makefile.pamphlet b/src/Makefile.pamphlet index 8e3b75a..ce9740c 100644 --- a/src/Makefile.pamphlet +++ b/src/Makefile.pamphlet @@ -112,7 +112,8 @@ smandir: ${SPD}/books/bookvol6.pamphlet @mkdir -p ${OBJ}/${SYS}/sman @mkdir -p ${MNT}/${SYS}/doc/src/sman @( cd sman ; \ - ${TANGLE} -t8 ${SPD}/books/bookvol6.pamphlet >Makefile ; \ + echo '(tangle "${SPD}/books/bookvol6.pamphlet" "*" "Makefile")' \ + | ${OBJ}/${SYS}/bin/lisp ; \ ${ENV} ${MAKE} ) @ @@ -417,7 +418,8 @@ hyperdir: ${SPD}/books/bookvol7.pamphlet ${SPD}/books/bookvol7.1.pamphlet @mkdir -p ${OBJ}/${SYS}/lib @mkdir -p ${MNT}/${SYS}/doc/src/hyper @(cd ${INT}/hyper ; \ - ${TANGLE} -t8 ${SPD}/books/bookvol7.pamphlet >Makefile ; \ + echo '(tangle "${SPD}/books/bookvol7.pamphlet" "*" "Makefile")' \ + | ${OBJ}/${SYS}/bin/lisp ; \ ${ENV} ${MAKE} ) @echo 7.1 making pages from bookvol7.1 ${ENV} @(cd ${INT}/hyper ; \ diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 7147b25..da41419 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3365,5 +3365,7 @@ books/bookvol9 move to lisp tangle
books/Makefile reduce the noise during make
20110123.01.tpd.patch src/input/fname.input fix failing test
+20110123.02.tpd.patch +books/Makefile, volumes 5,6,7 move to lisp tangle