[tex-k] header special extension proposal

Akira Kakuto kakuto at fsci.fuk.kindai.ac.jp
Wed Aug 17 09:35:03 CEST 2005


Hi Hendri, Karl,

> When correcting for the braces in this setting, I could only find one
> potential problem: the header special writes a
> %%BeginProcSet
> ...
> %%EndProcSet

I think the code becomes somewhat simple and "precode" comes after
%%BeginProcSet
and "postcode" before
%%EndProcSet
by applying the following, in addition to the previous patch
for dospecial.c.


--- header.c.orig	Wed Aug 17 07:45:56 2005
+++ header.c	Wed Aug 17 16:06:40 2005
@@ -22,7 +22,6 @@
 #ifndef KPATHSEA
 extern char *headerpath ;
 #endif
-extern FILE *bitfile ;
 extern char *infont ;
 extern int headersready ;
 #ifdef DEBUG
@@ -176,27 +175,7 @@
  	     if (strcmp(q,"target.dct")==0) noprocset = 1 ;
        }
 #endif
-      if(CUR_head && CUR_head->precode) {
-	 r = CUR_head->precode ;
-	 while(*r) {
-	    putc(*r, bitfile) ;
-	    r++ ;
-	 }
-	 putc('\n', bitfile) ;
-	 free(CUR_head->precode) ;
-	 CUR_head->precode = NULL ;
-      }
-      copyfile(q) ;
-      if(CUR_head && CUR_head->postcode) {
-	 r = CUR_head->postcode ;
-	 while(*r) {
-	    putc(*r, bitfile) ;
-	    r++ ;
-	 }
-	 putc('\n', bitfile) ;
-	 free(CUR_head->postcode) ;
-	 CUR_head->postcode = NULL ;
-      }
+      copyfile_general(q, CUR_head) ;
    }
    infont = 0 ;
 }
--- output.c.orig	Sun Jan 23 15:56:48 2005
+++ output.c	Wed Aug 17 16:03:48 2005
@@ -111,7 +111,7 @@
 static char possibleDSCLine[81],
        *dscLinePointer = possibleDSCLine, *dscLineEnd = possibleDSCLine + 80 ;
 void
-copyfile P1C(char *, s)
+copyfile_general P2C(char *, s, struct header_list *, cur_header)
 {
    FILE *f = NULL ;
    int c, prevc = '\n' ;
@@ -235,6 +235,10 @@
          else
             (void)fprintf(bitfile, "%%%%BeginProcSet: %s 0 0\n", s) ;
       }
+      if (cur_header && cur_header->precode) {
+         (void)fprintf(bitfile, "\n%s\n", cur_header->precode) ;
+         free(cur_header->precode) ;
+      }
       c = getc(f) ;
       if (c == 0x80) {
          while (1) {
@@ -595,6 +599,10 @@
 #endif
 #endif
          (void)fclose(f) ;
+      if (cur_header && cur_header->postcode) {
+         (void)fprintf(bitfile, "\n%s\n", cur_header->postcode) ;
+         free(cur_header->postcode) ;
+      }
       if (!disablecomments) {
          if (infigure)
             (void)fprintf(bitfile, "\n%%%%EndDocument\n") ;
@@ -607,6 +615,12 @@
             (void)fprintf(bitfile, "\n%%%%EndProcSet\n") ;
       }
    }
+}
+
+void
+copyfile P1C(char *, s)
+{
+   copyfile_general(s, NULL) ;
 }
 
 /*
--- protos.h.orig	Wed Aug 17 07:45:56 2005
+++ protos.h	Wed Aug 17 15:58:56 2005
@@ -196,6 +196,7 @@
 
 /* prototypes for functions from output.c */
 extern void copyfile P1H(char *s);
+extern void copyfile_general P2H(char *s, struct header_list *h);
 extern void figcopyfile P2H(char *s, int systemtype);
 extern void specialout P1H(char c);
 extern void stringend P1H(void);



More information about the tex-k mailing list